Clean up wifi/mobile indicators in the expanded panel.
We now have two separate RSSI icons, one for wifi and one for mobile data, as originally proposed in bug 5544770. Each has an accompanying label showing the appropriate network description string (PLMN or SSID or "No internet connection"); these will be truncated as necessary to avoid clobbering other UI elements in the panel. Bug: 5543495 Bug: 5621224 Change-Id: I8fc322f8471fc94000e7230de359d3f1fe561b1e
This commit is contained in:
@@ -25,120 +25,167 @@
|
||||
android:background="@drawable/notify_panel_clock_bg"
|
||||
>
|
||||
|
||||
<LinearLayout
|
||||
<TableLayout
|
||||
android:id="@+id/icons"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentLeft="true"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:baselineAlignedChildIndex="0"
|
||||
android:layout_marginLeft="16dp"
|
||||
android:layout_marginTop="16dp"
|
||||
android:layout_marginBottom="16dp"
|
||||
android:shrinkColumns="2,4"
|
||||
android:stretchColumns="7"
|
||||
>
|
||||
<TableRow>
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/bluetooth"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_width="wrap_content"
|
||||
android:scaleType="centerInside"
|
||||
android:baseline="18dp"
|
||||
android:visibility="gone"
|
||||
android:contentDescription="@null"
|
||||
/>
|
||||
|
||||
<FrameLayout
|
||||
android:id="@+id/netwerk"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_marginRight="4dp"
|
||||
>
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/network_signal"
|
||||
<!-- to keep the column ids stable we wrap disappearing views in
|
||||
frames -->
|
||||
<FrameLayout
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_width="wrap_content"
|
||||
android:contentDescription="@null"
|
||||
>
|
||||
<ImageView
|
||||
android:id="@+id/bluetooth"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_width="wrap_content"
|
||||
android:scaleType="centerInside"
|
||||
android:visibility="gone"
|
||||
android:contentDescription="@null"
|
||||
android:layout_gravity="center_vertical"
|
||||
/>
|
||||
</FrameLayout>
|
||||
|
||||
<!-- mobile data -->
|
||||
<FrameLayout
|
||||
android:id="@+id/mobile_icon"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_width="wrap_content"
|
||||
android:paddingRight="4dp"
|
||||
android:layout_gravity="center_vertical"
|
||||
>
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/mobile_signal"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_width="wrap_content"
|
||||
android:contentDescription="@null"
|
||||
/>
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/mobile_type"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_width="wrap_content"
|
||||
android:contentDescription="@null"
|
||||
/>
|
||||
|
||||
</FrameLayout>
|
||||
<TextView
|
||||
android:id="@+id/mobile_text"
|
||||
style="@style/StatusBarNotificationText"
|
||||
android:layout_gravity="left|center_vertical"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingRight="8dp"
|
||||
android:layout_weight="1"
|
||||
android:singleLine="true"
|
||||
android:ellipsize="end"
|
||||
android:text="@string/status_bar_settings_settings_button"
|
||||
/>
|
||||
|
||||
<!-- wifi -->
|
||||
<FrameLayout
|
||||
android:id="@+id/wifi_icon"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_width="wrap_content"
|
||||
android:paddingRight="4dp"
|
||||
android:layout_gravity="center_vertical"
|
||||
>
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/wifi_signal"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_width="wrap_content"
|
||||
android:contentDescription="@null"
|
||||
/>
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/wifi_direction"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_width="wrap_content"
|
||||
android:contentDescription="@null"
|
||||
/>
|
||||
|
||||
</FrameLayout>
|
||||
<TextView
|
||||
android:id="@+id/wifi_text"
|
||||
style="@style/StatusBarNotificationText"
|
||||
android:layout_gravity="left|center_vertical"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingRight="8dp"
|
||||
android:singleLine="true"
|
||||
android:ellipsize="end"
|
||||
android:text="@string/status_bar_settings_settings_button"
|
||||
/>
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/network_type"
|
||||
android:id="@+id/battery"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_width="wrap_content"
|
||||
android:scaleType="centerInside"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:layout_alignBaseline="@id/wifi_signal"
|
||||
android:paddingLeft="8dp"
|
||||
android:paddingRight="8dp"
|
||||
android:contentDescription="@null"
|
||||
/>
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/network_direction"
|
||||
<TextView
|
||||
android:id="@+id/battery_text"
|
||||
style="@style/StatusBarNotificationText"
|
||||
android:layout_width="56dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_width="wrap_content"
|
||||
android:contentDescription="@null"
|
||||
android:layout_gravity="left|center_vertical"
|
||||
android:paddingRight="8dp"
|
||||
android:singleLine="true"
|
||||
android:text="@string/status_bar_settings_settings_button"
|
||||
/>
|
||||
|
||||
</FrameLayout>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/network_text"
|
||||
style="@style/StatusBarNotificationText"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_toRightOf="@id/netwerk"
|
||||
android:layout_marginRight="8dp"
|
||||
android:layout_alignBaseline="@id/network_signal"
|
||||
android:singleLine="true"
|
||||
android:text="@string/status_bar_settings_settings_button"
|
||||
/>
|
||||
<!-- this will stretch to eat up available space -->
|
||||
<View
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="0dp"
|
||||
/>
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/battery"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_width="wrap_content"
|
||||
android:scaleType="centerInside"
|
||||
android:layout_toRightOf="@id/network_text"
|
||||
android:layout_alignBaseline="@id/network_signal"
|
||||
android:baseline="18dp"
|
||||
android:layout_marginLeft="8dp"
|
||||
android:layout_marginRight="8dp"
|
||||
android:contentDescription="@null"
|
||||
/>
|
||||
<FrameLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/battery_text"
|
||||
style="@style/StatusBarNotificationText"
|
||||
android:layout_width="56dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_toRightOf="@id/battery"
|
||||
android:layout_alignBaseline="@id/battery"
|
||||
android:layout_marginRight="8dp"
|
||||
android:singleLine="true"
|
||||
android:text="@string/status_bar_settings_settings_button"
|
||||
/>
|
||||
</LinearLayout>
|
||||
<ImageView
|
||||
android:id="@+id/settings_button"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingRight="16dp"
|
||||
android:src="@drawable/ic_sysbar_quicksettings"
|
||||
android:contentDescription="@string/accessibility_settings_button"
|
||||
/>
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/settings_button"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignBaseline="@id/icons"
|
||||
android:layout_alignParentRight="true"
|
||||
android:paddingRight="16dp"
|
||||
android:src="@drawable/ic_sysbar_quicksettings"
|
||||
android:baseline="21dp"
|
||||
android:contentDescription="@string/accessibility_settings_button"
|
||||
/>
|
||||
<ImageView
|
||||
android:id="@+id/notification_button"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingRight="16dp"
|
||||
android:src="@drawable/ic_notification_open"
|
||||
android:visibility="invisible"
|
||||
android:contentDescription="@string/accessibility_notifications_button"
|
||||
/>
|
||||
</FrameLayout>
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/notification_button"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignBaseline="@id/icons"
|
||||
android:layout_alignParentRight="true"
|
||||
android:paddingRight="16dp"
|
||||
android:src="@drawable/ic_notification_open"
|
||||
android:baseline="21dp"
|
||||
android:visibility="invisible"
|
||||
android:contentDescription="@string/accessibility_notifications_button"
|
||||
/>
|
||||
</TableRow>
|
||||
</TableLayout>
|
||||
|
||||
<com.android.systemui.statusbar.tablet.HoloClock
|
||||
android:id="@+id/clock"
|
||||
|
||||
@@ -135,7 +135,9 @@ public class NetworkController extends BroadcastReceiver {
|
||||
ArrayList<ImageView> mWimaxIconViews = new ArrayList<ImageView>();
|
||||
ArrayList<ImageView> mCombinedSignalIconViews = new ArrayList<ImageView>();
|
||||
ArrayList<ImageView> mDataTypeIconViews = new ArrayList<ImageView>();
|
||||
ArrayList<TextView> mLabelViews = new ArrayList<TextView>();
|
||||
ArrayList<TextView> mCombinedLabelViews = new ArrayList<TextView>();
|
||||
ArrayList<TextView> mMobileLabelViews = new ArrayList<TextView>();
|
||||
ArrayList<TextView> mWifiLabelViews = new ArrayList<TextView>();
|
||||
ArrayList<SignalCluster> mSignalClusters = new ArrayList<SignalCluster>();
|
||||
int mLastPhoneSignalIconId = -1;
|
||||
int mLastDataDirectionIconId = -1;
|
||||
@@ -144,7 +146,7 @@ public class NetworkController extends BroadcastReceiver {
|
||||
int mLastWimaxIconId = -1;
|
||||
int mLastCombinedSignalIconId = -1;
|
||||
int mLastDataTypeIconId = -1;
|
||||
String mLastLabel = "";
|
||||
String mLastCombinedLabel = "";
|
||||
|
||||
private boolean mHasMobileDataFeature;
|
||||
|
||||
@@ -257,8 +259,16 @@ public class NetworkController extends BroadcastReceiver {
|
||||
mDataTypeIconViews.add(v);
|
||||
}
|
||||
|
||||
public void addLabelView(TextView v) {
|
||||
mLabelViews.add(v);
|
||||
public void addCombinedLabelView(TextView v) {
|
||||
mCombinedLabelViews.add(v);
|
||||
}
|
||||
|
||||
public void addMobileLabelView(TextView v) {
|
||||
mMobileLabelViews.add(v);
|
||||
}
|
||||
|
||||
public void addWifiLabelView(TextView v) {
|
||||
mWifiLabelViews.add(v);
|
||||
}
|
||||
|
||||
public void addSignalCluster(SignalCluster cluster) {
|
||||
@@ -873,11 +883,16 @@ public class NetworkController extends BroadcastReceiver {
|
||||
|
||||
int combinedSignalIconId = 0;
|
||||
int combinedActivityIconId = 0;
|
||||
String label = "";
|
||||
String combinedLabel = "";
|
||||
String wifiLabel = "";
|
||||
String mobileLabel = "";
|
||||
int N;
|
||||
|
||||
if (mDataConnected) {
|
||||
label = mNetworkName;
|
||||
mobileLabel = mNetworkName;
|
||||
if (DEBUG) {
|
||||
mobileLabel += "yyyyYYYYyyyyYYYY";
|
||||
}
|
||||
combinedSignalIconId = mDataSignalIconId;
|
||||
switch (mDataActivity) {
|
||||
case TelephonyManager.DATA_ACTIVITY_IN:
|
||||
@@ -894,6 +909,7 @@ public class NetworkController extends BroadcastReceiver {
|
||||
break;
|
||||
}
|
||||
|
||||
combinedLabel = mobileLabel;
|
||||
combinedActivityIconId = mMobileActivityIconId;
|
||||
combinedSignalIconId = mDataSignalIconId; // set by updateDataIcon()
|
||||
mContentDescriptionCombinedSignal = mContentDescriptionDataType;
|
||||
@@ -901,10 +917,13 @@ public class NetworkController extends BroadcastReceiver {
|
||||
|
||||
if (mWifiConnected) {
|
||||
if (mWifiSsid == null) {
|
||||
label = context.getString(R.string.status_bar_settings_signal_meter_wifi_nossid);
|
||||
wifiLabel = context.getString(R.string.status_bar_settings_signal_meter_wifi_nossid);
|
||||
mWifiActivityIconId = 0; // no wifis, no bits
|
||||
} else {
|
||||
label = mWifiSsid;
|
||||
wifiLabel = mWifiSsid;
|
||||
if (DEBUG) {
|
||||
wifiLabel += "xxxxXXXXxxxxXXXX";
|
||||
}
|
||||
switch (mWifiActivity) {
|
||||
case WifiManager.DATA_ACTIVITY_IN:
|
||||
mWifiActivityIconId = R.drawable.stat_sys_wifi_in;
|
||||
@@ -922,12 +941,13 @@ public class NetworkController extends BroadcastReceiver {
|
||||
}
|
||||
|
||||
combinedActivityIconId = mWifiActivityIconId;
|
||||
combinedLabel = wifiLabel;
|
||||
combinedSignalIconId = mWifiIconId; // set by updateWifiIcons()
|
||||
mContentDescriptionCombinedSignal = mContentDescriptionWifi;
|
||||
}
|
||||
|
||||
if (mBluetoothTethered) {
|
||||
label = mContext.getString(R.string.bluetooth_tethered);
|
||||
combinedLabel = mContext.getString(R.string.bluetooth_tethered);
|
||||
combinedSignalIconId = mBluetoothTetherIconId;
|
||||
mContentDescriptionCombinedSignal = mContext.getString(
|
||||
R.string.accessibility_bluetooth_tether);
|
||||
@@ -945,7 +965,8 @@ public class NetworkController extends BroadcastReceiver {
|
||||
|
||||
// combined values from connected wifi take precedence over airplane mode
|
||||
if (!mWifiConnected) {
|
||||
label = context.getString(R.string.status_bar_settings_signal_meter_disconnected);
|
||||
wifiLabel = context.getString(R.string.status_bar_settings_signal_meter_disconnected);
|
||||
combinedLabel = wifiLabel;
|
||||
mContentDescriptionCombinedSignal = mContentDescriptionPhoneSignal;
|
||||
combinedSignalIconId = mDataSignalIconId;
|
||||
}
|
||||
@@ -953,7 +974,7 @@ public class NetworkController extends BroadcastReceiver {
|
||||
else if (!mDataConnected && !mWifiConnected && !mBluetoothTethered && !mWimaxConnected) {
|
||||
// pretty much totally disconnected
|
||||
|
||||
label = context.getString(R.string.status_bar_settings_signal_meter_disconnected);
|
||||
combinedLabel = context.getString(R.string.status_bar_settings_signal_meter_disconnected);
|
||||
// On devices without mobile radios, we want to show the wifi icon
|
||||
combinedSignalIconId =
|
||||
mHasMobileDataFeature ? mDataSignalIconId : mWifiIconId;
|
||||
@@ -1028,7 +1049,7 @@ public class NetworkController extends BroadcastReceiver {
|
||||
for (int i=0; i<N; i++) {
|
||||
final ImageView v = mWifiIconViews.get(i);
|
||||
if (mWifiIconId == 0) {
|
||||
v.setVisibility(View.INVISIBLE);
|
||||
v.setVisibility(View.GONE);
|
||||
} else {
|
||||
v.setVisibility(View.VISIBLE);
|
||||
v.setImageResource(mWifiIconId);
|
||||
@@ -1044,7 +1065,7 @@ public class NetworkController extends BroadcastReceiver {
|
||||
for (int i=0; i<N; i++) {
|
||||
final ImageView v = mWimaxIconViews.get(i);
|
||||
if (mWimaxIconId == 0) {
|
||||
v.setVisibility(View.INVISIBLE);
|
||||
v.setVisibility(View.GONE);
|
||||
} else {
|
||||
v.setVisibility(View.VISIBLE);
|
||||
v.setImageResource(mWimaxIconId);
|
||||
@@ -1070,7 +1091,7 @@ public class NetworkController extends BroadcastReceiver {
|
||||
for (int i=0; i<N; i++) {
|
||||
final ImageView v = mDataTypeIconViews.get(i);
|
||||
if (mDataTypeIconId == 0) {
|
||||
v.setVisibility(View.INVISIBLE);
|
||||
v.setVisibility(View.GONE);
|
||||
} else {
|
||||
v.setVisibility(View.VISIBLE);
|
||||
v.setImageResource(mDataTypeIconId);
|
||||
@@ -1089,7 +1110,7 @@ public class NetworkController extends BroadcastReceiver {
|
||||
for (int i=0; i<N; i++) {
|
||||
final ImageView v = mDataDirectionOverlayIconViews.get(i);
|
||||
if (combinedActivityIconId == 0) {
|
||||
v.setVisibility(View.INVISIBLE);
|
||||
v.setVisibility(View.GONE);
|
||||
} else {
|
||||
v.setVisibility(View.VISIBLE);
|
||||
v.setImageResource(combinedActivityIconId);
|
||||
@@ -1098,15 +1119,29 @@ public class NetworkController extends BroadcastReceiver {
|
||||
}
|
||||
}
|
||||
|
||||
// the label in the notification panel
|
||||
if (!mLastLabel.equals(label)) {
|
||||
mLastLabel = label;
|
||||
N = mLabelViews.size();
|
||||
// the combinedLabel in the notification panel
|
||||
if (!mLastCombinedLabel.equals(combinedLabel)) {
|
||||
mLastCombinedLabel = combinedLabel;
|
||||
N = mCombinedLabelViews.size();
|
||||
for (int i=0; i<N; i++) {
|
||||
TextView v = mLabelViews.get(i);
|
||||
v.setText(label);
|
||||
TextView v = mCombinedLabelViews.get(i);
|
||||
v.setText(combinedLabel);
|
||||
}
|
||||
}
|
||||
|
||||
// wifi label
|
||||
N = mWifiLabelViews.size();
|
||||
for (int i=0; i<N; i++) {
|
||||
TextView v = mWifiLabelViews.get(i);
|
||||
v.setText(wifiLabel);
|
||||
}
|
||||
|
||||
// mobile label
|
||||
N = mMobileLabelViews.size();
|
||||
for (int i=0; i<N; i++) {
|
||||
TextView v = mMobileLabelViews.get(i);
|
||||
v.setText(mobileLabel);
|
||||
}
|
||||
}
|
||||
|
||||
public void dump(FileDescriptor fd, PrintWriter pw, String[] args) {
|
||||
@@ -1220,8 +1255,8 @@ public class NetworkController extends BroadcastReceiver {
|
||||
pw.print(Integer.toHexString(mLastDataTypeIconId));
|
||||
pw.print("/");
|
||||
pw.println(getResourceName(mLastDataTypeIconId));
|
||||
pw.print(" mLastLabel=");
|
||||
pw.print(mLastLabel);
|
||||
pw.print(" mLastCombinedLabel=");
|
||||
pw.print(mLastCombinedLabel);
|
||||
pw.println("");
|
||||
}
|
||||
|
||||
|
||||
@@ -316,8 +316,8 @@ public class NotificationPanel extends RelativeLayout implements StatusBarPanel,
|
||||
|
||||
public void updatePanelModeButtons() {
|
||||
final boolean settingsVisible = (mSettingsView != null);
|
||||
mSettingsButton.setVisibility(!settingsVisible ? View.VISIBLE : View.INVISIBLE);
|
||||
mNotificationButton.setVisibility(settingsVisible ? View.VISIBLE : View.INVISIBLE);
|
||||
mSettingsButton.setVisibility(!settingsVisible ? View.VISIBLE : View.GONE);
|
||||
mNotificationButton.setVisibility(settingsVisible ? View.VISIBLE : View.GONE);
|
||||
}
|
||||
|
||||
public boolean isInContentArea(int x, int y) {
|
||||
|
||||
@@ -218,11 +218,6 @@ public class TabletStatusBar extends StatusBar implements
|
||||
|
||||
// network icons: either a combo icon that switches between mobile and data, or distinct
|
||||
// mobile and data icons
|
||||
final ImageView comboRSSI =
|
||||
(ImageView)mNotificationPanel.findViewById(R.id.network_signal);
|
||||
if (comboRSSI != null) {
|
||||
mNetworkController.addCombinedSignalIconView(comboRSSI);
|
||||
}
|
||||
final ImageView mobileRSSI =
|
||||
(ImageView)mNotificationPanel.findViewById(R.id.mobile_signal);
|
||||
if (mobileRSSI != null) {
|
||||
@@ -233,14 +228,14 @@ public class TabletStatusBar extends StatusBar implements
|
||||
if (wifiRSSI != null) {
|
||||
mNetworkController.addWifiIconView(wifiRSSI);
|
||||
}
|
||||
mNetworkController.addWifiLabelView(
|
||||
(TextView)mNotificationPanel.findViewById(R.id.wifi_text));
|
||||
|
||||
mNetworkController.addDataTypeIconView(
|
||||
(ImageView)mNotificationPanel.findViewById(R.id.network_type));
|
||||
mNetworkController.addDataDirectionOverlayIconView(
|
||||
(ImageView)mNotificationPanel.findViewById(R.id.network_direction));
|
||||
mNetworkController.addLabelView(
|
||||
(TextView)mNotificationPanel.findViewById(R.id.network_text));
|
||||
mNetworkController.addLabelView(
|
||||
(ImageView)mNotificationPanel.findViewById(R.id.mobile_type));
|
||||
mNetworkController.addMobileLabelView(
|
||||
(TextView)mNotificationPanel.findViewById(R.id.mobile_text));
|
||||
mNetworkController.addCombinedLabelView(
|
||||
(TextView)mBarContents.findViewById(R.id.network_text));
|
||||
|
||||
mStatusBarView.setIgnoreChildren(0, mNotificationTrigger, mNotificationPanel);
|
||||
|
||||
Reference in New Issue
Block a user