More work on making prefs work well on small screens.
Tweak padding so layouts now look decent, a few extensions so that
the correct title can be shown.
Change-Id: Ieace16bf4962d66564c6e2f67fb588e582943850
diff --git a/core/java/android/preference/Preference.java b/core/java/android/preference/Preference.java
index 7d37e5b..5e1be21 100644
--- a/core/java/android/preference/Preference.java
+++ b/core/java/android/preference/Preference.java
@@ -89,6 +89,7 @@
private int mOrder = DEFAULT_ORDER;
private CharSequence mTitle;
+ private int mTitleRes;
private CharSequence mSummary;
/**
* mIconResId is overridden by mIcon, if mIcon is specified.
@@ -214,6 +215,7 @@
break;
case com.android.internal.R.styleable.Preference_title:
+ mTitleRes = a.getResourceId(attr, 0);
mTitle = a.getString(attr);
break;
@@ -582,6 +584,7 @@
*/
public void setTitle(CharSequence title) {
if (title == null && mTitle != null || title != null && !title.equals(mTitle)) {
+ mTitleRes = 0;
mTitle = title;
notifyChanged();
}
@@ -595,9 +598,21 @@
*/
public void setTitle(int titleResId) {
setTitle(mContext.getString(titleResId));
+ mTitleRes = titleResId;
}
/**
+ * Returns the title resource ID of this Preference. If the title did
+ * not come from a resource, 0 is returned.
+ *
+ * @return The title resource.
+ * @see #setTitle(int)
+ */
+ public int getTitleRes() {
+ return mTitleRes;
+ }
+
+ /**
* Returns the title of this Preference.
*
* @return The title.