Skip to content

Commit 092ad66

Browse files
dsandlerAndroid (Google) Code Review
authored andcommitted
Merge changes Ic860de75,I8b2d6c7a into jb-mr1-dev
* changes: Remove notification/quicksettings explanation cling. Remove the double-swipe to access quick settings on phones.
2 parents 2a3e1ff + ace0bd7 commit 092ad66

File tree

9 files changed

+80
-40
lines changed

9 files changed

+80
-40
lines changed
-218 Bytes
Binary file not shown.
-209 Bytes
Binary file not shown.
-252 Bytes
Binary file not shown.

packages/SystemUI/res/layout/status_bar_expanded_header.xml

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
<LinearLayout
1919
xmlns:android="http://schemas.android.com/apk/res/android"
2020
xmlns:systemui="http://schemas.android.com/apk/res/com.android.systemui"
21+
android:id="@+id/header"
2122
android:layout_width="match_parent"
2223
android:layout_height="wrap_content"
2324
android:background="@drawable/notification_header_bg"
@@ -61,9 +62,18 @@
6162
android:padding="2dp"
6263
/>
6364

65+
<ImageView android:id="@+id/settings_button"
66+
android:layout_width="50dp"
67+
android:layout_height="50dp"
68+
android:scaleType="center"
69+
android:src="@drawable/ic_notify_quicksettings"
70+
android:contentDescription="@string/accessibility_settings_button"
71+
/>
72+
6473
<ImageView android:id="@+id/clear_all_button"
65-
android:layout_width="48dp"
66-
android:layout_height="48dp"
74+
android:layout_width="50dp"
75+
android:layout_height="50dp"
76+
android:layout_marginLeft="18dp"
6777
android:scaleType="center"
6878
android:src="@drawable/ic_notify_clear"
6979
android:contentDescription="@string/accessibility_clear_all"

packages/SystemUI/res/values/colors.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
<drawable name="recents_callout_line">#99ffffff</drawable>
2929
<drawable name="notification_item_background_legacy_color">#ffaaaaaa</drawable>
3030
<drawable name="intruder_bg_pressed">#ff33B5E5</drawable>
31+
<drawable name="notification_header_bg">#FF000000</drawable>
3132

3233
<!-- ==================== system bar only ==================== -->
3334
<drawable name="system_bar_background">#ff000000</drawable>

packages/SystemUI/src/com/android/systemui/statusbar/phone/PanelBar.java

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -68,9 +68,9 @@ public float getBarHeight() {
6868
return getMeasuredHeight();
6969
}
7070

