Icon picker: Styling improvements
Instead of a the plain appearance of a EntityHeaderController, make the top icon bigger and use the same circled style as the choices in the list. Also highlight the current icon in the list as selected, even if it is the default for the mode type. Also cleaned up controllers that don't need a ZenModesBackend to not receive it. (Both of these changes also line up with the "new mode" fragment that is incoming). Bug: 333901673 Bug: 326442408 Test: atest com.android.settings.notification.modes Flag: android.app.modes_ui Change-Id: I0c9f3e34019a1a6c48658933dde545ad8d7399ae
This commit is contained in:
@@ -24,8 +24,8 @@
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/icon_image_view"
|
||||
android:layout_width="@dimen/zen_mode_icon_list_circle_diameter"
|
||||
android:layout_height="@dimen/zen_mode_icon_list_circle_diameter"
|
||||
android:layout_width="@dimen/zen_mode_icon_list_item_circle_diameter"
|
||||
android:layout_height="@dimen/zen_mode_icon_list_item_circle_diameter"
|
||||
android:importantForAccessibility="no"
|
||||
android:layout_gravity="center" />
|
||||
</FrameLayout>
|
||||
|
@@ -502,7 +502,9 @@
|
||||
<dimen name="audio_streams_qrcode_preview_radius">30dp</dimen>
|
||||
|
||||
<!-- Zen Modes -->
|
||||
<dimen name="zen_mode_icon_list_header_circle_diameter">90dp</dimen>
|
||||
<dimen name="zen_mode_icon_list_header_icon_size">48dp</dimen>
|
||||
<dimen name="zen_mode_icon_list_item_size">96dp</dimen>
|
||||
<dimen name="zen_mode_icon_list_circle_diameter">56dp</dimen>
|
||||
<dimen name="zen_mode_icon_list_icon_size">32dp</dimen>
|
||||
<dimen name="zen_mode_icon_list_item_circle_diameter">56dp</dimen>
|
||||
<dimen name="zen_mode_icon_list_item_icon_size">32dp</dimen>
|
||||
</resources>
|
||||
|
@@ -16,6 +16,8 @@
|
||||
|
||||
package com.android.settings.notification.modes;
|
||||
|
||||
import static com.google.common.base.Preconditions.checkState;
|
||||
|
||||
import android.app.Flags;
|
||||
import android.content.Context;
|
||||
import android.service.notification.ZenPolicy;
|
||||
@@ -30,8 +32,6 @@ import com.android.settingslib.core.AbstractPreferenceController;
|
||||
import com.android.settingslib.notification.modes.ZenMode;
|
||||
import com.android.settingslib.notification.modes.ZenModesBackend;
|
||||
|
||||
import com.google.common.base.Preconditions;
|
||||
|
||||
import java.util.function.Function;
|
||||
|
||||
/**
|
||||
@@ -41,8 +41,8 @@ abstract class AbstractZenModePreferenceController extends AbstractPreferenceCon
|
||||
|
||||
private static final String TAG = "AbstractZenModePreferenceController";
|
||||
|
||||
@Nullable
|
||||
protected ZenModesBackend mBackend;
|
||||
@Nullable protected final ZenModesBackend mBackend;
|
||||
|
||||
|
||||
@Nullable // only until setZenMode() is called
|
||||
private ZenMode mZenMode;
|
||||
@@ -50,14 +50,27 @@ abstract class AbstractZenModePreferenceController extends AbstractPreferenceCon
|
||||
@NonNull
|
||||
private final String mKey;
|
||||
|
||||
// ZenModesBackend should only be passed in if the preference controller may set the user's
|
||||
// policy for this zen mode. Otherwise, if the preference controller is essentially read-only
|
||||
// and leads to a further Settings screen, backend should be null.
|
||||
AbstractZenModePreferenceController(@NonNull Context context, @NonNull String key,
|
||||
@Nullable ZenModesBackend backend) {
|
||||
/**
|
||||
* Constructor suitable for "read-only" controllers (e.g. link to a different sub-screen.
|
||||
* Controllers that call this constructor to initialize themselves <em>cannot</em> call
|
||||
* {@link #saveMode} or {@link #savePolicy} later.
|
||||
*/
|
||||
AbstractZenModePreferenceController(@NonNull Context context, @NonNull String key) {
|
||||
super(context);
|
||||
mBackend = backend;
|
||||
mKey = key;
|
||||
mBackend = null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructor suitable for controllers that will update the associated {@link ZenMode}.
|
||||
* Controllers that call this constructor to initialize themselves may call {@link #saveMode} or
|
||||
* {@link #savePolicy} later.
|
||||
*/
|
||||
AbstractZenModePreferenceController(@NonNull Context context, @NonNull String key,
|
||||
@NonNull ZenModesBackend backend) {
|
||||
super(context);
|
||||
mKey = key;
|
||||
mBackend = backend;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -135,7 +148,7 @@ abstract class AbstractZenModePreferenceController extends AbstractPreferenceCon
|
||||
* instance is ok.
|
||||
*/
|
||||
protected final boolean saveMode(Function<ZenMode, ZenMode> updater) {
|
||||
Preconditions.checkState(mBackend != null);
|
||||
checkState(mBackend != null);
|
||||
ZenMode mode = mZenMode;
|
||||
if (mode == null) {
|
||||
Log.wtf(TAG, "Cannot save mode, it hasn't been loaded (" + getClass() + ")");
|
||||
|
@@ -19,14 +19,17 @@ package com.android.settings.notification.modes;
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.res.ColorStateList;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.graphics.drawable.LayerDrawable;
|
||||
import android.graphics.drawable.ShapeDrawable;
|
||||
import android.graphics.drawable.shapes.OvalShape;
|
||||
import android.view.Gravity;
|
||||
|
||||
import androidx.annotation.AttrRes;
|
||||
import androidx.annotation.DrawableRes;
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Px;
|
||||
|
||||
import com.android.settings.R;
|
||||
import com.android.settingslib.Utils;
|
||||
@@ -49,32 +52,52 @@ class IconUtil {
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a variant of the supplied {@code icon} to be used in the icon picker. The inner icon
|
||||
* is 36x36dp and it's contained into a circle of diameter 54dp. It's also set up so that
|
||||
* selection and pressed states are represented in the color.
|
||||
* Returns a variant of the supplied {@code icon} to be used as the header in the icon picker.
|
||||
* The inner icon is 48x48dp and it's contained into a circle of diameter 90dp.
|
||||
*/
|
||||
static Drawable makeIconCircle(@NonNull Context context, @NonNull Drawable icon) {
|
||||
static Drawable makeBigIconCircle(@NonNull Context context, Drawable icon) {
|
||||
return composeIconCircle(
|
||||
Utils.getColorAttr(context,
|
||||
com.android.internal.R.attr.materialColorSecondaryContainer),
|
||||
context.getResources().getDimensionPixelSize(
|
||||
R.dimen.zen_mode_icon_list_header_circle_diameter),
|
||||
icon,
|
||||
Utils.getColorAttr(context,
|
||||
com.android.internal.R.attr.materialColorOnSecondaryContainer),
|
||||
context.getResources().getDimensionPixelSize(
|
||||
R.dimen.zen_mode_icon_list_header_icon_size));
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a variant of the supplied {@code icon} to be used as an option in the icon picker.
|
||||
* The inner icon is 36x36dp and it's contained into a circle of diameter 54dp. It's also set up
|
||||
* so that selection and pressed states are represented in the color.
|
||||
*/
|
||||
static Drawable makeSmallIconCircle(@NonNull Context context, @DrawableRes int iconResId) {
|
||||
return composeIconCircle(
|
||||
context.getColorStateList(R.color.modes_icon_picker_item_background),
|
||||
context.getResources().getDimensionPixelSize(
|
||||
R.dimen.zen_mode_icon_list_item_circle_diameter),
|
||||
checkNotNull(context.getDrawable(iconResId)),
|
||||
context.getColorStateList(R.color.modes_icon_picker_item_icon),
|
||||
context.getResources().getDimensionPixelSize(
|
||||
R.dimen.zen_mode_icon_list_item_icon_size));
|
||||
}
|
||||
|
||||
private static Drawable composeIconCircle(ColorStateList circleColor, @Px int circleDiameterPx,
|
||||
Drawable icon, ColorStateList iconColor, @Px int iconSizePx) {
|
||||
ShapeDrawable background = new ShapeDrawable(new OvalShape());
|
||||
background.setTintList(
|
||||
context.getColorStateList(R.color.modes_icon_picker_item_background));
|
||||
icon = icon.mutate();
|
||||
icon.setTintList(
|
||||
context.getColorStateList(R.color.modes_icon_picker_item_icon));
|
||||
background.setTintList(circleColor);
|
||||
Drawable foreground = checkNotNull(icon.getConstantState()).newDrawable().mutate();
|
||||
foreground.setTintList(iconColor);
|
||||
|
||||
LayerDrawable layerDrawable = new LayerDrawable(new Drawable[] { background, icon });
|
||||
LayerDrawable layerDrawable = new LayerDrawable(new Drawable[] { background, foreground });
|
||||
|
||||
int circleDiameter = context.getResources().getDimensionPixelSize(
|
||||
R.dimen.zen_mode_icon_list_circle_diameter);
|
||||
int iconSize = context.getResources().getDimensionPixelSize(
|
||||
R.dimen.zen_mode_icon_list_icon_size);
|
||||
int iconPadding = (circleDiameter - iconSize) / 2;
|
||||
layerDrawable.setBounds(0, 0, circleDiameter, circleDiameter);
|
||||
layerDrawable.setLayerInset(1, iconPadding, iconPadding, iconPadding, iconPadding);
|
||||
layerDrawable.setBounds(0, 0, circleDiameterPx, circleDiameterPx);
|
||||
layerDrawable.setLayerSize(0, circleDiameterPx, circleDiameterPx);
|
||||
layerDrawable.setLayerGravity(1, Gravity.CENTER);
|
||||
layerDrawable.setLayerSize(1, iconSizePx, iconSizePx);
|
||||
|
||||
return layerDrawable;
|
||||
}
|
||||
|
||||
static Drawable makeIconCircle(@NonNull Context context, @DrawableRes int iconResId) {
|
||||
return makeIconCircle(context, checkNotNull(context.getDrawable(iconResId)));
|
||||
}
|
||||
}
|
||||
|
@@ -22,20 +22,17 @@ import android.content.Context;
|
||||
import android.os.Bundle;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.preference.Preference;
|
||||
|
||||
import com.android.settings.R;
|
||||
import com.android.settings.core.SubSettingLauncher;
|
||||
import com.android.settingslib.notification.modes.ZenMode;
|
||||
import com.android.settingslib.notification.modes.ZenModesBackend;
|
||||
import com.android.settingslib.widget.ActionButtonsPreference;
|
||||
|
||||
class ZenModeActionsPreferenceController extends AbstractZenModePreferenceController {
|
||||
|
||||
ZenModeActionsPreferenceController(@NonNull Context context, @NonNull String key,
|
||||
@Nullable ZenModesBackend backend) {
|
||||
super(context, key, backend);
|
||||
ZenModeActionsPreferenceController(@NonNull Context context, @NonNull String key) {
|
||||
super(context, key);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@@ -24,7 +24,6 @@ import android.os.Bundle;
|
||||
import android.service.notification.ZenPolicy;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.annotation.VisibleForTesting;
|
||||
import androidx.preference.Preference;
|
||||
import androidx.preference.PreferenceScreen;
|
||||
@@ -44,7 +43,7 @@ public class ZenModeAppsPreferenceController extends
|
||||
String mModeId;
|
||||
|
||||
public ZenModeAppsPreferenceController(@NonNull Context context,
|
||||
@NonNull String key, @Nullable ZenModesBackend backend) {
|
||||
@NonNull String key, @NonNull ZenModesBackend backend) {
|
||||
super(context, key, backend);
|
||||
}
|
||||
|
||||
|
@@ -26,15 +26,14 @@ import androidx.preference.Preference;
|
||||
|
||||
import com.android.settings.core.SubSettingLauncher;
|
||||
import com.android.settingslib.notification.modes.ZenMode;
|
||||
import com.android.settingslib.notification.modes.ZenModesBackend;
|
||||
|
||||
class ZenModeCallsLinkPreferenceController extends AbstractZenModePreferenceController {
|
||||
|
||||
private final ZenModeSummaryHelper mSummaryHelper;
|
||||
|
||||
public ZenModeCallsLinkPreferenceController(Context context, String key,
|
||||
ZenModesBackend backend, ZenHelperBackend helperBackend) {
|
||||
super(context, key, backend);
|
||||
ZenHelperBackend helperBackend) {
|
||||
super(context, key);
|
||||
mSummaryHelper = new ZenModeSummaryHelper(context, helperBackend);
|
||||
}
|
||||
|
||||
|
@@ -35,7 +35,7 @@ public class ZenModeDisplayFragment extends ZenModeFragmentBase {
|
||||
protected List<AbstractPreferenceController> createPreferenceControllers(Context context) {
|
||||
List<AbstractPreferenceController> prefControllers = new ArrayList<>();
|
||||
prefControllers.add(new ZenModeNotifVisLinkPreferenceController(
|
||||
context, "notification_visibility", mBackend, mHelperBackend));
|
||||
context, "notification_visibility", mHelperBackend));
|
||||
prefControllers.add(new ZenModeDisplayEffectPreferenceController(
|
||||
context, "effect_greyscale", mBackend));
|
||||
prefControllers.add(new ZenModeDisplayEffectPreferenceController(
|
||||
|
@@ -47,18 +47,18 @@ public class ZenModeFragment extends ZenModeFragmentBase {
|
||||
@Override
|
||||
protected List<AbstractPreferenceController> createPreferenceControllers(Context context) {
|
||||
List<AbstractPreferenceController> prefControllers = new ArrayList<>();
|
||||
prefControllers.add(new ZenModeHeaderController(context, "header", this, mBackend));
|
||||
prefControllers.add(new ZenModeHeaderController(context, "header", this));
|
||||
prefControllers.add(
|
||||
new ZenModeButtonPreferenceController(context, "activate", this, mBackend));
|
||||
prefControllers.add(new ZenModeActionsPreferenceController(context, "actions", mBackend));
|
||||
prefControllers.add(new ZenModeActionsPreferenceController(context, "actions"));
|
||||
prefControllers.add(new ZenModePeopleLinkPreferenceController(
|
||||
context, "zen_mode_people", mBackend, mHelperBackend));
|
||||
context, "zen_mode_people", mHelperBackend));
|
||||
prefControllers.add(new ZenModeAppsLinkPreferenceController(
|
||||
context, "zen_mode_apps", this,
|
||||
ApplicationsState.getInstance((Application) context.getApplicationContext()),
|
||||
mBackend, mHelperBackend));
|
||||
prefControllers.add(new ZenModeOtherLinkPreferenceController(
|
||||
context, "zen_other_settings", mBackend, mHelperBackend));
|
||||
context, "zen_other_settings", mHelperBackend));
|
||||
prefControllers.add(new ZenModeDisplayLinkPreferenceController(
|
||||
context, "mode_display_settings", mBackend, mHelperBackend));
|
||||
prefControllers.add(new ZenModeSetTriggerLinkPreferenceController(context,
|
||||
|
@@ -19,7 +19,6 @@ import android.app.Flags;
|
||||
import android.content.Context;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.preference.Preference;
|
||||
|
||||
import com.android.settings.R;
|
||||
@@ -27,7 +26,6 @@ import com.android.settings.dashboard.DashboardFragment;
|
||||
import com.android.settings.widget.EntityHeaderController;
|
||||
import com.android.settingslib.notification.modes.ZenIconLoader;
|
||||
import com.android.settingslib.notification.modes.ZenMode;
|
||||
import com.android.settingslib.notification.modes.ZenModesBackend;
|
||||
import com.android.settingslib.widget.LayoutPreference;
|
||||
|
||||
class ZenModeHeaderController extends AbstractZenModePreferenceController {
|
||||
@@ -38,9 +36,8 @@ class ZenModeHeaderController extends AbstractZenModePreferenceController {
|
||||
ZenModeHeaderController(
|
||||
@NonNull Context context,
|
||||
@NonNull String key,
|
||||
@NonNull DashboardFragment fragment,
|
||||
@Nullable ZenModesBackend backend) {
|
||||
super(context, key, backend);
|
||||
@NonNull DashboardFragment fragment) {
|
||||
super(context, key);
|
||||
mFragment = fragment;
|
||||
}
|
||||
|
||||
|
@@ -41,10 +41,9 @@ public class ZenModeIconPickerFragment extends ZenModeFragmentBase {
|
||||
@Override
|
||||
protected List<AbstractPreferenceController> createPreferenceControllers(Context context) {
|
||||
return ImmutableList.of(
|
||||
new ZenModeIconPickerIconPreferenceController(context, "current_icon", this,
|
||||
mBackend),
|
||||
new ZenModeIconPickerIconPreferenceController(context, "current_icon", this),
|
||||
new ZenModeIconPickerListPreferenceController(context, "icon_list",
|
||||
mIconPickerListener, new IconOptionsProviderImpl(mContext), mBackend));
|
||||
mIconPickerListener));
|
||||
}
|
||||
|
||||
private final ZenModeIconPickerListPreferenceController.IconPickerListener mIconPickerListener =
|
||||
|
@@ -17,9 +17,10 @@
|
||||
package com.android.settings.notification.modes;
|
||||
|
||||
import android.content.Context;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.ImageView;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.preference.Preference;
|
||||
|
||||
import com.android.settings.R;
|
||||
@@ -27,17 +28,17 @@ import com.android.settings.dashboard.DashboardFragment;
|
||||
import com.android.settings.widget.EntityHeaderController;
|
||||
import com.android.settingslib.notification.modes.ZenIconLoader;
|
||||
import com.android.settingslib.notification.modes.ZenMode;
|
||||
import com.android.settingslib.notification.modes.ZenModesBackend;
|
||||
import com.android.settingslib.widget.LayoutPreference;
|
||||
|
||||
/** Controller used for displaying the currently-chosen icon at the top of the icon picker. */
|
||||
class ZenModeIconPickerIconPreferenceController extends AbstractZenModePreferenceController {
|
||||
|
||||
private final DashboardFragment mFragment;
|
||||
private EntityHeaderController mHeaderController;
|
||||
|
||||
ZenModeIconPickerIconPreferenceController(@NonNull Context context, @NonNull String key,
|
||||
@NonNull DashboardFragment fragment, @Nullable ZenModesBackend backend) {
|
||||
super(context, key, backend);
|
||||
@NonNull DashboardFragment fragment) {
|
||||
super(context, key);
|
||||
mFragment = fragment;
|
||||
}
|
||||
|
||||
@@ -51,11 +52,19 @@ class ZenModeIconPickerIconPreferenceController extends AbstractZenModePreferenc
|
||||
mFragment.getActivity(),
|
||||
mFragment,
|
||||
pref.findViewById(R.id.entity_header));
|
||||
|
||||
ImageView iconView = pref.findViewById(R.id.entity_header_icon);
|
||||
ViewGroup.LayoutParams layoutParams = iconView.getLayoutParams();
|
||||
int imageSizePx = iconView.getContext().getResources().getDimensionPixelSize(
|
||||
R.dimen.zen_mode_icon_list_header_circle_diameter);
|
||||
layoutParams.width = imageSizePx;
|
||||
layoutParams.height = imageSizePx;
|
||||
iconView.setLayoutParams(layoutParams);
|
||||
}
|
||||
|
||||
FutureUtil.whenDone(
|
||||
zenMode.getIcon(mContext, ZenIconLoader.getInstance()),
|
||||
icon -> mHeaderController.setIcon(IconUtil.applyNormalTint(mContext, icon))
|
||||
icon -> mHeaderController.setIcon(IconUtil.makeBigIconCircle(mContext, icon))
|
||||
.done(/* rebindActions= */ false),
|
||||
mContext.getMainExecutor());
|
||||
}
|
||||
|
@@ -26,6 +26,7 @@ import android.widget.ImageView;
|
||||
import androidx.annotation.DrawableRes;
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.annotation.VisibleForTesting;
|
||||
import androidx.preference.Preference;
|
||||
import androidx.preference.PreferenceScreen;
|
||||
import androidx.recyclerview.widget.GridLayoutManager;
|
||||
@@ -33,8 +34,8 @@ import androidx.recyclerview.widget.RecyclerView;
|
||||
import androidx.recyclerview.widget.SimpleItemAnimator;
|
||||
|
||||
import com.android.settings.R;
|
||||
import com.android.settingslib.notification.modes.ZenIconLoader;
|
||||
import com.android.settingslib.notification.modes.ZenMode;
|
||||
import com.android.settingslib.notification.modes.ZenModesBackend;
|
||||
import com.android.settingslib.widget.LayoutPreference;
|
||||
|
||||
import com.google.common.collect.ImmutableList;
|
||||
@@ -51,9 +52,15 @@ class ZenModeIconPickerListPreferenceController extends AbstractZenModePreferenc
|
||||
private @DrawableRes int mCurrentIconResId;
|
||||
|
||||
ZenModeIconPickerListPreferenceController(@NonNull Context context, @NonNull String key,
|
||||
@NonNull IconPickerListener listener, @NonNull IconOptionsProvider iconOptionsProvider,
|
||||
@Nullable ZenModesBackend backend) {
|
||||
super(context, key, backend);
|
||||
@NonNull IconPickerListener listener) {
|
||||
this(context, key, listener, new IconOptionsProviderImpl(context));
|
||||
}
|
||||
|
||||
@VisibleForTesting
|
||||
ZenModeIconPickerListPreferenceController(@NonNull Context context, @NonNull String key,
|
||||
@NonNull IconPickerListener listener,
|
||||
@NonNull IconOptionsProvider iconOptionsProvider) {
|
||||
super(context, key);
|
||||
mListener = listener;
|
||||
mIconOptionsProvider = iconOptionsProvider;
|
||||
}
|
||||
@@ -80,7 +87,11 @@ class ZenModeIconPickerListPreferenceController extends AbstractZenModePreferenc
|
||||
|
||||
@Override
|
||||
void updateState(Preference preference, @NonNull ZenMode zenMode) {
|
||||
updateIconSelection(zenMode.getRule().getIconResId());
|
||||
@DrawableRes int iconResId = zenMode.getRule().getIconResId();
|
||||
if (iconResId == 0) {
|
||||
iconResId = ZenIconLoader.getIconResourceIdFromType(zenMode.getType());
|
||||
}
|
||||
updateIconSelection(iconResId);
|
||||
}
|
||||
|
||||
private void updateIconSelection(@DrawableRes int iconResId) {
|
||||
@@ -145,7 +156,7 @@ class ZenModeIconPickerListPreferenceController extends AbstractZenModePreferenc
|
||||
public void onBindViewHolder(@NonNull IconHolder holder, int position) {
|
||||
IconOptionsProvider.IconInfo iconInfo = mIconResources.get(position);
|
||||
Drawable iconDrawable = mIconCache.computeIfAbsent(iconInfo,
|
||||
info -> IconUtil.makeIconCircle(mContext, info.resId()));
|
||||
info -> IconUtil.makeSmallIconCircle(mContext, info.resId()));
|
||||
holder.bindIcon(iconInfo, iconDrawable);
|
||||
}
|
||||
|
||||
|
@@ -26,14 +26,13 @@ import androidx.preference.Preference;
|
||||
|
||||
import com.android.settings.core.SubSettingLauncher;
|
||||
import com.android.settingslib.notification.modes.ZenMode;
|
||||
import com.android.settingslib.notification.modes.ZenModesBackend;
|
||||
|
||||
class ZenModeMessagesLinkPreferenceController extends AbstractZenModePreferenceController {
|
||||
private final ZenModeSummaryHelper mSummaryHelper;
|
||||
|
||||
public ZenModeMessagesLinkPreferenceController(Context context, String key,
|
||||
ZenModesBackend backend, ZenHelperBackend helperBackend) {
|
||||
super(context, key, backend);
|
||||
ZenHelperBackend helperBackend) {
|
||||
super(context, key);
|
||||
mSummaryHelper = new ZenModeSummaryHelper(context, helperBackend);
|
||||
}
|
||||
|
||||
|
@@ -27,15 +27,14 @@ import androidx.preference.Preference;
|
||||
|
||||
import com.android.settings.core.SubSettingLauncher;
|
||||
import com.android.settingslib.notification.modes.ZenMode;
|
||||
import com.android.settingslib.notification.modes.ZenModesBackend;
|
||||
|
||||
class ZenModeNotifVisLinkPreferenceController extends AbstractZenModePreferenceController {
|
||||
|
||||
private final ZenModeSummaryHelper mSummaryBuilder;
|
||||
|
||||
public ZenModeNotifVisLinkPreferenceController(Context context, String key,
|
||||
ZenModesBackend backend, ZenHelperBackend helperBackend) {
|
||||
super(context, key, backend);
|
||||
ZenHelperBackend helperBackend) {
|
||||
super(context, key);
|
||||
mSummaryBuilder = new ZenModeSummaryHelper(context, helperBackend);
|
||||
}
|
||||
|
||||
|
@@ -27,7 +27,6 @@ import androidx.preference.Preference;
|
||||
|
||||
import com.android.settings.core.SubSettingLauncher;
|
||||
import com.android.settingslib.notification.modes.ZenMode;
|
||||
import com.android.settingslib.notification.modes.ZenModesBackend;
|
||||
|
||||
/**
|
||||
* Preference with a link and summary about what other sounds can break through the mode
|
||||
@@ -37,8 +36,8 @@ class ZenModeOtherLinkPreferenceController extends AbstractZenModePreferenceCont
|
||||
private final ZenModeSummaryHelper mSummaryHelper;
|
||||
|
||||
public ZenModeOtherLinkPreferenceController(Context context, String key,
|
||||
ZenModesBackend backend, ZenHelperBackend helperBackend) {
|
||||
super(context, key, backend);
|
||||
ZenHelperBackend helperBackend) {
|
||||
super(context, key);
|
||||
mSummaryHelper = new ZenModeSummaryHelper(mContext, helperBackend);
|
||||
}
|
||||
|
||||
|
@@ -35,9 +35,9 @@ public class ZenModePeopleFragment extends ZenModeFragmentBase {
|
||||
protected List<AbstractPreferenceController> createPreferenceControllers(Context context) {
|
||||
List<AbstractPreferenceController> prefControllers = new ArrayList<>();
|
||||
prefControllers.add(new ZenModeCallsLinkPreferenceController(
|
||||
context, "zen_mode_people_calls", mBackend, mHelperBackend));
|
||||
context, "zen_mode_people_calls", mHelperBackend));
|
||||
prefControllers.add(new ZenModeMessagesLinkPreferenceController(
|
||||
context, "zen_mode_people_messages", mBackend, mHelperBackend));
|
||||
context, "zen_mode_people_messages", mHelperBackend));
|
||||
return prefControllers;
|
||||
}
|
||||
|
||||
|
@@ -27,7 +27,6 @@ import androidx.preference.Preference;
|
||||
|
||||
import com.android.settings.core.SubSettingLauncher;
|
||||
import com.android.settingslib.notification.modes.ZenMode;
|
||||
import com.android.settingslib.notification.modes.ZenModesBackend;
|
||||
|
||||
/**
|
||||
* Preference with a link and summary about what calls and messages can break through the mode
|
||||
@@ -37,8 +36,8 @@ class ZenModePeopleLinkPreferenceController extends AbstractZenModePreferenceCon
|
||||
private final ZenModeSummaryHelper mSummaryHelper;
|
||||
|
||||
public ZenModePeopleLinkPreferenceController(Context context, String key,
|
||||
ZenModesBackend backend, ZenHelperBackend helperBackend) {
|
||||
super(context, key, backend);
|
||||
ZenHelperBackend helperBackend) {
|
||||
super(context, key);
|
||||
mSummaryHelper = new ZenModeSummaryHelper(mContext, helperBackend);
|
||||
}
|
||||
|
||||
|
@@ -27,8 +27,6 @@ import android.platform.test.flag.junit.SetFlagsRule;
|
||||
|
||||
import androidx.preference.Preference;
|
||||
|
||||
import com.android.settingslib.notification.modes.ZenModesBackend;
|
||||
|
||||
import org.junit.Before;
|
||||
import org.junit.Rule;
|
||||
import org.junit.Test;
|
||||
@@ -47,7 +45,6 @@ public final class ZenModeCallsLinkPreferenceControllerTest {
|
||||
public final SetFlagsRule mSetFlagsRule = new SetFlagsRule();
|
||||
|
||||
private Context mContext;
|
||||
@Mock private ZenModesBackend mBackend;
|
||||
@Mock private ZenHelperBackend mHelperBackend;
|
||||
|
||||
@Before
|
||||
@@ -57,7 +54,7 @@ public final class ZenModeCallsLinkPreferenceControllerTest {
|
||||
mContext = RuntimeEnvironment.application;
|
||||
|
||||
mController = new ZenModeCallsLinkPreferenceController(
|
||||
mContext, "something", mBackend, mHelperBackend);
|
||||
mContext, "something", mHelperBackend);
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@@ -19,7 +19,6 @@ package com.android.settings.notification.modes;
|
||||
import static com.google.common.truth.Truth.assertThat;
|
||||
|
||||
import static org.mockito.ArgumentMatchers.eq;
|
||||
import static org.mockito.Mockito.mock;
|
||||
import static org.mockito.Mockito.verify;
|
||||
import static org.mockito.Mockito.when;
|
||||
|
||||
@@ -34,7 +33,6 @@ import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.android.settings.R;
|
||||
import com.android.settingslib.notification.modes.ZenMode;
|
||||
import com.android.settingslib.notification.modes.ZenModesBackend;
|
||||
import com.android.settingslib.widget.LayoutPreference;
|
||||
|
||||
import com.google.common.collect.ImmutableList;
|
||||
@@ -64,7 +62,7 @@ public class ZenModeIconPickerListPreferenceControllerTest {
|
||||
|
||||
mController = new ZenModeIconPickerListPreferenceController(
|
||||
RuntimeEnvironment.getApplication(), "icon_list", mListener,
|
||||
new TestIconOptionsProvider(), mock(ZenModesBackend.class));
|
||||
new TestIconOptionsProvider());
|
||||
|
||||
mRecyclerView = new RecyclerView(mContext);
|
||||
mRecyclerView.setId(R.id.icon_list);
|
||||
|
@@ -27,8 +27,6 @@ import android.platform.test.flag.junit.SetFlagsRule;
|
||||
|
||||
import androidx.preference.Preference;
|
||||
|
||||
import com.android.settingslib.notification.modes.ZenModesBackend;
|
||||
|
||||
import org.junit.Before;
|
||||
import org.junit.Rule;
|
||||
import org.junit.Test;
|
||||
@@ -47,7 +45,6 @@ public final class ZenModeMessagesLinkPreferenceControllerTest {
|
||||
public final SetFlagsRule mSetFlagsRule = new SetFlagsRule();
|
||||
|
||||
private Context mContext;
|
||||
@Mock private ZenModesBackend mBackend;
|
||||
@Mock private ZenHelperBackend mHelperBackend;
|
||||
|
||||
@Before
|
||||
@@ -57,7 +54,7 @@ public final class ZenModeMessagesLinkPreferenceControllerTest {
|
||||
mContext = RuntimeEnvironment.application;
|
||||
|
||||
mController = new ZenModeMessagesLinkPreferenceController(
|
||||
mContext, "something", mBackend, mHelperBackend);
|
||||
mContext, "something", mHelperBackend);
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@@ -27,8 +27,6 @@ import android.platform.test.flag.junit.SetFlagsRule;
|
||||
|
||||
import androidx.preference.Preference;
|
||||
|
||||
import com.android.settingslib.notification.modes.ZenModesBackend;
|
||||
|
||||
import org.junit.Before;
|
||||
import org.junit.Rule;
|
||||
import org.junit.Test;
|
||||
@@ -47,7 +45,6 @@ public final class ZenModeNotifVisLinkPreferenceControllerTest {
|
||||
public final SetFlagsRule mSetFlagsRule = new SetFlagsRule();
|
||||
|
||||
private Context mContext;
|
||||
@Mock private ZenModesBackend mBackend;
|
||||
@Mock private ZenHelperBackend mHelperBackend;
|
||||
|
||||
@Before
|
||||
@@ -57,7 +54,7 @@ public final class ZenModeNotifVisLinkPreferenceControllerTest {
|
||||
mContext = RuntimeEnvironment.application;
|
||||
|
||||
mController = new ZenModeNotifVisLinkPreferenceController(
|
||||
mContext, "something", mBackend, mHelperBackend);
|
||||
mContext, "something", mHelperBackend);
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@@ -27,8 +27,6 @@ import android.platform.test.flag.junit.SetFlagsRule;
|
||||
|
||||
import androidx.preference.Preference;
|
||||
|
||||
import com.android.settingslib.notification.modes.ZenModesBackend;
|
||||
|
||||
import org.junit.Before;
|
||||
import org.junit.Rule;
|
||||
import org.junit.Test;
|
||||
@@ -48,7 +46,6 @@ public final class ZenModeOtherLinkPreferenceControllerTest {
|
||||
public final SetFlagsRule mSetFlagsRule = new SetFlagsRule();
|
||||
|
||||
private Context mContext;
|
||||
@Mock private ZenModesBackend mBackend;
|
||||
@Mock private ZenHelperBackend mHelperBackend;
|
||||
|
||||
@Before
|
||||
@@ -58,7 +55,7 @@ public final class ZenModeOtherLinkPreferenceControllerTest {
|
||||
mContext = RuntimeEnvironment.application;
|
||||
|
||||
mController = new ZenModeOtherLinkPreferenceController(
|
||||
mContext, "something", mBackend, mHelperBackend);
|
||||
mContext, "something", mHelperBackend);
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@@ -27,8 +27,6 @@ import android.platform.test.flag.junit.SetFlagsRule;
|
||||
|
||||
import androidx.preference.Preference;
|
||||
|
||||
import com.android.settingslib.notification.modes.ZenModesBackend;
|
||||
|
||||
import org.junit.Before;
|
||||
import org.junit.Rule;
|
||||
import org.junit.Test;
|
||||
@@ -48,8 +46,6 @@ public final class ZenModePeopleLinkPreferenceControllerTest {
|
||||
|
||||
private Context mContext;
|
||||
@Mock
|
||||
private ZenModesBackend mBackend;
|
||||
@Mock
|
||||
private ZenHelperBackend mHelperBackend;
|
||||
|
||||
@Before
|
||||
@@ -59,7 +55,7 @@ public final class ZenModePeopleLinkPreferenceControllerTest {
|
||||
mContext = RuntimeEnvironment.application;
|
||||
|
||||
mController = new ZenModePeopleLinkPreferenceController(
|
||||
mContext, "something", mBackend, mHelperBackend);
|
||||
mContext, "something", mHelperBackend);
|
||||
}
|
||||
|
||||
@Test
|
||||
|
Reference in New Issue
Block a user