Skip to content

Commit 9cc9aeb

Browse files
dsandlerAndroid (Google) Code Review
authored andcommitted
Merge "Quick settings come to all Android devices." into jb-mr1-dev
2 parents 65dfac3 + 8e72c9e commit 9cc9aeb

File tree

10 files changed

+108
-23
lines changed

10 files changed

+108
-23
lines changed
29.2 KB
Loading

packages/SystemUI/res/layout-sw600dp/super_status_bar.xml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,11 +36,17 @@
3636
android:id="@+id/panel_holder"
3737
android:layout_width="match_parent"
3838
android:layout_height="match_parent"
39+
android:layout_marginTop="@*android:dimen/status_bar_height"
3940
>
4041
<include layout="@layout/status_bar_expanded"
4142
android:layout_width="@dimen/notification_panel_width"
4243
android:layout_height="wrap_content"
43-
android:layout_gravity="center_horizontal|top"
44+
android:layout_gravity="left|top"
45+
/>
46+
<include layout="@layout/quick_settings"
47+
android:layout_width="@dimen/notification_panel_width"
48+
android:layout_height="wrap_content"
49+
android:layout_gravity="right|top"
4450
/>
4551
</com.android.systemui.statusbar.phone.PanelHolder>
4652
</com.android.systemui.statusbar.phone.StatusBarWindowView>
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<!-- Copyright (C) 2012 The Android Open Source Project
3+
4+
Licensed under the Apache License, Version 2.0 (the "License");
5+
you may not use this file except in compliance with the License.
6+
You may obtain a copy of the License at
7+
8+
http://www.apache.org/licenses/LICENSE-2.0
9+
10+
Unless required by applicable law or agreed to in writing, software
11+
distributed under the License is distributed on an "AS IS" BASIS,
12+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
See the License for the specific language governing permissions and
14+
limitations under the License.
15+
-->
16+
17+
<com.android.systemui.statusbar.phone.PanelView
18+
xmlns:android="http://schemas.android.com/apk/res/android"
19+
android:layout_width="match_parent"
20+
android:layout_height="wrap_content"
21+
android:id="@+id/settings_panel"
22+
>
23+
<ImageView
24+
android:layout_width="match_parent"
25+
android:layout_height="wrap_content"
26+
android:scaleType="centerInside"
27+
android:src="@drawable/qs_coming_soon"
28+
android:padding="4dp"
29+
android:background="#80000080"
30+
/>
31+
<LinearLayout android:id="@+id/handle"
32+
android:layout_width="match_parent"
33+
android:layout_height="@dimen/close_handle_height"
34+
android:layout_gravity="bottom"
35+
android:orientation="vertical"
36+
>
37+
<ImageView
38+
android:layout_width="match_parent"
39+
android:layout_height="@dimen/close_handle_height"
40+
android:layout_gravity="bottom"
41+
android:scaleType="fitXY"
42+
android:src="@drawable/status_bar_close"
43+
/>
44+
</LinearLayout>
45+
</com.android.systemui.statusbar.phone.PanelView>

packages/SystemUI/res/layout/super_status_bar.xml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,11 +36,16 @@
3636
android:id="@+id/panel_holder"
3737
android:layout_width="match_parent"
3838
android:layout_height="match_parent"
39+
android:layout_marginTop="@*android:dimen/status_bar_height"
3940
>
4041
<include layout="@layout/status_bar_expanded"
4142
android:layout_width="match_parent"
4243
android:layout_height="wrap_content"
4344
/>
45+
<include layout="@layout/quick_settings"
46+
android:layout_width="match_parent"
47+
android:layout_height="wrap_content"
48+
/>
4449
</com.android.systemui.statusbar.phone.PanelHolder>
4550

4651
</com.android.systemui.statusbar.phone.StatusBarWindowView>

packages/SystemUI/res/values-sw600dp-land/dimens.xml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,4 @@
1919
<!-- Layout parameters for the notification panel -->
2020
<dimen name="notification_panel_margin_bottom">0dp</dimen>
2121
<dimen name="notification_panel_margin_left">32dp</dimen>
22-
23-
<!-- Gravity for the notification panel -->
24-
<!-- 0x33 = left|top -->
25-
<integer name="notification_panel_layout_gravity">0x33</integer>
2622
</resources>

packages/SystemUI/res/values-sw600dp/dimens.xml

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,12 @@
2121

2222
<!-- Layout parameters for the notification panel -->
2323
<dimen name="notification_panel_margin_bottom">192dp</dimen>
24-
<dimen name="notification_panel_margin_left">0dp</dimen>
24+
<dimen name="notification_panel_margin_left">16dp</dimen>
2525

26-
<!-- Gravity for the notification panel -->
27-
<!-- 0x33 = center_horizontal|top -->
28-
<integer name="notification_panel_layout_gravity">0x31</integer>
26+
<!-- Gravity for the notification & quick settings panels -->
27+
<!-- 0x33 = left|top ; 0x35 = right|top -->
28+
<integer name="notification_panel_layout_gravity">0x33</integer>
29+
<integer name="settings_panel_layout_gravity">0x35</integer>
2930

