Changes to icon picker for reusability in "add mode" flow
* Don't finish the fragment from the controller (ugh!) instead just report the selected icon via a listener. * Highlight the selected icon in the list. * Cache the icon drawables (since we're using selectors for the colors, we don't need to swap them, one per icon resource id is enough). * Improved the tests a bit too. Bug: 333901673 Bug: 326442408 Test: ates Flag: android.app.modes_ui Change-Id: Ib2ec7a7e3ed99b13f9264aa6f7c209ee3f6967a0
This commit is contained in:
@@ -43,7 +43,16 @@ public class ZenModeIconPickerFragment extends ZenModeFragmentBase {
|
||||
return ImmutableList.of(
|
||||
new ZenModeIconPickerIconPreferenceController(context, "current_icon", this,
|
||||
mBackend),
|
||||
new ZenModeIconPickerListPreferenceController(context, "icon_list", this,
|
||||
new IconOptionsProviderImpl(mContext), mBackend));
|
||||
new ZenModeIconPickerListPreferenceController(context, "icon_list",
|
||||
mIconPickerListener, new IconOptionsProviderImpl(mContext), mBackend));
|
||||
}
|
||||
|
||||
private final ZenModeIconPickerListPreferenceController.IconPickerListener mIconPickerListener =
|
||||
new ZenModeIconPickerListPreferenceController.IconPickerListener() {
|
||||
@Override
|
||||
public void onIconSelected(int iconResId) {
|
||||
saveMode(mode -> mode.getRule().setIconResId(iconResId));
|
||||
finish();
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user