diff options
author | Daniel Sandler <dsandler@android.com> | 2013-04-16 18:33:09 +0000 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2013-04-16 18:33:10 +0000 |
commit | cfd48d77a2d11324ce8641a9cc178fb9f12500a3 (patch) | |
tree | 47296aa11ff2a5f4303a244998c3f2688dd5a66a | |
parent | 8297e68d84a6edc8ecb6d17d5ba2043075f921ff (diff) | |
parent | b5538e642118209add5abd7c5da1472a0b608b07 (diff) | |
download | frameworks_base-cfd48d77a2d11324ce8641a9cc178fb9f12500a3.zip frameworks_base-cfd48d77a2d11324ce8641a9cc178fb9f12500a3.tar.gz frameworks_base-cfd48d77a2d11324ce8641a9cc178fb9f12500a3.tar.bz2 |
Merge "Rebuild quick settings tile layouts." into jb-mr2-dev
22 files changed, 308 insertions, 395 deletions
diff --git a/packages/SystemUI/res/layout/quick_settings_tile_airplane.xml b/packages/SystemUI/res/layout/quick_settings_tile_airplane.xml deleted file mode 100644 index ac87496..0000000 --- a/packages/SystemUI/res/layout/quick_settings_tile_airplane.xml +++ /dev/null @@ -1,24 +0,0 @@ -<?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. ---> -<TextView - xmlns:android="http://schemas.android.com/apk/res/android" - style="@style/TextAppearance.QuickSettings.TileView" - android:id="@+id/airplane_mode_textview" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:layout_gravity="center" - android:gravity="center" - />
\ No newline at end of file diff --git a/packages/SystemUI/res/layout/quick_settings_tile_alarm.xml b/packages/SystemUI/res/layout/quick_settings_tile_alarm.xml index 0327bee..493c704 100644 --- a/packages/SystemUI/res/layout/quick_settings_tile_alarm.xml +++ b/packages/SystemUI/res/layout/quick_settings_tile_alarm.xml @@ -15,11 +15,11 @@ --> <TextView xmlns:android="http://schemas.android.com/apk/res/android" - style="@style/TextAppearance.QuickSettings.TileView" + style="@style/TextAppearance.QuickSettings.TileView.AllInOne" android:id="@+id/alarm_textview" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="center" android:gravity="center" android:drawableTop="@drawable/ic_qs_alarm_on" - />
\ No newline at end of file + /> diff --git a/packages/SystemUI/res/layout/quick_settings_tile_basic.xml b/packages/SystemUI/res/layout/quick_settings_tile_basic.xml new file mode 100644 index 0000000..16bf49c --- /dev/null +++ b/packages/SystemUI/res/layout/quick_settings_tile_basic.xml @@ -0,0 +1,39 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- Copyright (C) 2013 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. +--> +<LinearLayout + xmlns:android="http://schemas.android.com/apk/res/android" + android:layout_width="match_parent" + android:layout_height="match_parent" + android:layout_gravity="top" + android:orientation="vertical"> + <ImageView + android:id="@+id/image" + android:layout_marginTop="@dimen/qs_tile_margin_above_icon" + android:layout_marginBottom="@dimen/qs_tile_margin_below_icon" + android:layout_width="@dimen/qs_tile_icon_size" + android:layout_height="@dimen/qs_tile_icon_size" + android:layout_gravity="top|center_horizontal" + android:scaleType="centerInside" + /> + <TextView + style="@style/TextAppearance.QuickSettings.TileView" + android:id="@+id/text" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:layout_gravity="top|center_horizontal" + android:gravity="top|center_horizontal" + /> +</LinearLayout>
\ No newline at end of file diff --git a/packages/SystemUI/res/layout/quick_settings_tile_battery.xml b/packages/SystemUI/res/layout/quick_settings_tile_battery.xml index 446b24c..c41e9b9 100644 --- a/packages/SystemUI/res/layout/quick_settings_tile_battery.xml +++ b/packages/SystemUI/res/layout/quick_settings_tile_battery.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="utf-8"?> -<!-- Copyright (C) 2012 The Android Open Source Project +<!-- Copyright (C) 2013 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. @@ -14,24 +14,26 @@ limitations under the License. --> <LinearLayout - xmlns:android="http://schemas.android.com/apk/res/android" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:layout_gravity="center" - android:orientation="vertical"> + xmlns:android="http://schemas.android.com/apk/res/android" + android:layout_width="match_parent" + android:layout_height="match_parent" + android:layout_gravity="top" + android:orientation="vertical"> <ImageView - android:id="@+id/battery_image" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:layout_gravity="center" - android:paddingBottom="10dp" - /> + android:id="@+id/image" + android:layout_marginTop="@dimen/qs_tile_margin_above_icon" + android:layout_marginBottom="@dimen/qs_tile_margin_below_icon" + android:layout_width="@dimen/qs_tile_icon_size" + android:layout_height="@dimen/qs_tile_icon_size" + android:layout_gravity="top|center_horizontal" + android:scaleType="centerInside" + /> <TextView - style="@style/TextAppearance.QuickSettings.TileView" - android:id="@+id/battery_textview" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:layout_gravity="center" - android:gravity="center" - /> + style="@style/TextAppearance.QuickSettings.TileView" + android:id="@+id/text" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:layout_gravity="top|center_horizontal" + android:gravity="top|center_horizontal" + /> </LinearLayout>
\ 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 deleted file mode 100644 index 2f3a9c6..0000000 --- a/packages/SystemUI/res/layout/quick_settings_tile_bluetooth.xml +++ /dev/null @@ -1,24 +0,0 @@ -<?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. ---> -<TextView - xmlns:android="http://schemas.android.com/apk/res/android" - style="@style/TextAppearance.QuickSettings.TileView" - android:id="@+id/bluetooth_textview" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:layout_gravity="center" - android:gravity="center" - />
\ 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 deleted file mode 100644 index 5b3ce1f..0000000 --- a/packages/SystemUI/res/layout/quick_settings_tile_brightness.xml +++ /dev/null @@ -1,25 +0,0 @@ -<?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. ---> -<TextView - xmlns:android="http://schemas.android.com/apk/res/android" - style="@style/TextAppearance.QuickSettings.TileView" - android:id="@+id/brightness_textview" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:layout_gravity="center" - android:gravity="center" - android:drawableTop="@drawable/ic_qs_brightness_auto_off" - />
\ No newline at end of file diff --git a/packages/SystemUI/res/layout/quick_settings_tile_bugreport.xml b/packages/SystemUI/res/layout/quick_settings_tile_bugreport.xml deleted file mode 100644 index 0b6a614..0000000 --- a/packages/SystemUI/res/layout/quick_settings_tile_bugreport.xml +++ /dev/null @@ -1,25 +0,0 @@ -<?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. ---> -<TextView - xmlns:android="http://schemas.android.com/apk/res/android" - style="@style/TextAppearance.QuickSettings.TileView" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:layout_gravity="center" - android:gravity="center" - android:drawableTop="@*android:drawable/stat_sys_adb" - android:text="@*android:string/bugreport_title" - /> diff --git a/packages/SystemUI/res/layout/quick_settings_tile_ime.xml b/packages/SystemUI/res/layout/quick_settings_tile_ime.xml index e92acd5..1a31efa5 100644 --- a/packages/SystemUI/res/layout/quick_settings_tile_ime.xml +++ b/packages/SystemUI/res/layout/quick_settings_tile_ime.xml @@ -15,7 +15,7 @@ --> <TextView xmlns:android="http://schemas.android.com/apk/res/android" - style="@style/TextAppearance.QuickSettings.TileView" + style="@style/TextAppearance.QuickSettings.TileView.AllInOne" android:id="@+id/ime_textview" android:layout_width="wrap_content" android:layout_height="wrap_content" @@ -23,4 +23,4 @@ android:gravity="center" android:drawableTop="@drawable/ic_qs_ime" android:text="@string/quick_settings_ime_label" - />
\ No newline at end of file + /> diff --git a/packages/SystemUI/res/layout/quick_settings_tile_location.xml b/packages/SystemUI/res/layout/quick_settings_tile_location.xml deleted file mode 100644 index 0accb38..0000000 --- a/packages/SystemUI/res/layout/quick_settings_tile_location.xml +++ /dev/null @@ -1,26 +0,0 @@ -<?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. ---> -<TextView - xmlns:android="http://schemas.android.com/apk/res/android" - style="@style/TextAppearance.QuickSettings.TileView" - android:id="@+id/location_textview" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:layout_gravity="center" - android:gravity="center" - android:drawableTop="@drawable/ic_qs_location" - android:text="@string/quick_settings_location_label" - />
\ No newline at end of file diff --git a/packages/SystemUI/res/layout/quick_settings_tile_media.xml b/packages/SystemUI/res/layout/quick_settings_tile_media.xml index 7217de3..355176c 100644 --- a/packages/SystemUI/res/layout/quick_settings_tile_media.xml +++ b/packages/SystemUI/res/layout/quick_settings_tile_media.xml @@ -15,10 +15,10 @@ --> <TextView xmlns:android="http://schemas.android.com/apk/res/android" - style="@style/TextAppearance.QuickSettings.TileView" + style="@style/TextAppearance.QuickSettings.TileView.AllInOne" android:layout_width="wrap_content" android:layout_height="wrap_content" android:gravity="center" android:text="@string/quick_settings_media_device_label" android:singleLine="true" - />
\ 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 deleted file mode 100644 index 6aecaea..0000000 --- a/packages/SystemUI/res/layout/quick_settings_tile_rotation_lock.xml +++ /dev/null @@ -1,24 +0,0 @@ -<?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. ---> -<TextView - xmlns:android="http://schemas.android.com/apk/res/android" - style="@style/TextAppearance.QuickSettings.TileView" - android:id="@+id/rotation_lock_textview" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:layout_gravity="center" - android:gravity="center" - />
\ No newline at end of file diff --git a/packages/SystemUI/res/layout/quick_settings_tile_rssi.xml b/packages/SystemUI/res/layout/quick_settings_tile_rssi.xml index febd8a8..34506b1 100644 --- a/packages/SystemUI/res/layout/quick_settings_tile_rssi.xml +++ b/packages/SystemUI/res/layout/quick_settings_tile_rssi.xml @@ -15,27 +15,28 @@ --> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:layout_gravity="center" + android:layout_width="match_parent" + android:layout_height="match_parent" + android:layout_gravity="top" android:orientation="vertical"> <FrameLayout - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:layout_gravity="center"> + android:layout_marginTop="@dimen/qs_tile_margin_above_icon" + android:layout_marginBottom="@dimen/qs_tile_margin_below_icon" + android:layout_width="@dimen/qs_tile_icon_size" + android:layout_height="@dimen/qs_tile_icon_size" + android:layout_gravity="top|center_horizontal" + > <ImageView android:id="@+id/rssi_image" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="center" - android:paddingBottom="10dp" /> <ImageView android:id="@+id/rssi_overlay_image" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="center" - android:paddingBottom="10dp" /> </FrameLayout> <TextView @@ -43,8 +44,8 @@ android:id="@+id/rssi_textview" android:layout_width="wrap_content" android:layout_height="wrap_content" - android:layout_gravity="center" - android:gravity="center" + android:layout_gravity="top|center_horizontal" + android:gravity="top|center_horizontal" android:text="@string/quick_settings_rssi_label" /> </LinearLayout>
\ 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 deleted file mode 100644 index d155935..0000000 --- a/packages/SystemUI/res/layout/quick_settings_tile_settings.xml +++ /dev/null @@ -1,25 +0,0 @@ -<?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. ---> -<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" - />
\ 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 878f500..80fc685 100644 --- a/packages/SystemUI/res/layout/quick_settings_tile_user.xml +++ b/packages/SystemUI/res/layout/quick_settings_tile_user.xml @@ -25,13 +25,12 @@ android:scaleType="centerCrop" /> <TextView - style="@style/TextAppearance.QuickSettings.TileView" + style="@style/TextAppearance.QuickSettings.TileView.User" android:id="@+id/user_textview" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_gravity="center_horizontal|bottom" android:gravity="center" android:text="@string/quick_settings_user_label" - android:background="#CC000000" /> </FrameLayout>
\ No newline at end of file diff --git a/packages/SystemUI/res/layout/quick_settings_tile_wifi.xml b/packages/SystemUI/res/layout/quick_settings_tile_wifi.xml deleted file mode 100644 index 67d6c23..0000000 --- a/packages/SystemUI/res/layout/quick_settings_tile_wifi.xml +++ /dev/null @@ -1,25 +0,0 @@ -<?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. ---> -<TextView - xmlns:android="http://schemas.android.com/apk/res/android" - style="@style/TextAppearance.QuickSettings.TileView" - android:id="@+id/wifi_textview" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:layout_gravity="center" - android:gravity="center" - android:text="@string/quick_settings_wifi_label" - />
\ No newline at end of file diff --git a/packages/SystemUI/res/layout/quick_settings_tile_wifi_display.xml b/packages/SystemUI/res/layout/quick_settings_tile_wifi_display.xml deleted file mode 100644 index 2d7e441..0000000 --- a/packages/SystemUI/res/layout/quick_settings_tile_wifi_display.xml +++ /dev/null @@ -1,26 +0,0 @@ -<?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. ---> -<TextView - xmlns:android="http://schemas.android.com/apk/res/android" - style="@style/TextAppearance.QuickSettings.TileView" - android:id="@+id/wifi_display_textview" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:layout_gravity="center" - android:gravity="center" - android:drawableTop="@drawable/ic_qs_remote_display" - android:text="@string/quick_settings_wifi_display_label" - />
\ No newline at end of file diff --git a/packages/SystemUI/res/values/dimens.xml b/packages/SystemUI/res/values/dimens.xml index ed08115..f90f08a 100644 --- a/packages/SystemUI/res/values/dimens.xml +++ b/packages/SystemUI/res/values/dimens.xml @@ -205,4 +205,11 @@ <!-- How far to slide the panel out when you touch it --> <!-- For phones, this is close_handle_height + header_height --> <dimen name="peek_height">84dp</dimen> + + <!-- Quick Settings tile geometry: top interior margin, above icon --> + <dimen name="qs_tile_margin_above_icon">27dp</dimen> + <!-- Quick Settings tile geometry: gap between icon and text --> + <dimen name="qs_tile_margin_below_icon">17dp</dimen> + <!-- Quick Settings tile geometry: icon size --> + <dimen name="qs_tile_icon_size">32dp</dimen> </resources> diff --git a/packages/SystemUI/res/values/styles.xml b/packages/SystemUI/res/values/styles.xml index 1a59d6c..7ddf261 100644 --- a/packages/SystemUI/res/values/styles.xml +++ b/packages/SystemUI/res/values/styles.xml @@ -92,17 +92,20 @@ <style name="TextAppearance.QuickSettings" /> <style name="TextAppearance.QuickSettings.TileView"> - <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> <item name="android:textStyle">normal</item> <item name="android:textColor">#CCCCCC</item> <item name="android:textAllCaps">true</item> - <item name="android:singleLine">true</item> - <item name="android:ellipsize">marquee</item> - <item name="android:fadingEdge">horizontal</item> + <item name="android:paddingStart">6dp</item> + <item name="android:paddingEnd">6dp</item> + </style> + + <style name="TextAppearance.QuickSettings.TileView.AllInOne" parent="@style/TextAppearance.QuickSettings.TileView"> + <item name="android:lines">2</item> + <item name="android:gravity">top</item> + <item name="android:paddingBottom">2dp</item> + <item name="android:paddingTop">16dp</item> + <item name="android:drawablePadding">8dp</item> </style> <style name="TextAppearance.QuickSettings.Clock" parent="@style/TextAppearance.QuickSettings.TileView"> @@ -119,6 +122,13 @@ <item name="android:textColor">#ff3a3b39</item> </style> + <style name="TextAppearance.QuickSettings.TileView.User" parent="@style/TextAppearance.QuickSettings.TileView"> + <item name="android:background">#CC000000</item> + <item name="android:padding">4dp</item> + <item name="android:singleLine">true</item> + <item name="android:fadingEdge">horizontal</item> + </style> + <style name="BaseBrightnessDialogContainer"> <item name="android:layout_width">match_parent</item> <item name="android:layout_height">wrap_content</item> 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 a7c7fba..d826282 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/QuickSettings.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/QuickSettings.java @@ -17,7 +17,6 @@ package com.android.systemui.statusbar.phone; import com.android.internal.view.RotationPolicy; -import com.android.internal.widget.LockPatternUtils; import com.android.systemui.R; import com.android.systemui.statusbar.phone.QuickSettingsModel.BluetoothState; @@ -38,7 +37,6 @@ import android.bluetooth.BluetoothAdapter; import android.content.BroadcastReceiver; import android.content.ComponentName; import android.content.Context; -import android.content.CursorLoader; import android.content.DialogInterface; import android.content.DialogInterface.OnClickListener; import android.content.Intent; @@ -80,6 +78,7 @@ import java.util.ArrayList; * */ class QuickSettings { + static final boolean DEBUG_GONE_TILES = false; private static final String TAG = "QuickSettings"; public static final boolean SHOW_IME_TILE = false; @@ -271,6 +270,10 @@ class QuickSettings { startSettingsActivity(intent, true); } + private void collapsePanels() { + getService().animateCollapsePanels(); + } + private void startSettingsActivity(Intent intent, boolean onlyProvisioned) { if (onlyProvisioned && !getService().isDeviceProvisioned()) return; try { @@ -280,7 +283,7 @@ class QuickSettings { } intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TOP); mContext.startActivityAsUser(intent, new UserHandle(UserHandle.USER_CURRENT)); - getService().animateCollapsePanels(); + collapsePanels(); } private void addUserTiles(ViewGroup parent, LayoutInflater inflater) { @@ -290,7 +293,7 @@ class QuickSettings { userTile.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { - mBar.collapseAllPanels(true); + collapsePanels(); final UserManager um = UserManager.get(mContext); if (um.getUsers(true).size() > 1) { try { @@ -322,24 +325,18 @@ class QuickSettings { mDynamicSpannedTiles.add(userTile); // Brightness - QuickSettingsTileView brightnessTile = (QuickSettingsTileView) - inflater.inflate(R.layout.quick_settings_tile, parent, false); - brightnessTile.setContent(R.layout.quick_settings_tile_brightness, inflater); + final QuickSettingsBasicTile brightnessTile + = new QuickSettingsBasicTile(mContext); + brightnessTile.setImageResource(R.drawable.ic_qs_brightness_auto_off); brightnessTile.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { - mBar.collapseAllPanels(true); + collapsePanels(); showBrightnessDialog(); } }); - mModel.addBrightnessTile(brightnessTile, new QuickSettingsModel.RefreshCallback() { - @Override - 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); - } - }); + mModel.addBrightnessTile(brightnessTile, + new QuickSettingsModel.BasicRefreshCallback(brightnessTile)); parent.addView(brightnessTile); mDynamicSpannedTiles.add(brightnessTile); @@ -364,31 +361,24 @@ class QuickSettings { */ // Settings tile - QuickSettingsTileView settingsTile = (QuickSettingsTileView) - inflater.inflate(R.layout.quick_settings_tile, parent, false); - settingsTile.setContent(R.layout.quick_settings_tile_settings, inflater); + final QuickSettingsBasicTile settingsTile = new QuickSettingsBasicTile(mContext); + settingsTile.setImageResource(R.drawable.ic_qs_settings); settingsTile.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { 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); - } - }); + mModel.addSettingsTile(settingsTile, + new QuickSettingsModel.BasicRefreshCallback(settingsTile)); parent.addView(settingsTile); mDynamicSpannedTiles.add(settingsTile); } private void addSystemTiles(ViewGroup parent, LayoutInflater inflater) { // Wi-fi - final QuickSettingsTileView wifiTile = (QuickSettingsTileView) - inflater.inflate(R.layout.quick_settings_tile, parent, false); - wifiTile.setContent(R.layout.quick_settings_tile_wifi, inflater); + final QuickSettingsBasicTile wifiTile + = new QuickSettingsBasicTile(mContext); wifiTile.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { @@ -421,12 +411,11 @@ class QuickSettings { } mModel.addWifiTile(wifiTile, new QuickSettingsModel.RefreshCallback() { @Override - public void refreshView(QuickSettingsTileView view, State state) { + public void refreshView(QuickSettingsTileView unused, State state) { WifiState wifiState = (WifiState) state; - TextView tv = (TextView) view.findViewById(R.id.wifi_textview); - tv.setCompoundDrawablesWithIntrinsicBounds(0, wifiState.iconId, 0, 0); - tv.setText(wifiState.label); - view.setContentDescription(mContext.getString( + wifiTile.setImageResource(wifiState.iconId); + wifiTile.setText(wifiState.label); + wifiTile.setContentDescription(mContext.getString( R.string.accessibility_quick_settings_wifi, wifiState.signalContentDescription, (wifiState.connected) ? wifiState.label : "")); @@ -476,10 +465,10 @@ class QuickSettings { } // Rotation Lock - if (mContext.getResources().getBoolean(R.bool.quick_settings_show_rotation_lock)) { - QuickSettingsTileView rotationLockTile = (QuickSettingsTileView) - inflater.inflate(R.layout.quick_settings_tile, parent, false); - rotationLockTile.setContent(R.layout.quick_settings_tile_rotation_lock, inflater); + if (mContext.getResources().getBoolean(R.bool.quick_settings_show_rotation_lock) + || DEBUG_GONE_TILES) { + final QuickSettingsBasicTile rotationLockTile + = new QuickSettingsBasicTile(mContext); rotationLockTile.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { @@ -487,21 +476,13 @@ class QuickSettings { RotationPolicy.setRotationLock(mContext, !locked); } }); - mModel.addRotationLockTile(rotationLockTile, new QuickSettingsModel.RefreshCallback() { - @Override - public void refreshView(QuickSettingsTileView view, State state) { - TextView tv = (TextView) view.findViewById(R.id.rotation_lock_textview); - tv.setCompoundDrawablesWithIntrinsicBounds(0, state.iconId, 0, 0); - tv.setText(state.label); - } - }); + mModel.addRotationLockTile(rotationLockTile, + new QuickSettingsModel.BasicRefreshCallback(rotationLockTile)); parent.addView(rotationLockTile); } // Battery - QuickSettingsTileView batteryTile = (QuickSettingsTileView) - inflater.inflate(R.layout.quick_settings_tile, parent, false); - batteryTile.setContent(R.layout.quick_settings_tile_battery, inflater); + final QuickSettingsBasicTile batteryTile = new QuickSettingsBasicTile(mContext); batteryTile.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { @@ -510,11 +491,9 @@ class QuickSettings { }); mModel.addBatteryTile(batteryTile, new QuickSettingsModel.RefreshCallback() { @Override - public void refreshView(QuickSettingsTileView view, State state) { + public void refreshView(QuickSettingsTileView unused, State state) { QuickSettingsModel.BatteryState batteryState = (QuickSettingsModel.BatteryState) state; - TextView tv = (TextView) view.findViewById(R.id.battery_textview); - ImageView iv = (ImageView) view.findViewById(R.id.battery_image); Drawable d = batteryState.pluggedIn ? mChargingBatteryLevels : mBatteryLevels; @@ -528,40 +507,38 @@ class QuickSettings { : mContext.getString(R.string.status_bar_settings_battery_meter_format, batteryState.batteryLevel); } - iv.setImageDrawable(d); - iv.setImageLevel(batteryState.batteryLevel); - tv.setText(t); - view.setContentDescription( + d.setLevel(batteryState.batteryLevel); + batteryTile.setImageDrawable(d); + batteryTile.setText(t); + batteryTile.setContentDescription( mContext.getString(R.string.accessibility_quick_settings_battery, t)); } }); parent.addView(batteryTile); // Airplane Mode - QuickSettingsTileView airplaneTile = (QuickSettingsTileView) - inflater.inflate(R.layout.quick_settings_tile, parent, false); - airplaneTile.setContent(R.layout.quick_settings_tile_airplane, inflater); + final QuickSettingsBasicTile airplaneTile + = new QuickSettingsBasicTile(mContext); mModel.addAirplaneModeTile(airplaneTile, new QuickSettingsModel.RefreshCallback() { @Override - public void refreshView(QuickSettingsTileView view, State state) { - TextView tv = (TextView) view.findViewById(R.id.airplane_mode_textview); - tv.setCompoundDrawablesWithIntrinsicBounds(0, state.iconId, 0, 0); + public void refreshView(QuickSettingsTileView unused, State state) { + airplaneTile.setImageResource(state.iconId); String airplaneState = mContext.getString( (state.enabled) ? R.string.accessibility_desc_on : R.string.accessibility_desc_off); - view.setContentDescription( + airplaneTile.setContentDescription( mContext.getString(R.string.accessibility_quick_settings_airplane, airplaneState)); - tv.setText(state.label); + airplaneTile.setText(state.label); } }); parent.addView(airplaneTile); // Bluetooth - if (mModel.deviceSupportsBluetooth()) { - final QuickSettingsTileView bluetoothTile = (QuickSettingsTileView) - inflater.inflate(R.layout.quick_settings_tile, parent, false); - bluetoothTile.setContent(R.layout.quick_settings_tile_bluetooth, inflater); + if (mModel.deviceSupportsBluetooth() + || DEBUG_GONE_TILES) { + final QuickSettingsBasicTile bluetoothTile + = new QuickSettingsBasicTile(mContext); bluetoothTile.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { @@ -583,14 +560,12 @@ class QuickSettings { } mModel.addBluetoothTile(bluetoothTile, new QuickSettingsModel.RefreshCallback() { @Override - public void refreshView(QuickSettingsTileView view, State state) { + public void refreshView(QuickSettingsTileView unused, State state) { BluetoothState bluetoothState = (BluetoothState) state; - TextView tv = (TextView) view.findViewById(R.id.bluetooth_textview); - tv.setCompoundDrawablesWithIntrinsicBounds(0, state.iconId, 0, 0); + bluetoothTile.setImageResource(state.iconId); - Resources r = mContext.getResources(); - String label = state.label; /* + Resources r = mContext.getResources(); //TODO: Show connected bluetooth device label Set<BluetoothDevice> btDevices = mBluetoothController.getBondedBluetoothDevices(); @@ -603,10 +578,10 @@ class QuickSettings { btDevices.size()); } */ - view.setContentDescription(mContext.getString( + bluetoothTile.setContentDescription(mContext.getString( R.string.accessibility_quick_settings_bluetooth, bluetoothState.stateContentDescription)); - tv.setText(label); + bluetoothTile.setText(state.label); } }); parent.addView(bluetoothTile); @@ -616,9 +591,9 @@ class QuickSettings { private void addTemporaryTiles(final ViewGroup parent, final LayoutInflater inflater) { // Alarm tile - QuickSettingsTileView alarmTile = (QuickSettingsTileView) - inflater.inflate(R.layout.quick_settings_tile, parent, false); - alarmTile.setContent(R.layout.quick_settings_tile_alarm, inflater); + final QuickSettingsBasicTile alarmTile + = new QuickSettingsBasicTile(mContext); + alarmTile.setImageResource(R.drawable.ic_qs_alarm_on); alarmTile.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { @@ -632,94 +607,77 @@ class QuickSettings { }); mModel.addAlarmTile(alarmTile, new QuickSettingsModel.RefreshCallback() { @Override - public void refreshView(QuickSettingsTileView view, State alarmState) { - TextView tv = (TextView) view.findViewById(R.id.alarm_textview); - tv.setText(alarmState.label); - view.setVisibility(alarmState.enabled ? View.VISIBLE : View.GONE); - view.setContentDescription(mContext.getString( + public void refreshView(QuickSettingsTileView unused, State alarmState) { + alarmTile.setText(alarmState.label); + alarmTile.setVisibility(alarmState.enabled ? View.VISIBLE : View.GONE); + alarmTile.setContentDescription(mContext.getString( R.string.accessibility_quick_settings_alarm, alarmState.label)); } }); parent.addView(alarmTile); // Location - QuickSettingsTileView locationTile = (QuickSettingsTileView) - inflater.inflate(R.layout.quick_settings_tile, parent, false); - locationTile.setContent(R.layout.quick_settings_tile_location, inflater); + final QuickSettingsBasicTile locationTile + = new QuickSettingsBasicTile(mContext); + locationTile.setImageResource(R.drawable.ic_qs_location); + locationTile.setTextResource(R.string.quick_settings_location_label); locationTile.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { startSettingsActivity(android.provider.Settings.ACTION_LOCATION_SOURCE_SETTINGS); } }); - mModel.addLocationTile(locationTile, new QuickSettingsModel.RefreshCallback() { - @Override - public void refreshView(QuickSettingsTileView view, State state) { - TextView tv = (TextView) view.findViewById(R.id.location_textview); - tv.setText(state.label); - view.setVisibility(state.enabled ? View.VISIBLE : View.GONE); - } - }); + mModel.addLocationTile(locationTile, + new QuickSettingsModel.BasicRefreshCallback(locationTile) + .setShowWhenEnabled(true)); parent.addView(locationTile); // Wifi Display - QuickSettingsTileView wifiDisplayTile = (QuickSettingsTileView) - inflater.inflate(R.layout.quick_settings_tile, parent, false); - wifiDisplayTile.setContent(R.layout.quick_settings_tile_wifi_display, inflater); + QuickSettingsBasicTile wifiDisplayTile + = new QuickSettingsBasicTile(mContext); + wifiDisplayTile.setImageResource(R.drawable.ic_qs_remote_display); wifiDisplayTile.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { startSettingsActivity(android.provider.Settings.ACTION_WIFI_DISPLAY_SETTINGS); } }); - mModel.addWifiDisplayTile(wifiDisplayTile, new QuickSettingsModel.RefreshCallback() { - @Override - public void refreshView(QuickSettingsTileView view, State state) { - TextView tv = (TextView) view.findViewById(R.id.wifi_display_textview); - tv.setText(state.label); - tv.setCompoundDrawablesWithIntrinsicBounds(0, state.iconId, 0, 0); - view.setVisibility(state.enabled ? View.VISIBLE : View.GONE); - } - }); + mModel.addWifiDisplayTile(wifiDisplayTile, + new QuickSettingsModel.BasicRefreshCallback(wifiDisplayTile) + .setShowWhenEnabled(true)); parent.addView(wifiDisplayTile); - if (SHOW_IME_TILE) { + if (SHOW_IME_TILE || DEBUG_GONE_TILES) { // IME - QuickSettingsTileView imeTile = (QuickSettingsTileView) - inflater.inflate(R.layout.quick_settings_tile, parent, false); - imeTile.setContent(R.layout.quick_settings_tile_ime, inflater); + final QuickSettingsBasicTile imeTile + = new QuickSettingsBasicTile(mContext); + imeTile.setImageResource(R.drawable.ic_qs_ime); imeTile.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { try { - mBar.collapseAllPanels(true); + collapsePanels(); Intent intent = new Intent(Settings.ACTION_SHOW_INPUT_METHOD_PICKER); PendingIntent pendingIntent = PendingIntent.getBroadcast(mContext, 0, intent, 0); pendingIntent.send(); } catch (Exception e) {} } }); - mModel.addImeTile(imeTile, new QuickSettingsModel.RefreshCallback() { - @Override - public void refreshView(QuickSettingsTileView view, State state) { - TextView tv = (TextView) view.findViewById(R.id.ime_textview); - if (state.label != null) { - tv.setText(state.label); - } - view.setVisibility(state.enabled ? View.VISIBLE : View.GONE); - } - }); + mModel.addImeTile(imeTile, + new QuickSettingsModel.BasicRefreshCallback(imeTile) + .setShowWhenEnabled(true)); parent.addView(imeTile); } // Bug reports - QuickSettingsTileView bugreportTile = (QuickSettingsTileView) - inflater.inflate(R.layout.quick_settings_tile, parent, false); - bugreportTile.setContent(R.layout.quick_settings_tile_bugreport, inflater); + final QuickSettingsBasicTile bugreportTile + = new QuickSettingsBasicTile(mContext); + bugreportTile.setImageResource(com.android.internal.R.drawable.stat_sys_adb); + bugreportTile.setTextResource(com.android.internal.R.string.bugreport_title); bugreportTile.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { - mBar.collapseAllPanels(true); + collapsePanels(); showBugreportDialog(); } }); diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/QuickSettingsBasicTile.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/QuickSettingsBasicTile.java new file mode 100644 index 0000000..94b2fc7 --- /dev/null +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/QuickSettingsBasicTile.java @@ -0,0 +1,82 @@ +/* + * Copyright (C) 2013 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. + */ + +package com.android.systemui.statusbar.phone; + +import com.android.systemui.R; + +import android.content.Context; +import android.graphics.drawable.Drawable; +import android.util.AttributeSet; +import android.view.LayoutInflater; +import android.widget.FrameLayout; +import android.widget.ImageView; +import android.widget.TextView; + +class QuickSettingsBasicTile extends QuickSettingsTileView { + private final TextView mTextView; + private final ImageView mImageView; + + public QuickSettingsBasicTile(Context context) { + this(context, null); + } + + public QuickSettingsBasicTile(Context context, AttributeSet attrs) { + super(context, attrs); + + setLayoutParams(new FrameLayout.LayoutParams( + FrameLayout.LayoutParams.MATCH_PARENT, + context.getResources().getDimensionPixelSize(R.dimen.quick_settings_cell_height) + )); + setBackgroundResource(R.drawable.qs_tile_background); + addView(LayoutInflater.from(context).inflate( + R.layout.quick_settings_tile_basic, null), + new FrameLayout.LayoutParams( + FrameLayout.LayoutParams.MATCH_PARENT, + FrameLayout.LayoutParams.MATCH_PARENT)); + mTextView = (TextView) findViewById(R.id.text); + mImageView = (ImageView) findViewById(R.id.image); + } + + @Override + void setContent(int layoutId, LayoutInflater inflater) { + throw new RuntimeException("why?"); + } + + public ImageView getImageView() { + return mImageView; + } + + public TextView getTextView() { + return mTextView; + } + + public void setImageDrawable(Drawable drawable) { + mImageView.setImageDrawable(drawable); + } + + public void setImageResource(int resId) { + mImageView.setImageResource(resId); + } + + public void setText(CharSequence text) { + mTextView.setText(text); + } + + public void setTextResource(int resId) { + mTextView.setText(resId); + } +} 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 435ea4c..38c46c4 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/QuickSettingsModel.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/QuickSettingsModel.java @@ -16,7 +16,6 @@ package com.android.systemui.statusbar.phone; -import android.app.ActivityManager; import android.bluetooth.BluetoothAdapter; import android.bluetooth.BluetoothAdapter.BluetoothStateChangeCallback; import android.content.BroadcastReceiver; @@ -96,6 +95,31 @@ class QuickSettingsModel implements BluetoothStateChangeCallback, public void refreshView(QuickSettingsTileView view, State state); } + public static class BasicRefreshCallback implements RefreshCallback { + private final QuickSettingsBasicTile mView; + private boolean mShowWhenEnabled; + + public BasicRefreshCallback(QuickSettingsBasicTile v) { + mView = v; + } + public void refreshView(QuickSettingsTileView ignored, State state) { + if (mShowWhenEnabled) { + mView.setVisibility(state.enabled ? View.VISIBLE : View.GONE); + } + if (state.iconId != 0) { + mView.setImageDrawable(null); // needed to flush any cached IDs + mView.setImageResource(state.iconId); + } + if (state.label != null) { + mView.setText(state.label); + } + } + public BasicRefreshCallback setShowWhenEnabled(boolean swe) { + mShowWhenEnabled = swe; + return this; + } + } + /** Broadcast receive to determine if there is an alarm set. */ private BroadcastReceiver mAlarmIntentReceiver = new BroadcastReceiver() { @Override diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/QuickSettingsTileView.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/QuickSettingsTileView.java index 8f5cde6..9cff242 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/QuickSettingsTileView.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/QuickSettingsTileView.java @@ -19,6 +19,7 @@ package com.android.systemui.statusbar.phone; import android.content.Context; import android.util.AttributeSet; import android.view.LayoutInflater; +import android.view.View; import android.widget.FrameLayout; /** @@ -28,7 +29,6 @@ class QuickSettingsTileView extends FrameLayout { private int mColSpan; private int mRowSpan; - private int mCellWidth; public QuickSettingsTileView(Context context, AttributeSet attrs) { super(context, attrs); @@ -48,4 +48,19 @@ class QuickSettingsTileView extends FrameLayout { void setContent(int layoutId, LayoutInflater inflater) { inflater.inflate(layoutId, this); } + + @Override + public void setVisibility(int vis) { + if (QuickSettings.DEBUG_GONE_TILES) { + if (vis == View.GONE) { + vis = View.VISIBLE; + setAlpha(0.25f); + setEnabled(false); + } else { + setAlpha(1f); + setEnabled(true); + } + } + super.setVisibility(vis); + } }
\ No newline at end of file |