71-
public PanelView selectPanelForTouchX(float x) {
71+
public PanelView selectPanelForTouch(MotionEvent touch) {
7272
final int N = mPanels.size();
73-
return mPanels.get((int)(N * x / getMeasuredWidth()));
73+
return mPanels.get((int)(N * touch.getX() / getMeasuredWidth()));
7474
}
7575

7676
public boolean panelsEnabled() {
@@ -84,15 +84,26 @@ public boolean onTouchEvent(MotionEvent event) {
8484

8585
// figure out which panel needs to be talked to here
8686
if (event.getAction() == MotionEvent.ACTION_DOWN) {
87-
final PanelView panel = selectPanelForTouchX(event.getX());
87+
final PanelView panel = selectPanelForTouch(event);
88+
if (panel == null) {
89+
// panel is not there, so we'll eat the gesture
90+
if (DEBUG) LOG("PanelBar.onTouch: no panel for x=%d, bailing", event.getX());
91+
mTouchingPanel = null;
92+
return true;
93+
}
8894
boolean enabled = panel.isEnabled();
8995
if (DEBUG) LOG("PanelBar.onTouch: state=%d ACTION_DOWN: panel %s %s", mState, panel,
9096
(enabled ? "" : " (disabled)"));
91-
if (!enabled)
92-
return false;
97+
if (!enabled) {
98+
// panel is disabled, so we'll eat the gesture
99+
mTouchingPanel = null;
100+
return true;
101+
}
93102
startOpeningPanel(panel);
94103
}
95-
final boolean result = mTouchingPanel.getHandle().dispatchTouchEvent(event);
104+
final boolean result = mTouchingPanel != null
105+
? mTouchingPanel.getHandle().dispatchTouchEvent(event)
106+
: true;
96107
return result;
97108
}
98109

packages/SystemUI/src/com/android/systemui/statusbar/phone/PanelView.java

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ public final void LOG(String fmt, Object... args) {
2323
}
2424

2525
public static final boolean BRAKES = false;
26-
private static final boolean STRETCH_PAST_CONTENTS = true;
26+
private boolean mRubberbandingEnabled = true;
2727

2828
private float mSelfExpandVelocityPx; // classic value: 2000px/s
2929
private float mSelfCollapseVelocityPx; // classic value: 2000px/s (will be negated to collapse "up")
@@ -86,6 +86,10 @@ public void run() {
8686
protected float mInitialTouchY;
8787
protected float mFinalTouchY;
8888

89+
public void setRubberbandingEnabled(boolean enable) {
90+
mRubberbandingEnabled = enable;
91+
}
92+
8993
private void runPeekAnimation() {
9094
if (DEBUG) LOG("peek to height=%.1f", mPeekHeight);
9195
if (mTimeAnimator.isStarted()) {
@@ -109,7 +113,7 @@ private void animationTick(long dtms) {
109113

110114
mTimeAnimator.start();
111115

112-
mRubberbanding = STRETCH_PAST_CONTENTS // is it enabled at all?
116+
mRubberbanding = mRubberbandingEnabled // is it enabled at all?
113117
&& mExpandedHeight > getFullHeight() // are we past the end?
114118
&& mVel >= -mFlingGestureMinDistPx; // was this not possibly a "close" gesture?
115119
if (mRubberbanding) {
@@ -413,7 +417,7 @@ public void setExpandedHeightInternal(float h) {
413417
}
414418

415419
if (h < 0) h = 0;
416-
if (!(STRETCH_PAST_CONTENTS && (mTracking || mRubberbanding)) && h > fh) h = fh;
420+
if (!(mRubberbandingEnabled && (mTracking || mRubberbanding)) && h > fh) h = fh;
417421
mExpandedHeight = h;
418422

419423
if (DEBUG) LOG("setExpansion: height=%.1f fh=%.1f tracking=%s rubber=%s", h, fh, mTracking?"T":"f", mRubberbanding?"T":"f");

packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java

Lines changed: 20 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,8 @@ public class PhoneStatusBar extends BaseStatusBar {
106106

107107
public static final boolean DEBUG_CLINGS = false;
108108

109+
public static final boolean ENABLE_NOTIFICATION_PANEL_CLING = false;
110+
109111
// additional instrumentation for testing purposes; intended to be left on during development
110112
public static final boolean CHATTY = DEBUG;
111113

@@ -344,6 +346,7 @@ public boolean onTouch(View v, MotionEvent event) {
344346

345347
mStatusBarView = (PhoneStatusBarView) mStatusBarWindow.findViewById(R.id.status_bar);
346348
mStatusBarView.setBar(this);
349+
347350

348351
PanelHolder holder = (PanelHolder) mStatusBarWindow.findViewById(R.id.panel_holder);
349352
mStatusBarView.setPanelHolder(holder);
@@ -356,6 +359,15 @@ public boolean onTouch(View v, MotionEvent event) {
356359
View.STATUS_BAR_DISABLE_NOTIFICATION_ICONS |
357360
View.STATUS_BAR_DISABLE_CLOCK);
358361

362+
// make the header non-responsive to clicks
363+
mNotificationPanel.findViewById(R.id.header).setOnTouchListener(
364+
new View.OnTouchListener() {
365+
@Override
366+
public boolean onTouch(View v, MotionEvent event) {
367+
return true; // e eats everything
368+
}
369+
});
370+
359371
if (!ActivityManager.isHighEndGfx()) {
360372
mStatusBarWindow.setBackground(null);
361373
mNotificationPanel.setBackground(new FastColorDrawable(context.getResources().getColor(
@@ -410,7 +422,12 @@ public boolean onTouch(View v, MotionEvent event) {
410422
mDateView = (DateView)mStatusBarWindow.findViewById(R.id.date);
411423
mSettingsButton = mStatusBarWindow.findViewById(R.id.settings_button);
412424
if (mSettingsButton != null) {
413-
mSettingsButton.setOnClickListener(mSettingsButtonListener);
425+
if (mStatusBarView.hasFullWidthNotifications()) {
426+
mSettingsButton.setOnClickListener(mSettingsButtonListener);
427+
mSettingsButton.setVisibility(View.VISIBLE);
428+
} else {
429+
mSettingsButton.setVisibility(View.GONE);
430+
}
414431
}
415432

416433
mScrollView = (ScrollView)mStatusBarWindow.findViewById(R.id.scroll);
@@ -490,8 +507,7 @@ public void onSizeChanged(View view, int w, int h, int oldw, int oldh) {
490507
mClingShown = ! (DEBUG_CLINGS
491508
|| !Prefs.read(mContext).getBoolean(Prefs.SHOWN_QUICK_SETTINGS_HELP, false));
492509

493-
// robots don't need help
494-
if (ActivityManager.isRunningInTestHarness()) {
510+
if (!ENABLE_NOTIFICATION_PANEL_CLING || ActivityManager.isRunningInTestHarness()) {
495511
mClingShown = true;
496512
}
497513

@@ -1900,18 +1916,7 @@ public void run() {
19001916

19011917
private View.OnClickListener mSettingsButtonListener = new View.OnClickListener() {
19021918
public void onClick(View v) {
1903-
// We take this as a good indicator that Setup is running and we shouldn't
1904-
// allow you to go somewhere else
1905-
if (!isDeviceProvisioned()) return;
1906-
try {
1907-
// Dismiss the lock screen when Settings starts.
1908-
ActivityManagerNative.getDefault().dismissKeyguardOnNextActivity();
1909-
} catch (RemoteException e) {
1910-
}
1911-
v.getContext().startActivityAsUser(new Intent(Settings.ACTION_SETTINGS)
1912-
.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK),
1913-
new UserHandle(UserHandle.USER_CURRENT));
1914-
animateCollapsePanels();
1919+
animateExpandSettingsPanel();
19151920
}
19161921
};
19171922

packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBarView.java

Lines changed: 23 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -45,14 +45,7 @@ public class PhoneStatusBarView extends PanelBar {
4545

4646
public PhoneStatusBarView(Context context, AttributeSet attrs) {
4747
super(context, attrs);
48-
}
49-
50-
public void setBar(PhoneStatusBar bar) {
51-
mBar = bar;
52-
}
5348

54-
@Override
55-
public void onAttachedToWindow() {
5649
Resources res = getContext().getResources();
5750
mScrimColor = res.getColor(R.color.notification_panel_scrim_color);
5851
mSettingsPanelDragzoneMin = res.getDimension(R.dimen.settings_panel_dragzone_min);
@@ -61,10 +54,24 @@ public void onAttachedToWindow() {
6154
} catch (NotFoundException ex) {
6255
mSettingsPanelDragzoneFrac = 0f;
6356
}
64-
6557
mFullWidthNotifications = mSettingsPanelDragzoneFrac <= 0f;
6658
}
6759

60+
public void setBar(PhoneStatusBar bar) {
61+
mBar = bar;
62+
}
63+
64+
public boolean hasFullWidthNotifications() {
65+
return mFullWidthNotifications;
66+
}
67+
68+
@Override
69+
public void onAttachedToWindow() {
70+
for (PanelView pv : mPanels) {
71+
pv.setRubberbandingEnabled(!mFullWidthNotifications);
72+
}
73+
}
74+
6875
@Override
6976
public void addPanel(PanelView pv) {
7077
super.addPanel(pv);
@@ -73,6 +80,7 @@ public void addPanel(PanelView pv) {
7380
} else if (pv.getId() == R.id.settings_panel){
7481
mSettingsPanel = pv;
7582
}
83+
pv.setRubberbandingEnabled(!mFullWidthNotifications);
7684
}
7785

7886
@Override
@@ -96,13 +104,14 @@ public boolean onRequestSendAccessibilityEvent(View child, AccessibilityEvent ev
96104
}
97105

98106
@Override
99-
public PanelView selectPanelForTouchX(float x) {
107+
public PanelView selectPanelForTouch(MotionEvent touch) {
108+
final float x = touch.getX();
109+
100110
if (mFullWidthNotifications) {
101-
if (DEBUG) {
102-
Slog.v(TAG, "notif frac=" + mNotificationPanel.getExpandedFraction());
103-
}
104-
return (mNotificationPanel.getExpandedFraction() > 0f)
105-
? mSettingsPanel : mNotificationPanel;
111+
// No double swiping. If either panel is open, nothing else can be pulled down.
112+
return (mSettingsPanel.getExpandedHeight() + mNotificationPanel.getExpandedHeight()> 0)
113+
? null
114+
: mNotificationPanel;
106115
}
107116

108117
// We split the status bar into thirds: the left 2/3 are for notifications, and the

0 commit comments

Comments
 (0)