From f5bb6ae27f45a835069afe56a4571239a31aa5ae Mon Sep 17 00:00:00 2001 From: allens <18856907654@#163.com> Date: Fri, 17 Jul 2020 10:24:34 +0800 Subject: [PATCH] add log i v e ... --- app/build.gradle | 4 +- .../com/allens/xloghelper/MainActivity.kt | 13 +++ app/src/main/res/layout/activity_main.xml | 18 +++- xlog/build.gradle | 3 - .../main/java/com/allens/xlog/XLogHelper.kt | 82 +++++++++++++++++-- 5 files changed, 106 insertions(+), 14 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index 1c90fc7..3fb7265 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -40,6 +40,6 @@ dependencies { androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0' -// implementation project(':xlog') - implementation 'com.github.JiangHaiYang01:XLogHelper:0.0.1' + implementation project(':xlog') +// implementation 'com.github.JiangHaiYang01:XLogHelper:0.0.1' } \ No newline at end of file diff --git a/app/src/main/java/com/allens/xloghelper/MainActivity.kt b/app/src/main/java/com/allens/xloghelper/MainActivity.kt index ef2ea2b..714dc78 100644 --- a/app/src/main/java/com/allens/xloghelper/MainActivity.kt +++ b/app/src/main/java/com/allens/xloghelper/MainActivity.kt @@ -11,6 +11,7 @@ class MainActivity : AppCompatActivity() { setContentView(R.layout.activity_main) + //添加日志 add.setOnClickListener { for (i in 1..10) { @@ -24,5 +25,17 @@ class MainActivity : AppCompatActivity() { } } + + //close 之后不能写入 + close.setOnClickListener { + XLogHelper.close() + } + + + //flush 之后 还能够再次写入 + flush.setOnClickListener { + XLogHelper.flush(true) + } + } } \ No newline at end of file diff --git a/app/src/main/res/layout/activity_main.xml b/app/src/main/res/layout/activity_main.xml index d2251d2..16e41a2 100644 --- a/app/src/main/res/layout/activity_main.xml +++ b/app/src/main/res/layout/activity_main.xml @@ -1,18 +1,30 @@