3031
<!-- Diameter of outer shape drawable shown in navbar search-->
3132
<dimen name="navbar_search_outerring_diameter">430dip</dimen>

packages/SystemUI/res/values/dimens.xml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,9 +158,10 @@
158158
<dimen name="notification_panel_margin_bottom">0dp</dimen>
159159
<dimen name="notification_panel_margin_left">0dp</dimen>
160160

161-
<!-- Gravity for the notification panel -->
161+
<!-- Gravity for the notification & quick settings panels -->
162162
<!-- 0x37 = fill_horizontal|top -->
163163
<integer name="notification_panel_layout_gravity">0x37</integer>
164+
<integer name="settings_panel_layout_gravity">0x37</integer>
164165

165166
<!-- Height of the carrier/wifi name label -->
166167
<dimen name="carrier_label_height">24dp</dimen>

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

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ public static final void LOG(String fmt, Object... args) {
1818

1919
private PanelHolder mPanelHolder;
2020
private ArrayList<PanelView> mPanels = new ArrayList<PanelView>();
21-
private PanelView mTouchingPanel;
21+
protected PanelView mTouchingPanel;
2222

2323
public PanelBar(Context context, AttributeSet attrs) {
2424
super(context, attrs);
@@ -71,24 +71,25 @@ public boolean onTouchEvent(MotionEvent event) {
7171

7272
public void panelExpansionChanged(PanelView panel, float frac) {
7373
boolean fullyClosed = true;
74-
boolean fullyOpened = false;
74+
PanelView fullyOpenedPanel = null;
7575
for (PanelView pv : mPanels) {
7676
if (pv.getExpandedHeight() > 0f) {
7777
fullyClosed = false;
7878
final float thisFrac = pv.getExpandedFraction();
7979
LOG("panel %s: f=%.1f", pv, thisFrac);
8080
if (panel == pv) {
81-
if (thisFrac == 1f) fullyOpened = true;
81+
if (thisFrac == 1f) fullyOpenedPanel = panel;
8282
} else {
8383
pv.setExpandedFraction(1f-frac);
8484
}
8585
}
8686
}
87-
if (fullyOpened) onPanelFullyOpened();
87+
if (fullyOpenedPanel != null) onPanelFullyOpened(fullyOpenedPanel);
8888
if (fullyClosed) onAllPanelsCollapsed();
8989
else onPanelPeeked();
9090

91-
LOG("panelExpansionChanged: [%s%s ]", fullyOpened?" fullyOpened":"", fullyClosed?" fullyClosed":"");
91+
LOG("panelExpansionChanged: [%s%s ]",
92+
(fullyOpenedPanel!=null)?" fullyOpened":"", fullyClosed?" fullyClosed":"");
9293
}
9394

9495
public void collapseAllPanels(boolean animate) {
@@ -109,7 +110,7 @@ public void onAllPanelsCollapsed() {
109110
LOG("onAllPanelsCollapsed");
110111
}
111112

112-
public void onPanelFullyOpened() {
113+
public void onPanelFullyOpened(PanelView openPanel) {
113114
LOG("onPanelFullyOpened");
114115
}
115116
}

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

Lines changed: 25 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -169,12 +169,16 @@ public class PhoneStatusBar extends BaseStatusBar {
169169
PanelView mNotificationPanel; // the sliding/resizing panel within the notification window
170170
ScrollView mScrollView;
171171
View mExpandedContents;
172-
int mNotificationPanelMarginBottomPx, mNotificationPanelMarginLeftPx;
173172
final Rect mNotificationPanelBackgroundPadding = new Rect();
174173
int mNotificationPanelGravity;
174+
int mNotificationPanelMarginBottomPx, mNotificationPanelMarginPx;
175175
int mNotificationPanelMinHeight;
176176
boolean mNotificationPanelIsFullScreenWidth;
177177

178+
// settings
179+
PanelView mSettingsPanel;
180+
int mSettingsPanelGravity;
181+
178182
// top bar
179183
View mClearButton;
180184
View mSettingsButton;
@@ -310,22 +314,29 @@ public boolean onTouch(View v, MotionEvent event) {
310314

311315
mNotificationPanel = (PanelView) mStatusBarWindow.findViewById(R.id.notification_panel);
312316
// don't allow clicks on the panel to pass through to the background where they will cause the panel to close
313-
mNotificationPanel.setOnTouchListener(new View.OnTouchListener() {
317+
View.OnTouchListener clickStopper = new View.OnTouchListener() {
314318
@Override
315319
public boolean onTouch(View v, MotionEvent event) {
316320
return true;
317321
}
318-
});
322+
};
323+
mNotificationPanel.setOnTouchListener(clickStopper);
319324
mNotificationPanelIsFullScreenWidth =
320325
(mNotificationPanel.getLayoutParams().width == ViewGroup.LayoutParams.MATCH_PARENT);
321326
mNotificationPanel.setSystemUiVisibility(
322327
View.STATUS_BAR_DISABLE_NOTIFICATION_TICKER
323328
| (mNotificationPanelIsFullScreenWidth ? 0 : View.STATUS_BAR_DISABLE_SYSTEM_INFO));
324329

330+
// quick settings (WIP)
331+
mSettingsPanel = (PanelView) mStatusBarWindow.findViewById(R.id.settings_panel);
332+
mSettingsPanel.setOnTouchListener(clickStopper);
333+
325334
if (!ActivityManager.isHighEndGfx(mDisplay)) {
326335
mStatusBarWindow.setBackground(null);
327336
mNotificationPanel.setBackground(new FastColorDrawable(context.getResources().getColor(
328337
R.color.notification_panel_solid_background)));
338+
mSettingsPanel.setBackground(new FastColorDrawable(context.getResources().getColor(
339+
R.color.notification_panel_solid_background)));
329340
}
330341
if (ENABLE_INTRUDERS) {
331342
mIntruderAlertView = (IntruderAlertView) View.inflate(context, R.layout.intruder_alert, null);
@@ -1634,8 +1645,12 @@ public void updateExpandedViewPos(int thingy) {
16341645
if (DEBUG) Slog.v(TAG, "updateExpandedViewPos");
16351646
FrameLayout.LayoutParams lp = (FrameLayout.LayoutParams) mNotificationPanel.getLayoutParams();
16361647
lp.gravity = mNotificationPanelGravity;
1637-
lp.leftMargin = mNotificationPanelMarginLeftPx;
1648+
lp.leftMargin = mNotificationPanelMarginPx;
16381649
mNotificationPanel.setLayoutParams(lp);
1650+
lp = (FrameLayout.LayoutParams) mSettingsPanel.getLayoutParams();
1651+
lp.gravity = mSettingsPanelGravity;
1652+
lp.rightMargin = mNotificationPanelMarginPx;
1653+
mSettingsPanel.setLayoutParams(lp);
16391654
}
16401655

16411656
// called by makeStatusbar and also by PhoneStatusBarView
@@ -1872,11 +1887,15 @@ protected void loadDimens() {
18721887

18731888
mNotificationPanelMarginBottomPx
18741889
= (int) res.getDimension(R.dimen.notification_panel_margin_bottom);
1875-
mNotificationPanelMarginLeftPx
1890+
mNotificationPanelMarginPx
18761891
= (int) res.getDimension(R.dimen.notification_panel_margin_left);
18771892
mNotificationPanelGravity = res.getInteger(R.integer.notification_panel_layout_gravity);
18781893
if (mNotificationPanelGravity <= 0) {
1879-
mNotificationPanelGravity = Gravity.CENTER_VERTICAL | Gravity.TOP;
1894+
mNotificationPanelGravity = Gravity.LEFT | Gravity.TOP;
1895+
}
1896+
mSettingsPanelGravity = res.getInteger(R.integer.settings_panel_layout_gravity);
1897+
if (mSettingsPanelGravity <= 0) {
1898+
mSettingsPanelGravity = Gravity.RIGHT | Gravity.TOP;
18801899
}
18811900
getNinePatchPadding(res.getDrawable(R.drawable.notification_panel_bg), mNotificationPanelBackgroundPadding);
18821901
final int notificationPanelDecorationHeight =

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

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ public class PhoneStatusBarView extends PanelBar {
4242
private static final String TAG = "PhoneStatusBarView";
4343
PhoneStatusBar mBar;
4444
int mScrimColor;
45+
PanelView mFadingPanel = null;
4546

4647
public PhoneStatusBarView(Context context, AttributeSet attrs) {
4748
super(context, attrs);
@@ -76,12 +77,21 @@ public boolean onRequestSendAccessibilityEvent(View child, AccessibilityEvent ev
7677
public void onPanelPeeked() {
7778
super.onPanelPeeked();
7879
mBar.makeExpandedVisible(true);
80+
if (mFadingPanel == null) {
81+
mFadingPanel = mTouchingPanel;
82+
}
7983
}
8084

8185
@Override
8286
public void onAllPanelsCollapsed() {
8387
super.onAllPanelsCollapsed();
8488
mBar.makeExpandedInvisible();
89+
mFadingPanel = null;
90+
}
91+
92+
@Override
93+
public void onPanelFullyOpened(PanelView openPanel) {
94+
mFadingPanel = openPanel;
8595
}
8696

8797
@Override
@@ -98,7 +108,8 @@ public boolean onInterceptTouchEvent(MotionEvent event) {
98108
public void panelExpansionChanged(PanelView pv, float frac) {
99109
super.panelExpansionChanged(pv, frac);
100110

101-
if (mScrimColor != 0 && ActivityManager.isHighEndGfx(mBar.mDisplay)) {
111+
if (mFadingPanel == pv
112+
&& mScrimColor != 0 && ActivityManager.isHighEndGfx(mBar.mDisplay)) {
102113
// woo, special effects
103114
final float k = (float)(1f-0.5f*(1f-Math.cos(3.14159f * Math.pow(1f-frac, 2.2f))));
104115
// attenuate background color alpha by k

0 commit comments

Comments
 (0)