Disabled state UI of Flash Notifications preview button
When both the camera flash and screen flash toggles are turned off, tapping on the preview button will have no effect and may confuse users. To avoid this, the appearance of the preview button should be updated to clearly indicated that its current state is disabled. This wil help users better understand the situation and prevent confusion. Bug: 276494146 Test: checks the UI manually Test: make RunSettingsRoboTests ROBOTEST_FILTER=FlashNotificationsPreviewPreferenceTest Change-Id: I55b11188fde6e551921a9b0f7c89daa20a8b766b
This commit is contained in:
@@ -55,7 +55,7 @@ public class FlashNotificationsPreviewPreferenceController extends
|
||||
new Handler(Looper.getMainLooper())) {
|
||||
@Override
|
||||
public void onChange(boolean selfChange, @Nullable Uri uri) {
|
||||
onSettingChanged();
|
||||
updateState(mPreference);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -73,7 +73,7 @@ public class FlashNotificationsPreviewPreferenceController extends
|
||||
public void displayPreference(PreferenceScreen screen) {
|
||||
super.displayPreference(screen);
|
||||
mPreference = screen.findPreference(getPreferenceKey());
|
||||
onSettingChanged();
|
||||
updateState(mPreference);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -103,10 +103,13 @@ public class FlashNotificationsPreviewPreferenceController extends
|
||||
}
|
||||
}
|
||||
|
||||
private void onSettingChanged() {
|
||||
if (mPreference == null) return;
|
||||
|
||||
mPreference.setEnabled(FlashNotificationsUtil.getFlashNotificationsState(mContext)
|
||||
@Override
|
||||
public void updateState(Preference preference) {
|
||||
super.updateState(preference);
|
||||
if (preference == null) {
|
||||
return;
|
||||
}
|
||||
preference.setEnabled(FlashNotificationsUtil.getFlashNotificationsState(mContext)
|
||||
!= FlashNotificationsUtil.State.OFF);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user