This repository has been archived by the owner on Dec 11, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
1a8db2e
commit c8fd4c7
Showing
17 changed files
with
1,219 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
/build |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
apply plugin: 'com.android.library' | ||
apply plugin: 'com.github.dcendents.android-maven' | ||
group = 'com.github.mobile-dev-pro' | ||
|
||
android { | ||
compileSdkVersion rootProject.compileSdkVersion | ||
|
||
defaultConfig { | ||
minSdkVersion rootProject.minSdkVersion | ||
targetSdkVersion rootProject.targetSdkVersion | ||
} | ||
buildTypes { | ||
release { | ||
minifyEnabled true | ||
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' | ||
} | ||
} | ||
} | ||
|
||
dependencies { | ||
compile fileTree(dir: 'libs', include: ['*.jar']) | ||
compile "com.android.support:appcompat-v7:$rootProject.supportLibraryVersion" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
# Add project specific ProGuard rules here. | ||
# By default, the flags in this file are appended to flags specified | ||
# in /home/cdv/Dev/Tools/android-sdk/tools/proguard/proguard-android.txt | ||
# You can edit the include path and order by changing the proguardFiles | ||
# directive in build.gradle. | ||
# | ||
# For more details, see | ||
# http://developer.android.com/guide/developing/tools/proguard.html | ||
|
||
# Add any project specific keep options here: | ||
|
||
# If your project uses WebView with JS, uncomment the following | ||
# and specify the fully qualified class name to the JavaScript interface | ||
# class: | ||
#-keepclassmembers class fqcn.of.javascript.interface.for.webview { | ||
# public *; | ||
#} | ||
|
||
# Uncomment this to preserve the line number information for | ||
# debugging stack traces. | ||
#-keepattributes SourceFile,LineNumberTable | ||
|
||
# If you keep the line number information, uncomment this to | ||
# hide the original source file name. | ||
#-renamesourcefileattribute SourceFile | ||
|
||
#these classes should be available as public | ||
-keep class com.mobiledevpro.remotelogcat.RemoteLog { | ||
public <methods>; | ||
} | ||
-keep class com.mobiledevpro.remotelogcat.UserInfoModel { | ||
public <methods>; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
<manifest xmlns:android="http://schemas.android.com/apk/res/android" | ||
|
||
package="com.mobiledevpro.remotelogcat" | ||
> | ||
|
||
<uses-permission android:name="android.permission.INTERNET"/> | ||
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/> | ||
|
||
<application | ||
android:allowBackup="true" | ||
android:label="@string/app_name" | ||
android:supportsRtl="true" | ||
> | ||
|
||
</application> | ||
|
||
</manifest> |
39 changes: 39 additions & 0 deletions
39
library/src/main/java/com/mobiledevpro/remotelogcat/AppInfoModel.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
package com.mobiledevpro.remotelogcat; | ||
|
||
/** | ||
* Mdel for app info | ||
* <p> | ||
* Created by Dmitriy V. Chernysh on 25.09.17. | ||
* [email protected] | ||
* <p> | ||
* https://fb.me/mobiledevpro/ | ||
* <p> | ||
* #MobileDevPro | ||
*/ | ||
|
||
class AppInfoModel { | ||
private String name; | ||
private String version; | ||
private int build; | ||
|
||
/** | ||
* Constructor for getting entry from DB | ||
*/ | ||
AppInfoModel(String name, String version, int build) { | ||
this.name = name; | ||
this.version = version; | ||
this.build = build; | ||
} | ||
|
||
String getName() { | ||
return name; | ||
} | ||
|
||
String getVersion() { | ||
return version; | ||
} | ||
|
||
int getBuild() { | ||
return build; | ||
} | ||
} |
38 changes: 38 additions & 0 deletions
38
library/src/main/java/com/mobiledevpro/remotelogcat/AsyncTaskCompat.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
package com.mobiledevpro.remotelogcat; | ||
|
||
import android.os.AsyncTask; | ||
|
||
/** | ||
* Helper for accessing features in {@link AsyncTask} | ||
* introduced after API level 4 in a backwards compatible fashion. | ||
* | ||
* This class has been removed from support library version 26+ | ||
* <p> | ||
* Created by Dmitriy V. Chernysh on 07.03.18. | ||
* <p> | ||
* https://fb.com/mobiledevpro/ | ||
* https://github.com/dmitriy-chernysh | ||
* #MobileDevPro | ||
*/ | ||
|
||
class AsyncTaskCompat { | ||
/** | ||
* Executes the task with the specified parameters, allowing multiple tasks to run in parallel | ||
* on a pool of threads managed by {@link AsyncTask}. | ||
* | ||
* @param task The {@link AsyncTask} to execute. | ||
* @param params The parameters of the task. | ||
* @return the instance of AsyncTask. | ||
*/ | ||
static <Params, Progress, Result> AsyncTask<Params, Progress, Result> executeParallel( | ||
AsyncTask<Params, Progress, Result> task, Params... params) { | ||
if (task == null) { | ||
throw new IllegalArgumentException("task can not be null"); | ||
} | ||
|
||
// From API 11 onwards, we need to manually select the THREAD_POOL_EXECUTOR | ||
task.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, params); | ||
|
||
return task; | ||
} | ||
} |
48 changes: 48 additions & 0 deletions
48
library/src/main/java/com/mobiledevpro/remotelogcat/Constants.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
package com.mobiledevpro.remotelogcat; | ||
|
||
import android.content.Context; | ||
import android.net.ConnectivityManager; | ||
import android.net.NetworkInfo; | ||
|
||
/** | ||
* Class for storing constant values | ||
* <p> | ||
* Created by Dmitriy V. Chernysh on 23.09.17. | ||
* [email protected] | ||
* <p> | ||
* https://fb.me/mobiledevpro/ | ||
* <p> | ||
* #MobileDevPro | ||
*/ | ||
|
||
class Constants { | ||
static final int LOG_LEVEL_DEBUG = 1; | ||
static final int LOG_LEVEL_ERROR = 2; | ||
static final String LOG_TAG = "remote-logcat"; | ||
|
||
private static final String LOG_LEVEL_DEBUG_TXT = "debug"; | ||
private static final String LOG_LEVEL_ERROR_TXT = "error"; | ||
|
||
static String getLogLevelTxt(int logLevel) { | ||
switch (logLevel) { | ||
case LOG_LEVEL_DEBUG: | ||
return LOG_LEVEL_DEBUG_TXT; | ||
case LOG_LEVEL_ERROR: | ||
return LOG_LEVEL_ERROR_TXT; | ||
default: | ||
return String.valueOf(logLevel); | ||
} | ||
} | ||
|
||
/** | ||
* Method for checking network connection | ||
* | ||
* @param context - application context | ||
* @return true - device online | ||
*/ | ||
static boolean isDeviceOnline(Context context) { | ||
ConnectivityManager connMngr = (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE); | ||
NetworkInfo netInfo = connMngr.getActiveNetworkInfo(); | ||
return (netInfo != null && netInfo.isConnected()); | ||
} | ||
} |
Oops, something went wrong.