Loading core/java/android/provider/Settings.java +8 −0 Original line number Diff line number Diff line Loading @@ -749,6 +749,14 @@ public final class Settings { public static final String ACTION_PRINT_SETTINGS = "android.settings.ACTION_PRINT_SETTINGS"; /** * Activity Action: Show Zen Mode configuration settings. * * @hide */ @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) public static final String ACTION_ZEN_MODE_SETTINGS = "android.settings.ZEN_MODE_SETTINGS"; // End of Intent actions for Settings /** Loading packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelView.java +9 −1 Original line number Diff line number Diff line Loading @@ -20,6 +20,7 @@ import android.content.Context; import android.content.res.Resources; import android.graphics.Canvas; import android.graphics.drawable.Drawable; import android.provider.Settings; import android.util.AttributeSet; import android.util.EventLog; import android.view.MotionEvent; Loading Loading @@ -58,7 +59,14 @@ public class NotificationPanelView extends PanelView { mHandleView = findViewById(R.id.handle); PanelHeaderView header = (PanelHeaderView) findViewById(R.id.header); ZenModeView zenModeView = (ZenModeView) findViewById(R.id.zenmode); zenModeView.setAdapter( new ZenModeViewAdapter(mContext)); zenModeView.setAdapter(new ZenModeViewAdapter(mContext) { @Override public void configure() { if (mStatusBar != null) { mStatusBar.startSettingsActivity(Settings.ACTION_ZEN_MODE_SETTINGS); } } }); header.setZenModeView(zenModeView); } Loading packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java +6 −0 Original line number Diff line number Diff line Loading @@ -2742,6 +2742,12 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode { || (mDisabled & StatusBarManager.DISABLE_SEARCH) != 0; } public void startSettingsActivity(String action) { if (mQS != null) { mQS.startSettingsActivity(action); } } private static class FastColorDrawable extends Drawable { private final int mColor; Loading packages/SystemUI/src/com/android/systemui/statusbar/phone/QuickSettings.java +1 −1 Original line number Diff line number Diff line Loading @@ -278,7 +278,7 @@ class QuickSettings { mTilesSetUp = true; } private void startSettingsActivity(String action) { public void startSettingsActivity(String action) { Intent intent = new Intent(action); startSettingsActivity(intent); } Loading packages/SystemUI/src/com/android/systemui/statusbar/phone/ZenModeView.java +3 −41 Original line number Diff line number Diff line Loading @@ -66,10 +66,7 @@ public class ZenModeView extends RelativeLayout { private static final long BOUNCE_DURATION = DURATION / 3; private static final float BOUNCE_SCALE = 0.8f; private static final float SETTINGS_ALPHA = 0.6f; private static final int INFO_WINDOW_DELAY = 2000; private static final String LIMITED_TEXT = "New notifications suppressed except calls, alarms & timers."; private static final String FULL_TEXT = "You won't hear any calls, alarms or timers."; Loading @@ -79,7 +76,6 @@ public class ZenModeView extends RelativeLayout { private final ModeSpinner mModeSpinner; private final ImageView mCloseButton; private final ImageView mSettingsButton; private final InfoWindow mInfoWindow; private final Rect mLayoutRect = new Rect(); private final UntilPager mUntilPager; private final AlarmWarning mAlarmWarning; Loading Loading @@ -133,16 +129,12 @@ public class ZenModeView extends RelativeLayout { mSettingsButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { if (mAdapter == null || mAdapter.getMode() != Adapter.MODE_LIMITED) { return; } if (!mInfoWindow.isShowing()) { mInfoWindow.show(mUntilPager); if (mAdapter != null && mAdapter.getMode() == Adapter.MODE_LIMITED) { mAdapter.configure(); } bounce(mSettingsButton, null); } }); mInfoWindow = new InfoWindow(mContext, LIMITED_TEXT); mModeSpinner = new ModeSpinner(mContext); mModeSpinner.setAlpha(0); Loading Loading @@ -201,7 +193,6 @@ public class ZenModeView extends RelativeLayout { }).start(); mUntilPager.animate().alpha(0).start(); mAlarmWarning.animate().alpha(0).start(); mInfoWindow.dismiss(); } public void setAdapter(Adapter adapter) { Loading Loading @@ -247,7 +238,6 @@ public class ZenModeView extends RelativeLayout { mBottom = getExpandedBottom(); setExpanded(1); } mInfoWindow.dismiss(); } } Loading Loading @@ -597,6 +587,7 @@ public class ZenModeView extends RelativeLayout { public static final int MODE_FULL = 2; boolean isApplicable(); void configure(); int getMode(); void setMode(int mode); void select(ExitCondition ec); Loading Loading @@ -745,33 +736,4 @@ public class ZenModeView extends RelativeLayout { } } } private static class InfoWindow extends PopupWindow implements Runnable { private final TextView mText; public InfoWindow(Context context, String text) { mText = new TextView(context); mText.setTypeface(CONDENSED); mText.setBackgroundColor(0xbb000000); mText.setTextColor(0xffffffff); mText.setText(text); mText.setGravity(Gravity.CENTER); setAnimationStyle(android.R.style.Animation_Toast); setContentView(mText); } @Override public void run() { dismiss(); } public void show(View over) { setWidth(over.getMeasuredWidth()); setHeight(over.getMeasuredHeight()); final int[] loc = new int[2]; over.getLocationInWindow(loc); showAtLocation(over, Gravity.NO_GRAVITY, loc[0], loc[1]); over.postDelayed(this, INFO_WINDOW_DELAY); } } } Loading
core/java/android/provider/Settings.java +8 −0 Original line number Diff line number Diff line Loading @@ -749,6 +749,14 @@ public final class Settings { public static final String ACTION_PRINT_SETTINGS = "android.settings.ACTION_PRINT_SETTINGS"; /** * Activity Action: Show Zen Mode configuration settings. * * @hide */ @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) public static final String ACTION_ZEN_MODE_SETTINGS = "android.settings.ZEN_MODE_SETTINGS"; // End of Intent actions for Settings /** Loading
packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelView.java +9 −1 Original line number Diff line number Diff line Loading @@ -20,6 +20,7 @@ import android.content.Context; import android.content.res.Resources; import android.graphics.Canvas; import android.graphics.drawable.Drawable; import android.provider.Settings; import android.util.AttributeSet; import android.util.EventLog; import android.view.MotionEvent; Loading Loading @@ -58,7 +59,14 @@ public class NotificationPanelView extends PanelView { mHandleView = findViewById(R.id.handle); PanelHeaderView header = (PanelHeaderView) findViewById(R.id.header); ZenModeView zenModeView = (ZenModeView) findViewById(R.id.zenmode); zenModeView.setAdapter( new ZenModeViewAdapter(mContext)); zenModeView.setAdapter(new ZenModeViewAdapter(mContext) { @Override public void configure() { if (mStatusBar != null) { mStatusBar.startSettingsActivity(Settings.ACTION_ZEN_MODE_SETTINGS); } } }); header.setZenModeView(zenModeView); } Loading
packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java +6 −0 Original line number Diff line number Diff line Loading @@ -2742,6 +2742,12 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode { || (mDisabled & StatusBarManager.DISABLE_SEARCH) != 0; } public void startSettingsActivity(String action) { if (mQS != null) { mQS.startSettingsActivity(action); } } private static class FastColorDrawable extends Drawable { private final int mColor; Loading
packages/SystemUI/src/com/android/systemui/statusbar/phone/QuickSettings.java +1 −1 Original line number Diff line number Diff line Loading @@ -278,7 +278,7 @@ class QuickSettings { mTilesSetUp = true; } private void startSettingsActivity(String action) { public void startSettingsActivity(String action) { Intent intent = new Intent(action); startSettingsActivity(intent); } Loading
packages/SystemUI/src/com/android/systemui/statusbar/phone/ZenModeView.java +3 −41 Original line number Diff line number Diff line Loading @@ -66,10 +66,7 @@ public class ZenModeView extends RelativeLayout { private static final long BOUNCE_DURATION = DURATION / 3; private static final float BOUNCE_SCALE = 0.8f; private static final float SETTINGS_ALPHA = 0.6f; private static final int INFO_WINDOW_DELAY = 2000; private static final String LIMITED_TEXT = "New notifications suppressed except calls, alarms & timers."; private static final String FULL_TEXT = "You won't hear any calls, alarms or timers."; Loading @@ -79,7 +76,6 @@ public class ZenModeView extends RelativeLayout { private final ModeSpinner mModeSpinner; private final ImageView mCloseButton; private final ImageView mSettingsButton; private final InfoWindow mInfoWindow; private final Rect mLayoutRect = new Rect(); private final UntilPager mUntilPager; private final AlarmWarning mAlarmWarning; Loading Loading @@ -133,16 +129,12 @@ public class ZenModeView extends RelativeLayout { mSettingsButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { if (mAdapter == null || mAdapter.getMode() != Adapter.MODE_LIMITED) { return; } if (!mInfoWindow.isShowing()) { mInfoWindow.show(mUntilPager); if (mAdapter != null && mAdapter.getMode() == Adapter.MODE_LIMITED) { mAdapter.configure(); } bounce(mSettingsButton, null); } }); mInfoWindow = new InfoWindow(mContext, LIMITED_TEXT); mModeSpinner = new ModeSpinner(mContext); mModeSpinner.setAlpha(0); Loading Loading @@ -201,7 +193,6 @@ public class ZenModeView extends RelativeLayout { }).start(); mUntilPager.animate().alpha(0).start(); mAlarmWarning.animate().alpha(0).start(); mInfoWindow.dismiss(); } public void setAdapter(Adapter adapter) { Loading Loading @@ -247,7 +238,6 @@ public class ZenModeView extends RelativeLayout { mBottom = getExpandedBottom(); setExpanded(1); } mInfoWindow.dismiss(); } } Loading Loading @@ -597,6 +587,7 @@ public class ZenModeView extends RelativeLayout { public static final int MODE_FULL = 2; boolean isApplicable(); void configure(); int getMode(); void setMode(int mode); void select(ExitCondition ec); Loading Loading @@ -745,33 +736,4 @@ public class ZenModeView extends RelativeLayout { } } } private static class InfoWindow extends PopupWindow implements Runnable { private final TextView mText; public InfoWindow(Context context, String text) { mText = new TextView(context); mText.setTypeface(CONDENSED); mText.setBackgroundColor(0xbb000000); mText.setTextColor(0xffffffff); mText.setText(text); mText.setGravity(Gravity.CENTER); setAnimationStyle(android.R.style.Animation_Toast); setContentView(mText); } @Override public void run() { dismiss(); } public void show(View over) { setWidth(over.getMeasuredWidth()); setHeight(over.getMeasuredHeight()); final int[] loc = new int[2]; over.getLocationInWindow(loc); showAtLocation(over, Gravity.NO_GRAVITY, loc[0], loc[1]); over.postDelayed(this, INFO_WINDOW_DELAY); } } }