diff options
author | Manuel Auer <auer.manuel@gmail.com> | 2010-11-20 10:22:59 +0100 |
---|---|---|
committer | Steve Kondik <shade@chemlab.org> | 2010-11-20 05:25:09 -0500 |
commit | 25cea7aa207e57b4eeceb5538b0ffb41d0ab45f0 (patch) | |
tree | bdb1f6e9f36566b5be60473d9866c252e13477f0 /services/java/com/android/server | |
parent | 3a79f7c1dfdc113c053bf2e0bb96d08e9329f303 (diff) | |
download | frameworks_base-25cea7aa207e57b4eeceb5538b0ffb41d0ab45f0.zip frameworks_base-25cea7aa207e57b4eeceb5538b0ffb41d0ab45f0.tar.gz frameworks_base-25cea7aa207e57b4eeceb5538b0ffb41d0ab45f0.tar.bz2 |
White energy widget icons for black statusbar (STOCK_Black)
Change-Id: Ib6a7e284648212bcb90a6f54dea834b83cda26c0
Diffstat (limited to 'services/java/com/android/server')
15 files changed, 334 insertions, 49 deletions
diff --git a/services/java/com/android/server/status/widget/AirplaneButton.java b/services/java/com/android/server/status/widget/AirplaneButton.java index c7a4df7..9823286 100755 --- a/services/java/com/android/server/status/widget/AirplaneButton.java +++ b/services/java/com/android/server/status/widget/AirplaneButton.java @@ -10,14 +10,28 @@ import android.provider.Settings; public class AirplaneButton extends PowerButton { + Context mContext; + static AirplaneButton ownButton=null; public void updateState(Context context) { + mContext = context; + boolean useCustomExp = Settings.System.getInt(mContext.getContentResolver(), + Settings.System.NOTIF_EXPANDED_BAR_CUSTOM, 0) == 1; + if (getState(context)) { - currentIcon = R.drawable.stat_airplane_on; + if (useCustomExp) { + currentIcon = R.drawable.stat_airplane_on_cust; + } else { + currentIcon = R.drawable.stat_airplane_on; + } currentState = PowerButton.STATE_ENABLED; } else { - currentIcon = R.drawable.stat_airplane_off; + if (useCustomExp) { + currentIcon = R.drawable.stat_airplane_off_cust; + } else { + currentIcon = R.drawable.stat_airplane_off; + } currentState = PowerButton.STATE_DISABLED; } diff --git a/services/java/com/android/server/status/widget/AutoRotateButton.java b/services/java/com/android/server/status/widget/AutoRotateButton.java index 501404a..f904bcc 100755 --- a/services/java/com/android/server/status/widget/AutoRotateButton.java +++ b/services/java/com/android/server/status/widget/AutoRotateButton.java @@ -8,6 +8,8 @@ import android.provider.Settings; public class AutoRotateButton extends PowerButton { + Context mContext; + static AutoRotateButton ownButton = null; @Override @@ -24,11 +26,23 @@ public class AutoRotateButton extends PowerButton { @Override public void updateState(Context context) { + mContext = context; + boolean useCustomExp = Settings.System.getInt(mContext.getContentResolver(), + Settings.System.NOTIF_EXPANDED_BAR_CUSTOM, 0) == 1; + if (getOrientationState(context) == 1) { - currentIcon = R.drawable.stat_orientation_on; + if (useCustomExp) { + currentIcon = R.drawable.stat_orientation_on_cust; + } else { + currentIcon = R.drawable.stat_orientation_on; + } currentState = PowerButton.STATE_ENABLED; } else { - currentIcon = R.drawable.stat_orientation_off; + if (useCustomExp) { + currentIcon = R.drawable.stat_orientation_off_cust; + } else { + currentIcon = R.drawable.stat_orientation_off; + } currentState = PowerButton.STATE_DISABLED; } } diff --git a/services/java/com/android/server/status/widget/BluetoothButton.java b/services/java/com/android/server/status/widget/BluetoothButton.java index 4461a54..46367d3 100755 --- a/services/java/com/android/server/status/widget/BluetoothButton.java +++ b/services/java/com/android/server/status/widget/BluetoothButton.java @@ -10,9 +10,12 @@ import android.content.Intent; import android.content.SharedPreferences; import android.os.AsyncTask; import android.util.Log; +import android.provider.Settings; public class BluetoothButton extends PowerButton{ + Context mContext; + private static final StateTracker sBluetoothState = new BluetoothStateTracker(); static BluetoothButton ownButton = null; @@ -104,13 +107,25 @@ public class BluetoothButton extends PowerButton{ @Override public void updateState(Context context) { + mContext = context; + boolean useCustomExp = Settings.System.getInt(mContext.getContentResolver(), + Settings.System.NOTIF_EXPANDED_BAR_CUSTOM, 0) == 1; + currentState = sBluetoothState.getTriState(context); switch (currentState) { case PowerButton.STATE_DISABLED: - currentIcon = R.drawable.stat_bluetooth_off; + if (useCustomExp) { + currentIcon = R.drawable.stat_bluetooth_off_cust; + } else { + currentIcon = R.drawable.stat_bluetooth_off; + } break; case PowerButton.STATE_ENABLED: - currentIcon = R.drawable.stat_bluetooth_on; + if (useCustomExp) { + currentIcon = R.drawable.stat_bluetooth_on_cust; + } else { + currentIcon = R.drawable.stat_bluetooth_on; + } break; case PowerButton.STATE_INTERMEDIATE: // In the transitional state, the bottom green bar @@ -119,9 +134,17 @@ public class BluetoothButton extends PowerButton{ // user's intent. This is much easier to see in // sunlight. if (sBluetoothState.isTurningOn()) { - currentIcon = R.drawable.stat_bluetooth_on; + if (useCustomExp) { + currentIcon = R.drawable.stat_bluetooth_on_cust; + } else { + currentIcon = R.drawable.stat_bluetooth_on; + } } else { - currentIcon = R.drawable.stat_bluetooth_off; + if (useCustomExp) { + currentIcon = R.drawable.stat_bluetooth_off_cust; + } else { + currentIcon = R.drawable.stat_bluetooth_off; + } } break; } diff --git a/services/java/com/android/server/status/widget/BrightnessButton.java b/services/java/com/android/server/status/widget/BrightnessButton.java index 9a4e098..7332056 100755 --- a/services/java/com/android/server/status/widget/BrightnessButton.java +++ b/services/java/com/android/server/status/widget/BrightnessButton.java @@ -14,6 +14,8 @@ import android.util.Log; public class BrightnessButton extends PowerButton { + Context mContext; + /** * Minimum and maximum brightnesses. Don't go to 0 since that makes the * display unusable @@ -203,23 +205,47 @@ Low High Max @Override public void updateState(Context context) { + mContext = context; + boolean useCustomExp = Settings.System.getInt(mContext.getContentResolver(), + Settings.System.NOTIF_EXPANDED_BAR_CUSTOM, 0) == 1; + currentMode = Settings.System.getInt(context.getContentResolver(), Settings.System.EXPANDED_BRIGHTNESS_MODE, DEFAULT_SETTING); if (isBrightnessSetToAutomatic(context)) { - currentIcon = R.drawable.stat_brightness_auto; + if (useCustomExp) { + currentIcon = R.drawable.stat_brightness_auto_cust; + } else { + currentIcon = R.drawable.stat_brightness_auto; + } currentState = PowerButton.STATE_ENABLED; } else if (getBrightnessState(context) == PowerButton.STATE_ENABLED) { - currentIcon = R.drawable.stat_brightness_on; + if (useCustomExp) { + currentIcon = R.drawable.stat_brightness_on_cust; + } else { + currentIcon = R.drawable.stat_brightness_on; + } currentState = PowerButton.STATE_ENABLED; } else if (getBrightnessState(context) == PowerButton.STATE_TURNING_ON) { - currentIcon = R.drawable.stat_brightness_on; + if (useCustomExp) { + currentIcon = R.drawable.stat_brightness_on_cust; + } else { + currentIcon = R.drawable.stat_brightness_on; + } currentState = PowerButton.STATE_INTERMEDIATE; } else if (getBrightnessState(context) == PowerButton.STATE_TURNING_OFF) { - currentIcon = R.drawable.stat_brightness_off; + if (useCustomExp) { + currentIcon = R.drawable.stat_brightness_off_cust; + } else { + currentIcon = R.drawable.stat_brightness_off; + } currentState = PowerButton.STATE_INTERMEDIATE; } else { - currentIcon = R.drawable.stat_brightness_off; + if (useCustomExp) { + currentIcon = R.drawable.stat_brightness_off_cust; + } else { + currentIcon = R.drawable.stat_brightness_off; + } currentState = PowerButton.STATE_DISABLED; } } diff --git a/services/java/com/android/server/status/widget/FlashlightButton.java b/services/java/com/android/server/status/widget/FlashlightButton.java index f6fd789..eb25cf0 100644 --- a/services/java/com/android/server/status/widget/FlashlightButton.java +++ b/services/java/com/android/server/status/widget/FlashlightButton.java @@ -19,6 +19,9 @@ import java.io.FileInputStream; import java.io.FileOutputStream; public class FlashlightButton extends PowerButton { + + Context mContext; + static FlashlightButton ownButton; private static final String TAG = "FlashlightButton"; private static int currentMode; @@ -44,11 +47,23 @@ public class FlashlightButton extends PowerButton { } public void updateState(Context context) { + mContext = context; + boolean useCustomExp = Settings.System.getInt(mContext.getContentResolver(), + Settings.System.NOTIF_EXPANDED_BAR_CUSTOM, 0) == 1; + if(getFlashlightEnabled()) { - currentIcon = com.android.internal.R.drawable.stat_flashlight_on; + if (useCustomExp) { + currentIcon = com.android.internal.R.drawable.stat_flashlight_on_cust; + } else { + currentIcon = com.android.internal.R.drawable.stat_flashlight_on; + } currentState = STATE_ENABLED; } else { - currentIcon = com.android.internal.R.drawable.stat_flashlight_off; + if (useCustomExp) { + currentIcon = com.android.internal.R.drawable.stat_flashlight_off_cust; + } else { + currentIcon = com.android.internal.R.drawable.stat_flashlight_off; + } currentState = STATE_DISABLED; } } diff --git a/services/java/com/android/server/status/widget/GPSButton.java b/services/java/com/android/server/status/widget/GPSButton.java index 0251745..5b01649 100644 --- a/services/java/com/android/server/status/widget/GPSButton.java +++ b/services/java/com/android/server/status/widget/GPSButton.java @@ -10,15 +10,30 @@ import android.provider.Settings; import android.util.Log; public class GPSButton extends PowerButton { + + Context mContext; + static GPSButton ownButton; public void updateState(Context context) { + mContext = context; + boolean useCustomExp = Settings.System.getInt(mContext.getContentResolver(), + Settings.System.NOTIF_EXPANDED_BAR_CUSTOM, 0) == 1; + Log.i("GPSButton", "Update State"); if(getGpsState(context)) { - currentIcon = com.android.internal.R.drawable.stat_gps_on; + if (useCustomExp) { + currentIcon = com.android.internal.R.drawable.stat_gps_on_cust; + } else { + currentIcon = com.android.internal.R.drawable.stat_gps_on; + } currentState = STATE_ENABLED; } else { - currentIcon = com.android.internal.R.drawable.stat_gps_off; + if (useCustomExp) { + currentIcon = com.android.internal.R.drawable.stat_gps_off_cust; + } else { + currentIcon = com.android.internal.R.drawable.stat_gps_off; + } currentState = STATE_DISABLED; } } diff --git a/services/java/com/android/server/status/widget/LockScreenButton.java b/services/java/com/android/server/status/widget/LockScreenButton.java index e1b205d..915e4e4 100755 --- a/services/java/com/android/server/status/widget/LockScreenButton.java +++ b/services/java/com/android/server/status/widget/LockScreenButton.java @@ -10,9 +10,12 @@ import android.content.Context; import android.content.SharedPreferences; import android.view.Gravity; import android.widget.Toast; +import android.provider.Settings; public class LockScreenButton extends PowerButton { + Context mContext; + static Boolean lockScreen = null; public static final String LOCK_SCREEN = "lockScreen"; @@ -29,15 +32,31 @@ public class LockScreenButton extends PowerButton { } public void updateState(Context context) { + mContext = context; + boolean useCustomExp = Settings.System.getInt(mContext.getContentResolver(), + Settings.System.NOTIF_EXPANDED_BAR_CUSTOM, 0) == 1; + getState(context); if (lockScreen == null) { - currentIcon = R.drawable.stat_lock_screen_off; + if (useCustomExp) { + currentIcon = R.drawable.stat_lock_screen_off_cust; + } else { + currentIcon = R.drawable.stat_lock_screen_off; + } currentState = PowerButton.STATE_INTERMEDIATE; } else if (lockScreen) { - currentIcon = R.drawable.stat_lock_screen_on; + if (useCustomExp) { + currentIcon = R.drawable.stat_lock_screen_on_cust; + } else { + currentIcon = R.drawable.stat_lock_screen_on; + } currentState = PowerButton.STATE_ENABLED; } else { - currentIcon = R.drawable.stat_lock_screen_off; + if (useCustomExp) { + currentIcon = R.drawable.stat_lock_screen_off_cust; + } else { + currentIcon = R.drawable.stat_lock_screen_off; + } currentState = PowerButton.STATE_DISABLED; } } diff --git a/services/java/com/android/server/status/widget/MobileDataButton.java b/services/java/com/android/server/status/widget/MobileDataButton.java index 69aa304..d3810f2 100755 --- a/services/java/com/android/server/status/widget/MobileDataButton.java +++ b/services/java/com/android/server/status/widget/MobileDataButton.java @@ -10,6 +10,8 @@ import android.provider.Settings; public class MobileDataButton extends PowerButton { + Context mContext; + public static final String MOBILE_DATA_CHANGED = "com.android.internal.telephony.MOBILE_DATA_CHANGED"; static MobileDataButton ownButton = null; @@ -51,14 +53,30 @@ public class MobileDataButton extends PowerButton { @Override public void updateState(Context context) { + mContext = context; + boolean useCustomExp = Settings.System.getInt(mContext.getContentResolver(), + Settings.System.NOTIF_EXPANDED_BAR_CUSTOM, 0) == 1; + if (stateChangeRequest) { - currentIcon = R.drawable.stat_data_on; + if (useCustomExp) { + currentIcon = R.drawable.stat_data_on_cust; + } else { + currentIcon = R.drawable.stat_data_on; + } currentState = PowerButton.STATE_INTERMEDIATE; } else if (getDataState(context)) { - currentIcon = R.drawable.stat_data_on; + if (useCustomExp) { + currentIcon = R.drawable.stat_data_on_cust; + } else { + currentIcon = R.drawable.stat_data_on; + } currentState = PowerButton.STATE_ENABLED; } else { - currentIcon = R.drawable.stat_data_off; + if (useCustomExp) { + currentIcon = R.drawable.stat_data_off_cust; + } else { + currentIcon = R.drawable.stat_data_off; + } currentState = PowerButton.STATE_DISABLED; } } diff --git a/services/java/com/android/server/status/widget/NetworkModeButton.java b/services/java/com/android/server/status/widget/NetworkModeButton.java index 885ab45..81becbe 100755 --- a/services/java/com/android/server/status/widget/NetworkModeButton.java +++ b/services/java/com/android/server/status/widget/NetworkModeButton.java @@ -13,6 +13,8 @@ import com.android.internal.telephony.Phone; public class NetworkModeButton extends PowerButton{ + Context mContext; + public static final String NETWORK_MODE_CHANGED = "com.android.internal.telephony.NETWORK_MODE_CHANGED"; public static final String REQUEST_NETWORK_MODE = "com.android.internal.telephony.REQUEST_NETWORK_MODE"; public static final String MODIFY_NETWORK_MODE = "com.android.internal.telephony.MODIFY_NETWORK_MODE"; @@ -44,7 +46,6 @@ public class NetworkModeButton extends PowerButton{ switch(networkMode) { case Phone.NT_MODE_WCDMA_PREF: case Phone.NT_MODE_WCDMA_ONLY: - case Phone.NT_MODE_GSM_UMTS: return PowerButton.STATE_ENABLED; case Phone.NT_MODE_GSM_ONLY: return PowerButton.STATE_DISABLED; @@ -99,7 +100,6 @@ public class NetworkModeButton extends PowerButton{ Intent intent = new Intent(MODIFY_NETWORK_MODE); switch (networkMode ) { case Phone.NT_MODE_WCDMA_PREF: - case Phone.NT_MODE_GSM_UMTS: intent.putExtra(NETWORK_MODE, Phone.NT_MODE_GSM_ONLY); currentInternalState = PowerButton.STATE_TURNING_OFF; intendedNetworkMode=Phone.NT_MODE_GSM_ONLY; @@ -137,6 +137,10 @@ public class NetworkModeButton extends PowerButton{ @Override public void updateState(Context context) { + mContext = context; + boolean useCustomExp = Settings.System.getInt(mContext.getContentResolver(), + Settings.System.NOTIF_EXPANDED_BAR_CUSTOM, 0) == 1; + currentMode = Settings.System.getInt(context.getContentResolver(), Settings.System.EXPANDED_NETWORK_MODE, DEFAULT_SETTING); networkMode = get2G3G(context); @@ -144,13 +148,25 @@ public class NetworkModeButton extends PowerButton{ switch (currentState) { case PowerButton.STATE_DISABLED: - currentIcon = R.drawable.stat_2g3g_off; + if (useCustomExp) { + currentIcon = R.drawable.stat_2g3g_off_cust; + } else { + currentIcon = R.drawable.stat_2g3g_off; + } break; case PowerButton.STATE_ENABLED: if (networkMode == Phone.NT_MODE_WCDMA_ONLY) { - currentIcon = R.drawable.stat_3g_on; + if (useCustomExp) { + currentIcon = R.drawable.stat_3g_on_cust; + } else { + currentIcon = R.drawable.stat_3g_on; + } } else { - currentIcon = R.drawable.stat_2g3g_on; + if (useCustomExp) { + currentIcon = R.drawable.stat_2g3g_on_cust; + } else { + currentIcon = R.drawable.stat_2g3g_on; + } } break; case PowerButton.STATE_INTERMEDIATE: @@ -161,12 +177,24 @@ public class NetworkModeButton extends PowerButton{ // sunlight. if (currentInternalState == PowerButton.STATE_TURNING_ON) { if (intendedNetworkMode == Phone.NT_MODE_WCDMA_ONLY) { - currentIcon = R.drawable.stat_3g_on; + if (useCustomExp) { + currentIcon = R.drawable.stat_3g_on_cust; + } else { + currentIcon = R.drawable.stat_3g_on; + } } else { - currentIcon = R.drawable.stat_2g3g_on; + if (useCustomExp) { + currentIcon = R.drawable.stat_2g3g_on_cust; + } else { + currentIcon = R.drawable.stat_2g3g_on; + } } } else { - currentIcon = R.drawable.stat_2g3g_off; + if (useCustomExp) { + currentIcon = R.drawable.stat_2g3g_off_cust; + } else { + currentIcon = R.drawable.stat_2g3g_off; + } } break; } diff --git a/services/java/com/android/server/status/widget/ScreenTimeoutButton.java b/services/java/com/android/server/status/widget/ScreenTimeoutButton.java index c64e4fb..c0c4fe8 100755 --- a/services/java/com/android/server/status/widget/ScreenTimeoutButton.java +++ b/services/java/com/android/server/status/widget/ScreenTimeoutButton.java @@ -10,6 +10,8 @@ import android.provider.Settings; public class ScreenTimeoutButton extends PowerButton { + Context mContext; + public static final int SCREEN_MINIMUM_TIMEOUT = 15000; public static final int SCREEN_LOW_TIMEOUT = 30000; public static final int SCREEN_NORMAL_TIMEOUT = 60000; @@ -83,19 +85,35 @@ public class ScreenTimeoutButton extends PowerButton { @Override public void updateState(Context context) { + mContext = context; + boolean useCustomExp = Settings.System.getInt(mContext.getContentResolver(), + Settings.System.NOTIF_EXPANDED_BAR_CUSTOM, 0) == 1; + currentMode = Settings.System.getInt(context.getContentResolver(), Settings.System.EXPANDED_SCREENTIMEOUT_MODE, DEFAULT_SETTING); int timeout=getScreenTtimeout(context); //TODO: ADD support for the possible values if (timeout <= SCREEN_LOW_TIMEOUT) { - currentIcon = R.drawable.stat_screen_timeout_off; + if (useCustomExp) { + currentIcon = R.drawable.stat_screen_timeout_off_cust; + } else { + currentIcon = R.drawable.stat_screen_timeout_off; + } currentState = PowerButton.STATE_DISABLED; } else if (timeout <= SCREEN_HI_TIMEOUT) { - currentIcon = R.drawable.stat_screen_timeout_off; + if (useCustomExp) { + currentIcon = R.drawable.stat_screen_timeout_off_cust; + } else { + currentIcon = R.drawable.stat_screen_timeout_off; + } currentState = PowerButton.STATE_INTERMEDIATE; } else { - currentIcon = R.drawable.stat_screen_timeout_on; + if (useCustomExp) { + currentIcon = R.drawable.stat_screen_timeout_on_cust; + } else { + currentIcon = R.drawable.stat_screen_timeout_on; + } currentState = PowerButton.STATE_ENABLED; } } diff --git a/services/java/com/android/server/status/widget/SleepButton.java b/services/java/com/android/server/status/widget/SleepButton.java index c041fce..1ac487f 100644 --- a/services/java/com/android/server/status/widget/SleepButton.java +++ b/services/java/com/android/server/status/widget/SleepButton.java @@ -11,10 +11,22 @@ import android.os.SystemClock; import android.util.Log; public class SleepButton extends PowerButton { + + Context mContext; + static SleepButton ownButton; public void updateState(Context context) { - currentIcon = com.android.internal.R.drawable.stat_sleep; + + mContext = context; + boolean useCustomExp = Settings.System.getInt(mContext.getContentResolver(), + Settings.System.NOTIF_EXPANDED_BAR_CUSTOM, 0) == 1; + + if (useCustomExp) { + currentIcon = com.android.internal.R.drawable.stat_sleep_cust; + } else { + currentIcon = com.android.internal.R.drawable.stat_sleep; + } currentState = STATE_DISABLED; } diff --git a/services/java/com/android/server/status/widget/SoundButton.java b/services/java/com/android/server/status/widget/SoundButton.java index bd96bd7..4feaa55 100755 --- a/services/java/com/android/server/status/widget/SoundButton.java +++ b/services/java/com/android/server/status/widget/SoundButton.java @@ -10,6 +10,8 @@ import android.provider.Settings; public class SoundButton extends PowerButton { + Context mContext; + static SoundButton ownButton = null; public static final int RINGER_MODE_UNKNOWN = 0; @@ -193,25 +195,45 @@ public class SoundButton extends PowerButton { @Override public void updateState(Context context) { + mContext = context; + boolean useCustomExp = Settings.System.getInt(mContext.getContentResolver(), + Settings.System.NOTIF_EXPANDED_BAR_CUSTOM, 0) == 1; + int soundState = getSoundState(context); currentMode = Settings.System.getInt(context.getContentResolver(), Settings.System.EXPANDED_RING_MODE, DEFAULT_SETTING); switch (soundState) { case RINGER_MODE_SOUND_AND_VIBRATE: - currentIcon = R.drawable.stat_ring_on; + if (useCustomExp) { + currentIcon = R.drawable.stat_ring_on_cust; + } else { + currentIcon = R.drawable.stat_ring_on; + } currentState = PowerButton.STATE_ENABLED; break; case RINGER_MODE_SOUND_ONLY: - currentIcon = R.drawable.stat_ring_on; + if (useCustomExp) { + currentIcon = R.drawable.stat_ring_on_cust; + } else { + currentIcon = R.drawable.stat_ring_on; + } currentState = PowerButton.STATE_INTERMEDIATE; break; case RINGER_MODE_VIBRATE_ONLY: - currentIcon = R.drawable.stat_vibrate_off; + if (useCustomExp) { + currentIcon = R.drawable.stat_vibrate_off_cust; + } else { + currentIcon = R.drawable.stat_vibrate_off; + } currentState = PowerButton.STATE_DISABLED; break; case RINGER_MODE_SILENT: - currentIcon = R.drawable.stat_silent; + if (useCustomExp) { + currentIcon = R.drawable.stat_silent_cust; + } else { + currentIcon = R.drawable.stat_silent; + } currentState = PowerButton.STATE_DISABLED; break; diff --git a/services/java/com/android/server/status/widget/SyncButton.java b/services/java/com/android/server/status/widget/SyncButton.java index f7de226..2cddf84 100755 --- a/services/java/com/android/server/status/widget/SyncButton.java +++ b/services/java/com/android/server/status/widget/SyncButton.java @@ -7,9 +7,12 @@ import android.content.ContentResolver; import android.content.Context; import android.content.SharedPreferences; import android.net.ConnectivityManager; +import android.provider.Settings; public class SyncButton extends PowerButton { + Context mContext; + static SyncButton ownButton=null; /** @@ -83,11 +86,23 @@ public class SyncButton extends PowerButton { public void updateState(Context context) { + mContext = context; + boolean useCustomExp = Settings.System.getInt(mContext.getContentResolver(), + Settings.System.NOTIF_EXPANDED_BAR_CUSTOM, 0) == 1; + if (getSync(context)) { - currentIcon = R.drawable.stat_sync_on; + if (useCustomExp) { + currentIcon = R.drawable.stat_sync_on_cust; + } else { + currentIcon = R.drawable.stat_sync_on; + } currentState = PowerButton.STATE_ENABLED; } else { - currentIcon = R.drawable.stat_sync_off; + if (useCustomExp) { + currentIcon = R.drawable.stat_sync_off_cust; + } else { + currentIcon = R.drawable.stat_sync_off; + } currentState = PowerButton.STATE_DISABLED; } } diff --git a/services/java/com/android/server/status/widget/WifiApButton.java b/services/java/com/android/server/status/widget/WifiApButton.java index d0b7394..51347f2 100755 --- a/services/java/com/android/server/status/widget/WifiApButton.java +++ b/services/java/com/android/server/status/widget/WifiApButton.java @@ -10,9 +10,12 @@ import android.content.SharedPreferences; import android.net.wifi.WifiManager; import android.os.AsyncTask; import android.util.Log; +import android.provider.Settings; public class WifiApButton extends PowerButton { + Context mContext; + static WifiApButton ownButton = null; @@ -104,13 +107,25 @@ public class WifiApButton extends PowerButton { public void updateState(Context context) { + mContext = context; + boolean useCustomExp = Settings.System.getInt(mContext.getContentResolver(), + Settings.System.NOTIF_EXPANDED_BAR_CUSTOM, 0) == 1; + currentState = sWifiApState.getTriState(context); switch (currentState) { case PowerButton.STATE_DISABLED: - currentIcon = R.drawable.stat_wifi_ap_off; + if (useCustomExp) { + currentIcon = R.drawable.stat_wifi_ap_off_cust; + } else { + currentIcon = R.drawable.stat_wifi_ap_off; + } break; case PowerButton.STATE_ENABLED: - currentIcon = R.drawable.stat_wifi_ap_on; + if (useCustomExp) { + currentIcon = R.drawable.stat_wifi_ap_on_cust; + } else { + currentIcon = R.drawable.stat_wifi_ap_on; + } break; case PowerButton.STATE_INTERMEDIATE: // In the transitional state, the bottom green bar @@ -119,9 +134,17 @@ public class WifiApButton extends PowerButton { // user's intent. This is much easier to see in // sunlight. if (sWifiApState.isTurningOn()) { - currentIcon = R.drawable.stat_wifi_ap_on; + if (useCustomExp) { + currentIcon = R.drawable.stat_wifi_ap_on_cust; + } else { + currentIcon = R.drawable.stat_wifi_ap_on; + } } else { - currentIcon = R.drawable.stat_wifi_ap_off; + if (useCustomExp) { + currentIcon = R.drawable.stat_wifi_ap_off_cust; + } else { + currentIcon = R.drawable.stat_wifi_ap_off; + } } break; } diff --git a/services/java/com/android/server/status/widget/WifiButton.java b/services/java/com/android/server/status/widget/WifiButton.java index bb89b6a..aefb78c 100644 --- a/services/java/com/android/server/status/widget/WifiButton.java +++ b/services/java/com/android/server/status/widget/WifiButton.java @@ -12,9 +12,12 @@ import android.content.IntentFilter; import android.net.wifi.WifiManager; import android.os.AsyncTask; import android.util.Log; +import android.provider.Settings; public class WifiButton extends PowerButton{ + Context mContext; + static WifiButton ownButton = null; private static final StateTracker sWifiState = new WifiStateTracker(); @@ -104,13 +107,25 @@ public class WifiButton extends PowerButton{ public void updateState(Context context) { + mContext = context; + boolean useCustomExp = Settings.System.getInt(mContext.getContentResolver(), + Settings.System.NOTIF_EXPANDED_BAR_CUSTOM, 0) == 1; + currentState = sWifiState.getTriState(context); switch (currentState) { case STATE_DISABLED: - currentIcon = com.android.internal.R.drawable.stat_wifi_off; + if (useCustomExp) { + currentIcon = com.android.internal.R.drawable.stat_wifi_off_cust; + } else { + currentIcon = com.android.internal.R.drawable.stat_wifi_off; + } break; case STATE_ENABLED: - currentIcon = com.android.internal.R.drawable.stat_wifi_on; + if (useCustomExp) { + currentIcon = com.android.internal.R.drawable.stat_wifi_on_cust; + } else { + currentIcon = com.android.internal.R.drawable.stat_wifi_on; + } break; case STATE_INTERMEDIATE: // In the transitional state, the bottom green bar @@ -119,9 +134,17 @@ public class WifiButton extends PowerButton{ // user's intent. This is much easier to see in // sunlight. if (sWifiState.isTurningOn()) { - currentIcon = com.android.internal.R.drawable.stat_wifi_on; + if (useCustomExp) { + currentIcon = com.android.internal.R.drawable.stat_wifi_on_cust; + } else { + currentIcon = com.android.internal.R.drawable.stat_wifi_on; + } } else { - currentIcon = com.android.internal.R.drawable.stat_wifi_off; + if (useCustomExp) { + currentIcon = com.android.internal.R.drawable.stat_wifi_off_cust; + } else { + currentIcon = com.android.internal.R.drawable.stat_wifi_off; + } } break; } |