Update Flash Notifications screen with expressive design

Flag: EXEMPT flag by System prop
Bug: 349678118
Test: atest FlashNotificationsPreviewPreferenceControllerTest
Test: manually check the UI, screenshots attached on bug
Change-Id: I2db55cef161016940b19f14c70b9d2442d3859c3
This commit is contained in:
Angela Wang
2024-12-26 03:38:54 +00:00
parent 242b3b8abd
commit 9736b59ac2
5 changed files with 48 additions and 241 deletions

View File

@@ -41,6 +41,7 @@ import androidx.preference.Preference;
import androidx.preference.PreferenceScreen;
import com.android.settings.core.BasePreferenceController;
import com.android.settingslib.widget.ButtonPreference;
/**
* Controller for flash notifications preview.
@@ -48,7 +49,7 @@ import com.android.settings.core.BasePreferenceController;
public class FlashNotificationsPreviewPreferenceController extends
BasePreferenceController implements LifecycleEventObserver {
private Preference mPreference;
private ButtonPreference mPreference;
private final ContentResolver mContentResolver;
@VisibleForTesting
@@ -74,19 +75,14 @@ public class FlashNotificationsPreviewPreferenceController extends
public void displayPreference(PreferenceScreen screen) {
super.displayPreference(screen);
mPreference = screen.findPreference(getPreferenceKey());
updateState(mPreference);
}
@Override
public boolean handlePreferenceTreeClick(Preference preference) {
if (getPreferenceKey().equals(preference.getKey())) {
Intent intent = new Intent(ACTION_FLASH_NOTIFICATION_START_PREVIEW);
intent.putExtra(EXTRA_FLASH_NOTIFICATION_PREVIEW_TYPE, TYPE_SHORT_PREVIEW);
mContext.sendBroadcastAsUser(intent, UserHandle.SYSTEM);
return true;
if (mPreference != null) {
mPreference.setOnClickListener(view -> {
Intent intent = new Intent(ACTION_FLASH_NOTIFICATION_START_PREVIEW);
intent.putExtra(EXTRA_FLASH_NOTIFICATION_PREVIEW_TYPE, TYPE_SHORT_PREVIEW);
mContext.sendBroadcastAsUser(intent, UserHandle.SYSTEM);
});
}
return super.handlePreferenceTreeClick(preference);
updateState(mPreference);
}
@Override