aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--app/src/main/java/org/pacien/tincapp/activities/BaseActivity.kt17
1 files changed, 14 insertions, 3 deletions
diff --git a/app/src/main/java/org/pacien/tincapp/activities/BaseActivity.kt b/app/src/main/java/org/pacien/tincapp/activities/BaseActivity.kt
index 18787a8..6f18565 100644
--- a/app/src/main/java/org/pacien/tincapp/activities/BaseActivity.kt
+++ b/app/src/main/java/org/pacien/tincapp/activities/BaseActivity.kt
@@ -98,7 +98,18 @@ abstract class BaseActivity : AppCompatActivity() {
98 fun notify(@StringRes msg: Int) = Snackbar.make(rootView, msg, Snackbar.LENGTH_LONG).show() 98 fun notify(@StringRes msg: Int) = Snackbar.make(rootView, msg, Snackbar.LENGTH_LONG).show()
99 fun notify(msg: String) = Snackbar.make(rootView, msg, Snackbar.LENGTH_LONG).show() 99 fun notify(msg: String) = Snackbar.make(rootView, msg, Snackbar.LENGTH_LONG).show()
100 100
101 fun showErrorDialog(msg: String): AlertDialog = AlertDialog.Builder(this) 101 fun showErrorDialog(@StringRes msg: Int, docTopic: String? = null) =
102 .setTitle(R.string.generic_title_error).setMessage(msg) 102 showErrorDialog(getString(msg), docTopic)
103 .setPositiveButton(R.string.generic_action_close) { _, _ -> Unit }.show() 103
104 fun showErrorDialog(msg: String, docTopic: String? = null): AlertDialog =
105 AlertDialog.Builder(this)
106 .setTitle(R.string.generic_title_error).setMessage(msg)
107 .setPositiveButton(R.string.generic_action_close) { _, _ -> Unit }
108 .apply {
109 if (docTopic != null)
110 setNeutralButton(R.string.notification_error_action_open_manual) { _, _ ->
111 App.openURL(getString(R.string.app_doc_url_format, docTopic))
112 }
113 }
114 .show()
104} 115}