diff options
author | Winson Chung <winsonc@google.com> | 2012-09-27 16:56:42 -0700 |
---|---|---|
committer | Winson Chung <winsonc@google.com> | 2012-09-27 17:18:23 -0700 |
commit | efba3235fcd5b71e17de13edd4be9819970014a9 (patch) | |
tree | ae74ce0a78677bbfb402741aeb407c9e45e52574 /packages | |
parent | 9aacd50ccdf8cc75f5c98da3dd64db1ec59e116f (diff) | |
download | frameworks_base-efba3235fcd5b71e17de13edd4be9819970014a9.zip frameworks_base-efba3235fcd5b71e17de13edd4be9819970014a9.tar.gz frameworks_base-efba3235fcd5b71e17de13edd4be9819970014a9.tar.bz2 |
Fixing various QS issues. (Bug 7217102)
- Certain tiles were not updating strings based on configuration changes
- Updating bluetooth icon
- Fixing issue where QuickContacts is not being launched per-user
Change-Id: I5936e856b5454d608f9c7ddb6b81d9b566bb03ea
Diffstat (limited to 'packages')
15 files changed, 91 insertions, 9 deletions
diff --git a/packages/SystemUI/res/drawable-hdpi/ic_qs_bluetooth_off.png b/packages/SystemUI/res/drawable-hdpi/ic_qs_bluetooth_off.png Binary files differindex d5650a7..7c6ca75 100644 --- a/packages/SystemUI/res/drawable-hdpi/ic_qs_bluetooth_off.png +++ b/packages/SystemUI/res/drawable-hdpi/ic_qs_bluetooth_off.png diff --git a/packages/SystemUI/res/drawable-hdpi/ic_qs_bluetooth_on.png b/packages/SystemUI/res/drawable-hdpi/ic_qs_bluetooth_on.png Binary files differindex 7d6fed5..ff0ba07 100644 --- a/packages/SystemUI/res/drawable-hdpi/ic_qs_bluetooth_on.png +++ b/packages/SystemUI/res/drawable-hdpi/ic_qs_bluetooth_on.png diff --git a/packages/SystemUI/res/drawable-mdpi/ic_qs_bluetooth_off.png b/packages/SystemUI/res/drawable-mdpi/ic_qs_bluetooth_off.png Binary files differindex 19e4e40..61eff94 100644 --- a/packages/SystemUI/res/drawable-mdpi/ic_qs_bluetooth_off.png +++ b/packages/SystemUI/res/drawable-mdpi/ic_qs_bluetooth_off.png diff --git a/packages/SystemUI/res/drawable-mdpi/ic_qs_bluetooth_on.png b/packages/SystemUI/res/drawable-mdpi/ic_qs_bluetooth_on.png Binary files differindex ec30791..b480a80 100644 --- a/packages/SystemUI/res/drawable-mdpi/ic_qs_bluetooth_on.png +++ b/packages/SystemUI/res/drawable-mdpi/ic_qs_bluetooth_on.png diff --git a/packages/SystemUI/res/drawable-xhdpi/ic_qs_bluetooth_off.png b/packages/SystemUI/res/drawable-xhdpi/ic_qs_bluetooth_off.png Binary files differindex 65a873d..b4d9175 100644 --- a/packages/SystemUI/res/drawable-xhdpi/ic_qs_bluetooth_off.png +++ b/packages/SystemUI/res/drawable-xhdpi/ic_qs_bluetooth_off.png diff --git a/packages/SystemUI/res/drawable-xhdpi/ic_qs_bluetooth_on.png b/packages/SystemUI/res/drawable-xhdpi/ic_qs_bluetooth_on.png Binary files differindex 7ac3015..598d967 100644 --- a/packages/SystemUI/res/drawable-xhdpi/ic_qs_bluetooth_on.png +++ b/packages/SystemUI/res/drawable-xhdpi/ic_qs_bluetooth_on.png diff --git a/packages/SystemUI/res/layout/quick_settings_tile_airplane.xml b/packages/SystemUI/res/layout/quick_settings_tile_airplane.xml index 6ae10d5..ac87496 100644 --- a/packages/SystemUI/res/layout/quick_settings_tile_airplane.xml +++ b/packages/SystemUI/res/layout/quick_settings_tile_airplane.xml @@ -21,5 +21,4 @@ android:layout_height="wrap_content" android:layout_gravity="center" android:gravity="center" - android:text="@string/quick_settings_airplane_mode_label" />
\ No newline at end of file diff --git a/packages/SystemUI/res/layout/quick_settings_tile_bluetooth.xml b/packages/SystemUI/res/layout/quick_settings_tile_bluetooth.xml index 565055c..2f3a9c6 100644 --- a/packages/SystemUI/res/layout/quick_settings_tile_bluetooth.xml +++ b/packages/SystemUI/res/layout/quick_settings_tile_bluetooth.xml @@ -21,5 +21,4 @@ android:layout_height="wrap_content" android:layout_gravity="center" android:gravity="center" - android:text="@string/quick_settings_bluetooth_label" />
\ No newline at end of file diff --git a/packages/SystemUI/res/layout/quick_settings_tile_brightness.xml b/packages/SystemUI/res/layout/quick_settings_tile_brightness.xml index ac872e6..5b3ce1f 100644 --- a/packages/SystemUI/res/layout/quick_settings_tile_brightness.xml +++ b/packages/SystemUI/res/layout/quick_settings_tile_brightness.xml @@ -22,5 +22,4 @@ android:layout_gravity="center" android:gravity="center" android:drawableTop="@drawable/ic_qs_brightness_auto_off" - android:text="@string/quick_settings_brightness_label" />
\ No newline at end of file diff --git a/packages/SystemUI/res/layout/quick_settings_tile_rotation_lock.xml b/packages/SystemUI/res/layout/quick_settings_tile_rotation_lock.xml index 4dbf6a0..6aecaea 100644 --- a/packages/SystemUI/res/layout/quick_settings_tile_rotation_lock.xml +++ b/packages/SystemUI/res/layout/quick_settings_tile_rotation_lock.xml @@ -21,5 +21,4 @@ android:layout_height="wrap_content" android:layout_gravity="center" android:gravity="center" - android:text="@string/quick_settings_rotation_unlocked_label" />
\ No newline at end of file diff --git a/packages/SystemUI/res/layout/quick_settings_tile_settings.xml b/packages/SystemUI/res/layout/quick_settings_tile_settings.xml index 7026ebc..d155935 100644 --- a/packages/SystemUI/res/layout/quick_settings_tile_settings.xml +++ b/packages/SystemUI/res/layout/quick_settings_tile_settings.xml @@ -16,10 +16,10 @@ <TextView xmlns:android="http://schemas.android.com/apk/res/android" style="@style/TextAppearance.QuickSettings.TileView" + android:id="@+id/settings_tileview" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="center" android:gravity="center" android:drawableTop="@drawable/ic_qs_settings" - android:text="@string/quick_settings_settings_label" />
\ No newline at end of file diff --git a/packages/SystemUI/res/layout/quick_settings_tile_user.xml b/packages/SystemUI/res/layout/quick_settings_tile_user.xml index 08e8e20..1732f6d 100644 --- a/packages/SystemUI/res/layout/quick_settings_tile_user.xml +++ b/packages/SystemUI/res/layout/quick_settings_tile_user.xml @@ -18,6 +18,7 @@ android:layout_width="match_parent" android:layout_height="match_parent"> <ImageView + android:id="@+id/user_imageview" android:layout_width="match_parent" android:layout_height="match_parent" android:src="@drawable/ic_qs_default_user" diff --git a/packages/SystemUI/res/values-sw380dp/dimens.xml b/packages/SystemUI/res/values-sw380dp/dimens.xml new file mode 100644 index 0000000..b39e94c --- /dev/null +++ b/packages/SystemUI/res/values-sw380dp/dimens.xml @@ -0,0 +1,21 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- + * Copyright (c) 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. +*/ +--> +<resources> + <!-- The fixed height of each tile --> + <dimen name="quick_settings_cell_height">124dp</dimen> +</resources> diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/QuickSettings.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/QuickSettings.java index 7077018..1ee1c41 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/QuickSettings.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/QuickSettings.java @@ -31,6 +31,7 @@ import android.content.IntentFilter; import android.content.Loader; import android.content.res.Resources; import android.database.Cursor; +import android.graphics.drawable.BitmapDrawable; import android.graphics.drawable.Drawable; import android.graphics.drawable.LevelListDrawable; import android.hardware.display.DisplayManager; @@ -40,6 +41,7 @@ import android.os.Handler; import android.os.RemoteException; import android.os.SystemProperties; import android.os.UserHandle; +import android.os.UserManager; import android.provider.ContactsContract; import android.provider.Settings; import android.view.LayoutInflater; @@ -160,6 +162,8 @@ class QuickSettings { } private void queryForUserInformation() { + System.out.println("queryForUserInformation"); + Uri userContactUri = Uri.withAppendedPath( ContactsContract.Profile.CONTENT_URI, ContactsContract.Contacts.Data.CONTENT_DIRECTORY); @@ -184,9 +188,11 @@ class QuickSettings { @Override public void onLoadComplete(Loader<Cursor> loader, Cursor cursor) { + UserManager userManager = (UserManager) mContext.getSystemService(Context.USER_SERVICE); if (cursor != null && cursor.moveToFirst()) { String name = cursor.getString(0); // DISPLAY_NAME - mModel.setUserTileInfo(name, null); + BitmapDrawable d = new BitmapDrawable(userManager.getUserIcon(userManager.getUserHandle())); + mModel.setUserTileInfo(name, d); /* byte[] photoData = cursor.getBlob(0); Bitmap b = @@ -248,10 +254,11 @@ class QuickSettings { @Override public void refreshView(QuickSettingsTileView view, State state) { UserState us = (UserState) state; + ImageView iv = (ImageView) view.findViewById(R.id.user_imageview); TextView tv = (TextView) view.findViewById(R.id.user_textview); tv.setText(state.label); if (us.avatar != null) { - tv.setCompoundDrawables(null, us.avatar, null, null); + iv.setImageDrawable(us.avatar); } } }); @@ -290,6 +297,13 @@ class QuickSettings { startSettingsActivity(android.provider.Settings.ACTION_SETTINGS); } }); + mModel.addSettingsTile(settingsTile, new QuickSettingsModel.RefreshCallback() { + @Override + public void refreshView(QuickSettingsTileView view, State state) { + TextView tv = (TextView) view.findViewById(R.id.settings_tileview); + tv.setText(state.label); + } + }); parent.addView(settingsTile); mDynamicSpannedTiles.add(settingsTile); } @@ -418,6 +432,7 @@ class QuickSettings { public void refreshView(QuickSettingsTileView view, State state) { TextView tv = (TextView) view.findViewById(R.id.airplane_mode_textview); tv.setCompoundDrawablesWithIntrinsicBounds(0, state.iconId, 0, 0); + tv.setText(state.label); } }); parent.addView(airplaneTile); @@ -476,6 +491,7 @@ class QuickSettings { public void refreshView(QuickSettingsTileView view, State state) { TextView tv = (TextView) view.findViewById(R.id.brightness_textview); tv.setCompoundDrawablesWithIntrinsicBounds(0, state.iconId, 0, 0); + tv.setText(state.label); dismissBrightnessDialog(mBrightnessDialogShortTimeout); } }); @@ -614,6 +630,9 @@ class QuickSettings { void updateResources() { Resources r = mContext.getResources(); + // Update the model + mModel.updateResources(); + // Update the User, Time, and Settings tiles spans, and reset everything else int span = r.getInteger(R.integer.quick_settings_user_time_settings_tile_span); for (QuickSettingsTileView v : mDynamicSpannedTiles) { 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 04633bf..a4caabe 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/QuickSettingsModel.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/QuickSettingsModel.java @@ -188,6 +188,10 @@ class QuickSettingsModel implements BluetoothStateChangeCallback, private RefreshCallback mBugreportCallback; private State mBugreportState = new State(); + private QuickSettingsTileView mSettingsTile; + private RefreshCallback mSettingsCallback; + private State mSettingsState = new State(); + public QuickSettingsModel(Context context) { mContext = context; mHandler = new Handler(); @@ -201,6 +205,26 @@ class QuickSettingsModel implements BluetoothStateChangeCallback, context.registerReceiver(mAlarmIntentReceiver, alarmIntentFilter); } + void updateResources() { + refreshSettingsTile(); + refreshBatteryTile(); + refreshBluetoothTile(); + refreshBrightnessTile(); + refreshRotationLockTile(); + } + + // Settings + void addSettingsTile(QuickSettingsTileView view, RefreshCallback cb) { + mSettingsTile = view; + mSettingsCallback = cb; + refreshSettingsTile(); + } + void refreshSettingsTile() { + Resources r = mContext.getResources(); + mSettingsState.label = r.getString(R.string.quick_settings_settings_label); + mSettingsCallback.refreshView(mSettingsTile, mSettingsState); + } + // User void addUserTile(QuickSettingsTileView view, RefreshCallback cb) { mUserTile = view; @@ -250,7 +274,9 @@ class QuickSettingsModel implements BluetoothStateChangeCallback, } }); mAirplaneModeCallback = cb; - mAirplaneModeCallback.refreshView(mAirplaneModeTile, mAirplaneModeState); + int airplaneMode = Settings.Global.getInt(mContext.getContentResolver(), + Settings.Global.AIRPLANE_MODE_ON, 0); + onAirplaneModeChanged(airplaneMode != 0); } private void setAirplaneModeState(boolean enabled) { // TODO: Sets the view to be "awaiting" if not already awaiting @@ -273,6 +299,7 @@ class QuickSettingsModel implements BluetoothStateChangeCallback, mAirplaneModeState.iconId = (enabled ? R.drawable.ic_qs_airplane_on : R.drawable.ic_qs_airplane_off); + mAirplaneModeState.label = r.getString(R.string.quick_settings_airplane_mode_label); mAirplaneModeCallback.refreshView(mAirplaneModeTile, mAirplaneModeState); } @@ -307,7 +334,7 @@ class QuickSettingsModel implements BluetoothStateChangeCallback, Resources r = mContext.getResources(); mWifiState.enabled = enabled; boolean wifiConnected = enabled && (wifiSignalIconId > 0) && (enabledDesc != null); - boolean wifiNotConnected = enabled && (enabledDesc == null); + boolean wifiNotConnected = (wifiSignalIconId > 0) && (enabledDesc == null); if (wifiConnected) { mWifiState.iconId = wifiSignalIconId; mWifiState.label = removeDoubleQuotes(enabledDesc); @@ -377,6 +404,11 @@ class QuickSettingsModel implements BluetoothStateChangeCallback, } mBluetoothCallback.refreshView(mBluetoothTile, mBluetoothState); } + void refreshBluetoothTile() { + if (mBluetoothTile != null) { + onBluetoothStateChange(mBluetoothState.enabled); + } + } // Battery void addBatteryTile(QuickSettingsTileView view, RefreshCallback cb) { @@ -391,6 +423,9 @@ class QuickSettingsModel implements BluetoothStateChangeCallback, mBatteryState.pluggedIn = pluggedIn; mBatteryCallback.refreshView(mBatteryTile, mBatteryState); } + void refreshBatteryTile() { + mBatteryCallback.refreshView(mBatteryTile, mBatteryState); + } // Location void addLocationTile(QuickSettingsTileView view, RefreshCallback cb) { @@ -544,6 +579,11 @@ class QuickSettingsModel implements BluetoothStateChangeCallback, mRotationLockCallback.refreshView(mRotationLockTile, mRotationLockState); } } + void refreshRotationLockTile() { + if (mRotationLockTile != null) { + onRotationLockChanged(); + } + } // Brightness void addBrightnessTile(QuickSettingsTileView view, RefreshCallback cb) { @@ -553,6 +593,7 @@ class QuickSettingsModel implements BluetoothStateChangeCallback, } @Override public void onBrightnessLevelChanged() { + Resources r = mContext.getResources(); int mode = Settings.System.getInt(mContext.getContentResolver(), Settings.System.SCREEN_BRIGHTNESS_MODE, Settings.System.SCREEN_BRIGHTNESS_MODE_MANUAL); @@ -561,7 +602,11 @@ class QuickSettingsModel implements BluetoothStateChangeCallback, mBrightnessState.iconId = mBrightnessState.autoBrightness ? R.drawable.ic_qs_brightness_auto_on : R.drawable.ic_qs_brightness_auto_off; + mBrightnessState.label = r.getString(R.string.quick_settings_brightness_label); mBrightnessCallback.refreshView(mBrightnessTile, mBrightnessState); } + void refreshBrightnessTile() { + onBrightnessLevelChanged(); + } }
\ No newline at end of file |