diff options
author | Winson Chung <winsonc@google.com> | 2012-09-13 18:13:44 -0700 |
---|---|---|
committer | Winson Chung <winsonc@google.com> | 2012-09-13 18:16:02 -0700 |
commit | ed1395f3981193c762e436cd1db725ce70022e43 (patch) | |
tree | 54a48856073e6d669d84a3f45333eb7e3ccf3b19 /packages/SystemUI | |
parent | 35f3a2241809e8f54216b531847f67306b679c4d (diff) | |
download | frameworks_base-ed1395f3981193c762e436cd1db725ce70022e43.zip frameworks_base-ed1395f3981193c762e436cd1db725ce70022e43.tar.gz frameworks_base-ed1395f3981193c762e436cd1db725ce70022e43.tar.bz2 |
Updating Wifi/Mobile tiles to reflect actual connection state with new assets.
Change-Id: Ic1cd78c77f94f1c9cf9bbc1bcea3082ca536d94c
Diffstat (limited to 'packages/SystemUI')
6 files changed, 85 insertions, 26 deletions
diff --git a/packages/SystemUI/res/values-sw600dp/config.xml b/packages/SystemUI/res/values-sw600dp/config.xml new file mode 100644 index 0000000..c52b6ca --- /dev/null +++ b/packages/SystemUI/res/values-sw600dp/config.xml @@ -0,0 +1,28 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- +/* +** Copyright 2012, The Android Open Source Project +** +** Licensed under the Apache License, Version 2.0 (the "License"); +** you may not use this file except in compliance with the License. +** You may obtain a copy of the License at +** +** http://www.apache.org/licenses/LICENSE-2.0 +** +** Unless required by applicable law or agreed to in writing, software +** distributed under the License is distributed on an "AS IS" BASIS, +** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +** See the License for the specific language governing permissions and +** limitations under the License. +*/ +--> + +<!-- These resources are around just to allow their values to be customized + for different hardware and product builds. --> +<resources> + <!-- The number of columns in the QuickSettings --> + <integer name="quick_settings_num_columns">3</integer> + + <!-- The number of columns that the top level tiles span in the QuickSettings --> + <integer name="quick_settings_user_time_settings_tile_span">1</integer> +</resources> diff --git a/packages/SystemUI/res/values/styles.xml b/packages/SystemUI/res/values/styles.xml index 78b60d9..738b41f 100644 --- a/packages/SystemUI/res/values/styles.xml +++ b/packages/SystemUI/res/values/styles.xml @@ -74,8 +74,8 @@ <style name="TextAppearance.QuickSettings" /> <style name="TextAppearance.QuickSettings.TileView"> - <item name="android:paddingLeft">4dp</item> - <item name="android:paddingRight">4dp</item> + <item name="android:paddingLeft">6dp</item> + <item name="android:paddingRight">6dp</item> <item name="android:paddingBottom">2dp</item> <item name="android:drawablePadding">12dp</item> <item name="android:textSize">12dp</item> diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/QuickSettingsModel.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/QuickSettingsModel.java index 503e84f..a6117be 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/QuickSettingsModel.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/QuickSettingsModel.java @@ -228,17 +228,15 @@ class QuickSettingsModel implements BluetoothStateChangeCallback, } // NetworkSignalChanged callback @Override - public void onWifiSignalChanged(boolean enabled, String description) { + public void onWifiSignalChanged(boolean enabled, int wifiSignalIconId, String enabledDesc) { // TODO: If view is in awaiting state, disable Resources r = mContext.getResources(); - // TODO: Check if wifi is enabled - mWifiState.enabled = enabled; - mWifiState.iconId = (enabled ? - R.drawable.ic_qs_wifi_4 : - R.drawable.ic_qs_wifi_not_connected); - mWifiState.label = (enabled ? - description : - r.getString(R.string.quick_settings_wifi_no_network)); + mWifiState.iconId = enabled && (wifiSignalIconId > 0) + ? wifiSignalIconId + : R.drawable.ic_qs_wifi_no_network; + mWifiState.label = enabled + ? enabledDesc + : r.getString(R.string.quick_settings_wifi_no_network); mWifiCallback.refreshView(mWifiTile, mWifiState); } @@ -254,18 +252,17 @@ class QuickSettingsModel implements BluetoothStateChangeCallback, } // NetworkSignalChanged callback @Override - public void onMobileDataSignalChanged(boolean enabled, String description) { + public void onMobileDataSignalChanged(boolean enabled, int mobileSignalIconId, + String enabledDesc) { if (deviceSupportsTelephony()) { // TODO: If view is in awaiting state, disable Resources r = mContext.getResources(); - // TODO: Check if RSSI is enabled - mRSSIState.enabled = enabled; - mRSSIState.iconId = (enabled ? - R.drawable.ic_qs_signal_4 : - R.drawable.ic_qs_signal_0); - mRSSIState.label = (enabled ? - description : - r.getString(R.string.quick_settings_rssi_emergency_only)); + mRSSIState.iconId = enabled && (mobileSignalIconId > 0) + ? mobileSignalIconId + : R.drawable.ic_qs_signal_no_signal; + mRSSIState.label = enabled + ? enabledDesc + : r.getString(R.string.quick_settings_rssi_emergency_only); mRSSICallback.refreshView(mRSSITile, mRSSIState); } } 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 ea7235d..0bdc59b 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/policy/NetworkController.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/policy/NetworkController.java @@ -81,6 +81,7 @@ public class NetworkController extends BroadcastReceiver { String mNetworkNameDefault; String mNetworkNameSeparator; int mPhoneSignalIconId; + int mQSPhoneSignalIconId; int mDataDirectionIconId; // data + data direction on phones int mDataSignalIconId; int mDataTypeIconId; @@ -105,6 +106,7 @@ public class NetworkController extends BroadcastReceiver { int mWifiRssi, mWifiLevel; String mWifiSsid; int mWifiIconId = 0; + int mQSWifiIconId = 0; int mWifiActivityIconId = 0; // overlay arrows for wifi direction int mWifiActivity = WifiManager.DATA_ACTIVITY_NONE; @@ -175,8 +177,8 @@ public class NetworkController extends BroadcastReceiver { } public interface NetworkSignalChangedCallback { - void onWifiSignalChanged(boolean enabled, String description); - void onMobileDataSignalChanged(boolean enabled, String description); + void onWifiSignalChanged(boolean enabled, int wifiSignalIconId, String description); + void onMobileDataSignalChanged(boolean enabled, int mobileSignalIconId, String description); void onAirplaneModeChanged(boolean enabled); } @@ -347,17 +349,18 @@ public class NetworkController extends BroadcastReceiver { boolean wifiEnabled = mWifiEnabled && (mWifiConnected || !mHasMobileDataFeature); String wifiDesc = wifiEnabled ? mWifiSsid : null; - cb.onWifiSignalChanged(wifiEnabled, wifiDesc); + cb.onWifiSignalChanged(wifiEnabled, mQSWifiIconId, wifiDesc); if (isEmergencyOnly()) { - cb.onMobileDataSignalChanged(false, null); + cb.onMobileDataSignalChanged(false, mQSPhoneSignalIconId, null); } else { if (mIsWimaxEnabled && mWimaxConnected) { // wimax is special - cb.onMobileDataSignalChanged(true, mNetworkName); + cb.onMobileDataSignalChanged(true, mQSPhoneSignalIconId, mNetworkName); } else { // normal mobile data - cb.onMobileDataSignalChanged(mHasMobileDataFeature, mNetworkName); + cb.onMobileDataSignalChanged(mHasMobileDataFeature, mQSPhoneSignalIconId, + mNetworkName); } } cb.onAirplaneModeChanged(mAirplaneMode); @@ -517,11 +520,13 @@ public class NetworkController extends BroadcastReceiver { if (!hasService()) { if (CHATTY) Slog.d(TAG, "updateTelephonySignalStrength: !hasService()"); mPhoneSignalIconId = R.drawable.stat_sys_signal_null; + mQSPhoneSignalIconId = R.drawable.ic_qs_signal_no_signal; mDataSignalIconId = R.drawable.stat_sys_signal_null; } else { if (mSignalStrength == null) { if (CHATTY) Slog.d(TAG, "updateTelephonySignalStrength: mSignalStrength == null"); mPhoneSignalIconId = R.drawable.stat_sys_signal_null; + mQSPhoneSignalIconId = R.drawable.ic_qs_signal_no_signal; mDataSignalIconId = R.drawable.stat_sys_signal_null; mContentDescriptionPhoneSignal = mContext.getString( AccessibilityContentDescriptions.PHONE_SIGNAL_STRENGTH[0]); @@ -552,6 +557,7 @@ public class NetworkController extends BroadcastReceiver { } } mPhoneSignalIconId = iconList[iconLevel]; + mQSPhoneSignalIconId = TelephonyIcons.QS_TELEPHONY_SIGNAL_STRENGTH[iconLevel]; mContentDescriptionPhoneSignal = mContext.getString( AccessibilityContentDescriptions.PHONE_SIGNAL_STRENGTH[iconLevel]); mDataSignalIconId = TelephonyIcons.DATA_SIGNAL_STRENGTH[mInetCondition][iconLevel]; @@ -844,13 +850,16 @@ public class NetworkController extends BroadcastReceiver { private void updateWifiIcons() { if (mWifiConnected) { mWifiIconId = WifiIcons.WIFI_SIGNAL_STRENGTH[mInetCondition][mWifiLevel]; + mQSWifiIconId = WifiIcons.QS_WIFI_SIGNAL_STRENGTH[mWifiLevel]; mContentDescriptionWifi = mContext.getString( AccessibilityContentDescriptions.WIFI_CONNECTION_STRENGTH[mWifiLevel]); } else { if (mDataAndWifiStacked) { mWifiIconId = 0; + mQSWifiIconId = 0; } else { mWifiIconId = mWifiEnabled ? R.drawable.stat_sys_wifi_signal_null : 0; + mQSWifiIconId = mWifiEnabled ? R.drawable.ic_qs_wifi_no_network : 0; } mContentDescriptionWifi = mContext.getString(R.string.accessibility_no_wifi); } @@ -975,6 +984,7 @@ public class NetworkController extends BroadcastReceiver { if (!mHasMobileDataFeature) { mDataSignalIconId = mPhoneSignalIconId = 0; + mQSPhoneSignalIconId = 0; mobileLabel = ""; } else { // We want to show the carrier name if in service and either: @@ -1086,6 +1096,7 @@ public class NetworkController extends BroadcastReceiver { R.string.accessibility_airplane_mode); mAirplaneIconId = R.drawable.stat_sys_signal_flightmode; mPhoneSignalIconId = mDataSignalIconId = mDataTypeIconId = 0; + mQSPhoneSignalIconId = 0; // combined values from connected wifi take precedence over airplane mode if (mWifiConnected) { @@ -1140,10 +1151,12 @@ public class NetworkController extends BroadcastReceiver { + " mAirplaneMode=" + mAirplaneMode + " mDataActivity=" + mDataActivity + " mPhoneSignalIconId=0x" + Integer.toHexString(mPhoneSignalIconId) + + " mQSPhoneSignalIconId=0x" + Integer.toHexString(mQSPhoneSignalIconId) + " mDataDirectionIconId=0x" + Integer.toHexString(mDataDirectionIconId) + " mDataSignalIconId=0x" + Integer.toHexString(mDataSignalIconId) + " mDataTypeIconId=0x" + Integer.toHexString(mDataTypeIconId) + " mWifiIconId=0x" + Integer.toHexString(mWifiIconId) + + " mQSWifiIconId=0x" + Integer.toHexString(mQSWifiIconId) + " mBluetoothTetherIconId=0x" + Integer.toHexString(mBluetoothTetherIconId)); } @@ -1357,6 +1370,9 @@ public class NetworkController extends BroadcastReceiver { pw.print(" mPhoneSignalIconId=0x"); pw.print(Integer.toHexString(mPhoneSignalIconId)); pw.print("/"); + pw.print(" mQSPhoneSignalIconId=0x"); + pw.print(Integer.toHexString(mQSPhoneSignalIconId)); + pw.print("/"); pw.println(getResourceName(mPhoneSignalIconId)); pw.print(" mDataDirectionIconId="); pw.print(Integer.toHexString(mDataDirectionIconId)); @@ -1384,6 +1400,8 @@ public class NetworkController extends BroadcastReceiver { pw.println(mWifiSsid); pw.println(String.format(" mWifiIconId=0x%08x/%s", mWifiIconId, getResourceName(mWifiIconId))); + pw.println(String.format(" mQSWifiIconId=0x%08x/%s", + mQSWifiIconId, getResourceName(mQSWifiIconId))); pw.print(" mWifiActivity="); pw.println(mWifiActivity); diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/policy/TelephonyIcons.java b/packages/SystemUI/src/com/android/systemui/statusbar/policy/TelephonyIcons.java index 959e06d..de9b218 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/policy/TelephonyIcons.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/policy/TelephonyIcons.java @@ -35,6 +35,14 @@ class TelephonyIcons { R.drawable.stat_sys_signal_4_fully } }; + static final int[] QS_TELEPHONY_SIGNAL_STRENGTH = { + R.drawable.ic_qs_signal_0, + R.drawable.ic_qs_signal_1, + R.drawable.ic_qs_signal_2, + R.drawable.ic_qs_signal_3, + R.drawable.ic_qs_signal_4 + }; + static final int[][] TELEPHONY_SIGNAL_STRENGTH_ROAMING = { { R.drawable.stat_sys_signal_0, R.drawable.stat_sys_signal_1, diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/policy/WifiIcons.java b/packages/SystemUI/src/com/android/systemui/statusbar/policy/WifiIcons.java index 8d72eba..f5d6484 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/policy/WifiIcons.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/policy/WifiIcons.java @@ -32,5 +32,13 @@ class WifiIcons { R.drawable.stat_sys_wifi_signal_4_fully } }; + static final int[] QS_WIFI_SIGNAL_STRENGTH = { + R.drawable.ic_qs_wifi_not_connected, + R.drawable.ic_qs_wifi_1, + R.drawable.ic_qs_wifi_2, + R.drawable.ic_qs_wifi_3, + R.drawable.ic_qs_wifi_4 + }; + static final int WIFI_LEVEL_COUNT = WIFI_SIGNAL_STRENGTH[0].length; } |