diff --git a/app/src/main/java/info/nightscout/androidaps/di/PluginsListModule.kt b/app/src/main/java/info/nightscout/androidaps/di/PluginsListModule.kt index 8dd325c3f8..9710bc44ad 100644 --- a/app/src/main/java/info/nightscout/androidaps/di/PluginsListModule.kt +++ b/app/src/main/java/info/nightscout/androidaps/di/PluginsListModule.kt @@ -174,6 +174,12 @@ abstract class PluginsListModule { @IntKey(140) abstract fun bindComboPlugin(plugin: ComboPlugin): PluginBase + @Binds + @PumpDriver + @IntoMap + @IntKey(141) + abstract fun bindComboV2Plugin(plugin: ComboV2Plugin): PluginBase + @Binds @PumpDriver @IntoMap @@ -432,12 +438,6 @@ abstract class PluginsListModule { @IntKey(500) abstract fun bindThemeSwitcherPlugin(plugin: ThemeSwitcherPlugin): PluginBase - @Binds - @PumpDriver - @IntoMap - @IntKey(510) - abstract fun bindComboV2Plugin(plugin: ComboV2Plugin): PluginBase - @Qualifier annotation class AllConfigs diff --git a/core/ui/src/main/java/info/nightscout/core/ui/activities/PluginNoSplashAppCompatActivity.kt b/core/ui/src/main/java/info/nightscout/core/ui/activities/PluginNoSplashAppCompatActivity.kt index 9c45162707..4aa503a08f 100644 --- a/core/ui/src/main/java/info/nightscout/core/ui/activities/PluginNoSplashAppCompatActivity.kt +++ b/core/ui/src/main/java/info/nightscout/core/ui/activities/PluginNoSplashAppCompatActivity.kt @@ -7,6 +7,6 @@ import info.nightscout.core.ui.R open class PluginNoSplashAppCompatActivity : DaggerAppCompatActivity() { public override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) - setTheme(R.style.AppTheme_NoActionBar) + setTheme(R.style.AppTheme) } } \ No newline at end of file diff --git a/pump/combo/src/main/res/values/strings.xml b/pump/combo/src/main/res/values/strings.xml index 2b5f21bd52..920de3e3a1 100644 --- a/pump/combo/src/main/res/values/strings.xml +++ b/pump/combo/src/main/res/values/strings.xml @@ -1,6 +1,6 @@ - Accu-Chek Combo + Accu-Chek Combo (Ruffy) COMBO Pump integration for Accu-Chek Combo pumps, requires having ruffy installed Programming pump for bolusing diff --git a/pump/combov2/src/main/AndroidManifest.xml b/pump/combov2/src/main/AndroidManifest.xml index 4a8b96bcba..d83e5ddd6d 100644 --- a/pump/combov2/src/main/AndroidManifest.xml +++ b/pump/combov2/src/main/AndroidManifest.xml @@ -8,7 +8,7 @@ + android:exported="false" + android:theme="@style/AppTheme.NoActionBar" /> diff --git a/pump/combov2/src/main/kotlin/info/nightscout/pump/combov2/ComboV2Plugin.kt b/pump/combov2/src/main/kotlin/info/nightscout/pump/combov2/ComboV2Plugin.kt index 3088312651..80749ba4e1 100644 --- a/pump/combov2/src/main/kotlin/info/nightscout/pump/combov2/ComboV2Plugin.kt +++ b/pump/combov2/src/main/kotlin/info/nightscout/pump/combov2/ComboV2Plugin.kt @@ -175,7 +175,7 @@ class ComboV2Plugin @Inject constructor ( /*** Public functions and base class & interface overrides ***/ - sealed class DriverState(val label: String) { + sealed class DriverState(@Suppress("unused") val label: String) { // Initial state when the driver is created. object NotInitialized : DriverState("notInitialized") // Driver is disconnected from the pump, or no pump @@ -211,7 +211,7 @@ class ComboV2Plugin @Inject constructor ( object Error : DriverState("error") } - val driverStateFlow = _driverStateFlow.asStateFlow() + private val driverStateFlow = _driverStateFlow.asStateFlow() // Used by ComboV2PairingActivity to launch its own // custom activities that have a result. @@ -228,30 +228,31 @@ class ComboV2Plugin @Inject constructor ( override fun onStart() { super.onStart() + pumpCoroutineScope.launch { + aapsLogger.debug(LTag.PUMP, "Creating bluetooth interface") + bluetoothInterface = AndroidBluetoothInterface(context) - aapsLogger.debug(LTag.PUMP, "Creating bluetooth interface") - bluetoothInterface = AndroidBluetoothInterface(context) + aapsLogger.debug(LTag.PUMP, "Setting up bluetooth interface") + bluetoothInterface!!.setup() - aapsLogger.debug(LTag.PUMP, "Setting up bluetooth interface") - bluetoothInterface!!.setup() + aapsLogger.debug(LTag.PUMP, "Setting up pump manager") + pumpManager = ComboCtlPumpManager(bluetoothInterface!!, pumpStateStore) + pumpManager!!.setup { + _pairedStateUIFlow.value = false + } - aapsLogger.debug(LTag.PUMP, "Setting up pump manager") - pumpManager = ComboCtlPumpManager(bluetoothInterface!!, pumpStateStore) - pumpManager!!.setup { - _pairedStateUIFlow.value = false + // UI flows that must have defined values right + // at start are initialized here. + + // The paired state UI flow is special in that it is also + // used as the backing store for the isPaired() function, + // so setting up that UI state flow equals updating that + // paired state. + val paired = pumpManager!!.getPairedPumpAddresses().isNotEmpty() + _pairedStateUIFlow.value = paired + + setDriverState(DriverState.Disconnected) } - - // UI flows that must have defined values right - // at start are initialized here. - - // The paired state UI flow is special in that it is also - // used as the backing store for the isPaired() function, - // so setting up that UI state flow equals updating that - // paired state. - val paired = pumpManager!!.getPairedPumpAddresses().isNotEmpty() - _pairedStateUIFlow.value = paired - - setDriverState(DriverState.Disconnected) } override fun onStop() { diff --git a/pump/combov2/src/main/kotlin/info/nightscout/pump/combov2/activities/ComboV2PairingActivity.kt b/pump/combov2/src/main/kotlin/info/nightscout/pump/combov2/activities/ComboV2PairingActivity.kt index 25e2d07d59..844253153a 100644 --- a/pump/combov2/src/main/kotlin/info/nightscout/pump/combov2/activities/ComboV2PairingActivity.kt +++ b/pump/combov2/src/main/kotlin/info/nightscout/pump/combov2/activities/ComboV2PairingActivity.kt @@ -10,9 +10,9 @@ import androidx.databinding.DataBindingUtil import androidx.lifecycle.Lifecycle import androidx.lifecycle.lifecycleScope import androidx.lifecycle.repeatOnLifecycle +import dagger.android.support.DaggerAppCompatActivity import info.nightscout.comboctl.base.BasicProgressStage import info.nightscout.comboctl.base.PairingPIN -import info.nightscout.core.ui.activities.PluginNoSplashAppCompatActivity import info.nightscout.core.ui.dialogs.OKDialog import info.nightscout.pump.combov2.ComboV2Plugin import info.nightscout.pump.combov2.R @@ -26,7 +26,8 @@ import kotlinx.coroutines.launch import kotlinx.coroutines.runBlocking import javax.inject.Inject -class ComboV2PairingActivity : PluginNoSplashAppCompatActivity() { +class ComboV2PairingActivity : DaggerAppCompatActivity() { + @Inject lateinit var aapsLogger: AAPSLogger @Inject lateinit var rh: ResourceHelper @Inject lateinit var combov2Plugin: ComboV2Plugin @@ -196,7 +197,7 @@ class ComboV2PairingActivity : PluginNoSplashAppCompatActivity() { if (stage == BasicProgressStage.ComboPairingKeyAndPinRequested) { binding.combov2PinEntryUi.visibility = View.VISIBLE } else - binding.combov2PinEntryUi.visibility = View.INVISIBLE + binding.combov2PinEntryUi.visibility = View.GONE // Scanning for the pump can take a long time and happens at the // beginning, so set the progress bar to indeterminate during that @@ -211,7 +212,7 @@ class ComboV2PairingActivity : PluginNoSplashAppCompatActivity() { combov2Plugin.previousPairingAttemptFailedFlow .onEach { previousAttemptFailed -> binding.combov2PinFailureIndicator.visibility = - if (previousAttemptFailed) View.VISIBLE else View.INVISIBLE + if (previousAttemptFailed) View.VISIBLE else View.GONE } .launchIn(this) } diff --git a/pump/combov2/src/main/res/layout/combov2_fragment.xml b/pump/combov2/src/main/res/layout/combov2_fragment.xml index caa797da2a..58bd02c224 100644 --- a/pump/combov2/src/main/res/layout/combov2_fragment.xml +++ b/pump/combov2/src/main/res/layout/combov2_fragment.xml @@ -124,6 +124,7 @@ diff --git a/pump/combov2/src/main/res/layout/combov2_pairing_activity.xml b/pump/combov2/src/main/res/layout/combov2_pairing_activity.xml index 8b899aa4de..83b88bd19e 100644 --- a/pump/combov2/src/main/res/layout/combov2_pairing_activity.xml +++ b/pump/combov2/src/main/res/layout/combov2_pairing_activity.xml @@ -1,16 +1,51 @@ - + + + + + + + + + android:layout_height="wrap_content" + android:visibility="visible"> + android:layout_height="wrap_content" + android:visibility="gone"> @@ -106,27 +141,27 @@ style="@android:style/Widget.ProgressBar.Horizontal" android:layout_width="match_parent" android:layout_height="10dp" - android:layout_marginBottom="20dp" android:layout_marginLeft="16dp" android:layout_marginRight="16dp" + android:layout_marginBottom="20dp" + android:max="100" android:maxHeight="5dp" - android:minHeight="3dp" - android:max="100" /> + android:minHeight="3dp" /> + android:orientation="vertical" + android:visibility="gone">