am d8893d93: am 5a426f6c: Merge "Full-height panels on phones." into jb-mr1-dev

* commit 'd8893d931dce9149690d379bbb768f948ad1e25e':
  Full-height panels on phones.
This commit is contained in:
Daniel Sandler
2012-09-05 09:38:35 -07:00
committed by Android Git Automerger
7 changed files with 78 additions and 27 deletions

View File

@@ -0,0 +1,23 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
/*
** Copyright 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.
*/
-->
<Space
xmlns:android="http://schemas.android.com/apk/res/android"
android:visibility="gone"
/>

View File

@@ -0,0 +1,30 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
/*
** Copyright 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.
*/
-->
<TextView
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/carrier_label"
android:textAppearance="@style/TextAppearance.StatusBar.Expanded.Network"
android:layout_height="@dimen/carrier_label_height"
android:layout_width="match_parent"
android:layout_gravity="bottom"
android:layout_marginBottom="@dimen/close_handle_height"
android:gravity="center"
android:visibility="invisible"
/>

View File

@@ -19,6 +19,7 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/settings_panel"
android:background="#80000080"
>
<ImageView
android:layout_width="match_parent"
@@ -26,7 +27,6 @@
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"

View File

@@ -29,15 +29,10 @@
android:layout_marginLeft="@dimen/notification_panel_margin_left"
>
<TextView
android:id="@+id/carrier_label"
android:textAppearance="@style/TextAppearance.StatusBar.Expanded.Network"
<include
layout="@layout/carrier_label"
android:layout_height="@dimen/carrier_label_height"
android:layout_width="match_parent"
android:layout_gravity="bottom"
android:layout_marginBottom="@dimen/close_handle_height"
android:gravity="center"
android:visibility="invisible"
/>
<LinearLayout

View File

@@ -40,11 +40,11 @@
>
<include layout="@layout/status_bar_expanded"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_height="match_parent"
/>
<include layout="@layout/quick_settings"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_height="match_parent"
/>
</com.android.systemui.statusbar.phone.PanelHolder>

View File

@@ -5,7 +5,7 @@ import android.animation.TimeAnimator.TimeListener;
import android.content.Context;
import android.content.res.Resources;
import android.util.AttributeSet;
import android.util.Log;
import android.util.Slog;
import android.view.MotionEvent;
import android.view.VelocityTracker;
import android.view.View;
@@ -18,7 +18,7 @@ public class PanelView extends FrameLayout {
public static final String TAG = PanelView.class.getSimpleName();
public final void LOG(String fmt, Object... args) {
if (!DEBUG) return;
Log.v(TAG, (mViewName != null ? (mViewName + ": ") : "") + String.format(fmt, args));
Slog.v(TAG, (mViewName != null ? (mViewName + ": ") : "") + String.format(fmt, args));
}
public static final boolean BRAKES = false;
@@ -175,6 +175,12 @@ public class PanelView extends FrameLayout {
event.offsetLocation(-deltaX, -deltaY);
}
// Pass all touches along to the handle, allowing the user to drag the panel closed from its interior
@Override
public boolean onTouchEvent(MotionEvent event) {
return mHandleView.dispatchTouchEvent(event);
}
@Override
protected void onFinishInflate() {
super.onFinishInflate();

View File

@@ -109,8 +109,6 @@ public class PhoneStatusBar extends BaseStatusBar {
public static final String ACTION_STATUSBAR_START
= "com.android.internal.policy.statusbar.START";
private static final boolean SHOW_CARRIER_LABEL = false; // XXX: doesn't work with rubberband panels right now
private static final int MSG_OPEN_NOTIFICATION_PANEL = 1000;
private static final int MSG_CLOSE_NOTIFICATION_PANEL = 1001;
// 1020-1030 reserved for BaseStatusBar
@@ -189,6 +187,9 @@ public class PhoneStatusBar extends BaseStatusBar {
private boolean mCarrierLabelVisible = false;
private int mCarrierLabelHeight;
private TextView mEmergencyCallLabel;
private int mNotificationHeaderHeight;
private boolean mShowCarrierInPanel = false;
// position
int[] mPositionTmp = new int[2];
@@ -310,14 +311,6 @@ public class PhoneStatusBar extends BaseStatusBar {
mStatusBarView.setPanelHolder(holder);
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
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(
@@ -326,7 +319,6 @@ public class PhoneStatusBar extends BaseStatusBar {
// quick settings (WIP)
mSettingsPanel = (PanelView) mStatusBarWindow.findViewById(R.id.settings_panel);
mSettingsPanel.setOnTouchListener(clickStopper);
if (!ActivityManager.isHighEndGfx()) {
mStatusBarWindow.setBackground(null);
@@ -419,8 +411,10 @@ public class PhoneStatusBar extends BaseStatusBar {
}});
}
if (SHOW_CARRIER_LABEL) {
mCarrierLabel = (TextView)mStatusBarWindow.findViewById(R.id.carrier_label);
mCarrierLabel = (TextView)mStatusBarWindow.findViewById(R.id.carrier_label);
mShowCarrierInPanel = (mCarrierLabel != null);
Slog.v(TAG, "carrierlabel=" + mCarrierLabel + " show=" + mShowCarrierInPanel);
if (mShowCarrierInPanel) {
mCarrierLabel.setVisibility(mCarrierLabelVisible ? View.VISIBLE : View.INVISIBLE);
// for mobile devices, we always show mobile connection info here (SPN/PLMN)
@@ -867,7 +861,7 @@ public class PhoneStatusBar extends BaseStatusBar {
}
protected void updateCarrierLabelVisibility(boolean force) {
if (!SHOW_CARRIER_LABEL) return;
if (!mShowCarrierInPanel) return;
// The idea here is to only show the carrier label when there is enough room to see it,
// i.e. when there aren't enough notifications to fill the panel.
if (DEBUG) {
@@ -878,7 +872,7 @@ public class PhoneStatusBar extends BaseStatusBar {
final boolean emergencyCallsShownElsewhere = mEmergencyCallLabel != null;
final boolean makeVisible =
!(emergencyCallsShownElsewhere && mNetworkController.isEmergencyOnly())
&& mPile.getHeight() < (mScrollView.getHeight() - mCarrierLabelHeight);
&& mPile.getHeight() < (mNotificationPanel.getHeight() - mCarrierLabelHeight - mNotificationHeaderHeight);
if (force || mCarrierLabelVisible != makeVisible) {
mCarrierLabelVisible = makeVisible;
@@ -1631,6 +1625,8 @@ public class PhoneStatusBar extends BaseStatusBar {
lp.gravity = mSettingsPanelGravity;
lp.rightMargin = mNotificationPanelMarginPx;
mSettingsPanel.setLayoutParams(lp);
updateCarrierLabelVisibility(false);
}
// called by makeStatusbar and also by PhoneStatusBarView
@@ -1905,6 +1901,7 @@ public class PhoneStatusBar extends BaseStatusBar {
+ res.getDimensionPixelSize(R.dimen.close_handle_underlap);
mCarrierLabelHeight = res.getDimensionPixelSize(R.dimen.carrier_label_height);
mNotificationHeaderHeight = res.getDimensionPixelSize(R.dimen.notification_panel_header_height);
if (false) Slog.v(TAG, "updateResources");
}