simplify :core:interfaces

This commit is contained in:
Milos Kozak 2023-09-18 14:44:15 +02:00
parent 2b1d60218d
commit e9e10ffec5
8 changed files with 15 additions and 15 deletions

View file

@ -1,9 +1,8 @@
package info.nightscout.interfaces.pump.actions
import info.nightscout.interfaces.R
class CustomAction @JvmOverloads constructor(val name: Int, val customActionType: CustomActionType, val iconResourceId: Int = R.drawable.ic_actions_profileswitch, var isEnabled: Boolean = true) {
constructor(nameResourceId: Int, actionType: CustomActionType, enabled: Boolean) :
this(nameResourceId, actionType, R.drawable.ic_actions_profileswitch, enabled)
}
data class CustomAction(
val name: Int,
val customActionType: CustomActionType,
val iconResourceId: Int,
var isEnabled: Boolean = true
)

View file

@ -49,7 +49,7 @@ class UserEntryPresentationHelperImpl @Inject constructor(
Sources.QuickWizard -> R.drawable.ic_quick_wizard
Sources.ExtendedBolusDialog -> R.drawable.ic_actions_start_extended_bolus
Sources.TTDialog -> R.drawable.ic_temptarget_high
Sources.ProfileSwitchDialog -> info.nightscout.interfaces.R.drawable.ic_actions_profileswitch
Sources.ProfileSwitchDialog -> info.nightscout.core.ui.R.drawable.ic_actions_profileswitch
Sources.LoopDialog -> R.drawable.ic_loop_closed
Sources.TempBasalDialog -> R.drawable.ic_actions_start_temp_basal
Sources.CalibrationDialog -> R.drawable.ic_calibration

View file

@ -32,7 +32,7 @@ class ActionProfileSwitch(injector: HasAndroidInjector) : Action(injector) {
override fun friendlyName(): Int = R.string.profilename
override fun shortDescription(): String = rh.gs(R.string.changengetoprofilename, inputProfileName.value)
@DrawableRes override fun icon(): Int = info.nightscout.interfaces.R.drawable.ic_actions_profileswitch
@DrawableRes override fun icon(): Int = info.nightscout.core.ui.R.drawable.ic_actions_profileswitch
override fun doAction(callback: Callback) {
val activeProfileName = profileFunction.getProfileName()

View file

@ -35,7 +35,7 @@ class ActionProfileSwitchPercent(injector: HasAndroidInjector) : Action(injector
if (duration.value == 0) rh.gs(R.string.startprofileforever, pct.value.toInt())
else rh.gs(info.nightscout.core.ui.R.string.startprofile, pct.value.toInt(), duration.value)
@DrawableRes override fun icon(): Int = info.nightscout.interfaces.R.drawable.ic_actions_profileswitch
@DrawableRes override fun icon(): Int = info.nightscout.core.ui.R.drawable.ic_actions_profileswitch
init {
precondition = TriggerProfilePercent(injector, 100.0, Comparator.Compare.IS_EQUAL)

View file

@ -36,7 +36,7 @@ class ActionRunAutotune(injector: HasAndroidInjector) : Action(injector) {
override fun friendlyName(): Int = info.nightscout.core.ui.R.string.autotune_run
override fun shortDescription(): String = resourceHelper.gs(info.nightscout.core.ui.R.string.autotune_profile_name, inputProfileName.value)
@DrawableRes override fun icon(): Int = info.nightscout.interfaces.R.drawable.ic_actions_profileswitch
@DrawableRes override fun icon(): Int = info.nightscout.core.ui.R.drawable.ic_actions_profileswitch
override fun doAction(callback: Callback) {
val autoSwitch = sp.getBoolean(info.nightscout.core.utils.R.string.key_autotune_auto, false)

View file

@ -86,7 +86,7 @@ class TriggerProfilePercent(injector: HasAndroidInjector) : Trigger(injector) {
override fun friendlyDescription(): String =
rh.gs(R.string.percentagecompared, rh.gs(comparator.value.stringRes), pct.value.toInt())
override fun icon(): Optional<Int> = Optional.of(info.nightscout.interfaces.R.drawable.ic_actions_profileswitch)
override fun icon(): Optional<Int> = Optional.of(info.nightscout.core.ui.R.drawable.ic_actions_profileswitch)
override fun duplicate(): Trigger = TriggerProfilePercent(injector, this)

View file

@ -1170,13 +1170,14 @@ class MedtronicPumpPlugin @Inject constructor(
private var customActions: List<CustomAction>? = null
private val customActionWakeUpAndTune = CustomAction(
R.string.medtronic_custom_action_wake_and_tune,
MedtronicCustomActionType.WakeUpAndTune
MedtronicCustomActionType.WakeUpAndTune,
info.nightscout.core.ui.R.drawable.ic_actions_profileswitch
)
private val customActionClearBolusBlock = CustomAction(
R.string.medtronic_custom_action_clear_bolus_block, MedtronicCustomActionType.ClearBolusBlock, false
R.string.medtronic_custom_action_clear_bolus_block, MedtronicCustomActionType.ClearBolusBlock, info.nightscout.core.ui.R.drawable.ic_actions_profileswitch, false
)
private val customActionResetRLConfig = CustomAction(
R.string.medtronic_custom_action_reset_rileylink, MedtronicCustomActionType.ResetRileyLinkConfiguration, true
R.string.medtronic_custom_action_reset_rileylink, MedtronicCustomActionType.ResetRileyLinkConfiguration, info.nightscout.core.ui.R.drawable.ic_actions_profileswitch, true
)
override fun getCustomActions(): List<CustomAction>? {