Wear: fix preference crash

This commit is contained in:
Milos Kozak 2022-05-18 22:31:10 +02:00
parent 7254fc3654
commit be199719bd
7 changed files with 9 additions and 7 deletions

View file

@ -1172,7 +1172,7 @@
<string name="wizard_no_active_profile">No active profile set!</string>
<string name="wizard_no_cob">Unknown COB! BG reading missing or recent app restart?</string>
<string name="wizard_carbs_constraint">Carb constraint violation!</string>
<string name="wizard_explain_calc">Calc (IC: %1$.1f, ISF: %2$.1f)"</string>
<string name="wizard_explain_calc">Calc (IC: %1$.1f, ISF: %2$.1f)</string>
<string name="wizard_explain_carbs">Carbs: %1$.2fU</string>
<string name="wizard_explain_cob">COB: %1$.0fg %2$.2fU</string>
<string name="wizard_explain_bg">BG: %1$.2fU</string>

View file

@ -81,7 +81,7 @@ class ComplicationTapBroadcastReceiver : DaggerBroadcastReceiver() {
}
private val complicationTapAction: String
get() = sp.getString("complication_tap_action", "default")
get() = sp.getString(R.string.key_complication_tap_action, "default")
private fun remapActionWithUserPreferences(originalAction: ComplicationAction): ComplicationAction {
val userPrefAction = complicationTapAction

View file

@ -74,7 +74,7 @@ open class ViewSelectorActivity : DaggerActivity() {
}
fun getInflatedPlusMinusView(container: ViewGroup?): View =
when (sp.getInt("input_design", 1)) {
when (sp.getInt(R.string.key_input_design, 1)) {
2 -> LayoutInflater.from(applicationContext).inflate(R.layout.action_editplusminus_item_quickrighty, container, false)
3 -> LayoutInflater.from(applicationContext).inflate(R.layout.action_editplusminus_item_quicklefty, container, false)
4 -> LayoutInflater.from(applicationContext).inflate(R.layout.action_editplusminus_item_viktoria, container, false)

View file

@ -236,7 +236,7 @@ abstract class BaseWatchFace : WatchFace() {
open fun changeChartTimeframe() {
var timeframe = sp.getInt(R.string.key_chart_time_frame, 3)
timeframe = timeframe % 5 + 1
sp.putInt(R.string.key_chart_time_frame, timeframe)
sp.putString(R.string.key_chart_time_frame, timeframe.toString())
}
override fun getWatchFaceStyle(): WatchFaceStyle {

View file

@ -198,6 +198,6 @@ class SteampunkWatchface : BaseWatchFace() {
var timeframe = sp.getInt(R.string.key_chart_time_frame, 3)
timeframe = timeframe % 5 + 1
pointSize = if (timeframe < 3) 2 else 1
sp.putInt(R.string.key_chart_time_frame, timeframe)
sp.putString(R.string.key_chart_time_frame, timeframe.toString())
}
}

View file

@ -220,5 +220,7 @@
<string name="key_match_divider" translatable="false">match_divider</string>
<string name="key_simplify_ui" translatable="false">simplify_ui</string>
<string name="key_dark" translatable="false">dark</string>
<string name="key_input_design" translatable="false">input_design</string>
<string name="key_complication_tap_action" translatable="false">complication_tap_action</string>
</resources>

View file

@ -105,7 +105,7 @@
android:defaultValue="1"
android:entries="@array/input_design"
android:entryValues="@array/input_design_values"
android:key="input_design"
android:key="@string/key_input_design"
android:summary="Input Design"
android:title="@string/pref_input_design" />
@ -152,7 +152,7 @@
android:defaultValue="default"
android:entries="@array/complication_tap_action"
android:entryValues="@array/complication_tap_action_values"
android:key="complication_tap_action"
android:key="@string/key_complication_tap_action"
android:summary="What dialog to show after tap on complication"
android:title="@string/pref_complication_tap_action" />