summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Amith Yamasani <yamasani@google.com> 2011-05-24 15:43:14 -0700
committer Amith Yamasani <yamasani@google.com> 2011-05-24 15:50:36 -0700
commit6ea08998eecb97e8ebc26e7c84869f1db794f4dc (patch)
treef09363e1450e364fa3843c7ea4064398d0c1c0c7
parent36ac304c6e62dbb1caaf729c70d7aa956aff63be (diff)
More preference item visual adjustments for smaller tablets. DO NOT MERGE
Use medium text size for locale picker. Hide icon region if there's no icon. Bug: 4462313 Change-Id: I8062646f31bfec753bcd476f54c8ab5b66375b5e
-rw-r--r--core/java/android/preference/Preference.java29
-rw-r--r--core/res/res/layout/locale_picker_item.xml7
-rw-r--r--core/res/res/layout/preference_holo.xml1
3 files changed, 24 insertions, 13 deletions
diff --git a/core/java/android/preference/Preference.java b/core/java/android/preference/Preference.java
index 1584424a6624..93114ad2aaf9 100644
--- a/core/java/android/preference/Preference.java
+++ b/core/java/android/preference/Preference.java
@@ -470,11 +470,15 @@ public class Preference implements Comparable<Preference>, OnDependencyChangeLis
final View layout = layoutInflater.inflate(mLayoutResId, parent, false);
- if (mWidgetLayoutResId != 0) {
- final ViewGroup widgetFrame = (ViewGroup)layout.findViewById(com.android.internal.R.id.widget_frame);
- layoutInflater.inflate(mWidgetLayoutResId, widgetFrame);
+ final ViewGroup widgetFrame = (ViewGroup) layout
+ .findViewById(com.android.internal.R.id.widget_frame);
+ if (widgetFrame != null) {
+ if (mWidgetLayoutResId != 0) {
+ layoutInflater.inflate(mWidgetLayoutResId, widgetFrame);
+ } else {
+ widgetFrame.setVisibility(View.GONE);
+ }
}
-
return layout;
}
@@ -510,17 +514,20 @@ public class Preference implements Comparable<Preference>, OnDependencyChangeLis
}
}
}
-
+
ImageView imageView = (ImageView) view.findViewById(com.android.internal.R.id.icon);
- if (imageView != null && (mIconResId != 0 || mIcon != null)) {
- if (mIcon == null) {
- mIcon = getContext().getResources().getDrawable(mIconResId);
- }
- if (mIcon != null) {
- imageView.setImageDrawable(mIcon);
+ if (imageView != null) {
+ if (mIconResId != 0 || mIcon != null) {
+ if (mIcon == null) {
+ mIcon = getContext().getResources().getDrawable(mIconResId);
+ }
+ if (mIcon != null) {
+ imageView.setImageDrawable(mIcon);
+ }
}
imageView.setVisibility(mIcon != null ? View.VISIBLE : View.GONE);
}
+
if (mShouldDisableView) {
setEnabledStateOnViews(view, isEnabled());
}
diff --git a/core/res/res/layout/locale_picker_item.xml b/core/res/res/layout/locale_picker_item.xml
index b63f5ab65864..19c0deeff93a 100644
--- a/core/res/res/layout/locale_picker_item.xml
+++ b/core/res/res/layout/locale_picker_item.xml
@@ -20,11 +20,14 @@
android:layout_width="match_parent"
android:gravity="center_vertical"
android:minHeight="?android:attr/listPreferredItemHeight"
- android:padding="5dip">
+ android:paddingLeft="16dp"
+ android:paddingTop="8dp"
+ android:paddingBottom="8dp"
+ android:paddingRight="16dp">
<TextView android:id="@+id/locale"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
- android:textAppearance="?android:attr/textAppearanceLarge"
+ android:textAppearance="?android:attr/textAppearanceMedium"
/>
</LinearLayout >
diff --git a/core/res/res/layout/preference_holo.xml b/core/res/res/layout/preference_holo.xml
index 8b1b02734eb6..e5ed33c8ff83 100644
--- a/core/res/res/layout/preference_holo.xml
+++ b/core/res/res/layout/preference_holo.xml
@@ -35,6 +35,7 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
+ android:minWidth="48dp"
/>
</LinearLayout>