2021-12-14 12:17:04 +01:00
|
|
|
package info.nightscout.androidaps.tile
|
|
|
|
|
2022-01-18 20:54:39 +01:00
|
|
|
import android.content.res.Resources
|
2021-12-14 12:17:04 +01:00
|
|
|
import info.nightscout.androidaps.R
|
2022-03-16 14:44:22 +01:00
|
|
|
import info.nightscout.androidaps.interaction.actions.*
|
2021-12-14 12:17:04 +01:00
|
|
|
|
2022-01-24 19:17:35 +01:00
|
|
|
object ActionSource : StaticTileSource() {
|
2021-12-14 12:17:04 +01:00
|
|
|
|
2022-01-18 20:54:39 +01:00
|
|
|
override val preferencePrefix = "tile_action_"
|
|
|
|
|
|
|
|
override fun getActions(resources: Resources): List<StaticAction> {
|
2021-12-14 12:17:04 +01:00
|
|
|
return listOf(
|
2022-01-18 20:54:39 +01:00
|
|
|
StaticAction(
|
2022-01-12 12:22:53 +01:00
|
|
|
settingName = "wizard",
|
2022-01-18 20:54:39 +01:00
|
|
|
buttonText = resources.getString(R.string.menu_wizard_short),
|
2021-12-14 12:17:04 +01:00
|
|
|
iconRes = R.drawable.ic_calculator_green,
|
2022-01-12 12:22:53 +01:00
|
|
|
activityClass = WizardActivity::class.java.name,
|
2021-12-14 12:17:04 +01:00
|
|
|
),
|
2022-01-18 20:54:39 +01:00
|
|
|
StaticAction(
|
2022-01-11 23:19:20 +01:00
|
|
|
settingName = "treatment",
|
2022-01-18 20:54:39 +01:00
|
|
|
buttonText = resources.getString(R.string.menu_treatment_short),
|
2021-12-14 12:17:04 +01:00
|
|
|
iconRes = R.drawable.ic_bolus_carbs,
|
2022-01-12 12:22:53 +01:00
|
|
|
activityClass = TreatmentActivity::class.java.name,
|
2021-12-14 12:17:04 +01:00
|
|
|
),
|
2022-01-18 20:54:39 +01:00
|
|
|
StaticAction(
|
2022-01-11 23:19:20 +01:00
|
|
|
settingName = "bolus",
|
2022-01-18 20:54:39 +01:00
|
|
|
buttonText = resources.getString(R.string.action_insulin),
|
2022-01-11 23:19:20 +01:00
|
|
|
iconRes = R.drawable.ic_bolus,
|
2022-01-12 12:22:53 +01:00
|
|
|
activityClass = BolusActivity::class.java.name,
|
2022-01-11 23:19:20 +01:00
|
|
|
),
|
2022-01-18 20:54:39 +01:00
|
|
|
StaticAction(
|
2022-01-10 21:15:43 +01:00
|
|
|
settingName = "carbs",
|
2022-01-18 20:54:39 +01:00
|
|
|
buttonText = resources.getString(R.string.action_carbs),
|
2021-12-14 12:17:04 +01:00
|
|
|
iconRes = R.drawable.ic_carbs_orange,
|
2022-03-16 14:44:22 +01:00
|
|
|
activityClass = CarbActivity::class.java.name,
|
|
|
|
),
|
|
|
|
StaticAction(
|
|
|
|
settingName = "ecarbs",
|
|
|
|
buttonText = resources.getString(R.string.action_ecarbs),
|
|
|
|
iconRes = R.drawable.ic_carbs_orange,
|
2022-01-12 12:22:53 +01:00
|
|
|
activityClass = ECarbActivity::class.java.name,
|
2021-12-14 12:17:04 +01:00
|
|
|
),
|
2022-01-18 20:54:39 +01:00
|
|
|
StaticAction(
|
2022-01-10 21:15:43 +01:00
|
|
|
settingName = "temp_target",
|
2022-01-18 20:54:39 +01:00
|
|
|
buttonText = resources.getString(R.string.menu_tempt),
|
2021-12-14 12:17:04 +01:00
|
|
|
iconRes = R.drawable.ic_temptarget_flat,
|
2022-01-12 12:22:53 +01:00
|
|
|
activityClass = TempTargetActivity::class.java.name,
|
2021-12-14 12:17:04 +01:00
|
|
|
)
|
|
|
|
)
|
|
|
|
}
|
2022-01-11 10:38:20 +01:00
|
|
|
|
2022-01-18 20:54:39 +01:00
|
|
|
override fun getResourceReferences(resources: Resources): List<Int> {
|
|
|
|
return getActions(resources).map { it.iconRes }
|
|
|
|
}
|
|
|
|
|
2022-01-11 10:38:20 +01:00
|
|
|
override fun getDefaultConfig(): Map<String, String> {
|
|
|
|
return mapOf(
|
2022-01-12 12:22:53 +01:00
|
|
|
"tile_action_1" to "wizard",
|
2022-01-11 23:19:20 +01:00
|
|
|
"tile_action_2" to "treatment",
|
2022-03-16 14:44:22 +01:00
|
|
|
"tile_action_3" to "ecarbs",
|
2022-01-11 10:38:20 +01:00
|
|
|
"tile_action_4" to "temp_target"
|
|
|
|
)
|
|
|
|
}
|
|
|
|
|
2021-12-14 12:17:04 +01:00
|
|
|
}
|