ComboV2: UI improvements
This commit is contained in:
parent
c6d01f10bd
commit
963016ef5d
9 changed files with 106 additions and 68 deletions
|
@ -174,6 +174,12 @@ abstract class PluginsListModule {
|
||||||
@IntKey(140)
|
@IntKey(140)
|
||||||
abstract fun bindComboPlugin(plugin: ComboPlugin): PluginBase
|
abstract fun bindComboPlugin(plugin: ComboPlugin): PluginBase
|
||||||
|
|
||||||
|
@Binds
|
||||||
|
@PumpDriver
|
||||||
|
@IntoMap
|
||||||
|
@IntKey(141)
|
||||||
|
abstract fun bindComboV2Plugin(plugin: ComboV2Plugin): PluginBase
|
||||||
|
|
||||||
@Binds
|
@Binds
|
||||||
@PumpDriver
|
@PumpDriver
|
||||||
@IntoMap
|
@IntoMap
|
||||||
|
@ -432,12 +438,6 @@ abstract class PluginsListModule {
|
||||||
@IntKey(500)
|
@IntKey(500)
|
||||||
abstract fun bindThemeSwitcherPlugin(plugin: ThemeSwitcherPlugin): PluginBase
|
abstract fun bindThemeSwitcherPlugin(plugin: ThemeSwitcherPlugin): PluginBase
|
||||||
|
|
||||||
@Binds
|
|
||||||
@PumpDriver
|
|
||||||
@IntoMap
|
|
||||||
@IntKey(510)
|
|
||||||
abstract fun bindComboV2Plugin(plugin: ComboV2Plugin): PluginBase
|
|
||||||
|
|
||||||
@Qualifier
|
@Qualifier
|
||||||
annotation class AllConfigs
|
annotation class AllConfigs
|
||||||
|
|
||||||
|
|
|
@ -7,6 +7,6 @@ import info.nightscout.core.ui.R
|
||||||
open class PluginNoSplashAppCompatActivity : DaggerAppCompatActivity() {
|
open class PluginNoSplashAppCompatActivity : DaggerAppCompatActivity() {
|
||||||
public override fun onCreate(savedInstanceState: Bundle?) {
|
public override fun onCreate(savedInstanceState: Bundle?) {
|
||||||
super.onCreate(savedInstanceState)
|
super.onCreate(savedInstanceState)
|
||||||
setTheme(R.style.AppTheme_NoActionBar)
|
setTheme(R.style.AppTheme)
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -1,6 +1,6 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<resources>
|
<resources>
|
||||||
<string name="combopump" translatable="false">Accu-Chek Combo</string>
|
<string name="combopump" translatable="false">Accu-Chek Combo (Ruffy)</string>
|
||||||
<string name="combopump_shortname" translatable="false">COMBO</string>
|
<string name="combopump_shortname" translatable="false">COMBO</string>
|
||||||
<string name="description_pump_combo">Pump integration for Accu-Chek Combo pumps, requires having ruffy installed</string>
|
<string name="description_pump_combo">Pump integration for Accu-Chek Combo pumps, requires having ruffy installed</string>
|
||||||
<string name="combo_programming_bolus">Programming pump for bolusing</string>
|
<string name="combo_programming_bolus">Programming pump for bolusing</string>
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
<application>
|
<application>
|
||||||
<activity
|
<activity
|
||||||
android:name="info.nightscout.pump.combov2.activities.ComboV2PairingActivity"
|
android:name="info.nightscout.pump.combov2.activities.ComboV2PairingActivity"
|
||||||
android:label="@string/combov2_pair_with_pump_title"
|
android:exported="false"
|
||||||
android:theme="@style/AppTheme" />
|
android:theme="@style/AppTheme.NoActionBar" />
|
||||||
</application>
|
</application>
|
||||||
</manifest>
|
</manifest>
|
||||||
|
|
|
@ -175,7 +175,7 @@ class ComboV2Plugin @Inject constructor (
|
||||||
|
|
||||||
/*** Public functions and base class & interface overrides ***/
|
/*** 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.
|
// Initial state when the driver is created.
|
||||||
object NotInitialized : DriverState("notInitialized")
|
object NotInitialized : DriverState("notInitialized")
|
||||||
// Driver is disconnected from the pump, or no pump
|
// Driver is disconnected from the pump, or no pump
|
||||||
|
@ -211,7 +211,7 @@ class ComboV2Plugin @Inject constructor (
|
||||||
object Error : DriverState("error")
|
object Error : DriverState("error")
|
||||||
}
|
}
|
||||||
|
|
||||||
val driverStateFlow = _driverStateFlow.asStateFlow()
|
private val driverStateFlow = _driverStateFlow.asStateFlow()
|
||||||
|
|
||||||
// Used by ComboV2PairingActivity to launch its own
|
// Used by ComboV2PairingActivity to launch its own
|
||||||
// custom activities that have a result.
|
// custom activities that have a result.
|
||||||
|
@ -228,7 +228,7 @@ class ComboV2Plugin @Inject constructor (
|
||||||
|
|
||||||
override fun onStart() {
|
override fun onStart() {
|
||||||
super.onStart()
|
super.onStart()
|
||||||
|
pumpCoroutineScope.launch {
|
||||||
aapsLogger.debug(LTag.PUMP, "Creating bluetooth interface")
|
aapsLogger.debug(LTag.PUMP, "Creating bluetooth interface")
|
||||||
bluetoothInterface = AndroidBluetoothInterface(context)
|
bluetoothInterface = AndroidBluetoothInterface(context)
|
||||||
|
|
||||||
|
@ -253,6 +253,7 @@ class ComboV2Plugin @Inject constructor (
|
||||||
|
|
||||||
setDriverState(DriverState.Disconnected)
|
setDriverState(DriverState.Disconnected)
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
override fun onStop() {
|
override fun onStop() {
|
||||||
pumpCoroutineScope.cancel()
|
pumpCoroutineScope.cancel()
|
||||||
|
|
|
@ -10,9 +10,9 @@ import androidx.databinding.DataBindingUtil
|
||||||
import androidx.lifecycle.Lifecycle
|
import androidx.lifecycle.Lifecycle
|
||||||
import androidx.lifecycle.lifecycleScope
|
import androidx.lifecycle.lifecycleScope
|
||||||
import androidx.lifecycle.repeatOnLifecycle
|
import androidx.lifecycle.repeatOnLifecycle
|
||||||
|
import dagger.android.support.DaggerAppCompatActivity
|
||||||
import info.nightscout.comboctl.base.BasicProgressStage
|
import info.nightscout.comboctl.base.BasicProgressStage
|
||||||
import info.nightscout.comboctl.base.PairingPIN
|
import info.nightscout.comboctl.base.PairingPIN
|
||||||
import info.nightscout.core.ui.activities.PluginNoSplashAppCompatActivity
|
|
||||||
import info.nightscout.core.ui.dialogs.OKDialog
|
import info.nightscout.core.ui.dialogs.OKDialog
|
||||||
import info.nightscout.pump.combov2.ComboV2Plugin
|
import info.nightscout.pump.combov2.ComboV2Plugin
|
||||||
import info.nightscout.pump.combov2.R
|
import info.nightscout.pump.combov2.R
|
||||||
|
@ -26,7 +26,8 @@ import kotlinx.coroutines.launch
|
||||||
import kotlinx.coroutines.runBlocking
|
import kotlinx.coroutines.runBlocking
|
||||||
import javax.inject.Inject
|
import javax.inject.Inject
|
||||||
|
|
||||||
class ComboV2PairingActivity : PluginNoSplashAppCompatActivity() {
|
class ComboV2PairingActivity : DaggerAppCompatActivity() {
|
||||||
|
|
||||||
@Inject lateinit var aapsLogger: AAPSLogger
|
@Inject lateinit var aapsLogger: AAPSLogger
|
||||||
@Inject lateinit var rh: ResourceHelper
|
@Inject lateinit var rh: ResourceHelper
|
||||||
@Inject lateinit var combov2Plugin: ComboV2Plugin
|
@Inject lateinit var combov2Plugin: ComboV2Plugin
|
||||||
|
@ -196,7 +197,7 @@ class ComboV2PairingActivity : PluginNoSplashAppCompatActivity() {
|
||||||
if (stage == BasicProgressStage.ComboPairingKeyAndPinRequested) {
|
if (stage == BasicProgressStage.ComboPairingKeyAndPinRequested) {
|
||||||
binding.combov2PinEntryUi.visibility = View.VISIBLE
|
binding.combov2PinEntryUi.visibility = View.VISIBLE
|
||||||
} else
|
} else
|
||||||
binding.combov2PinEntryUi.visibility = View.INVISIBLE
|
binding.combov2PinEntryUi.visibility = View.GONE
|
||||||
|
|
||||||
// Scanning for the pump can take a long time and happens at the
|
// Scanning for the pump can take a long time and happens at the
|
||||||
// beginning, so set the progress bar to indeterminate during that
|
// beginning, so set the progress bar to indeterminate during that
|
||||||
|
@ -211,7 +212,7 @@ class ComboV2PairingActivity : PluginNoSplashAppCompatActivity() {
|
||||||
combov2Plugin.previousPairingAttemptFailedFlow
|
combov2Plugin.previousPairingAttemptFailedFlow
|
||||||
.onEach { previousAttemptFailed ->
|
.onEach { previousAttemptFailed ->
|
||||||
binding.combov2PinFailureIndicator.visibility =
|
binding.combov2PinFailureIndicator.visibility =
|
||||||
if (previousAttemptFailed) View.VISIBLE else View.INVISIBLE
|
if (previousAttemptFailed) View.VISIBLE else View.GONE
|
||||||
}
|
}
|
||||||
.launchIn(this)
|
.launchIn(this)
|
||||||
}
|
}
|
||||||
|
|
|
@ -124,6 +124,7 @@
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
|
android:layout_marginBottom="5dp"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:orientation="horizontal">
|
android:orientation="horizontal">
|
||||||
|
|
||||||
|
|
|
@ -1,16 +1,51 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<layout xmlns:android="http://schemas.android.com/apk/res/android"
|
<layout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
xmlns:tools="http://schemas.android.com/tools">
|
xmlns:tools="http://schemas.android.com/tools">
|
||||||
<FrameLayout
|
|
||||||
|
<androidx.appcompat.widget.LinearLayoutCompat
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
|
android:orientation="vertical"
|
||||||
tools:context=".plugins.pump.combov2.activities.ComboV2PairingActivity">
|
tools:context=".plugins.pump.combov2.activities.ComboV2PairingActivity">
|
||||||
|
|
||||||
|
<androidx.appcompat.widget.LinearLayoutCompat
|
||||||
|
android:id="@+id/header"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginBottom="10dp"
|
||||||
|
android:background="?attr/activity_title_backgroundColor"
|
||||||
|
android:orientation="horizontal"
|
||||||
|
android:padding="5dp">
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/imageView"
|
||||||
|
android:layout_width="42dp"
|
||||||
|
android:layout_height="42dp"
|
||||||
|
android:importantForAccessibility="no"
|
||||||
|
android:scaleType="fitXY"
|
||||||
|
app:srcCompat="@drawable/ic_combo_128" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/textView2"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_centerHorizontal="true"
|
||||||
|
android:layout_centerVertical="true"
|
||||||
|
android:layout_gravity="center"
|
||||||
|
android:layout_marginStart="10dp"
|
||||||
|
android:layout_marginEnd="10dp"
|
||||||
|
android:text="@string/combov2_pair_with_pump_title"
|
||||||
|
android:textAlignment="center"
|
||||||
|
android:textAppearance="?android:attr/textAppearanceLarge" />
|
||||||
|
|
||||||
|
</androidx.appcompat.widget.LinearLayoutCompat>
|
||||||
|
|
||||||
<ScrollView
|
<ScrollView
|
||||||
android:visibility="visible"
|
|
||||||
android:id="@+id/combov2_pairing_section_initial"
|
android:id="@+id/combov2_pairing_section_initial"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent">
|
android:layout_height="wrap_content"
|
||||||
|
android:visibility="visible">
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
|
@ -44,10 +79,10 @@
|
||||||
</ScrollView>
|
</ScrollView>
|
||||||
|
|
||||||
<ScrollView
|
<ScrollView
|
||||||
android:visibility="gone"
|
|
||||||
android:id="@+id/combov2_pairing_section_main"
|
android:id="@+id/combov2_pairing_section_main"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent">
|
android:layout_height="wrap_content"
|
||||||
|
android:visibility="gone">
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
|
@ -91,13 +126,13 @@
|
||||||
android:id="@+id/combov2_current_pairing_step_desc"
|
android:id="@+id/combov2_current_pairing_step_desc"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginTop="20dp"
|
|
||||||
android:layout_marginBottom="20dp"
|
|
||||||
android:layout_marginLeft="16dp"
|
android:layout_marginLeft="16dp"
|
||||||
|
android:layout_marginTop="20dp"
|
||||||
android:layout_marginRight="16dp"
|
android:layout_marginRight="16dp"
|
||||||
|
android:layout_marginBottom="20dp"
|
||||||
|
android:background="@color/pumpStatusBackground"
|
||||||
android:gravity="center"
|
android:gravity="center"
|
||||||
android:padding="16dp"
|
android:padding="16dp"
|
||||||
android:background="@color/pumpStatusBackground"
|
|
||||||
android:text=""
|
android:text=""
|
||||||
android:textSize="16sp" />
|
android:textSize="16sp" />
|
||||||
|
|
||||||
|
@ -106,27 +141,27 @@
|
||||||
style="@android:style/Widget.ProgressBar.Horizontal"
|
style="@android:style/Widget.ProgressBar.Horizontal"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="10dp"
|
android:layout_height="10dp"
|
||||||
android:layout_marginBottom="20dp"
|
|
||||||
android:layout_marginLeft="16dp"
|
android:layout_marginLeft="16dp"
|
||||||
android:layout_marginRight="16dp"
|
android:layout_marginRight="16dp"
|
||||||
|
android:layout_marginBottom="20dp"
|
||||||
|
android:max="100"
|
||||||
android:maxHeight="5dp"
|
android:maxHeight="5dp"
|
||||||
android:minHeight="3dp"
|
android:minHeight="3dp" />
|
||||||
android:max="100" />
|
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:id="@+id/combov2_pin_entry_ui"
|
android:id="@+id/combov2_pin_entry_ui"
|
||||||
android:visibility="invisible"
|
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginBottom="20dp"
|
android:layout_marginBottom="20dp"
|
||||||
android:gravity="center_horizontal"
|
android:gravity="center_horizontal"
|
||||||
android:orientation="vertical">
|
android:orientation="vertical"
|
||||||
|
android:visibility="gone">
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:gravity="center_horizontal"
|
|
||||||
android:layout_marginBottom="20dp"
|
android:layout_marginBottom="20dp"
|
||||||
|
android:gravity="center_horizontal"
|
||||||
android:orientation="horizontal">
|
android:orientation="horizontal">
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
|
@ -140,12 +175,12 @@
|
||||||
android:id="@+id/combov2_pin_entry_edit"
|
android:id="@+id/combov2_pin_entry_edit"
|
||||||
android:layout_width="200dp"
|
android:layout_width="200dp"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:maxLength="12"
|
|
||||||
android:inputType="number"
|
|
||||||
android:digits="0123456789 "
|
|
||||||
android:minHeight="48dp"
|
|
||||||
android:hint="@string/combov2_pin_hint"
|
|
||||||
android:autofillHints="@string/combov2_pin_entry_hint"
|
android:autofillHints="@string/combov2_pin_entry_hint"
|
||||||
|
android:digits="0123456789 "
|
||||||
|
android:hint="@string/combov2_pin_hint"
|
||||||
|
android:inputType="number"
|
||||||
|
android:maxLength="12"
|
||||||
|
android:minHeight="48dp"
|
||||||
android:text="" />
|
android:text="" />
|
||||||
|
|
||||||
<Button
|
<Button
|
||||||
|
@ -158,14 +193,14 @@
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/combov2_pin_failure_indicator"
|
android:id="@+id/combov2_pin_failure_indicator"
|
||||||
android:visibility="invisible"
|
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginLeft="16dp"
|
android:layout_marginLeft="16dp"
|
||||||
android:layout_marginRight="16dp"
|
android:layout_marginRight="16dp"
|
||||||
android:gravity="center"
|
android:gravity="center"
|
||||||
android:text="@string/combov2_pairing_pin_failure"
|
android:text="@string/combov2_pairing_pin_failure"
|
||||||
android:textSize="16sp" />
|
android:textSize="16sp"
|
||||||
|
android:visibility="gone" />
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
|
@ -188,18 +223,18 @@
|
||||||
</ScrollView>
|
</ScrollView>
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:visibility="gone"
|
|
||||||
android:id="@+id/combov2_pairing_section_finished"
|
android:id="@+id/combov2_pairing_section_finished"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="wrap_content"
|
||||||
android:gravity="center"
|
android:gravity="center"
|
||||||
android:orientation="vertical">
|
android:orientation="vertical"
|
||||||
|
android:visibility="gone">
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:padding="16dp"
|
|
||||||
android:gravity="center"
|
android:gravity="center"
|
||||||
|
android:padding="16dp"
|
||||||
android:text="@string/combov2_pairing_finished_successfully"
|
android:text="@string/combov2_pairing_finished_successfully"
|
||||||
android:textSize="16sp" />
|
android:textSize="16sp" />
|
||||||
|
|
||||||
|
@ -220,19 +255,19 @@
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:visibility="gone"
|
|
||||||
android:id="@+id/combov2_pairing_section_aborted"
|
android:id="@+id/combov2_pairing_section_aborted"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="wrap_content"
|
||||||
android:gravity="center"
|
android:gravity="center"
|
||||||
android:orientation="vertical">
|
android:orientation="vertical"
|
||||||
|
android:visibility="gone">
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/combov2_pairing_aborted_reason_text"
|
android:id="@+id/combov2_pairing_aborted_reason_text"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:padding="16dp"
|
|
||||||
android:gravity="center"
|
android:gravity="center"
|
||||||
|
android:padding="16dp"
|
||||||
android:text=""
|
android:text=""
|
||||||
android:textSize="16sp" />
|
android:textSize="16sp" />
|
||||||
|
|
||||||
|
@ -252,5 +287,5 @@
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
</FrameLayout>
|
</androidx.appcompat.widget.LinearLayoutCompat>
|
||||||
</layout>
|
</layout>
|
|
@ -1,8 +1,8 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<resources>
|
<resources>
|
||||||
<string name="combov2_plugin_name">Accu-Chek Combo (new plugin)</string>
|
<string name="combov2_plugin_name">Accu-Chek Combo</string>
|
||||||
<string name="combov2_plugin_shortname" translatable="false">COMBOV2</string>
|
<string name="combov2_plugin_shortname" translatable="false">COMBOV2</string>
|
||||||
<string name="combov2_plugin_description">Pump integration for Accu-Chek Combo pumps, successor to Ruffy (EXPERIMENTAL)</string>
|
<string name="combov2_plugin_description">Native pump integration for Accu-Chek Combo pumps</string>
|
||||||
<string name="combov2_could_not_connect">Could not connect to the pump</string>
|
<string name="combov2_could_not_connect">Could not connect to the pump</string>
|
||||||
<string name="combov2_not_paired">Not paired to a pump</string>
|
<string name="combov2_not_paired">Not paired to a pump</string>
|
||||||
<string name="combov2_pump_terminated_connection">Pump terminated connection</string>
|
<string name="combov2_pump_terminated_connection">Pump terminated connection</string>
|
||||||
|
|
Loading…
Reference in a new issue