Merge "Fixing various QS issues. (Bug 7216908, Bug 7217154)" into jb-mr1-dev

This commit is contained in:
Winson Chung
2012-09-25 12:20:18 -07:00
committed by Android (Google) Code Review
10 changed files with 31 additions and 13 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.6 KiB

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.6 KiB

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.2 KiB

After

Width:  |  Height:  |  Size: 2.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.2 KiB

After

Width:  |  Height:  |  Size: 2.6 KiB

View File

@@ -265,7 +265,7 @@
<!-- Content description of the WIFI signal when it is three bars for accessibility (not shown on the screen). [CHAR LIMIT=NONE] --> <!-- Content description of the WIFI signal when it is three bars for accessibility (not shown on the screen). [CHAR LIMIT=NONE] -->
<string name="accessibility_wifi_three_bars">Wi-Fi three bars.</string> <string name="accessibility_wifi_three_bars">Wi-Fi three bars.</string>
<!-- Content description of the WIFI signal when it is full for accessibility (not shown on the screen). [CHAR LIMIT=NONE] --> <!-- Content description of the WIFI signal when it is full for accessibility (not shown on the screen). [CHAR LIMIT=NONE] -->
<string name="accessibility_wifi_signal_full">WiFi signal full.</string> <string name="accessibility_wifi_signal_full">Wi-Fi signal full.</string>
<!-- Content description of the WiMAX signal when no signal for accessibility (not shown on the screen). [CHAR LIMIT=NONE] --> <!-- Content description of the WiMAX signal when no signal for accessibility (not shown on the screen). [CHAR LIMIT=NONE] -->
<string name="accessibility_no_wimax">No WiMAX.</string> <string name="accessibility_no_wimax">No WiMAX.</string>
@@ -439,15 +439,17 @@
<!-- QuickSettings: User [CHAR LIMIT=NONE] --> <!-- QuickSettings: User [CHAR LIMIT=NONE] -->
<string name="quick_settings_user_label">Me</string> <string name="quick_settings_user_label">Me</string>
<!-- QuickSettings: Wifi [CHAR LIMIT=NONE] --> <!-- QuickSettings: Wifi [CHAR LIMIT=NONE] -->
<string name="quick_settings_wifi_label">Wifi</string> <string name="quick_settings_wifi_label">Wi-Fi</string>
<!-- QuickSettings: Wifi (Not connected) [CHAR LIMIT=NONE] -->
<string name="quick_settings_wifi_not_connected">Not Connected</string>
<!-- QuickSettings: Wifi (No network) [CHAR LIMIT=NONE] --> <!-- QuickSettings: Wifi (No network) [CHAR LIMIT=NONE] -->
<string name="quick_settings_wifi_no_network">No Network</string> <string name="quick_settings_wifi_no_network">No Network</string>
<!-- QuickSettings: Wifi (Off) [CHAR LIMIT=NONE] --> <!-- QuickSettings: Wifi (Off) [CHAR LIMIT=NONE] -->
<string name="quick_settings_wifi_off_label">Wifi Off</string> <string name="quick_settings_wifi_off_label">Wi-Fi Off</string>
<!-- QuickSettings: Wifi display [CHAR LIMIT=NONE] --> <!-- QuickSettings: Wifi display [CHAR LIMIT=NONE] -->
<string name="quick_settings_wifi_display_label">Wifi Display</string> <string name="quick_settings_wifi_display_label">Wi-Fi Display</string>
<!-- QuickSettings: Wifi display [CHAR LIMIT=NONE] --> <!-- QuickSettings: Wifi display [CHAR LIMIT=NONE] -->
<string name="quick_settings_wifi_display_no_connection_label">No Wifi Display Connection</string> <string name="quick_settings_wifi_display_no_connection_label">No Wi-Fi Display Connection</string>
<!-- QuickSettings: Brightness dialog title [CHAR LIMIT=NONE] --> <!-- QuickSettings: Brightness dialog title [CHAR LIMIT=NONE] -->
<string name="quick_settings_brightness_dialog_title">Brightness</string> <string name="quick_settings_brightness_dialog_title">Brightness</string>
<!-- QuickSettings: Brightness dialog auto brightness button [CHAR LIMIT=NONE] --> <!-- QuickSettings: Brightness dialog auto brightness button [CHAR LIMIT=NONE] -->

