summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJohn Spurlock <jspurlock@google.com>2014-02-28 17:50:39 -0500
committerJohn Spurlock <jspurlock@google.com>2014-02-28 17:50:39 -0500
commitde547008d110fc4a23ee5ff6ae6ebba4788cd4bb (patch)
treee14bf4c429dc08eb457db61b31c52be1ae95f381
parentf87b2248497223a18ee0e5403967a5de55d8cbb5 (diff)
downloadframeworks_base-de547008d110fc4a23ee5ff6ae6ebba4788cd4bb.zip
frameworks_base-de547008d110fc4a23ee5ff6ae6ebba4788cd4bb.tar.gz
frameworks_base-de547008d110fc4a23ee5ff6ae6ebba4788cd4bb.tar.bz2
Wire up SystemUI zen mode config to new settings panel.
Change-Id: I949b31be0b31c02ab736799f9080601fb0fd79d1
-rw-r--r--core/java/android/provider/Settings.java8
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelView.java10
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java6
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/phone/QuickSettings.java2
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/phone/ZenModeView.java44
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/phone/ZenModeViewAdapter.java2
6 files changed, 28 insertions, 44 deletions
diff --git a/core/java/android/provider/Settings.java b/core/java/android/provider/Settings.java
index 40bbbd4..ee85972 100644
--- a/core/java/android/provider/Settings.java
+++ b/core/java/android/provider/Settings.java
@@ -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
/**
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelView.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelView.java
index ae74407..237b7f7 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelView.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelView.java
@@ -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;
@@ -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);
}
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java
index 1464b39..f54bd90 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java
@@ -2739,6 +2739,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;
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/QuickSettings.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/QuickSettings.java
index bcb818a..c1c8946 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/QuickSettings.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/QuickSettings.java
@@ -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);
}
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/ZenModeView.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/ZenModeView.java
index f5dc4d9..783e371 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/ZenModeView.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/ZenModeView.java
@@ -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.";
@@ -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;
@@ -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);
@@ -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) {
@@ -247,7 +238,6 @@ public class ZenModeView extends RelativeLayout {
mBottom = getExpandedBottom();
setExpanded(1);
}
- mInfoWindow.dismiss();
}
}
@@ -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);
@@ -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);
- }
- }
}
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/ZenModeViewAdapter.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/ZenModeViewAdapter.java
index c9ac89f..39c4faa 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/ZenModeViewAdapter.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/ZenModeViewAdapter.java
@@ -27,7 +27,7 @@ import android.util.Log;
import java.util.Arrays;
import java.util.List;
-public class ZenModeViewAdapter implements ZenModeView.Adapter {
+public abstract class ZenModeViewAdapter implements ZenModeView.Adapter {
private static final String TAG = "ZenModeViewAdapter";
private final Context mContext;