Refactor preference controllers to receive and mutate ZenMode/ZenPolicy
Also fixed a handful of style issues / warnings along the way. Fixes: 341950853 Fixes: 341910620 Test: atest com.android.settings.notification.modes Flag: android.app.modes_ui Change-Id: I65900941fcdf53824caf052fd0a24401c1bfb476
This commit is contained in:
@@ -16,20 +16,22 @@
|
||||
|
||||
package com.android.settings.notification.modes;
|
||||
|
||||
|
||||
import static com.android.settings.notification.modes.ZenModeFragmentBase.MODE_ID;
|
||||
|
||||
import android.content.Context;
|
||||
import android.os.Bundle;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.preference.Preference;
|
||||
|
||||
import com.android.settings.core.SubSettingLauncher;
|
||||
|
||||
/**
|
||||
* Preference with a link and summary about what other sounds can break through the mode
|
||||
*/
|
||||
public class ZenModeOtherLinkPreferenceController extends AbstractZenModePreferenceController {
|
||||
class ZenModeOtherLinkPreferenceController extends AbstractZenModePreferenceController {
|
||||
|
||||
ZenModeSummaryHelper mSummaryHelper;
|
||||
private final ZenModeSummaryHelper mSummaryHelper;
|
||||
|
||||
public ZenModeOtherLinkPreferenceController(Context context, String key,
|
||||
ZenModesBackend backend) {
|
||||
@@ -38,15 +40,14 @@ public class ZenModeOtherLinkPreferenceController extends AbstractZenModePrefere
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateState(Preference preference) {
|
||||
super.updateState(preference);
|
||||
public void updateState(Preference preference, @NonNull ZenMode zenMode) {
|
||||
Bundle bundle = new Bundle();
|
||||
bundle.putString(MODE_ID, getMode().getId());
|
||||
bundle.putString(MODE_ID, zenMode.getId());
|
||||
preference.setIntent(new SubSettingLauncher(mContext)
|
||||
.setDestination(ZenModeOtherFragment.class.getName())
|
||||
.setSourceMetricsCategory(0)
|
||||
.setArguments(bundle)
|
||||
.toIntent());
|
||||
preference.setSummary(mSummaryHelper.getOtherSoundCategoriesSummary(getMode()));
|
||||
preference.setSummary(mSummaryHelper.getOtherSoundCategoriesSummary(zenMode));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user