diff options
Diffstat (limited to 'library/src')
-rw-r--r-- | library/src/main/kotlin/ca/allanwang/kau/logging/KL.kt | 6 | ||||
-rw-r--r-- | library/src/main/kotlin/ca/allanwang/kau/utils/Utils.kt | 12 |
2 files changed, 17 insertions, 1 deletions
diff --git a/library/src/main/kotlin/ca/allanwang/kau/logging/KL.kt b/library/src/main/kotlin/ca/allanwang/kau/logging/KL.kt new file mode 100644 index 0000000..4fa3360 --- /dev/null +++ b/library/src/main/kotlin/ca/allanwang/kau/logging/KL.kt @@ -0,0 +1,6 @@ +package ca.allanwang.kau.logging + +/** + * Created by Allan Wang on 2017-06-19. + */ +object KL : TimberLogger("KAU")
\ No newline at end of file diff --git a/library/src/main/kotlin/ca/allanwang/kau/utils/Utils.kt b/library/src/main/kotlin/ca/allanwang/kau/utils/Utils.kt index e00891d..642c29c 100644 --- a/library/src/main/kotlin/ca/allanwang/kau/utils/Utils.kt +++ b/library/src/main/kotlin/ca/allanwang/kau/utils/Utils.kt @@ -2,6 +2,8 @@ package ca.allanwang.kau.utils import android.content.res.Resources import android.os.Build +import android.os.Looper +import ca.allanwang.kau.logging.KL /** * Created by Allan Wang on 2017-05-28. @@ -17,4 +19,12 @@ val buildIsLollipopAndUp: Boolean get() = Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP val buildIsMarshmallowAndUp: Boolean - get() = Build.VERSION.SDK_INT >= Build.VERSION_CODES.M
\ No newline at end of file + get() = Build.VERSION.SDK_INT >= Build.VERSION_CODES.M + +/** + * Log whether current state is in the main thread + */ +fun checkThread(id: Int) { + val status = if (Looper.myLooper() == Looper.getMainLooper()) "is" else "is not" + KL.d("$id $status in the main thread") +}
\ No newline at end of file |