Skip to content

Commit bf526d1

Browse files
committed
Full-height panels on phones.
The dynamic carrier label is also back for those devices. Finally, allow the panel to be dragged just by touching the (newly reopened) empty area. Bug: 6999596 Change-Id: I65f2867f1bd1977270de0bcedd32cb7141fcb6b1
1 parent e94831e commit bf526d1

File tree

7 files changed

+78
-27
lines changed

7 files changed

+78
-27
lines changed
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<!--
3+
/*
4+
** Copyright 2012, The Android Open Source Project
5+
**
6+
** Licensed under the Apache License, Version 2.0 (the "License");
7+
** you may not use this file except in compliance with the License.
8+
** You may obtain a copy of the License at
9+
**
10+
** http://www.apache.org/licenses/LICENSE-2.0
11+
**
12+
** Unless required by applicable law or agreed to in writing, software
13+
** distributed under the License is distributed on an "AS IS" BASIS,
14+
** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15+
** See the License for the specific language governing permissions and
16+
** limitations under the License.
17+
*/
18+
-->
19+
20+
<Space
21+
xmlns:android="http://schemas.android.com/apk/res/android"
22+
android:visibility="gone"
23+
/>
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<!--
3+
/*
4+
** Copyright 2012, The Android Open Source Project
5+
**
6+
** Licensed under the Apache License, Version 2.0 (the "License");
7+
** you may not use this file except in compliance with the License.
8+
** You may obtain a copy of the License at
9+
**
10+
** http://www.apache.org/licenses/LICENSE-2.0
11+
**
12+
** Unless required by applicable law or agreed to in writing, software
13+
** distributed under the License is distributed on an "AS IS" BASIS,
14+
** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15+
** See the License for the specific language governing permissions and
16+
** limitations under the License.
17+
*/
18+
-->
19+
20+
<TextView
21+
xmlns:android="http://schemas.android.com/apk/res/android"
22+
android:id="@+id/carrier_label"
23+
android:textAppearance="@style/TextAppearance.StatusBar.Expanded.Network"
24+
android:layout_height="@dimen/carrier_label_height"
25+
android:layout_width="match_parent"
26+
android:layout_gravity="bottom"
27+
android:layout_marginBottom="@dimen/close_handle_height"
28+
android:gravity="center"
29+
android:visibility="invisible"
30+
/>

packages/SystemUI/res/layout/quick_settings.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,14 +19,14 @@
1919
android:layout_width="match_parent"
2020
android:layout_height="wrap_content"
2121
android:id="@+id/settings_panel"
22+
android:background="#80000080"
2223
>
2324
<ImageView
2425
android:layout_width="match_parent"
2526
android:layout_height="wrap_content"
2627
android:scaleType="centerInside"
2728
android:src="@drawable/qs_coming_soon"
2829
android:padding="4dp"
29-
android:background="#80000080"
3030
/>
3131
<LinearLayout android:id="@+id/handle"
3232
android:layout_width="match_parent"

packages/SystemUI/res/layout/status_bar_expanded.xml

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -29,15 +29,10 @@
2929
android:layout_marginLeft="@dimen/notification_panel_margin_left"
3030
>
3131

32-
<TextView
33-
android:id="@+id/carrier_label"
34-
android:textAppearance="@style/TextAppearance.StatusBar.Expanded.Network"
32+
<include
33+
layout="@layout/carrier_label"
3534
android:layout_height="@dimen/carrier_label_height"
3635
android:layout_width="match_parent"
37-
android:layout_gravity="bottom"
38-
android:layout_marginBottom="@dimen/close_handle_height"
39-
android:gravity="center"
40-
android:visibility="invisible"
4136
/>
4237

4338
<LinearLayout