View File

@@ -654,6 +654,7 @@ class QuickSettings {
} }
private void dismissBrightnessDialog(int timeout) { private void dismissBrightnessDialog(int timeout) {
removeAllBrightnessDialogCallbacks();
if (mBrightnessDialog != null) { if (mBrightnessDialog != null) {
mHandler.postDelayed(mDismissBrightnessDialogRunnable, timeout); mHandler.postDelayed(mDismissBrightnessDialogRunnable, timeout);
} }

View File

@@ -64,7 +64,7 @@ class QuickSettingsContainerView extends FrameLayout {
int height = MeasureSpec.getSize(heightMeasureSpec); int height = MeasureSpec.getSize(heightMeasureSpec);
int availableWidth = (int) (width - getPaddingLeft() - getPaddingRight() - int availableWidth = (int) (width - getPaddingLeft() - getPaddingRight() -
(mNumColumns - 1) * mCellGap); (mNumColumns - 1) * mCellGap);
float cellWidth = availableWidth / mNumColumns; float cellWidth = (float) Math.ceil(((float) availableWidth) / mNumColumns);
// Update each of the children's widths accordingly to the cell width // Update each of the children's widths accordingly to the cell width
int N = getChildCount(); int N = getChildCount();

View File

@@ -280,18 +280,33 @@ class QuickSettingsModel implements BluetoothStateChangeCallback,
} }
return string; return string;
} }
// Remove the period from the network name
public static String removeTrailingPeriod(String string) {
if (string == null) return null;
final int length = string.length();
if (string.endsWith(".")) {
string.substring(0, length - 1);
}
return string;
}
// NetworkSignalChanged callback // NetworkSignalChanged callback
@Override @Override
public void onWifiSignalChanged(boolean enabled, int wifiSignalIconId, String enabledDesc) { public void onWifiSignalChanged(boolean enabled, int wifiSignalIconId, String enabledDesc) {
// TODO: If view is in awaiting state, disable // TODO: If view is in awaiting state, disable
Resources r = mContext.getResources(); Resources r = mContext.getResources();
mWifiState.enabled = enabled; mWifiState.enabled = enabled;
mWifiState.iconId = enabled && (wifiSignalIconId > 0) boolean wifiConnected = enabled && (wifiSignalIconId > 0) && (enabledDesc != null);
? wifiSignalIconId boolean wifiNotConnected = enabled && (enabledDesc == null);
: R.drawable.ic_qs_wifi_no_network; if (wifiConnected) {
mWifiState.label = enabled && (enabledDesc != null) mWifiState.iconId = wifiSignalIconId;
? removeDoubleQuotes(enabledDesc) mWifiState.label = removeDoubleQuotes(enabledDesc);
: r.getString(R.string.quick_settings_wifi_off_label); } else if (wifiNotConnected) {
mWifiState.iconId = R.drawable.ic_qs_wifi_0;
mWifiState.label = r.getString(R.string.quick_settings_wifi_not_connected);
} else {
mWifiState.iconId = R.drawable.ic_qs_wifi_no_network;
mWifiState.label = r.getString(R.string.quick_settings_wifi_off_label);
}
mWifiCallback.refreshView(mWifiTile, mWifiState); mWifiCallback.refreshView(mWifiTile, mWifiState);
} }
@@ -319,7 +334,7 @@ class QuickSettingsModel implements BluetoothStateChangeCallback,
? dataTypeIconId ? dataTypeIconId
: 0; : 0;
mRSSIState.label = enabled mRSSIState.label = enabled
? enabledDesc ? removeTrailingPeriod(enabledDesc)
: r.getString(R.string.quick_settings_rssi_emergency_only); : r.getString(R.string.quick_settings_rssi_emergency_only);
mRSSICallback.refreshView(mRSSITile, mRSSIState); mRSSICallback.refreshView(mRSSITile, mRSSIState);
} }