aboutsummaryrefslogtreecommitdiff
path: root/core/src
diff options
context:
space:
mode:
Diffstat (limited to 'core/src')
-rw-r--r--core/src/main/kotlin/ca/allanwang/kau/internal/KauBaseActivity.kt2
-rw-r--r--core/src/main/kotlin/ca/allanwang/kau/logging/KL.kt8
-rw-r--r--core/src/main/kotlin/ca/allanwang/kau/utils/BundleUtils.kt2
-rw-r--r--core/src/main/kotlin/ca/allanwang/kau/utils/ContextUtils.kt3
-rw-r--r--core/src/main/kotlin/ca/allanwang/kau/xml/Changelog.kt5
5 files changed, 11 insertions, 9 deletions
diff --git a/core/src/main/kotlin/ca/allanwang/kau/internal/KauBaseActivity.kt b/core/src/main/kotlin/ca/allanwang/kau/internal/KauBaseActivity.kt
index bf977f2..e192ff2 100644
--- a/core/src/main/kotlin/ca/allanwang/kau/internal/KauBaseActivity.kt
+++ b/core/src/main/kotlin/ca/allanwang/kau/internal/KauBaseActivity.kt
@@ -59,4 +59,4 @@ abstract class KauBaseActivity : AppCompatActivity(), CoroutineScope {
super.onRequestPermissionsResult(requestCode, permissions, grantResults)
kauOnRequestPermissionsResult(permissions, grantResults)
}
-} \ No newline at end of file
+}
diff --git a/core/src/main/kotlin/ca/allanwang/kau/logging/KL.kt b/core/src/main/kotlin/ca/allanwang/kau/logging/KL.kt
index 52e5415..9fbc070 100644
--- a/core/src/main/kotlin/ca/allanwang/kau/logging/KL.kt
+++ b/core/src/main/kotlin/ca/allanwang/kau/logging/KL.kt
@@ -23,8 +23,12 @@ import ca.allanwang.kau.BuildConfig
* Internal KAU logger
*/
object KL : KauLogger("KAU", { BuildConfig.DEBUG }) {
- internal inline fun test(message: () -> Any?) {
+
+ /**
+ * Logger with searchable tag and thread info
+ */
+ inline fun test(message: () -> Any?) {
if (BuildConfig.DEBUG)
- d { "Test1234 ${message()}" }
+ d { "Test1234 ${Thread.currentThread().name} ${message()}" }
}
}
diff --git a/core/src/main/kotlin/ca/allanwang/kau/utils/BundleUtils.kt b/core/src/main/kotlin/ca/allanwang/kau/utils/BundleUtils.kt
index 8dcd856..40c1c72 100644
--- a/core/src/main/kotlin/ca/allanwang/kau/utils/BundleUtils.kt
+++ b/core/src/main/kotlin/ca/allanwang/kau/utils/BundleUtils.kt
@@ -23,8 +23,6 @@ import android.os.Bundle
import android.os.Parcelable
import android.util.Pair
import android.view.View
-import android.widget.ImageView
-import android.widget.TextView
import androidx.annotation.AnimRes
import ca.allanwang.kau.R
import java.io.Serializable
diff --git a/core/src/main/kotlin/ca/allanwang/kau/utils/ContextUtils.kt b/core/src/main/kotlin/ca/allanwang/kau/utils/ContextUtils.kt
index 60ef236..6867b49 100644
--- a/core/src/main/kotlin/ca/allanwang/kau/utils/ContextUtils.kt
+++ b/core/src/main/kotlin/ca/allanwang/kau/utils/ContextUtils.kt
@@ -49,13 +49,12 @@ import ca.allanwang.kau.logging.KL
import com.afollestad.materialdialogs.MaterialDialog
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.Dispatchers
-import kotlinx.coroutines.GlobalScope
import kotlin.coroutines.CoroutineContext
/**
* Created by Allan Wang on 2017-06-03.
*/
-private object ContextHelper: CoroutineScope {
+private object ContextHelper : CoroutineScope {
val handler = Handler(Looper.getMainLooper())
diff --git a/core/src/main/kotlin/ca/allanwang/kau/xml/Changelog.kt b/core/src/main/kotlin/ca/allanwang/kau/xml/Changelog.kt
index 51e63f9..22e8e76 100644
--- a/core/src/main/kotlin/ca/allanwang/kau/xml/Changelog.kt
+++ b/core/src/main/kotlin/ca/allanwang/kau/xml/Changelog.kt
@@ -30,8 +30,9 @@ import ca.allanwang.kau.utils.ctxCoroutine
import ca.allanwang.kau.utils.materialDialog
import ca.allanwang.kau.utils.use
import com.afollestad.materialdialogs.MaterialDialog
-import kotlinx.coroutines.async
+import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.launch
+import kotlinx.coroutines.withContext
import org.xmlpull.v1.XmlPullParser
/**
@@ -41,7 +42,7 @@ import org.xmlpull.v1.XmlPullParser
*/
fun Context.showChangelog(@XmlRes xmlRes: Int, @ColorInt textColor: Int? = null, customize: MaterialDialog.Builder.() -> Unit = {}) {
ctxCoroutine.launch {
- val items = async { parse(this@showChangelog, xmlRes) }.await()
+ val items = withContext(Dispatchers.Default) { parse(this@showChangelog, xmlRes) }
materialDialog {
title(R.string.kau_changelog)
positiveText(R.string.kau_great)