aboutsummaryrefslogtreecommitdiff
path: root/taler-kotlin-common/src/main/java/net/taler/common
diff options
context:
space:
mode:
Diffstat (limited to 'taler-kotlin-common/src/main/java/net/taler/common')
-rw-r--r--taler-kotlin-common/src/main/java/net/taler/common/AndroidUtils.kt5
1 files changed, 5 insertions, 0 deletions
diff --git a/taler-kotlin-common/src/main/java/net/taler/common/AndroidUtils.kt b/taler-kotlin-common/src/main/java/net/taler/common/AndroidUtils.kt
index f171039..3ab45ad 100644
--- a/taler-kotlin-common/src/main/java/net/taler/common/AndroidUtils.kt
+++ b/taler-kotlin-common/src/main/java/net/taler/common/AndroidUtils.kt
@@ -23,6 +23,7 @@ import android.content.pm.PackageManager.MATCH_DEFAULT_ONLY
import android.net.ConnectivityManager
import android.net.NetworkCapabilities.NET_CAPABILITY_INTERNET
import android.os.Build.VERSION.SDK_INT
+import android.os.Looper
import android.text.format.DateUtils.DAY_IN_MILLIS
import android.text.format.DateUtils.FORMAT_ABBREV_ALL
import android.text.format.DateUtils.FORMAT_ABBREV_MONTH
@@ -60,6 +61,10 @@ fun View.fadeOut(endAction: () -> Unit = {}) {
}.start()
}
+fun assertUiThread() {
+ check(Looper.getMainLooper().thread == Thread.currentThread())
+}
+
/**
* Use this with 'when' expressions when you need it to handle all possibilities/branches.
*/