am 9cc9aeb0: Merge "Quick settings come to all Android devices." into jb-mr1-dev

* commit '9cc9aeb07c9218dbcedb08107e298f1fddbbf235':
  Quick settings come to all Android devices.
This commit is contained in:
Daniel Sandler
2012-08-15 06:55:35 -07:00
committed by Android Git Automerger
10 changed files with 108 additions and 23 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 29 KiB

View File

@@ -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>

View File

@@ -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>

View File

@@ -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>

View File

@@ -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>

View File

@@ -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>

View File

@@ -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>

View File

@@ -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");
}
}

View File

@@ -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 =

View File

@@ -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