Skip to content

Commit

Permalink
Initial Commit
Browse files Browse the repository at this point in the history
  • Loading branch information
Aman committed Oct 11, 2017
1 parent d6f9246 commit 8b17f51
Show file tree
Hide file tree
Showing 31 changed files with 77 additions and 72 deletions.
2 changes: 1 addition & 1 deletion .idea/gradle.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion .idea/modules.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -27,5 +27,5 @@ dependencies {
compile 'com.android.support:appcompat-v7:25.3.1'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
testCompile 'junit:junit:4.12'
compile project(':devicelogger')
compile project(':hyper-log')
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.hypertrack.devicelogging;
package com.hypertrack.demo;

import android.content.Context;
import android.support.test.InstrumentationRegistry;
Expand Down
6 changes: 3 additions & 3 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.hypertrack.devicelogging">
package="com.hypertrack.demo">
<uses-permission android:name="android.permission.INTERNET"/>

<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:name=".MyApplication"
android:name="com.hypertrack.demo.MyApplication"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/AppTheme">
<activity android:name=".MainActivity">
<activity android:name="com.hypertrack.demo.MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,11 @@ of this software and associated documentation files (the "Software"), to deal
/**
* Created by Aman on 04/10/17.
*/
package com.hypertrack.devicelogging;
package com.hypertrack.demo;

import android.content.Context;

import com.hypertrack.devicelogger.db.LogFormat;
import com.hypertrack.hyperlog.LogFormat;

class CustomLogMessageFormat extends LogFormat {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ of this software and associated documentation files (the "Software"), to deal
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
*/
package com.hypertrack.devicelogging;
package com.hypertrack.demo;

import android.os.Bundle;
import android.support.annotation.NonNull;
Expand All @@ -35,8 +35,8 @@ of this software and associated documentation files (the "Software"), to deal
import android.widget.Toast;

import com.android.volley.VolleyError;
import com.hypertrack.devicelogger.db.HyperLog;
import com.hypertrack.devicelogger.db.HyperLogCallback;
import com.hypertrack.hyperlog.HyperLog;
import com.hypertrack.hyperlog.HyperLogCallback;

import java.io.File;
import java.util.ArrayList;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,12 @@ of this software and associated documentation files (the "Software"), to deal
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
*/
package com.hypertrack.devicelogging;
package com.hypertrack.demo;

import android.app.Application;
import android.util.Log;

import com.hypertrack.devicelogger.db.HyperLog;
import com.hypertrack.hyperlog.HyperLog;

/**
* Created by Aman on 04/10/17.
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/res/layout/activity_main.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="com.hypertrack.devicelogging.MainActivity">
tools:context="com.hypertrack.demo.MainActivity">

<EditText
android:id="@+id/logText"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.hypertrack.devicelogging;
package com.hypertrack.demo;

import org.junit.Test;

Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ of this software and associated documentation files (the "Software"), to deal
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
*/
package com.hypertrack.devicelogger.db;
package com.hypertrack.hyperlog;

import java.util.List;

Expand All @@ -35,11 +35,11 @@ interface DeviceLogDataSource {

void addDeviceLog(String deviceLog);

void deleteDeviceLog(List<DeviceLog> deviceLogList);
void deleteDeviceLog(List<DeviceLogModel> deviceLogList);

void deleteAllDeviceLogs();

List<DeviceLog> getDeviceLogs(int batch);
List<DeviceLogModel> getDeviceLogs(int batch);

int getDeviceLogBatchCount();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ of this software and associated documentation files (the "Software"), to deal
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
*/
package com.hypertrack.devicelogger.db;
package com.hypertrack.hyperlog;

import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
Expand Down Expand Up @@ -91,7 +91,7 @@ public void addDeviceLog(String deviceLog) {
}

@Override
public void deleteDeviceLog(List<DeviceLog> deviceLogList) {
public void deleteDeviceLog(List<DeviceLogModel> deviceLogList) {
// Initialize SQLiteDatabase if null
initializeDatabase();

Expand All @@ -107,10 +107,10 @@ public void deleteAllDeviceLogs() {
}

@Override
public List<DeviceLog> getDeviceLogs(int batch) {
public List<DeviceLogModel> getDeviceLogs(int batch) {
// Initialize SQLiteDatabase if null
initializeDatabase();
List<DeviceLog> deviceLogList = null;
List<DeviceLogModel> deviceLogList = null;

try {
deviceLogList = DeviceLogTable.getDeviceLogs(database,batch);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ of this software and associated documentation files (the "Software"), to deal
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
*/
package com.hypertrack.devicelogger.db;
package com.hypertrack.hyperlog;

import android.text.TextUtils;

Expand Down Expand Up @@ -50,11 +50,11 @@ void clearSavedDeviceLogs() {
this.mDeviceLogDataSource.deleteAllDeviceLogs();
}

List<DeviceLog> getDeviceLogs(int batch) {
List<DeviceLogModel> getDeviceLogs(int batch) {
return this.mDeviceLogDataSource.getDeviceLogs(batch);
}

void clearDeviceLogs(List<DeviceLog> pushedDeviceLogs) {
void clearDeviceLogs(List<DeviceLogModel> pushedDeviceLogs) {
if (pushedDeviceLogs == null || pushedDeviceLogs.isEmpty())
return;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,15 @@ of this software and associated documentation files (the "Software"), to deal
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
*/
package com.hypertrack.devicelogger.db;
package com.hypertrack.hyperlog;

import com.google.gson.annotations.Expose;

/**
* Created by Aman Jain on 22/09/17.
*/
/** package */
public class DeviceLog {
public class DeviceLogModel {

@Expose(serialize = false, deserialize = false)
private int id;
Expand All @@ -53,11 +53,11 @@ public void setDeviceLog(String deviceLog) {
this.deviceLog = deviceLog;
}

public DeviceLog(String deviceLog) {
public DeviceLogModel(String deviceLog) {
this.deviceLog = deviceLog;
}

public DeviceLog(int id, String deviceLog) {
public DeviceLogModel(int id, String deviceLog) {
this.id = id;
this.deviceLog = deviceLog;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,15 @@ of this software and associated documentation files (the "Software"), to deal
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
*/
package com.hypertrack.devicelogger.db;
package com.hypertrack.hyperlog;

import android.content.ContentValues;
import android.database.Cursor;
import android.database.DatabaseUtils;
import android.database.sqlite.SQLiteDatabase;
import android.text.TextUtils;

import com.hypertrack.devicelogger.db.Utils.DateTimeUtility;
import com.hypertrack.hyperlog.utils.DateTimeUtility;

import java.util.ArrayList;
import java.util.Calendar;
Expand Down Expand Up @@ -130,12 +130,12 @@ static void addDeviceLog(SQLiteDatabase db, String deviceLog) {
}
}

static void deleteDeviceLog(SQLiteDatabase db, List<DeviceLog> deviceLogList) {
static void deleteDeviceLog(SQLiteDatabase db, List<DeviceLogModel> deviceLogList) {
if (db == null)
return;

StringBuilder builder = new StringBuilder();
for (DeviceLog deviceLog : deviceLogList) {
for (DeviceLogModel deviceLog : deviceLogList) {
if (deviceLog != null && deviceLog.getId() > 0) {
builder.append(deviceLog.getId())
.append(",");
Expand Down Expand Up @@ -175,7 +175,7 @@ static void deleteAllDeviceLogs(SQLiteDatabase db) {
}
}

static List<DeviceLog> getDeviceLogs(SQLiteDatabase db, int batch) {
static List<DeviceLogModel> getDeviceLogs(SQLiteDatabase db, int batch) {
if (db == null) {
return null;
}
Expand All @@ -186,7 +186,7 @@ static List<DeviceLog> getDeviceLogs(SQLiteDatabase db, int batch) {
batch = 0;
}

ArrayList<DeviceLog> deviceLogList = null;
ArrayList<DeviceLogModel> deviceLogList = null;

String limit = String.valueOf(batch * DEVICE_LOG_REQUEST_QUERY_LIMIT) + ", " + String.valueOf(DEVICE_LOG_REQUEST_QUERY_LIMIT);

Expand All @@ -206,9 +206,9 @@ static List<DeviceLog> getDeviceLogs(SQLiteDatabase db, int batch) {

String deviceLogString = cursor.getString(1);
if (!TextUtils.isEmpty(deviceLogString)) {
DeviceLog deviceLog = new DeviceLog(deviceLogString);
DeviceLogModel deviceLog = new DeviceLogModel(deviceLogString);

// Get RowId for DeviceLog
// Get RowId for DeviceLogModel
Integer rowId = Integer.valueOf(cursor.getString(0));
deviceLog.setId(rowId != null ? rowId : 0);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ of this software and associated documentation files (the "Software"), to deal
* Created by Aman on 04/10/17.
*/

package com.hypertrack.devicelogger.db;
package com.hypertrack.hyperlog;

import android.content.Context;
import android.os.Build;
Expand All @@ -40,9 +40,9 @@ of this software and associated documentation files (the "Software"), to deal
import com.android.volley.toolbox.HttpHeaderParser;
import com.google.gson.Gson;
import com.google.gson.JsonSyntaxException;
import com.hypertrack.devicelogger.db.Utils.CustomGson;
import com.hypertrack.devicelogger.db.Utils.DateTimeUtility;
import com.hypertrack.devicelogger.db.Utils.Utils;
import com.hypertrack.hyperlog.utils.CustomGson;
import com.hypertrack.hyperlog.utils.DateTimeUtility;
import com.hypertrack.hyperlog.utils.Utils;

import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
Expand Down
Loading

0 comments on commit 8b17f51

Please sign in to comment.