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