├── .gitignore ├── .idea ├── .name ├── compiler.xml ├── copyright │ ├── Baidu.xml │ └── profiles_settings.xml ├── encodings.xml ├── gradle.xml ├── misc.xml ├── modules.xml ├── runConfigurations.xml └── vcs.xml ├── LogView_GitHub.iml ├── README.md ├── app ├── .gitignore ├── app.iml ├── build.gradle ├── proguard-rules.pro └── src │ └── main │ ├── AndroidManifest.xml │ ├── java │ └── tony │ │ └── com │ │ └── logview │ │ ├── MainActivity.java │ │ └── TestActivity.java │ └── res │ ├── layout │ ├── activity_main.xml │ └── activity_test.xml │ ├── menu │ ├── menu_main.xml │ └── menu_test.xml │ ├── mipmap-hdpi │ └── ic_launcher.png │ ├── mipmap-mdpi │ └── ic_launcher.png │ ├── mipmap-xhdpi │ └── ic_launcher.png │ ├── mipmap-xxhdpi │ └── ic_launcher.png │ ├── values-w820dp │ └── dimens.xml │ └── values │ ├── dimens.xml │ ├── strings.xml │ └── styles.xml ├── build.gradle ├── gradle.properties ├── gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── gradlew ├── gradlew.bat ├── logmodel ├── .gitignore ├── build.gradle ├── logmodel.iml ├── proguard-rules.pro └── src │ └── main │ ├── AndroidManifest.xml │ ├── java │ └── tony │ │ └── com │ │ └── logmodel │ │ ├── CommonUtils │ │ └── LogUtils.java │ │ ├── LogConfig.java │ │ ├── LogView.java │ │ ├── LogWindow.java │ │ ├── adpater │ │ └── SimpleTextAdapter.java │ │ ├── control │ │ ├── LogCtrl.java │ │ └── TraceBuffer.java │ │ └── model │ │ ├── LogCat.java │ │ ├── LogMainThread.java │ │ ├── LogManager.java │ │ ├── MainThread.java │ │ ├── TraceLevel.java │ │ └── TraceObject.java │ └── res │ └── values │ └── strings.xml ├── settings.gradle └── source ├── instance1.gif └── instance2.gif /.gitignore: -------------------------------------------------------------------------------- 1 | .gradle 2 | /local.properties 3 | /.idea/workspace.xml 4 | /.idea/libraries 5 | .DS_Store 6 | /build 7 | /captures 8 | -------------------------------------------------------------------------------- /.idea/.name: -------------------------------------------------------------------------------- 1 | LogView -------------------------------------------------------------------------------- /.idea/compiler.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 22 | -------------------------------------------------------------------------------- /.idea/copyright/Baidu.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 9 | -------------------------------------------------------------------------------- /.idea/copyright/profiles_settings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 6 | 7 | -------------------------------------------------------------------------------- /.idea/encodings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /.idea/gradle.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 25 | 26 | -------------------------------------------------------------------------------- /.idea/misc.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 19 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 46 | 47 | 48 | 49 | 50 | Baidu 51 | 52 | 57 | 58 | 59 | 60 | 61 | 62 | 1.7 63 | 64 | 69 | 70 | 71 | 72 | 73 | 74 | -------------------------------------------------------------------------------- /.idea/modules.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /.idea/runConfigurations.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 11 | 12 | -------------------------------------------------------------------------------- /.idea/vcs.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /LogView_GitHub.iml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # LogView 2 | ##Describe 3 | Hi,guys ,this is a android logcat library based on [Lynx](https://github.com/pedrovgs/Lynx),so you can show your Android logcat in a float view .But it’s different. I think it is more 4 | useful for hybrid app. Because it's very simple to import it and don't need other jars. 5 | Firstly,I am so sorry for my screenshots gif.It's too big , so I have to translate them to the end. 6 | 7 | 8 | ##Add it to your project 9 | 10 | There are two ways to use this lib. 11 | 12 | 1. Just import this model to your project , but do't forget change your build.gradle and setting.gradle. 13 | 2. Cd the list of my logmodel, and execute "./gradlew makeJar"(if it does't work , please use gradle makeJar) on the console.There will be build a jar(log.jar) in the libs list. 14 | 15 | ## ~~USE GRADLE DEPENDENCIES~~ (Discard) 16 | 17 | allprojects { 18 | repositories { 19 | ... 20 | maven { url "https://jitpack.io" } 21 | } 22 | } 23 | 24 | dependencies { 25 | compile 'com.github.sanyinchen:LogView:v1.0' 26 | } 27 | 28 | ## USAGES 29 | It's very simple to use this lib.You should add two line codes to your activity. 30 | such as: 31 | 32 | LogWindow logWindow = new LogWindow(this, getApplication()); 33 | logWindow.creatLogView(); 34 | 35 | Please be careful this , you need a promise to execute your application: 36 | 37 | 38 | 39 | Yes,it's onlely need one piece of promise and two code lines.No more other jars. 40 | I think it's very import for a finished project.Because we usually don't want to import too much jars that we don't need in release. 41 | 42 | ## Summary 43 | * Thanks for [Lynx](https://github.com/pedrovgs/Lynx),it‘s a very nice job. 44 | * If you have any question,please email to me(My email:sanyinchen@gmail.com) 45 | * Welcome to subscribe my [google+](https://plus.google.com/u/0/100465464266192894461) 46 | 47 | ## Screenshots 48 | ![](https://github.com/sanyinchen/LogView/blob/master/source/instance1.gif) 49 | ![](https://github.com/sanyinchen/LogView/blob/master/source/instance2.gif) 50 | -------------------------------------------------------------------------------- /app/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /app/app.iml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 8 | 9 | 10 | 11 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | -------------------------------------------------------------------------------- /app/build.gradle: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) Apache licence, Inc. All Rights Reserved. 3 | */ 4 | apply plugin: 'com.android.application' 5 | 6 | android { 7 | compileSdkVersion 23 8 | buildToolsVersion "23.0.3" 9 | 10 | defaultConfig { 11 | applicationId "tony.com.logview" 12 | minSdkVersion 15 13 | targetSdkVersion 23 14 | versionCode 1 15 | versionName "1.0" 16 | } 17 | buildTypes { 18 | release { 19 | minifyEnabled false 20 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 21 | } 22 | } 23 | lintOptions { 24 | checkReleaseBuilds false 25 | abortOnError false 26 | } 27 | } 28 | 29 | dependencies { 30 | compile fileTree(dir: 'libs', include: ['*.jar']) 31 | compile project(':logmodel') 32 | // compile 'com.android.support:appcompat-v7:23.1.0' 33 | 34 | } 35 | -------------------------------------------------------------------------------- /app/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # By default, the flags in this file are appended to flags specified 3 | # in /Users/sanyinchen/Tools/Android/sdk/tools/proguard/proguard-android.txt 4 | # You can edit the include path and order by changing the proguardFiles 5 | # directive in build.gradle. 6 | # 7 | # For more details, see 8 | # http://developer.android.com/guide/developing/tools/proguard.html 9 | 10 | # Add any project specific keep options here: 11 | 12 | # If your project uses WebView with JS, uncomment the following 13 | # and specify the fully qualified class name to the JavaScript interface 14 | # class: 15 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 16 | # public *; 17 | #} 18 | -------------------------------------------------------------------------------- /app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 7 | 12 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /app/src/main/java/tony/com/logview/MainActivity.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) Apache licence, Inc. All Rights Reserved. 3 | */ 4 | package tony.com.logview; 5 | 6 | import android.content.Intent; 7 | import android.support.v7.app.AppCompatActivity; 8 | import android.os.Bundle; 9 | import android.util.Log; 10 | import android.view.View; 11 | import android.widget.Button; 12 | import tony.com.logmodel.LogView; 13 | import tony.com.logmodel.LogWindow; 14 | 15 | public class MainActivity extends AppCompatActivity { 16 | 17 | int i = 0; 18 | Button testButton; 19 | Button startActivityButton; 20 | Button finishTestButton; 21 | 22 | @Override 23 | protected void onCreate(Bundle savedInstanceState) { 24 | super.onCreate(savedInstanceState); 25 | setContentView(R.layout.activity_main); 26 | testButton = (Button) findViewById(R.id.mybutton); 27 | startActivityButton = (Button) findViewById(R.id.startActivity); 28 | finishTestButton = (Button) findViewById(R.id.finishActivity); 29 | final LogWindow logWindow = new LogWindow(this, getApplication()).setregisterLifeCycleInStop(false); 30 | testButton.setOnClickListener(new View.OnClickListener() { 31 | @Override 32 | public void onClick(View v) { 33 | // createFloatView(); 34 | logWindow.creatLogView(); 35 | } 36 | }); 37 | startActivityButton.setOnClickListener(new View.OnClickListener() { 38 | @Override 39 | public void onClick(View v) { 40 | // onDestroy(); 41 | startActivity(new Intent(getBaseContext(), TestActivity.class)); 42 | } 43 | }); 44 | finishTestButton.setOnClickListener(new View.OnClickListener() { 45 | @Override 46 | public void onClick(View v) { 47 | finish(); 48 | } 49 | }); 50 | 51 | new Thread() { 52 | @Override 53 | public void run() { 54 | super.run(); 55 | 56 | while (true) { 57 | System.out.println("test-->" + (++i)); 58 | Log.e("srcomp", "Just test error work: " + i); 59 | Log.d("srcomp", "Just test: " + (++i)); 60 | Log.i("srcomp", "Just test: info : " + (++i)); 61 | try { 62 | Thread.sleep(1000); 63 | } catch (InterruptedException e) { 64 | e.printStackTrace(); 65 | } 66 | } 67 | } 68 | }.start(); 69 | 70 | } 71 | 72 | @Override 73 | protected void onDestroy() { 74 | super.onDestroy(); 75 | Log.d("srcomp", "Activity destory"); 76 | } 77 | 78 | } -------------------------------------------------------------------------------- /app/src/main/java/tony/com/logview/TestActivity.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) Apache licence, Inc. All Rights Reserved. 3 | */ 4 | package tony.com.logview; 5 | 6 | import android.annotation.TargetApi; 7 | import android.os.Build; 8 | import android.support.v7.app.AppCompatActivity; 9 | import android.os.Bundle; 10 | import android.util.Log; 11 | import android.view.View; 12 | import android.webkit.ConsoleMessage; 13 | import android.webkit.WebChromeClient; 14 | import android.webkit.WebView; 15 | import android.webkit.WebViewClient; 16 | import android.widget.Button; 17 | 18 | import tony.com.logmodel.LogWindow; 19 | 20 | public class TestActivity extends AppCompatActivity { 21 | private LogWindow logWindow; 22 | 23 | @TargetApi(Build.VERSION_CODES.KITKAT) 24 | @Override 25 | protected void onCreate(Bundle savedInstanceState) { 26 | super.onCreate(savedInstanceState); 27 | setContentView(R.layout.activity_test); 28 | logWindow = new LogWindow(this, getApplication()).setregisterLifeCycleInStop(false); 29 | logWindow.creatLogView(); 30 | Button button = (Button) findViewById(R.id.test_finish); 31 | button.setOnClickListener(new View.OnClickListener() { 32 | @Override 33 | public void onClick(View v) { 34 | finish(); 35 | } 36 | }); 37 | WebView webView = (WebView) findViewById(R.id.test_web); 38 | webView.setWebChromeClient(new DefaultWebChromeClient()); 39 | webView.setWebViewClient(new DefaultWebViewClient()); 40 | webView.loadUrl("https://developer.android.google.cn/"); 41 | if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) { 42 | webView.setWebContentsDebuggingEnabled(true); 43 | } 44 | 45 | } 46 | 47 | @Override 48 | public void finish() { 49 | super.finish(); 50 | logWindow.dismiss(); 51 | } 52 | 53 | private class DefaultWebViewClient extends WebViewClient { 54 | 55 | } 56 | 57 | private class DefaultWebChromeClient extends WebChromeClient { 58 | 59 | @Override 60 | public boolean onConsoleMessage(ConsoleMessage consoleMessage) { 61 | 62 | Log.d("srcomp", "[console]" + consoleMessage.message()); 63 | return super.onConsoleMessage(consoleMessage); 64 | } 65 | } 66 | 67 | } 68 | -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_main.xml: -------------------------------------------------------------------------------- 1 | 11 | 12 |