summaryrefslogtreecommitdiff
path: root/taler-kotlin-android/src/main/java/net/taler/common/AndroidUtils.kt
diff options
context:
space:
mode:
Diffstat (limited to 'taler-kotlin-android/src/main/java/net/taler/common/AndroidUtils.kt')
-rw-r--r--taler-kotlin-android/src/main/java/net/taler/common/AndroidUtils.kt12
1 files changed, 10 insertions, 2 deletions
diff --git a/taler-kotlin-android/src/main/java/net/taler/common/AndroidUtils.kt b/taler-kotlin-android/src/main/java/net/taler/common/AndroidUtils.kt
index 7dde872..c6d34e9 100644
--- a/taler-kotlin-android/src/main/java/net/taler/common/AndroidUtils.kt
+++ b/taler-kotlin-android/src/main/java/net/taler/common/AndroidUtils.kt
@@ -97,13 +97,21 @@ fun Context.isOnline(): Boolean {
}
fun FragmentActivity.showError(mainText: String, detailText: String = "") = ErrorBottomSheet
- .newInstance(mainText, detailText)
- .show(supportFragmentManager, "ERROR_BOTTOM_SHEET")
+ .newInstance(mainText, detailText)
+ .show(supportFragmentManager, "ERROR_BOTTOM_SHEET")
fun FragmentActivity.showError(@StringRes mainId: Int, detailText: String = "") {
showError(getString(mainId), detailText)
}
+fun Fragment.showError(mainText: String, detailText: String = "") = ErrorBottomSheet
+ .newInstance(mainText, detailText)
+ .show(parentFragmentManager, "ERROR_BOTTOM_SHEET")
+
+fun Fragment.showError(@StringRes mainId: Int, detailText: String = "") {
+ showError(getString(mainId), detailText)
+}
+
fun Fragment.startActivitySafe(intent: Intent) {
try {
startActivity(intent)