diff --git a/app/src/main/java/info/nightscout/androidaps/MainActivity.kt b/app/src/main/java/info/nightscout/androidaps/MainActivity.kt
index 709d30a1b1..f07ef96d0f 100644
--- a/app/src/main/java/info/nightscout/androidaps/MainActivity.kt
+++ b/app/src/main/java/info/nightscout/androidaps/MainActivity.kt
@@ -42,7 +42,7 @@ import info.nightscout.androidaps.utils.extensions.isRunningRealPumpTest
import info.nightscout.androidaps.utils.protection.PasswordCheck
import info.nightscout.androidaps.utils.protection.ProtectionCheck
import info.nightscout.androidaps.utils.tabs.TabPageAdapter
-import info.nightscout.androidaps.utils.ui.UIRunnable
+import info.nightscout.core.ui.UIRunnable
import info.nightscout.core.fabric.FabricPrivacy
import info.nightscout.core.ui.dialogs.OKDialog
import info.nightscout.database.entities.UserEntry.Action
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/general/overview/OverviewFragment.kt b/app/src/main/java/info/nightscout/androidaps/plugins/general/overview/OverviewFragment.kt
index 52257dd48f..047e8f146e 100644
--- a/app/src/main/java/info/nightscout/androidaps/plugins/general/overview/OverviewFragment.kt
+++ b/app/src/main/java/info/nightscout/androidaps/plugins/general/overview/OverviewFragment.kt
@@ -47,8 +47,8 @@ import info.nightscout.androidaps.plugins.pump.omnipod.eros.OmnipodErosPumpPlugi
import info.nightscout.androidaps.utils.DefaultValueHelper
import info.nightscout.androidaps.utils.ToastUtils
import info.nightscout.androidaps.utils.protection.ProtectionCheck
-import info.nightscout.androidaps.utils.ui.SingleClickButton
-import info.nightscout.androidaps.utils.ui.UIRunnable
+import info.nightscout.core.ui.elements.SingleClickButton
+import info.nightscout.core.ui.UIRunnable
import info.nightscout.automation.AutomationPlugin
import info.nightscout.core.fabric.FabricPrivacy
import info.nightscout.core.iob.displayText
diff --git a/app/src/main/res/layout/maintenance_fragment.xml b/app/src/main/res/layout/maintenance_fragment.xml
index 852d2b906e..bb9718b4de 100644
--- a/app/src/main/res/layout/maintenance_fragment.xml
+++ b/app/src/main/res/layout/maintenance_fragment.xml
@@ -55,7 +55,7 @@
android:padding="10dip"
app:columnCount="2">
-
-
-
-
-
-
-
- Boolean): Boolean {
- isEnabled = false
- postDelayed({ isEnabled = true; aapsLogger.debug(LTag.UI, "Button enabled") }, BUTTON_REFRACTION_PERIOD)
- return block()
- }
-
- companion object {
-
- const val BUTTON_REFRACTION_PERIOD = 3000L
- }
-}
\ No newline at end of file
diff --git a/core/core-main/src/main/java/info/nightscout/androidaps/utils/ui/UIRunnable.kt b/core/core-main/src/main/java/info/nightscout/androidaps/utils/ui/UIRunnable.kt
deleted file mode 100644
index d80d7bfb47..0000000000
--- a/core/core-main/src/main/java/info/nightscout/androidaps/utils/ui/UIRunnable.kt
+++ /dev/null
@@ -1,9 +0,0 @@
-package info.nightscout.androidaps.utils.ui
-
-import info.nightscout.shared.extensions.runOnUiThread
-
-class UIRunnable (val runnable: Runnable) : Runnable {
- override fun run() {
- runOnUiThread(runnable)
- }
-}
\ No newline at end of file
diff --git a/core/core-main/src/main/java/info/nightscout/androidaps/utils/resources/ResourceHelperExtensions.kt b/core/ui/src/main/java/info/nightscout/core/ui/ContextExtensions.kt
similarity index 85%
rename from core/core-main/src/main/java/info/nightscout/androidaps/utils/resources/ResourceHelperExtensions.kt
rename to core/ui/src/main/java/info/nightscout/core/ui/ContextExtensions.kt
index db31c42970..66c90c75d2 100644
--- a/core/core-main/src/main/java/info/nightscout/androidaps/utils/resources/ResourceHelperExtensions.kt
+++ b/core/ui/src/main/java/info/nightscout/core/ui/ContextExtensions.kt
@@ -1,4 +1,4 @@
-package info.nightscout.androidaps.utils.resources
+package info.nightscout.core.ui
import android.content.Context
import android.util.TypedValue
diff --git a/core/ui/src/main/java/info/nightscout/core/ui/UIRunnable.kt b/core/ui/src/main/java/info/nightscout/core/ui/UIRunnable.kt
new file mode 100644
index 0000000000..2ec57ab925
--- /dev/null
+++ b/core/ui/src/main/java/info/nightscout/core/ui/UIRunnable.kt
@@ -0,0 +1,14 @@
+package info.nightscout.core.ui
+
+import android.os.Handler
+import android.os.Looper
+
+class UIRunnable (val runnable: Runnable) : Runnable {
+ private fun runOnUiThread(theRunnable: Runnable?) = theRunnable?.let {
+ Handler(Looper.getMainLooper()).post(it)
+ }
+
+ override fun run() {
+ runOnUiThread(runnable)
+ }
+}
\ No newline at end of file
diff --git a/core/ui/src/main/java/info/nightscout/core/ui/elements/SingleClickButton.kt b/core/ui/src/main/java/info/nightscout/core/ui/elements/SingleClickButton.kt
new file mode 100644
index 0000000000..c204907443
--- /dev/null
+++ b/core/ui/src/main/java/info/nightscout/core/ui/elements/SingleClickButton.kt
@@ -0,0 +1,24 @@
+package info.nightscout.core.ui.elements
+
+import android.content.Context
+import android.util.AttributeSet
+import com.google.android.material.button.MaterialButton
+import info.nightscout.core.ui.R
+
+class SingleClickButton @JvmOverloads constructor(context: Context, attrs: AttributeSet? = null, defStyleAttr: Int = R.style.Widget_MaterialComponents_Button) :
+ MaterialButton(context, attrs, defStyleAttr) {
+
+ override fun performClick(): Boolean = guardClick { super.performClick() }
+ override fun callOnClick(): Boolean = guardClick { super.callOnClick() }
+
+ private fun guardClick(block: () -> Boolean): Boolean {
+ isEnabled = false
+ postDelayed({ isEnabled = true }, BUTTON_REFRACTION_PERIOD)
+ return block()
+ }
+
+ companion object {
+
+ const val BUTTON_REFRACTION_PERIOD = 3000L
+ }
+}
\ No newline at end of file
diff --git a/core/core-main/src/main/java/info/nightscout/androidaps/utils/ui/VerticalTextView.kt b/core/ui/src/main/java/info/nightscout/core/ui/elements/VerticalTextView.kt
similarity index 96%
rename from core/core-main/src/main/java/info/nightscout/androidaps/utils/ui/VerticalTextView.kt
rename to core/ui/src/main/java/info/nightscout/core/ui/elements/VerticalTextView.kt
index b771b4073c..2e04fe4b76 100644
--- a/core/core-main/src/main/java/info/nightscout/androidaps/utils/ui/VerticalTextView.kt
+++ b/core/ui/src/main/java/info/nightscout/core/ui/elements/VerticalTextView.kt
@@ -1,4 +1,4 @@
-package info.nightscout.androidaps.utils.ui
+package info.nightscout.core.ui.elements
import android.content.Context
import android.graphics.Canvas
diff --git a/implementation/src/main/java/info/nightscout/implementation/resources/ResourceHelperImpl.kt b/implementation/src/main/java/info/nightscout/implementation/resources/ResourceHelperImpl.kt
index 9893ba50cf..7ee1656a24 100644
--- a/implementation/src/main/java/info/nightscout/implementation/resources/ResourceHelperImpl.kt
+++ b/implementation/src/main/java/info/nightscout/implementation/resources/ResourceHelperImpl.kt
@@ -18,7 +18,7 @@ import androidx.annotation.StringRes
import androidx.appcompat.app.AppCompatDelegate
import androidx.appcompat.view.ContextThemeWrapper
import androidx.core.content.ContextCompat
-import info.nightscout.androidaps.utils.resources.getThemeColor
+import info.nightscout.core.ui.getThemeColor
import info.nightscout.core.fabric.FabricPrivacy
import info.nightscout.core.main.R
import info.nightscout.shared.interfaces.ResourceHelper
diff --git a/plugins/src/main/java/info/nightscout/plugins/general/actions/ActionsFragment.kt b/plugins/src/main/java/info/nightscout/plugins/general/actions/ActionsFragment.kt
index 177920061f..078d35dfbf 100644
--- a/plugins/src/main/java/info/nightscout/plugins/general/actions/ActionsFragment.kt
+++ b/plugins/src/main/java/info/nightscout/plugins/general/actions/ActionsFragment.kt
@@ -14,10 +14,10 @@ import info.nightscout.androidaps.extensions.toStringMedium
import info.nightscout.androidaps.extensions.toStringShort
import info.nightscout.androidaps.logging.UserEntryLogger
import info.nightscout.androidaps.utils.protection.ProtectionCheck
-import info.nightscout.androidaps.utils.ui.SingleClickButton
-import info.nightscout.androidaps.utils.ui.UIRunnable
import info.nightscout.core.fabric.FabricPrivacy
+import info.nightscout.core.ui.UIRunnable
import info.nightscout.core.ui.dialogs.OKDialog
+import info.nightscout.core.ui.elements.SingleClickButton
import info.nightscout.database.entities.UserEntry.Action
import info.nightscout.database.entities.UserEntry.Sources
import info.nightscout.database.impl.AppRepository
diff --git a/plugins/src/main/java/info/nightscout/plugins/general/food/FoodFragment.kt b/plugins/src/main/java/info/nightscout/plugins/general/food/FoodFragment.kt
index 7501343c79..69b9dc55f3 100644
--- a/plugins/src/main/java/info/nightscout/plugins/general/food/FoodFragment.kt
+++ b/plugins/src/main/java/info/nightscout/plugins/general/food/FoodFragment.kt
@@ -14,7 +14,7 @@ import androidx.recyclerview.widget.RecyclerView
import dagger.android.support.DaggerFragment
import info.nightscout.androidaps.logging.UserEntryLogger
import info.nightscout.androidaps.utils.protection.ProtectionCheck
-import info.nightscout.androidaps.utils.ui.UIRunnable
+import info.nightscout.core.ui.UIRunnable
import info.nightscout.core.fabric.FabricPrivacy
import info.nightscout.core.ui.dialogs.OKDialog
import info.nightscout.database.entities.Food
diff --git a/plugins/src/main/res/layout/actions_fragment.xml b/plugins/src/main/res/layout/actions_fragment.xml
index d61ea35e9e..7dd28c7b6c 100644
--- a/plugins/src/main/res/layout/actions_fragment.xml
+++ b/plugins/src/main/res/layout/actions_fragment.xml
@@ -41,7 +41,7 @@
android:padding="10dip"
app:columnCount="2">
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
protectionCheck.queryProtection(
activity, ProtectionCheck.Protection.PREFERENCES,
- UIRunnable { startActivity(Intent(context, ErosPodManagementActivity::class.java)) }
+ info.nightscout.core.ui.UIRunnable { startActivity(Intent(context, ErosPodManagementActivity::class.java)) }
)
}
}
@@ -581,7 +581,7 @@ class OmnipodErosOverviewFragment : DaggerFragment() {
private fun displayNotConfiguredDialog() {
context?.let {
- UIRunnable {
+ info.nightscout.core.ui.UIRunnable {
OKDialog.show(
it, rh.gs(R.string.omnipod_common_warning),
rh.gs(R.string.omnipod_eros_error_operation_not_possible_no_configuration), null
@@ -598,7 +598,7 @@ class OmnipodErosOverviewFragment : DaggerFragment() {
private fun displayOkDialog(title: String, message: String) {
context?.let {
- UIRunnable {
+ info.nightscout.core.ui.UIRunnable {
OKDialog.show(it, title, message, null)
}.run()
}
diff --git a/pump/omnipod-eros/src/main/res/layout/omnipod_eros_pod_management.xml b/pump/omnipod-eros/src/main/res/layout/omnipod_eros_pod_management.xml
index e0597f4e26..0ec672c5c0 100644
--- a/pump/omnipod-eros/src/main/res/layout/omnipod_eros_pod_management.xml
+++ b/pump/omnipod-eros/src/main/res/layout/omnipod_eros_pod_management.xml
@@ -73,7 +73,7 @@
android:orientation="horizontal"
app:layout_constraintGuide_percent="0" />
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-