Skip to content

Commit 639ed75

Browse files
dsandlerJustin Ho
authored andcommitted
Hide mobile RSSI on devices without mobile data.
Also fixes some minor layout glitches along that row of icons (Bluetooth vertical alignment & spacing, battery text width, inter-icon padding). Bug: 5895226 Change-Id: I303c2899bf21ddb7e28914d8fb36efd7090ac5e2
1 parent 70e21c9 commit 639ed75

File tree

2 files changed

+31
-15
lines changed

2 files changed

+31
-15
lines changed

packages/SystemUI/res/layout-sw600dp/status_bar_notification_panel_title.xml

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -44,12 +44,13 @@
4444
<FrameLayout
4545
android:layout_height="wrap_content"
4646
android:layout_width="wrap_content"
47+
android:layout_gravity="center_vertical"
4748
>
4849
<ImageView
4950
android:id="@+id/bluetooth"
5051
android:layout_height="wrap_content"
5152
android:layout_width="wrap_content"
52-
android:scaleType="centerInside"
53+
android:paddingRight="16dp"
5354
android:visibility="gone"
5455
android:contentDescription="@null"
5556
android:layout_gravity="center_vertical"
@@ -61,7 +62,6 @@
6162
android:id="@+id/mobile_icon"
6263
android:layout_height="wrap_content"
6364
android:layout_width="wrap_content"
64-
android:paddingRight="4dp"
6565
android:layout_gravity="center_vertical"
6666
>
6767

@@ -86,8 +86,8 @@
8686
android:layout_gravity="left|center_vertical"
8787
android:layout_width="wrap_content"
8888
android:layout_height="wrap_content"
89-
android:paddingRight="8dp"
90-
android:layout_weight="1"
89+
android:paddingRight="12dp"
90+
android:paddingLeft="6dp"
9191
android:singleLine="true"
9292
android:ellipsize="end"
9393
android:text="@string/status_bar_settings_settings_button"
@@ -98,7 +98,6 @@
9898
android:id="@+id/wifi_icon"
9999
android:layout_height="wrap_content"
100100
android:layout_width="wrap_content"
101-
android:paddingRight="4dp"
102101
android:layout_gravity="center_vertical"
103102
>
104103

@@ -123,7 +122,8 @@
123122
android:layout_gravity="left|center_vertical"
124123
android:layout_width="wrap_content"
125124
android:layout_height="wrap_content"
126-
android:paddingRight="8dp"
125+
android:paddingLeft="6dp"
126+
android:paddingRight="12dp"
127127
android:singleLine="true"
128128
android:ellipsize="end"
129129
android:text="@string/status_bar_settings_settings_button"
@@ -136,18 +136,17 @@
136136
android:scaleType="centerInside"
137137
android:layout_gravity="center_vertical"
138138
android:layout_alignBaseline="@id/wifi_signal"
139-
android:paddingLeft="8dp"
140-
android:paddingRight="8dp"
139+
android:paddingRight="6dp"
141140
android:contentDescription="@null"
142141
/>
143142

144143
<TextView
145144
android:id="@+id/battery_text"
146145
style="@style/StatusBarNotificationText"
147-
android:layout_width="56dp"
146+
android:layout_width="wrap_content"
148147
android:layout_height="wrap_content"
149148
android:layout_gravity="left|center_vertical"
150-
android:paddingRight="8dp"
149+
android:paddingRight="2dp"
151150
android:singleLine="true"
152151
android:text="@string/status_bar_settings_settings_button"
153152
/>

packages/SystemUI/src/com/android/systemui/statusbar/policy/NetworkController.java

Lines changed: 22 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -888,7 +888,9 @@ void refreshViews() {
888888
String mobileLabel = "";
889889
int N;
890890

891-
if (mDataConnected) {
891+
if (!mHasMobileDataFeature) {
892+
mDataSignalIconId = mPhoneSignalIconId = 0;
893+
} else if (mDataConnected) {
892894
mobileLabel = mNetworkName;
893895
if (DEBUG) {
894896
mobileLabel += "yyyyYYYYyyyyYYYY";
@@ -1029,8 +1031,13 @@ else if (!mDataConnected && !mWifiConnected && !mBluetoothTethered && !mWimaxCon
10291031
N = mPhoneSignalIconViews.size();
10301032
for (int i=0; i<N; i++) {
10311033
final ImageView v = mPhoneSignalIconViews.get(i);
1032-
v.setImageResource(mPhoneSignalIconId);
1033-
v.setContentDescription(mContentDescriptionPhoneSignal);
1034+
if (mPhoneSignalIconId == 0) {
1035+
v.setVisibility(View.GONE);
1036+
} else {
1037+
v.setVisibility(View.VISIBLE);
1038+
v.setImageResource(mPhoneSignalIconId);
1039+
v.setContentDescription(mContentDescriptionPhoneSignal);
1040+
}
10341041
}
10351042
}
10361043

@@ -1136,14 +1143,24 @@ else if (!mDataConnected && !mWifiConnected && !mBluetoothTethered && !mWimaxCon
11361143
N = mWifiLabelViews.size();
11371144
for (int i=0; i<N; i++) {
11381145
TextView v = mWifiLabelViews.get(i);
1139-
v.setText(wifiLabel);
1146+
if ("".equals(wifiLabel)) {
1147+
v.setVisibility(View.GONE);
1148+
} else {
1149+
v.setVisibility(View.VISIBLE);
1150+
v.setText(wifiLabel);
1151+
}
11401152
}
11411153

11421154
// mobile label
11431155
N = mMobileLabelViews.size();
11441156
for (int i=0; i<N; i++) {
11451157
TextView v = mMobileLabelViews.get(i);
1146-
v.setText(mobileLabel);
1158+
if ("".equals(mobileLabel)) {
1159+
v.setVisibility(View.GONE);
1160+
} else {
1161+
v.setVisibility(View.VISIBLE);
1162+
v.setText(mobileLabel);
1163+
}
11471164
}
11481165
}
11491166

0 commit comments

Comments
 (0)