diff options
author | Daniel Sandler <dsandler@android.com> | 2012-08-15 00:09:26 -0400 |
---|---|---|
committer | Daniel Sandler <dsandler@android.com> | 2012-08-15 09:52:43 -0400 |
commit | 8e72c9e19cfb0b6c1463fa841f1dd02be8f3b4e1 (patch) | |
tree | e96bfb75bf13ec2fa65c8cf2c5af5518d16fa33b /packages/SystemUI | |
parent | f8d9e2fccdd9f2addeda852ad168eeb67a5f6626 (diff) | |
download | frameworks_base-8e72c9e19cfb0b6c1463fa841f1dd02be8f3b4e1.zip frameworks_base-8e72c9e19cfb0b6c1463fa841f1dd02be8f3b4e1.tar.gz frameworks_base-8e72c9e19cfb0b6c1463fa841f1dd02be8f3b4e1.tar.bz2 |
Quick settings come to all Android devices.
I mean, real soon now.
Change-Id: I9a15b49f271e7ae06eb48a402f58270d8adccbf4
Diffstat (limited to 'packages/SystemUI')
10 files changed, 108 insertions, 23 deletions
diff --git a/packages/SystemUI/res/drawable-nodpi/qs_coming_soon.png b/packages/SystemUI/res/drawable-nodpi/qs_coming_soon.png Binary files differnew file mode 100644 index 0000000..47c89b1 --- /dev/null +++ b/packages/SystemUI/res/drawable-nodpi/qs_coming_soon.png diff --git a/packages/SystemUI/res/layout-sw600dp/super_status_bar.xml b/packages/SystemUI/res/layout-sw600dp/super_status_bar.xml index 47c511c..b68632a 100644 --- a/packages/SystemUI/res/layout-sw600dp/super_status_bar.xml +++ b/packages/SystemUI/res/layout-sw600dp/super_status_bar.xml @@ -36,11 +36,17 @@ android:id="@+id/panel_holder" android:layout_width="match_parent" android:layout_height="match_parent" + android:layout_marginTop="@*android:dimen/status_bar_height" > <include layout="@layout/status_bar_expanded" android:layout_width="@dimen/notification_panel_width" android:layout_height="wrap_content" - android:layout_gravity="center_horizontal|top" + android:layout_gravity="left|top" + /> + <include layout="@layout/quick_settings" + android:layout_width="@dimen/notification_panel_width" + android:layout_height="wrap_content" + android:layout_gravity="right|top" /> </com.android.systemui.statusbar.phone.PanelHolder> </com.android.systemui.statusbar.phone.StatusBarWindowView> diff --git a/packages/SystemUI/res/layout/quick_settings.xml b/packages/SystemUI/res/layout/quick_settings.xml new file mode 100644 index 0000000..a62a470 --- /dev/null +++ b/packages/SystemUI/res/layout/quick_settings.xml @@ -0,0 +1,45 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- Copyright (C) 2012 The Android Open Source Project + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +--> + +<com.android.systemui.statusbar.phone.PanelView + xmlns:android="http://schemas.android.com/apk/res/android" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:id="@+id/settings_panel" + > + <ImageView + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:scaleType="centerInside" + android:src="@drawable/qs_coming_soon" + android:padding="4dp" + android:background="#80000080" + /> + <LinearLayout android:id="@+id/handle" + android:layout_width="match_parent" + android:layout_height="@dimen/close_handle_height" + android:layout_gravity="bottom" + android:orientation="vertical" + > + <ImageView + android:layout_width="match_parent" + android:layout_height="@dimen/close_handle_height" + android:layout_gravity="bottom" + android:scaleType="fitXY" + android:src="@drawable/status_bar_close" + /> + </LinearLayout> +</com.android.systemui.statusbar.phone.PanelView>
\ No newline at end of file diff --git a/packages/SystemUI/res/layout/super_status_bar.xml b/packages/SystemUI/res/layout/super_status_bar.xml index ad905bd..ad6b8f4 100644 --- a/packages/SystemUI/res/layout/super_status_bar.xml +++ b/packages/SystemUI/res/layout/super_status_bar.xml @@ -36,11 +36,16 @@ android:id="@+id/panel_holder" android:layout_width="match_parent" android:layout_height="match_parent" + android:layout_marginTop="@*android:dimen/status_bar_height" > <include layout="@layout/status_bar_expanded" android:layout_width="match_parent" android:layout_height="wrap_content" /> + <include layout="@layout/quick_settings" + android:layout_width="match_parent" + android:layout_height="wrap_content" + /> </com.android.systemui.statusbar.phone.PanelHolder> </com.android.systemui.statusbar.phone.StatusBarWindowView> diff --git a/packages/SystemUI/res/values-sw600dp-land/dimens.xml b/packages/SystemUI/res/values-sw600dp-land/dimens.xml index afa0b20..c6c0719 100644 --- a/packages/SystemUI/res/values-sw600dp-land/dimens.xml +++ b/packages/SystemUI/res/values-sw600dp-land/dimens.xml @@ -19,8 +19,4 @@ <!-- Layout parameters for the notification panel --> <dimen name="notification_panel_margin_bottom">0dp</dimen> <dimen name="notification_panel_margin_left">32dp</dimen> - - <!-- Gravity for the notification panel --> - <!-- 0x33 = left|top --> - <integer name="notification_panel_layout_gravity">0x33</integer> </resources> diff --git a/packages/SystemUI/res/values-sw600dp/dimens.xml b/packages/SystemUI/res/values-sw600dp/dimens.xml index 2b5248f..b6faff3 100644 --- a/packages/SystemUI/res/values-sw600dp/dimens.xml +++ b/packages/SystemUI/res/values-sw600dp/dimens.xml @@ -21,11 +21,12 @@ <!-- Layout parameters for the notification panel --> <dimen name="notification_panel_margin_bottom">192dp</dimen> - <dimen name="notification_panel_margin_left">0dp</dimen> + <dimen name="notification_panel_margin_left">16dp</dimen> - <!-- Gravity for the notification panel --> - <!-- 0x33 = center_horizontal|top --> - <integer name="notification_panel_layout_gravity">0x31</integer> + <!-- Gravity for the notification & quick settings panels --> + <!-- 0x33 = left|top ; 0x35 = right|top --> + <integer name="notification_panel_layout_gravity">0x33</integer> + <integer name="settings_panel_layout_gravity">0x35</integer> <!-- Diameter of outer shape drawable shown in navbar search--> <dimen name="navbar_search_outerring_diameter">430dip</dimen> diff --git a/packages/SystemUI/res/values/dimens.xml b/packages/SystemUI/res/values/dimens.xml index 8204e95..9539373 100644 --- a/packages/SystemUI/res/values/dimens.xml +++ b/packages/SystemUI/res/values/dimens.xml @@ -158,9 +158,10 @@ <dimen name="notification_panel_margin_bottom">0dp</dimen> <dimen name="notification_panel_margin_left">0dp</dimen> - <!-- Gravity for the notification panel --> + <!-- Gravity for the notification & quick settings panels --> <!-- 0x37 = fill_horizontal|top --> <integer name="notification_panel_layout_gravity">0x37</integer> + <integer name="settings_panel_layout_gravity">0x37</integer> <!-- Height of the carrier/wifi name label --> <dimen name="carrier_label_height">24dp</dimen> diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PanelBar.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PanelBar.java index b2c72e8..1ea5b3e 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PanelBar.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PanelBar.java @@ -18,7 +18,7 @@ public class PanelBar extends FrameLayout { private PanelHolder mPanelHolder; private ArrayList<PanelView> mPanels = new ArrayList<PanelView>(); - private PanelView mTouchingPanel; + protected PanelView mTouchingPanel; public PanelBar(Context context, AttributeSet attrs) { super(context, attrs); @@ -71,24 +71,25 @@ public class PanelBar extends FrameLayout { public void panelExpansionChanged(PanelView panel, float frac) { boolean fullyClosed = true; - boolean fullyOpened = false; + PanelView fullyOpenedPanel = null; for (PanelView pv : mPanels) { if (pv.getExpandedHeight() > 0f) { fullyClosed = false; final float thisFrac = pv.getExpandedFraction(); LOG("panel %s: f=%.1f", pv, thisFrac); if (panel == pv) { - if (thisFrac == 1f) fullyOpened = true; + if (thisFrac == 1f) fullyOpenedPanel = panel; } else { pv.setExpandedFraction(1f-frac); } } } - if (fullyOpened) onPanelFullyOpened(); + if (fullyOpenedPanel != null) onPanelFullyOpened(fullyOpenedPanel); if (fullyClosed) onAllPanelsCollapsed(); else onPanelPeeked(); - LOG("panelExpansionChanged: [%s%s ]", fullyOpened?" fullyOpened":"", fullyClosed?" fullyClosed":""); + LOG("panelExpansionChanged: [%s%s ]", + (fullyOpenedPanel!=null)?" fullyOpened":"", fullyClosed?" fullyClosed":""); } public void collapseAllPanels(boolean animate) { @@ -109,7 +110,7 @@ public class PanelBar extends FrameLayout { LOG("onAllPanelsCollapsed"); } - public void onPanelFullyOpened() { + public void onPanelFullyOpened(PanelView openPanel) { LOG("onPanelFullyOpened"); } } 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 0f84c2f..4d4adcb 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java @@ -169,12 +169,16 @@ public class PhoneStatusBar extends BaseStatusBar { PanelView mNotificationPanel; // the sliding/resizing panel within the notification window ScrollView mScrollView; View mExpandedContents; - int mNotificationPanelMarginBottomPx, mNotificationPanelMarginLeftPx; final Rect mNotificationPanelBackgroundPadding = new Rect(); int mNotificationPanelGravity; + int mNotificationPanelMarginBottomPx, mNotificationPanelMarginPx; int mNotificationPanelMinHeight; boolean mNotificationPanelIsFullScreenWidth; + // settings + PanelView mSettingsPanel; + int mSettingsPanelGravity; + // top bar View mClearButton; View mSettingsButton; @@ -310,22 +314,29 @@ public class PhoneStatusBar extends BaseStatusBar { mNotificationPanel = (PanelView) mStatusBarWindow.findViewById(R.id.notification_panel); // don't allow clicks on the panel to pass through to the background where they will cause the panel to close - mNotificationPanel.setOnTouchListener(new View.OnTouchListener() { + View.OnTouchListener clickStopper = new View.OnTouchListener() { @Override public boolean onTouch(View v, MotionEvent event) { return true; } - }); + }; + mNotificationPanel.setOnTouchListener(clickStopper); mNotificationPanelIsFullScreenWidth = (mNotificationPanel.getLayoutParams().width == ViewGroup.LayoutParams.MATCH_PARENT); mNotificationPanel.setSystemUiVisibility( View.STATUS_BAR_DISABLE_NOTIFICATION_TICKER | (mNotificationPanelIsFullScreenWidth ? 0 : View.STATUS_BAR_DISABLE_SYSTEM_INFO)); + // quick settings (WIP) + mSettingsPanel = (PanelView) mStatusBarWindow.findViewById(R.id.settings_panel); + mSettingsPanel.setOnTouchListener(clickStopper); + if (!ActivityManager.isHighEndGfx(mDisplay)) { mStatusBarWindow.setBackground(null); mNotificationPanel.setBackground(new FastColorDrawable(context.getResources().getColor( R.color.notification_panel_solid_background))); + mSettingsPanel.setBackground(new FastColorDrawable(context.getResources().getColor( + R.color.notification_panel_solid_background))); } if (ENABLE_INTRUDERS) { mIntruderAlertView = (IntruderAlertView) View.inflate(context, R.layout.intruder_alert, null); @@ -1634,8 +1645,12 @@ public class PhoneStatusBar extends BaseStatusBar { if (DEBUG) Slog.v(TAG, "updateExpandedViewPos"); FrameLayout.LayoutParams lp = (FrameLayout.LayoutParams) mNotificationPanel.getLayoutParams(); lp.gravity = mNotificationPanelGravity; - lp.leftMargin = mNotificationPanelMarginLeftPx; + lp.leftMargin = mNotificationPanelMarginPx; mNotificationPanel.setLayoutParams(lp); + lp = (FrameLayout.LayoutParams) mSettingsPanel.getLayoutParams(); + lp.gravity = mSettingsPanelGravity; + lp.rightMargin = mNotificationPanelMarginPx; + mSettingsPanel.setLayoutParams(lp); } // called by makeStatusbar and also by PhoneStatusBarView @@ -1872,11 +1887,15 @@ public class PhoneStatusBar extends BaseStatusBar { mNotificationPanelMarginBottomPx = (int) res.getDimension(R.dimen.notification_panel_margin_bottom); - mNotificationPanelMarginLeftPx + mNotificationPanelMarginPx = (int) res.getDimension(R.dimen.notification_panel_margin_left); mNotificationPanelGravity = res.getInteger(R.integer.notification_panel_layout_gravity); if (mNotificationPanelGravity <= 0) { - mNotificationPanelGravity = Gravity.CENTER_VERTICAL | Gravity.TOP; + mNotificationPanelGravity = Gravity.LEFT | Gravity.TOP; + } + mSettingsPanelGravity = res.getInteger(R.integer.settings_panel_layout_gravity); + if (mSettingsPanelGravity <= 0) { + mSettingsPanelGravity = Gravity.RIGHT | Gravity.TOP; } getNinePatchPadding(res.getDrawable(R.drawable.notification_panel_bg), mNotificationPanelBackgroundPadding); final int notificationPanelDecorationHeight = diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBarView.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBarView.java index 6de0153..25ff9aa 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBarView.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBarView.java @@ -42,6 +42,7 @@ public class PhoneStatusBarView extends PanelBar { private static final String TAG = "PhoneStatusBarView"; PhoneStatusBar mBar; int mScrimColor; + PanelView mFadingPanel = null; public PhoneStatusBarView(Context context, AttributeSet attrs) { super(context, attrs); @@ -76,12 +77,21 @@ public class PhoneStatusBarView extends PanelBar { public void onPanelPeeked() { super.onPanelPeeked(); mBar.makeExpandedVisible(true); + if (mFadingPanel == null) { + mFadingPanel = mTouchingPanel; + } } @Override public void onAllPanelsCollapsed() { super.onAllPanelsCollapsed(); mBar.makeExpandedInvisible(); + mFadingPanel = null; + } + + @Override + public void onPanelFullyOpened(PanelView openPanel) { + mFadingPanel = openPanel; } @Override @@ -98,7 +108,8 @@ public class PhoneStatusBarView extends PanelBar { public void panelExpansionChanged(PanelView pv, float frac) { super.panelExpansionChanged(pv, frac); - if (mScrimColor != 0 && ActivityManager.isHighEndGfx(mBar.mDisplay)) { + if (mFadingPanel == pv + && mScrimColor != 0 && ActivityManager.isHighEndGfx(mBar.mDisplay)) { // woo, special effects final float k = (float)(1f-0.5f*(1f-Math.cos(3.14159f * Math.pow(1f-frac, 2.2f)))); // attenuate background color alpha by k |