mirror of
https://github.com/home-assistant/android
synced 2024-10-15 04:22:54 +00:00
Set proper values and defaults for shortcut type list (#1494)
This commit is contained in:
parent
d6b6f9607c
commit
92a132776a
|
@ -96,7 +96,6 @@ class ManageShortcutsSettingsFragment : PreferenceFragmentCompat(), IconDialog.C
|
|||
.inject(this)
|
||||
|
||||
val addNewShortcut = findPreference<PreferenceCategory>("pinned_shortcut_category")
|
||||
val shortcutTypes = listOf(getString(R.string.entity_id), getString(R.string.lovelace))
|
||||
val shortcutManager = requireContext().getSystemService(ShortcutManager::class.java)
|
||||
var pinnedShortcuts = shortcutManager.pinnedShortcuts
|
||||
var dynamicShortcuts = shortcutManager.dynamicShortcuts
|
||||
|
@ -133,8 +132,7 @@ class ManageShortcutsSettingsFragment : PreferenceFragmentCompat(), IconDialog.C
|
|||
shortcutEntityList?.entries = entityList.sorted().toTypedArray()
|
||||
shortcutEntityList?.entryValues = entityList.sorted().toTypedArray()
|
||||
}
|
||||
shortcutType?.entries = shortcutTypes.toTypedArray()
|
||||
shortcutType?.entryValues = shortcutTypes.toTypedArray()
|
||||
|
||||
setDynamicShortcutType(shortcutType?.value.toString(), i)
|
||||
shortcutType?.setOnPreferenceChangeListener { _, newValue ->
|
||||
setDynamicShortcutType(newValue.toString(), i)
|
||||
|
@ -230,9 +228,7 @@ class ManageShortcutsSettingsFragment : PreferenceFragmentCompat(), IconDialog.C
|
|||
pinnedShortcutEntityList?.entries = entityList.sorted().toTypedArray()
|
||||
pinnedShortcutEntityList?.entryValues = entityList.sorted().toTypedArray()
|
||||
}
|
||||
pinnedShortcutType?.entries = shortcutTypes.toTypedArray()
|
||||
pinnedShortcutType?.entryValues = shortcutTypes.toTypedArray()
|
||||
pinnedShortcutType?.setDefaultValue(getString(R.string.lovelace))
|
||||
|
||||
setPinnedShortcutType(pinnedShortcutType?.value.toString())
|
||||
pinnedShortcutType?.setOnPreferenceChangeListener { _, newValue ->
|
||||
setPinnedShortcutType(newValue.toString())
|
||||
|
|
|
@ -1,15 +1,5 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<string-array name="filter_notifications_entries">
|
||||
<item>Show last 25 notifications</item>
|
||||
<item>Show last 50 notifications</item>
|
||||
<item>Show last 100 notifications</item>
|
||||
</string-array>
|
||||
<string-array name="filter_notifications_values">
|
||||
<item>last25</item>
|
||||
<item>last50</item>
|
||||
<item>last100</item>
|
||||
</string-array>
|
||||
<string-array name="setting_ble_emitter_transmit_power_labels">
|
||||
<item>@string/ble_transmit_power_label_high</item>
|
||||
<item>@string/ble_transmit_power_label_medium</item>
|
||||
|
@ -22,4 +12,8 @@
|
|||
<item>@string/ble_transmit_power_value_low</item>
|
||||
<item>@string/ble_transmit_power_value_ultra_low</item>
|
||||
</string-array>
|
||||
<string-array name="shortcutTypes">
|
||||
<item>@string/entity_id</item>
|
||||
<item>@string/lovelace</item>
|
||||
</string-array>
|
||||
</resources>
|
|
@ -27,6 +27,9 @@
|
|||
android:key="shortcut1_type"
|
||||
android:title="@string/shortcut_type"
|
||||
app:useSimpleSummaryProvider="true"
|
||||
android:defaultValue="@string/lovelace"
|
||||
android:entries="@array/shortcutTypes"
|
||||
android:entryValues="@array/shortcutTypes"
|
||||
app:iconSpaceReserved="false" />
|
||||
<ListPreference
|
||||
android:key="shortcut1_entity_list"
|
||||
|
@ -69,6 +72,9 @@
|
|||
android:key="shortcut2_type"
|
||||
android:title="@string/shortcut_type"
|
||||
app:useSimpleSummaryProvider="true"
|
||||
android:defaultValue="@string/lovelace"
|
||||
android:entries="@array/shortcutTypes"
|
||||
android:entryValues="@array/shortcutTypes"
|
||||
app:iconSpaceReserved="false" />
|
||||
<ListPreference
|
||||
android:key="shortcut2_entity_list"
|
||||
|
@ -111,6 +117,9 @@
|
|||
android:key="shortcut3_type"
|
||||
android:title="@string/shortcut_type"
|
||||
app:useSimpleSummaryProvider="true"
|
||||
android:defaultValue="@string/lovelace"
|
||||
android:entries="@array/shortcutTypes"
|
||||
android:entryValues="@array/shortcutTypes"
|
||||
app:iconSpaceReserved="false" />
|
||||
<ListPreference
|
||||
android:key="shortcut3_entity_list"
|
||||
|
@ -153,6 +162,9 @@
|
|||
android:key="shortcut4_type"
|
||||
android:title="@string/shortcut_type"
|
||||
app:useSimpleSummaryProvider="true"
|
||||
android:defaultValue="@string/lovelace"
|
||||
android:entries="@array/shortcutTypes"
|
||||
android:entryValues="@array/shortcutTypes"
|
||||
app:iconSpaceReserved="false" />
|
||||
<ListPreference
|
||||
android:key="shortcut4_entity_list"
|
||||
|
@ -200,6 +212,9 @@
|
|||
android:key="shortcut5_type"
|
||||
android:title="@string/shortcut_type"
|
||||
app:useSimpleSummaryProvider="true"
|
||||
android:defaultValue="@string/lovelace"
|
||||
android:entries="@array/shortcutTypes"
|
||||
android:entryValues="@array/shortcutTypes"
|
||||
app:iconSpaceReserved="false" />
|
||||
<ListPreference
|
||||
android:key="shortcut5_entity_list"
|
||||
|
@ -263,6 +278,8 @@
|
|||
android:title="@string/shortcut_type"
|
||||
app:useSimpleSummaryProvider="true"
|
||||
android:defaultValue="@string/lovelace"
|
||||
android:entries="@array/shortcutTypes"
|
||||
android:entryValues="@array/shortcutTypes"
|
||||
app:iconSpaceReserved="false" />
|
||||
<ListPreference
|
||||
android:key="pinned_shortcut_entity_list"
|
||||
|
|
Loading…
Reference in a new issue