diff options
-rw-r--r-- | app/src/main/java/org/pacien/tincapp/activities/BaseActivity.kt | 4 | ||||
-rw-r--r-- | app/src/main/java/org/pacien/tincapp/activities/StatusActivity.kt | 2 |
2 files changed, 5 insertions, 1 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 44f3210..ff5b930 100644 --- a/app/src/main/java/org/pacien/tincapp/activities/BaseActivity.kt +++ b/app/src/main/java/org/pacien/tincapp/activities/BaseActivity.kt | |||
@@ -41,6 +41,10 @@ abstract class BaseActivity : AppCompatActivity() { | |||
41 | .show() | 41 | .show() |
42 | } | 42 | } |
43 | 43 | ||
44 | fun runOnUiThread(action: () -> Unit) { | ||
45 | if (!isFinishing && !isDestroyed) super.runOnUiThread(action) | ||
46 | } | ||
47 | |||
44 | protected fun notify(@StringRes msg: Int) = Snackbar.make(activity_base, msg, Snackbar.LENGTH_LONG).show() | 48 | protected fun notify(@StringRes msg: Int) = Snackbar.make(activity_base, msg, Snackbar.LENGTH_LONG).show() |
45 | protected fun notify(msg: String) = Snackbar.make(activity_base, msg, Snackbar.LENGTH_LONG).show() | 49 | protected fun notify(msg: String) = Snackbar.make(activity_base, msg, Snackbar.LENGTH_LONG).show() |
46 | protected fun showProgressDialog(@StringRes msg: Int): ProgressDialog = ProgressDialog.show(this, null, getString(msg), true, false) | 50 | protected fun showProgressDialog(@StringRes msg: Int): ProgressDialog = ProgressDialog.show(this, null, getString(msg), true, false) |
diff --git a/app/src/main/java/org/pacien/tincapp/activities/StatusActivity.kt b/app/src/main/java/org/pacien/tincapp/activities/StatusActivity.kt index 351305c..4206f7f 100644 --- a/app/src/main/java/org/pacien/tincapp/activities/StatusActivity.kt +++ b/app/src/main/java/org/pacien/tincapp/activities/StatusActivity.kt | |||
@@ -139,7 +139,7 @@ class StatusActivity : BaseActivity(), AdapterView.OnItemClickListener, SwipeRef | |||
139 | text_network_disallowed_applications.setText(cfg.disallowedApplications) | 139 | text_network_disallowed_applications.setText(cfg.disallowedApplications) |
140 | } | 140 | } |
141 | 141 | ||
142 | private fun writeNodeList(nodeList: List<String>) = runOnUiThread { | 142 | private fun writeNodeList(nodeList: List<String>) { |
143 | nodeListAdapter?.setElements(nodeList) | 143 | nodeListAdapter?.setElements(nodeList) |
144 | node_list_placeholder.visibility = View.GONE | 144 | node_list_placeholder.visibility = View.GONE |
145 | list_wrapper.isRefreshing = false | 145 | list_wrapper.isRefreshing = false |