diff options
author | Daniel Sandler <dsandler@android.com> | 2012-07-27 15:46:20 -0700 |
---|---|---|
committer | Android Git Automerger <android-git-automerger@android.com> | 2012-07-27 15:46:20 -0700 |
commit | 5cb62df6bdac4aaab7a1c1b1ef849ec213ff028b (patch) | |
tree | e109375f1935cf0b7f7ca1760dd2743a196deccf /packages/SystemUI | |
parent | 587616a670cfa4dc532e30643052b428cd376138 (diff) | |
parent | dd4ef49f4545dad2a6503d29e129472aba5392fc (diff) | |
download | frameworks_base-5cb62df6bdac4aaab7a1c1b1ef849ec213ff028b.zip frameworks_base-5cb62df6bdac4aaab7a1c1b1ef849ec213ff028b.tar.gz frameworks_base-5cb62df6bdac4aaab7a1c1b1ef849ec213ff028b.tar.bz2 |
am dd4ef49f: Persistent \'emergency calls\' banner in the notification panel.
* commit 'dd4ef49f4545dad2a6503d29e129472aba5392fc':
Persistent 'emergency calls' banner in the notification panel.
Diffstat (limited to 'packages/SystemUI')
4 files changed, 69 insertions, 20 deletions
diff --git a/packages/SystemUI/res/layout/status_bar_expanded.xml b/packages/SystemUI/res/layout/status_bar_expanded.xml index 47e5b71..5841978 100644 --- a/packages/SystemUI/res/layout/status_bar_expanded.xml +++ b/packages/SystemUI/res/layout/status_bar_expanded.xml @@ -40,24 +40,34 @@ android:visibility="invisible" /> - <FrameLayout + <LinearLayout android:layout_width="match_parent" android:layout_height="match_parent" android:layout_marginBottom="@dimen/close_handle_underlap" + android:orientation="vertical" > <include layout="@layout/status_bar_expanded_header" android:layout_width="match_parent" android:layout_height="@dimen/notification_panel_header_height" /> - + + <TextView + android:id="@+id/emergency_calls_only" + android:textAppearance="@style/TextAppearance.StatusBar.Expanded.Network.EmergencyOnly" + android:layout_height="wrap_content" + android:layout_width="match_parent" + android:paddingBottom="4dp" + android:gravity="center" + android:visibility="gone" + /> + <ScrollView android:id="@+id/scroll" android:layout_width="match_parent" android:layout_height="match_parent" android:fadingEdge="none" - android:overScrollMode="ifContentScrolls" - android:layout_marginTop="@dimen/notification_panel_header_height" + android:overScrollMode="always" > <com.android.systemui.statusbar.policy.NotificationRowLayout android:id="@+id/latestItems" @@ -66,7 +76,7 @@ systemui:rowHeight="@dimen/notification_row_min_height" /> </ScrollView> - </FrameLayout> + </LinearLayout> <com.android.systemui.statusbar.phone.CloseDragHandle android:id="@+id/close" android:layout_width="match_parent" diff --git a/packages/SystemUI/res/values/styles.xml b/packages/SystemUI/res/values/styles.xml index 1d5bf3c..2564003 100644 --- a/packages/SystemUI/res/values/styles.xml +++ b/packages/SystemUI/res/values/styles.xml @@ -67,6 +67,9 @@ <item name="android:textColor">#999999</item> </style> + <style name="TextAppearance.StatusBar.Expanded.Network.EmergencyOnly"> + </style> + <style name="Animation" /> <style name="Animation.ShirtPocketPanel"> 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 c337ebe..2f22cae 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java @@ -182,6 +182,7 @@ public class PhoneStatusBar extends BaseStatusBar { private TextView mCarrierLabel; private boolean mCarrierLabelVisible = false; private int mCarrierLabelHeight; + private TextView mEmergencyCallLabel; // drag bar CloseDragHandle mCloseView; @@ -409,14 +410,6 @@ public class PhoneStatusBar extends BaseStatusBar { mPile = (NotificationRowLayout)mStatusBarWindow.findViewById(R.id.latestItems); mPile.setLayoutTransitionsEnabled(false); mPile.setLongPressListener(getNotificationLongClicker()); - if (SHOW_CARRIER_LABEL) { - mPile.setOnSizeChangedListener(new OnSizeChangedListener() { - @Override - public void onSizeChanged(View view, int w, int h, int oldw, int oldh) { - updateCarrierLabelVisibility(false); - } - }); - } mExpandedContents = mPile; // was: expanded.findViewById(R.id.notificationLinearLayout); mClearButton = mStatusBarWindow.findViewById(R.id.clear_all_button); @@ -429,9 +422,6 @@ public class PhoneStatusBar extends BaseStatusBar { mSettingsButton.setOnClickListener(mSettingsButtonListener); mRotationButton = (RotationToggle) mStatusBarWindow.findViewById(R.id.rotation_lock_button); - mCarrierLabel = (TextView)mStatusBarWindow.findViewById(R.id.carrier_label); - mCarrierLabel.setVisibility(mCarrierLabelVisible ? View.VISIBLE : View.INVISIBLE); - mScrollView = (ScrollView)mStatusBarWindow.findViewById(R.id.scroll); mScrollView.setVerticalScrollBarEnabled(false); // less drawing during pulldowns @@ -460,7 +450,21 @@ public class PhoneStatusBar extends BaseStatusBar { mNetworkController.addSignalCluster(signalCluster); signalCluster.setNetworkController(mNetworkController); + mEmergencyCallLabel = (TextView)mStatusBarWindow.findViewById(R.id.emergency_calls_only); + if (mEmergencyCallLabel != null) { + mNetworkController.addEmergencyLabelView(mEmergencyCallLabel); + mEmergencyCallLabel.addOnLayoutChangeListener(new View.OnLayoutChangeListener() { + @Override + public void onLayoutChange(View v, int left, int top, int right, int bottom, + int oldLeft, int oldTop, int oldRight, int oldBottom) { + updateCarrierLabelVisibility(false); + }}); + } + if (SHOW_CARRIER_LABEL) { + mCarrierLabel = (TextView)mStatusBarWindow.findViewById(R.id.carrier_label); + mCarrierLabel.setVisibility(mCarrierLabelVisible ? View.VISIBLE : View.INVISIBLE); + // for mobile devices, we always show mobile connection info here (SPN/PLMN) // for other devices, we show whatever network is connected if (mNetworkController.hasMobileDataFeature()) { @@ -468,6 +472,14 @@ public class PhoneStatusBar extends BaseStatusBar { } else { mNetworkController.addCombinedLabelView(mCarrierLabel); } + + // set up the dynamic hide/show of the label + mPile.setOnSizeChangedListener(new OnSizeChangedListener() { + @Override + public void onSizeChanged(View view, int w, int h, int oldw, int oldh) { + updateCarrierLabelVisibility(false); + } + }); } // final ImageView wimaxRSSI = @@ -919,9 +931,11 @@ public class PhoneStatusBar extends BaseStatusBar { Slog.d(TAG, String.format("pileh=%d scrollh=%d carrierh=%d", mPile.getHeight(), mScrollView.getHeight(), mCarrierLabelHeight)); } - - final boolean makeVisible = - mPile.getHeight() < (mScrollView.getHeight() - mCarrierLabelHeight); + + final boolean emergencyCallsShownElsewhere = mEmergencyCallLabel != null; + final boolean makeVisible = + !(emergencyCallsShownElsewhere && mNetworkController.isEmergencyOnly()) + && mPile.getHeight() < (mScrollView.getHeight() - mCarrierLabelHeight); if (force || mCarrierLabelVisible != makeVisible) { mCarrierLabelVisible = makeVisible; diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/policy/NetworkController.java b/packages/SystemUI/src/com/android/systemui/statusbar/policy/NetworkController.java index 9035e45..8711a8d 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/policy/NetworkController.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/policy/NetworkController.java @@ -146,6 +146,7 @@ public class NetworkController extends BroadcastReceiver { ArrayList<TextView> mCombinedLabelViews = new ArrayList<TextView>(); ArrayList<TextView> mMobileLabelViews = new ArrayList<TextView>(); ArrayList<TextView> mWifiLabelViews = new ArrayList<TextView>(); + ArrayList<TextView> mEmergencyLabelViews = new ArrayList<TextView>(); ArrayList<SignalCluster> mSignalClusters = new ArrayList<SignalCluster>(); int mLastPhoneSignalIconId = -1; int mLastDataDirectionIconId = -1; @@ -246,6 +247,10 @@ public class NetworkController extends BroadcastReceiver { return mHasMobileDataFeature; } + public boolean isEmergencyOnly() { + return (mServiceState != null && mServiceState.isEmergencyOnly()); + } + public void addPhoneSignalIconView(ImageView v) { mPhoneSignalIconViews.add(v); } @@ -285,6 +290,10 @@ public class NetworkController extends BroadcastReceiver { mWifiLabelViews.add(v); } + public void addEmergencyLabelView(TextView v) { + mEmergencyLabelViews.add(v); + } + public void addSignalCluster(SignalCluster cluster) { mSignalClusters.add(cluster); refreshSignalCluster(cluster); @@ -920,7 +929,7 @@ public class NetworkController extends BroadcastReceiver { String wifiLabel = ""; String mobileLabel = ""; int N; - final boolean emergencyOnly = (mServiceState != null && mServiceState.isEmergencyOnly()); + final boolean emergencyOnly = isEmergencyOnly(); if (!mHasMobileDataFeature) { mDataSignalIconId = mPhoneSignalIconId = 0; @@ -1082,6 +1091,7 @@ public class NetworkController extends BroadcastReceiver { + " combinedActivityIconId=0x" + Integer.toHexString(combinedActivityIconId) + " mobileLabel=" + mobileLabel + " wifiLabel=" + wifiLabel + + " emergencyOnly=" + emergencyOnly + " combinedLabel=" + combinedLabel + " mAirplaneMode=" + mAirplaneMode + " mDataActivity=" + mDataActivity @@ -1247,6 +1257,18 @@ public class NetworkController extends BroadcastReceiver { v.setVisibility(View.VISIBLE); } } + + // e-call label + N = mEmergencyLabelViews.size(); + for (int i=0; i<N; i++) { + TextView v = mEmergencyLabelViews.get(i); + if (!emergencyOnly) { + v.setVisibility(View.GONE); + } else { + v.setText(mobileLabel); // comes from the telephony stack + v.setVisibility(View.VISIBLE); + } + } } public void dump(FileDescriptor fd, PrintWriter pw, String[] args) { |