ShortcutPreference Toggle design (2/n)

- Removes edit shortcut disable condition.
- Shows "off" if user removes all items in edit dialog.
- Restores last time what user chosen options when show edit dialog.

Bug: 148989269
Test: Manually test
Change-Id: I105abda782999d38c92e3de9811e2fd378869e73
This commit is contained in:
menghanli
2020-03-04 21:47:57 +08:00
parent b6ab224ddb
commit 5d7083a103
6 changed files with 53 additions and 74 deletions

View File

@@ -60,7 +60,7 @@ public class ToggleFeaturePreferenceFragmentTest {
TEST_SERVICE_KEY_1);
assertThat(shortcut.getComponentName()).isEqualTo(TEST_SERVICE_NAME_1);
assertThat(shortcut.getUserShortcutType()).isEqualTo(TEST_SERVICE_VALUE_1);
assertThat(shortcut.getType()).isEqualTo(TEST_SERVICE_VALUE_1);
}
@Test
@@ -69,7 +69,7 @@ public class ToggleFeaturePreferenceFragmentTest {
TEST_SERVICE_KEY_2);
shortcut.setComponentName(TEST_SERVICE_NAME_1);
shortcut.setUserShortcutType(TEST_SERVICE_VALUE_1);
shortcut.setType(TEST_SERVICE_VALUE_1);
assertThat(shortcut.flattenToString()).isEqualTo(TEST_SERVICE_KEY_1);
}
@@ -103,7 +103,7 @@ public class ToggleFeaturePreferenceFragmentTest {
final String str = (String) filtered.toArray()[0];
final AccessibilityUserShortcutType shortcut = new AccessibilityUserShortcutType(str);
final int type = shortcut.getUserShortcutType();
final int type = shortcut.getType();
assertThat(type).isEqualTo(TEST_SERVICE_VALUE_1);
}