summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorDanesh Mondegarian <daneshm90@gmail.com>2013-04-07 16:29:07 -0400
committerDanesh Mondegarian <daneshm90@gmail.com>2013-04-07 18:07:48 -0400
commit1a3dae8572e5f2c7ba6906687eb38d65d793e3a0 (patch)
treef6757daa08596d672d1c4763c70a11c7b81ca6cd /src
parente5b86228ffe2c7c0a79572cf81c3ca035449a9b0 (diff)
downloadpackages_apps_settings-1a3dae8572e5f2c7ba6906687eb38d65d793e3a0.zip
packages_apps_settings-1a3dae8572e5f2c7ba6906687eb38d65d793e3a0.tar.gz
packages_apps_settings-1a3dae8572e5f2c7ba6906687eb38d65d793e3a0.tar.bz2
QuickSettings : Use stock layouts / fix userTile
Switch over to using 2 layouts (one generic, one user tile), just like how aosp does it. This way the tiles look similar to their SystemUI counter part. Change-Id: I8640c99602b056fb48b37f516c23c16555a2ba2a
Diffstat (limited to 'src')
-rw-r--r--src/com/android/settings/cyanogenmod/DraggableGridView.java2
-rw-r--r--src/com/android/settings/cyanogenmod/QuickSettingsTiles.java46
-rw-r--r--src/com/android/settings/cyanogenmod/QuickSettingsUtil.java18
3 files changed, 42 insertions, 24 deletions
diff --git a/src/com/android/settings/cyanogenmod/DraggableGridView.java b/src/com/android/settings/cyanogenmod/DraggableGridView.java
index d949d48..a0ac1bc 100644
--- a/src/com/android/settings/cyanogenmod/DraggableGridView.java
+++ b/src/com/android/settings/cyanogenmod/DraggableGridView.java
@@ -274,7 +274,7 @@ public class DraggableGridView extends ViewGroup implements
resid = R.drawable.ic_menu_delete_holo_dark;
stringid = R.string.dialog_delete_title;
}
- TextView addDeleteTile = ((TextView) getChildAt(getChildCount() - 1).findViewById(R.id.qs_text));
+ TextView addDeleteTile = ((TextView) getChildAt(getChildCount() - 1).findViewById(R.id.tile_textview));
addDeleteTile.setCompoundDrawablesRelativeWithIntrinsicBounds(0, resid, 0, 0);
addDeleteTile.setText(stringid);
}
diff --git a/src/com/android/settings/cyanogenmod/QuickSettingsTiles.java b/src/com/android/settings/cyanogenmod/QuickSettingsTiles.java
index 90ebd30..8a91832 100644
--- a/src/com/android/settings/cyanogenmod/QuickSettingsTiles.java
+++ b/src/com/android/settings/cyanogenmod/QuickSettingsTiles.java
@@ -33,8 +33,10 @@ import android.view.ViewGroup;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemClickListener;
import android.widget.ArrayAdapter;
+import android.widget.ImageView;
import android.widget.TextView;
+import static com.android.internal.util.cm.QSConstants.TILE_USER;
import com.android.settings.R;
import com.android.settings.Utils;
import com.android.settings.cyanogenmod.QuickSettingsUtil.TileInfo;
@@ -87,23 +89,39 @@ public class QuickSettingsTiles extends Fragment {
* @param newTile - whether a new tile is being added by user
*/
void addTile(int titleId, String iconSysId, int iconRegId, boolean newTile) {
- View v = (View) mInflater.inflate(R.layout.qs_tile, null, false);
- final TextView name = (TextView) v.findViewById(R.id.qs_text);
- name.setText(titleId);
- if (mSystemUiResources != null && iconSysId != null) {
- int resId = mSystemUiResources.getIdentifier(iconSysId, null, null);
- if (resId > 0) {
- try {
- Drawable d = mSystemUiResources.getDrawable(resId);
- name.setCompoundDrawablesRelativeWithIntrinsicBounds(null, d, null, null);
- } catch (Exception e) {
- e.printStackTrace();
+ View tileView = null;
+ if (iconRegId != 0) {
+ tileView = (View) mInflater.inflate(R.layout.quick_settings_tile_generic, null, false);
+ final TextView name = (TextView) tileView.findViewById(R.id.tile_textview);
+ name.setText(titleId);
+ name.setCompoundDrawablesRelativeWithIntrinsicBounds(0, iconRegId, 0, 0);
+ } else {
+ final boolean isUserTile = titleId == QuickSettingsUtil.TILES.get(TILE_USER).getTitleResId();
+ if (mSystemUiResources != null && iconSysId != null) {
+ int resId = mSystemUiResources.getIdentifier(iconSysId, null, null);
+ if (resId > 0) {
+ try {
+ Drawable d = mSystemUiResources.getDrawable(resId);
+ tileView = null;
+ if (isUserTile) {
+ tileView = (View) mInflater.inflate(R.layout.quick_settings_tile_user, null, false);
+ ImageView iv = (ImageView) tileView.findViewById(R.id.user_imageview);
+ TextView tv = (TextView) tileView.findViewById(R.id.tile_textview);
+ tv.setText(titleId);
+ iv.setImageDrawable(d);
+ } else {
+ tileView = (View) mInflater.inflate(R.layout.quick_settings_tile_generic, null, false);
+ final TextView name = (TextView) tileView.findViewById(R.id.tile_textview);
+ name.setText(titleId);
+ name.setCompoundDrawablesRelativeWithIntrinsicBounds(null, d, null, null);
+ }
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
}
}
- } else {
- name.setCompoundDrawablesRelativeWithIntrinsicBounds(0, iconRegId, 0, 0);
}
- mDragView.addView(v, newTile ? mDragView.getChildCount() - 1 : mDragView.getChildCount());
+ mDragView.addView(tileView, newTile ? mDragView.getChildCount() - 1 : mDragView.getChildCount());
}
@Override
diff --git a/src/com/android/settings/cyanogenmod/QuickSettingsUtil.java b/src/com/android/settings/cyanogenmod/QuickSettingsUtil.java
index 761fa7b..be5a466 100644
--- a/src/com/android/settings/cyanogenmod/QuickSettingsUtil.java
+++ b/src/com/android/settings/cyanogenmod/QuickSettingsUtil.java
@@ -75,6 +75,9 @@ public class QuickSettingsUtil {
TILES.put(TILE_EXPANDEDDESKTOP, new QuickSettingsUtil.TileInfo(
TILE_EXPANDEDDESKTOP, R.string.title_tile_expanded_desktop,
"com.android.systemui:drawable/ic_qs_expanded_desktop_off"));
+ TILES.put(TILE_SLEEP, new QuickSettingsUtil.TileInfo(
+ TILE_SLEEP, R.string.title_tile_sleep,
+ "com.android.systemui:drawable/ic_qs_sleep"));
TILES.put(TILE_GPS, new QuickSettingsUtil.TileInfo(
TILE_GPS, R.string.title_tile_gps,
"com.android.systemui:drawable/ic_qs_gps_neutral"));
@@ -102,24 +105,24 @@ public class QuickSettingsUtil {
TILES.put(TILE_QUIETHOURS, new QuickSettingsUtil.TileInfo(
TILE_QUIETHOURS, R.string.title_tile_quiet_hours,
"com.android.systemui:drawable/ic_qs_quiet_hours_off"));
+ TILES.put(TILE_SCREENTIMEOUT, new QuickSettingsUtil.TileInfo(
+ TILE_SCREENTIMEOUT, R.string.title_tile_screen_timeout,
+ "com.android.systemui:drawable/ic_qs_screen_timeout_off"));
TILES.put(TILE_SETTINGS, new QuickSettingsUtil.TileInfo(
TILE_SETTINGS, R.string.title_tile_settings,
"com.android.systemui:drawable/ic_qs_settings"));
- TILES.put(TILE_SLEEP, new QuickSettingsUtil.TileInfo(
- TILE_SLEEP, R.string.title_tile_sleep,
- "com.android.systemui:drawable/ic_qs_sleep"));
TILES.put(TILE_RINGER, new QuickSettingsUtil.TileInfo(
TILE_RINGER, R.string.title_tile_sound,
"com.android.systemui:drawable/ic_qs_ring_on"));
TILES.put(TILE_SYNC, new QuickSettingsUtil.TileInfo(
TILE_SYNC, R.string.title_tile_sync,
"com.android.systemui:drawable/ic_qs_sync_off"));
- TILES.put(TILE_SCREENTIMEOUT, new QuickSettingsUtil.TileInfo(
- TILE_SCREENTIMEOUT, R.string.title_tile_screen_timeout,
- "com.android.systemui:drawable/ic_qs_screen_timeout_off"));
TILES.put(TILE_TORCH, new QuickSettingsUtil.TileInfo(
TILE_TORCH, R.string.title_tile_torch,
"com.android.systemui:drawable/ic_qs_torch_off"));
+ TILES.put(TILE_USER, new QuickSettingsUtil.TileInfo(
+ TILE_USER, R.string.title_tile_user,
+ "com.android.systemui:drawable/ic_qs_default_user"));
TILES.put(TILE_VOLUME, new QuickSettingsUtil.TileInfo(
TILE_VOLUME, R.string.title_tile_volume,
"com.android.systemui:drawable/ic_qs_volume"));
@@ -129,9 +132,6 @@ public class QuickSettingsUtil {
TILES.put(TILE_WIFIAP, new QuickSettingsUtil.TileInfo(
TILE_WIFIAP, R.string.title_tile_wifiap,
"com.android.systemui:drawable/ic_qs_wifi_ap_neutral"));
- TILES.put(TILE_USER, new QuickSettingsUtil.TileInfo(
- TILE_USER, R.string.title_tile_user,
- "com.android.systemui:drawable/ic_qs_default_user"));
}
public static String getCurrentTiles(Context context) {