Merge remote-tracking branch 'ns/dev' into wear
This commit is contained in:
commit
cc510da7b1
|
@ -149,7 +149,7 @@ class AutomationFragment : DaggerFragment(), OnStartDragListener {
|
||||||
} else {
|
} else {
|
||||||
val icon = t.icon()
|
val icon = t.icon()
|
||||||
if (icon.isPresent) {
|
if (icon.isPresent) {
|
||||||
set.add(icon.get()!!)
|
set.add(icon.get())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -53,7 +53,7 @@ abstract class Trigger(val injector: HasAndroidInjector) {
|
||||||
|
|
||||||
abstract fun friendlyName(): Int
|
abstract fun friendlyName(): Int
|
||||||
abstract fun friendlyDescription(): String
|
abstract fun friendlyDescription(): String
|
||||||
abstract fun icon(): Optional<Int?>
|
abstract fun icon(): Optional<Int>
|
||||||
abstract fun duplicate(): Trigger
|
abstract fun duplicate(): Trigger
|
||||||
|
|
||||||
fun scanForActivity(cont: Context?): AppCompatActivity? {
|
fun scanForActivity(cont: Context?): AppCompatActivity? {
|
||||||
|
|
|
@ -63,7 +63,7 @@ class TriggerAutosensValue(injector: HasAndroidInjector) : Trigger(injector) {
|
||||||
override fun friendlyDescription(): String =
|
override fun friendlyDescription(): String =
|
||||||
rh.gs(R.string.autosenscompared, rh.gs(comparator.value.stringRes), autosens.value)
|
rh.gs(R.string.autosenscompared, rh.gs(comparator.value.stringRes), autosens.value)
|
||||||
|
|
||||||
override fun icon(): Optional<Int?> = Optional.of(R.drawable.ic_as)
|
override fun icon(): Optional<Int> = Optional.of(R.drawable.ic_as)
|
||||||
|
|
||||||
override fun duplicate(): Trigger = TriggerAutosensValue(injector, this)
|
override fun duplicate(): Trigger = TriggerAutosensValue(injector, this)
|
||||||
|
|
||||||
|
|
|
@ -57,7 +57,7 @@ class TriggerBTDevice(injector: HasAndroidInjector) : Trigger(injector) {
|
||||||
override fun friendlyDescription(): String =
|
override fun friendlyDescription(): String =
|
||||||
rh.gs(R.string.btdevicecompared, btDevice.value, rh.gs(comparator.value.stringRes))
|
rh.gs(R.string.btdevicecompared, btDevice.value, rh.gs(comparator.value.stringRes))
|
||||||
|
|
||||||
override fun icon(): Optional<Int?> = Optional.of(R.drawable.ic_bluetooth_white_48dp)
|
override fun icon(): Optional<Int> = Optional.of(R.drawable.ic_bluetooth_white_48dp)
|
||||||
|
|
||||||
override fun duplicate(): Trigger = TriggerBTDevice(injector, this)
|
override fun duplicate(): Trigger = TriggerBTDevice(injector, this)
|
||||||
|
|
||||||
|
|
|
@ -87,7 +87,7 @@ class TriggerBg(injector: HasAndroidInjector) : Trigger(injector) {
|
||||||
rh.gs(if (bg.units == GlucoseUnit.MGDL) R.string.glucosecomparedmgdl else R.string.glucosecomparedmmol, rh.gs(comparator.value.stringRes), bg.value, bg.units)
|
rh.gs(if (bg.units == GlucoseUnit.MGDL) R.string.glucosecomparedmgdl else R.string.glucosecomparedmmol, rh.gs(comparator.value.stringRes), bg.value, bg.units)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun icon(): Optional<Int?> = Optional.of(R.drawable.ic_cp_bgcheck)
|
override fun icon(): Optional<Int> = Optional.of(R.drawable.ic_cp_bgcheck)
|
||||||
|
|
||||||
override fun duplicate(): Trigger = TriggerBg(injector, this)
|
override fun duplicate(): Trigger = TriggerBg(injector, this)
|
||||||
|
|
||||||
|
|
|
@ -75,7 +75,7 @@ class TriggerBolusAgo(injector: HasAndroidInjector) : Trigger(injector) {
|
||||||
override fun friendlyDescription(): String =
|
override fun friendlyDescription(): String =
|
||||||
rh.gs(R.string.lastboluscompared, rh.gs(comparator.value.stringRes), minutesAgo.getMinutes())
|
rh.gs(R.string.lastboluscompared, rh.gs(comparator.value.stringRes), minutesAgo.getMinutes())
|
||||||
|
|
||||||
override fun icon(): Optional<Int?> = Optional.of(R.drawable.ic_bolus)
|
override fun icon(): Optional<Int> = Optional.of(R.drawable.ic_bolus)
|
||||||
|
|
||||||
override fun duplicate(): Trigger = TriggerBolusAgo(injector, this)
|
override fun duplicate(): Trigger = TriggerBolusAgo(injector, this)
|
||||||
|
|
||||||
|
|
|
@ -73,7 +73,7 @@ class TriggerCOB(injector: HasAndroidInjector) : Trigger(injector) {
|
||||||
override fun friendlyDescription(): String =
|
override fun friendlyDescription(): String =
|
||||||
rh.gs(R.string.cobcompared, rh.gs(comparator.value.stringRes), cob.value)
|
rh.gs(R.string.cobcompared, rh.gs(comparator.value.stringRes), cob.value)
|
||||||
|
|
||||||
override fun icon(): Optional<Int?> = Optional.of(R.drawable.ic_cp_bolus_carbs)
|
override fun icon(): Optional<Int> = Optional.of(R.drawable.ic_cp_bolus_carbs)
|
||||||
|
|
||||||
override fun duplicate(): Trigger = TriggerCOB(injector, this)
|
override fun duplicate(): Trigger = TriggerCOB(injector, this)
|
||||||
|
|
||||||
|
|
|
@ -115,7 +115,7 @@ class TriggerConnector(injector: HasAndroidInjector) : Trigger(injector) {
|
||||||
return result.toString()
|
return result.toString()
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun icon(): Optional<Int?> = Optional.absent()
|
override fun icon(): Optional<Int> = Optional.absent()
|
||||||
|
|
||||||
override fun duplicate(): Trigger = TriggerConnector(injector, connectorType)
|
override fun duplicate(): Trigger = TriggerConnector(injector, connectorType)
|
||||||
|
|
||||||
|
|
|
@ -110,7 +110,7 @@ class TriggerDelta(injector: HasAndroidInjector) : Trigger(injector) {
|
||||||
override fun friendlyDescription(): String =
|
override fun friendlyDescription(): String =
|
||||||
rh.gs(R.string.deltacompared, rh.gs(comparator.value.stringRes), delta.value, rh.gs(delta.deltaType.stringRes))
|
rh.gs(R.string.deltacompared, rh.gs(comparator.value.stringRes), delta.value, rh.gs(delta.deltaType.stringRes))
|
||||||
|
|
||||||
override fun icon(): Optional<Int?> = Optional.of(R.drawable.ic_auto_delta)
|
override fun icon(): Optional<Int> = Optional.of(R.drawable.ic_auto_delta)
|
||||||
|
|
||||||
override fun duplicate(): Trigger = TriggerDelta(injector, this)
|
override fun duplicate(): Trigger = TriggerDelta(injector, this)
|
||||||
|
|
||||||
|
|
|
@ -27,7 +27,7 @@ class TriggerDummy(injector: HasAndroidInjector, val shouldRun: Boolean = false)
|
||||||
return "TriggerDummy"
|
return "TriggerDummy"
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun icon(): Optional<Int?> {
|
override fun icon(): Optional<Int> {
|
||||||
throw NotImplementedError("An operation is not implemented")
|
throw NotImplementedError("An operation is not implemented")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -60,7 +60,7 @@ class TriggerIob(injector: HasAndroidInjector) : Trigger(injector) {
|
||||||
override fun friendlyDescription(): String =
|
override fun friendlyDescription(): String =
|
||||||
rh.gs(R.string.iobcompared, rh.gs(comparator.value.stringRes), insulin.value)
|
rh.gs(R.string.iobcompared, rh.gs(comparator.value.stringRes), insulin.value)
|
||||||
|
|
||||||
override fun icon(): Optional<Int?> = Optional.of(R.drawable.ic_keyboard_capslock)
|
override fun icon(): Optional<Int> = Optional.of(R.drawable.ic_keyboard_capslock)
|
||||||
|
|
||||||
override fun duplicate(): Trigger = TriggerIob(injector, this)
|
override fun duplicate(): Trigger = TriggerIob(injector, this)
|
||||||
|
|
||||||
|
|
|
@ -81,7 +81,7 @@ class TriggerLocation(injector: HasAndroidInjector) : Trigger(injector) {
|
||||||
override fun friendlyDescription(): String =
|
override fun friendlyDescription(): String =
|
||||||
rh.gs(R.string.locationis, rh.gs(modeSelected.value.stringRes), " " + name.value)
|
rh.gs(R.string.locationis, rh.gs(modeSelected.value.stringRes), " " + name.value)
|
||||||
|
|
||||||
override fun icon(): Optional<Int?> = Optional.of(R.drawable.ic_location_on)
|
override fun icon(): Optional<Int> = Optional.of(R.drawable.ic_location_on)
|
||||||
|
|
||||||
override fun duplicate(): Trigger = TriggerLocation(injector, this)
|
override fun duplicate(): Trigger = TriggerLocation(injector, this)
|
||||||
|
|
||||||
|
|
|
@ -86,7 +86,7 @@ class TriggerProfilePercent(injector: HasAndroidInjector) : Trigger(injector) {
|
||||||
override fun friendlyDescription(): String =
|
override fun friendlyDescription(): String =
|
||||||
rh.gs(R.string.percentagecompared, rh.gs(comparator.value.stringRes), pct.value.toInt())
|
rh.gs(R.string.percentagecompared, rh.gs(comparator.value.stringRes), pct.value.toInt())
|
||||||
|
|
||||||
override fun icon(): Optional<Int?> = Optional.of(R.drawable.ic_actions_profileswitch)
|
override fun icon(): Optional<Int> = Optional.of(R.drawable.ic_actions_profileswitch)
|
||||||
|
|
||||||
override fun duplicate(): Trigger = TriggerProfilePercent(injector, this)
|
override fun duplicate(): Trigger = TriggerProfilePercent(injector, this)
|
||||||
|
|
||||||
|
|
|
@ -73,7 +73,7 @@ class TriggerPumpLastConnection(injector: HasAndroidInjector) : Trigger(injector
|
||||||
override fun friendlyDescription(): String =
|
override fun friendlyDescription(): String =
|
||||||
rh.gs(R.string.automation_trigger_pump_last_connection_compared, rh.gs(comparator.value.stringRes), minutesAgo.value)
|
rh.gs(R.string.automation_trigger_pump_last_connection_compared, rh.gs(comparator.value.stringRes), minutesAgo.value)
|
||||||
|
|
||||||
override fun icon(): Optional<Int?> = Optional.of(R.drawable.ic_remove)
|
override fun icon(): Optional<Int> = Optional.of(R.drawable.ic_remove)
|
||||||
|
|
||||||
override fun duplicate(): Trigger = TriggerPumpLastConnection(injector, this)
|
override fun duplicate(): Trigger = TriggerPumpLastConnection(injector, this)
|
||||||
|
|
||||||
|
|
|
@ -84,7 +84,7 @@ class TriggerRecurringTime(injector: HasAndroidInjector) : Trigger(injector) {
|
||||||
return if (counter == 0) rh.gs(R.string.never) else sb.toString()
|
return if (counter == 0) rh.gs(R.string.never) else sb.toString()
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun icon(): Optional<Int?> = Optional.of(R.drawable.ic_access_alarm_24dp)
|
override fun icon(): Optional<Int> = Optional.of(R.drawable.ic_access_alarm_24dp)
|
||||||
|
|
||||||
override fun duplicate(): Trigger = TriggerRecurringTime(injector, this)
|
override fun duplicate(): Trigger = TriggerRecurringTime(injector, this)
|
||||||
|
|
||||||
|
|
|
@ -58,7 +58,7 @@ class TriggerTempTarget(injector: HasAndroidInjector) : Trigger(injector) {
|
||||||
override fun friendlyDescription(): String =
|
override fun friendlyDescription(): String =
|
||||||
rh.gs(R.string.temptargetcompared, rh.gs(comparator.value.stringRes))
|
rh.gs(R.string.temptargetcompared, rh.gs(comparator.value.stringRes))
|
||||||
|
|
||||||
override fun icon(): Optional<Int?> = Optional.of(R.drawable.ic_keyboard_tab)
|
override fun icon(): Optional<Int> = Optional.of(R.drawable.ic_keyboard_tab)
|
||||||
|
|
||||||
override fun duplicate(): Trigger = TriggerTempTarget(injector, this)
|
override fun duplicate(): Trigger = TriggerTempTarget(injector, this)
|
||||||
|
|
||||||
|
|
|
@ -84,7 +84,7 @@ class TriggerTempTargetValue(injector: HasAndroidInjector) : Trigger(injector) {
|
||||||
rh.gs(if (ttValue.units == GlucoseUnit.MGDL) R.string.temptargetcomparedmgdl else R.string.temptargetcomparedmmol, rh.gs(comparator.value.stringRes), ttValue.value, ttValue.units)
|
rh.gs(if (ttValue.units == GlucoseUnit.MGDL) R.string.temptargetcomparedmgdl else R.string.temptargetcomparedmmol, rh.gs(comparator.value.stringRes), ttValue.value, ttValue.units)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun icon(): Optional<Int?> = Optional.of(R.drawable.ic_keyboard_tab)
|
override fun icon(): Optional<Int> = Optional.of(R.drawable.ic_keyboard_tab)
|
||||||
|
|
||||||
override fun duplicate(): Trigger = TriggerTempTargetValue(injector, this)
|
override fun duplicate(): Trigger = TriggerTempTargetValue(injector, this)
|
||||||
|
|
||||||
|
|
|
@ -55,7 +55,7 @@ class TriggerTime(injector: HasAndroidInjector) : Trigger(injector) {
|
||||||
override fun friendlyDescription(): String =
|
override fun friendlyDescription(): String =
|
||||||
rh.gs(R.string.atspecifiedtime, dateUtil.dateAndTimeString(time.value))
|
rh.gs(R.string.atspecifiedtime, dateUtil.dateAndTimeString(time.value))
|
||||||
|
|
||||||
override fun icon(): Optional<Int?> = Optional.of(R.drawable.ic_access_alarm_24dp)
|
override fun icon(): Optional<Int> = Optional.of(R.drawable.ic_access_alarm_24dp)
|
||||||
|
|
||||||
override fun duplicate(): Trigger = TriggerTime(injector, time.value)
|
override fun duplicate(): Trigger = TriggerTime(injector, time.value)
|
||||||
|
|
||||||
|
|
|
@ -66,7 +66,7 @@ class TriggerTimeRange(injector: HasAndroidInjector) : Trigger(injector) {
|
||||||
override fun friendlyDescription(): String =
|
override fun friendlyDescription(): String =
|
||||||
rh.gs(R.string.timerange_value, dateUtil.timeString(toMills(range.start)), dateUtil.timeString(toMills(range.end)))
|
rh.gs(R.string.timerange_value, dateUtil.timeString(toMills(range.start)), dateUtil.timeString(toMills(range.end)))
|
||||||
|
|
||||||
override fun icon(): Optional<Int?> = Optional.of(R.drawable.ic_access_alarm_24dp)
|
override fun icon(): Optional<Int> = Optional.of(R.drawable.ic_access_alarm_24dp)
|
||||||
|
|
||||||
override fun duplicate(): Trigger = TriggerTimeRange(injector, range.start, range.end)
|
override fun duplicate(): Trigger = TriggerTimeRange(injector, range.start, range.end)
|
||||||
|
|
||||||
|
|
|
@ -74,7 +74,7 @@ class TriggerWifiSsid(injector: HasAndroidInjector) : Trigger(injector) {
|
||||||
override fun friendlyDescription(): String =
|
override fun friendlyDescription(): String =
|
||||||
rh.gs(R.string.wifissidcompared, rh.gs(comparator.value.stringRes), ssid.value)
|
rh.gs(R.string.wifissidcompared, rh.gs(comparator.value.stringRes), ssid.value)
|
||||||
|
|
||||||
override fun icon(): Optional<Int?> = Optional.of(R.drawable.ic_network_wifi)
|
override fun icon(): Optional<Int> = Optional.of(R.drawable.ic_network_wifi)
|
||||||
|
|
||||||
override fun duplicate(): Trigger = TriggerWifiSsid(injector, this)
|
override fun duplicate(): Trigger = TriggerWifiSsid(injector, this)
|
||||||
|
|
||||||
|
|
|
@ -12,6 +12,6 @@ class DummyTrigger(var result: Boolean) : Trigger(HasAndroidInjector { AndroidIn
|
||||||
override fun fromJSON(data: String): Trigger = DummyTrigger(result)
|
override fun fromJSON(data: String): Trigger = DummyTrigger(result)
|
||||||
override fun friendlyName(): Int = 0
|
override fun friendlyName(): Int = 0
|
||||||
override fun friendlyDescription(): String = " "
|
override fun friendlyDescription(): String = " "
|
||||||
override fun icon(): Optional<Int?> = Optional.absent()
|
override fun icon(): Optional<Int> = Optional.absent()
|
||||||
override fun duplicate(): Trigger = DummyTrigger(result)
|
override fun duplicate(): Trigger = DummyTrigger(result)
|
||||||
}
|
}
|
Loading…
Reference in a new issue