packages/SystemUI/res/layout/super_status_bar.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,11 +40,11 @@
4040
>
4141
<include layout="@layout/status_bar_expanded"
4242
android:layout_width="match_parent"
43-
android:layout_height="wrap_content"
43+
android:layout_height="match_parent"
4444
/>
4545
<include layout="@layout/quick_settings"
4646
android:layout_width="match_parent"
47-
android:layout_height="wrap_content"
47+
android:layout_height="match_parent"
4848
/>
4949
</com.android.systemui.statusbar.phone.PanelHolder>
5050

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

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
import android.content.Context;
66
import android.content.res.Resources;
77
import android.util.AttributeSet;
8-
import android.util.Log;
8+
import android.util.Slog;
99
import android.view.MotionEvent;
1010
import android.view.VelocityTracker;
1111
import android.view.View;
@@ -18,7 +18,7 @@ public class PanelView extends FrameLayout {
1818
public static final String TAG = PanelView.class.getSimpleName();
1919
public final void LOG(String fmt, Object... args) {
2020
if (!DEBUG) return;
21-
Log.v(TAG, (mViewName != null ? (mViewName + ": ") : "") + String.format(fmt, args));
21+
Slog.v(TAG, (mViewName != null ? (mViewName + ": ") : "") + String.format(fmt, args));
2222
}
2323

2424
public static final boolean BRAKES = false;
@@ -175,6 +175,12 @@ private void trackMovement(MotionEvent event) {
175175
event.offsetLocation(-deltaX, -deltaY);
176176
}
177177

178+
// Pass all touches along to the handle, allowing the user to drag the panel closed from its interior
179+
@Override
180+
public boolean onTouchEvent(MotionEvent event) {
181+
return mHandleView.dispatchTouchEvent(event);
182+
}
183+
178184
@Override
179185
protected void onFinishInflate() {
180186
super.onFinishInflate();

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

Lines changed: 12 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -109,8 +109,6 @@ public class PhoneStatusBar extends BaseStatusBar {
109109
public static final String ACTION_STATUSBAR_START
110110
= "com.android.internal.policy.statusbar.START";
111111

112-
private static final boolean SHOW_CARRIER_LABEL = false; // XXX: doesn't work with rubberband panels right now
113-
114112
private static final int MSG_OPEN_NOTIFICATION_PANEL = 1000;
115113
private static final int MSG_CLOSE_NOTIFICATION_PANEL = 1001;
116114
// 1020-1030 reserved for BaseStatusBar
@@ -189,6 +187,9 @@ public class PhoneStatusBar extends BaseStatusBar {
189187
private boolean mCarrierLabelVisible = false;
190188
private int mCarrierLabelHeight;
191189
private TextView mEmergencyCallLabel;
190+
private int mNotificationHeaderHeight;
191+
192+
private boolean mShowCarrierInPanel = false;
192193

193194
// position
194195
int[] mPositionTmp = new int[2];
@@ -310,14 +311,6 @@ public boolean onTouch(View v, MotionEvent event) {
310311
mStatusBarView.setPanelHolder(holder);
311312

312313
mNotificationPanel = (PanelView) mStatusBarWindow.findViewById(R.id.notification_panel);
313-
// don't allow clicks on the panel to pass through to the background where they will cause the panel to close
314-
View.OnTouchListener clickStopper = new View.OnTouchListener() {
315-
@Override
316-
public boolean onTouch(View v, MotionEvent event) {
317-
return true;
318-
}
319-
};
320-
mNotificationPanel.setOnTouchListener(clickStopper);
321314
mNotificationPanelIsFullScreenWidth =
322315
(mNotificationPanel.getLayoutParams().width == ViewGroup.LayoutParams.MATCH_PARENT);
323316
mNotificationPanel.setSystemUiVisibility(
@@ -326,7 +319,6 @@ public boolean onTouch(View v, MotionEvent event) {
326319

327320
// quick settings (WIP)
328321
mSettingsPanel = (PanelView) mStatusBarWindow.findViewById(R.id.settings_panel);
329-
mSettingsPanel.setOnTouchListener(clickStopper);
330322

331323
if (!ActivityManager.isHighEndGfx()) {
332324
mStatusBarWindow.setBackground(null);
@@ -419,8 +411,10 @@ public void onLayoutChange(View v, int left, int top, int right, int bottom,
419411
}});
420412
}
421413

422-
if (SHOW_CARRIER_LABEL) {
423-
mCarrierLabel = (TextView)mStatusBarWindow.findViewById(R.id.carrier_label);
414+
mCarrierLabel = (TextView)mStatusBarWindow.findViewById(R.id.carrier_label);
415+
mShowCarrierInPanel = (mCarrierLabel != null);
416+
Slog.v(TAG, "carrierlabel=" + mCarrierLabel + " show=" + mShowCarrierInPanel);
417+
if (mShowCarrierInPanel) {
424418
mCarrierLabel.setVisibility(mCarrierLabelVisible ? View.VISIBLE : View.INVISIBLE);
425419

426420
// for mobile devices, we always show mobile connection info here (SPN/PLMN)
@@ -880,7 +874,7 @@ protected void updateNotificationIcons() {
880874
}
881875

882876
protected void updateCarrierLabelVisibility(boolean force) {
883-
if (!SHOW_CARRIER_LABEL) return;
877+
if (!mShowCarrierInPanel) return;
884878
// The idea here is to only show the carrier label when there is enough room to see it,
885879
// i.e. when there aren't enough notifications to fill the panel.
886880
if (DEBUG) {
@@ -891,7 +885,7 @@ protected void updateCarrierLabelVisibility(boolean force) {
891885
final boolean emergencyCallsShownElsewhere = mEmergencyCallLabel != null;
892886
final boolean makeVisible =
893887
!(emergencyCallsShownElsewhere && mNetworkController.isEmergencyOnly())
894-
&& mPile.getHeight() < (mScrollView.getHeight() - mCarrierLabelHeight);
888+
&& mPile.getHeight() < (mNotificationPanel.getHeight() - mCarrierLabelHeight - mNotificationHeaderHeight);
895889

896890
if (force || mCarrierLabelVisible != makeVisible) {
897891
mCarrierLabelVisible = makeVisible;
@@ -1644,6 +1638,8 @@ public void updateExpandedViewPos(int thingy) {
16441638
lp.gravity = mSettingsPanelGravity;
16451639
lp.rightMargin = mNotificationPanelMarginPx;
16461640
mSettingsPanel.setLayoutParams(lp);
1641+
1642+
updateCarrierLabelVisibility(false);
16471643
}
16481644

16491645
// called by makeStatusbar and also by PhoneStatusBarView
@@ -1918,6 +1914,7 @@ protected void loadDimens() {
19181914
+ res.getDimensionPixelSize(R.dimen.close_handle_underlap);
19191915

19201916
mCarrierLabelHeight = res.getDimensionPixelSize(R.dimen.carrier_label_height);
1917+
mNotificationHeaderHeight = res.getDimensionPixelSize(R.dimen.notification_panel_header_height);
19211918

19221919
if (false) Slog.v(TAG, "updateResources");
19231920
}

0 commit comments

Comments
 (0)