Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 52b6bde4 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Allow multi line preference title."

parents 229ce701 2cb4bab1
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -1179,6 +1179,7 @@ package android {
    field public static final deprecated int shownWeekCount = 16843585; // 0x1010341
    field public static final int shrinkColumns = 16843082; // 0x101014a
    field public static final deprecated int singleLine = 16843101; // 0x101015d
    field public static final int singleLineTitle = 16844127; // 0x101055f
    field public static final int singleUser = 16843711; // 0x10103bf
    field public static final int slideEdge = 16843824; // 0x1010430
    field public static final int smallIcon = 16843422; // 0x101029e
@@ -32028,6 +32029,7 @@ package android.preference {
    method public boolean isPersistent();
    method public boolean isRecycleEnabled();
    method public boolean isSelectable();
    method public boolean isSingleLineTitle();
    method protected void notifyChanged();
    method public void notifyDependencyChange(boolean);
    method protected void notifyHierarchyChanged();
@@ -32069,6 +32071,7 @@ package android.preference {
    method public void setRecycleEnabled(boolean);
    method public void setSelectable(boolean);
    method public void setShouldDisableView(boolean);
    method public void setSingleLineTitle(boolean);
    method public void setSummary(java.lang.CharSequence);
    method public void setSummary(int);
    method public void setTitle(java.lang.CharSequence);
+3 −0
Original line number Diff line number Diff line
@@ -1296,6 +1296,7 @@ package android {
    field public static final deprecated int shownWeekCount = 16843585; // 0x1010341
    field public static final int shrinkColumns = 16843082; // 0x101014a
    field public static final deprecated int singleLine = 16843101; // 0x101015d
    field public static final int singleLineTitle = 16844127; // 0x101055f
    field public static final int singleUser = 16843711; // 0x10103bf
    field public static final int slideEdge = 16843824; // 0x1010430
    field public static final int smallIcon = 16843422; // 0x101029e
@@ -34878,6 +34879,7 @@ package android.preference {
    method public boolean isPersistent();
    method public boolean isRecycleEnabled();
    method public boolean isSelectable();
    method public boolean isSingleLineTitle();
    method protected void notifyChanged();
    method public void notifyDependencyChange(boolean);
    method protected void notifyHierarchyChanged();
@@ -34919,6 +34921,7 @@ package android.preference {
    method public void setRecycleEnabled(boolean);
    method public void setSelectable(boolean);
    method public void setShouldDisableView(boolean);
    method public void setSingleLineTitle(boolean);
    method public void setSummary(java.lang.CharSequence);
    method public void setSummary(int);
    method public void setTitle(java.lang.CharSequence);
+3 −0
Original line number Diff line number Diff line
@@ -1179,6 +1179,7 @@ package android {
    field public static final deprecated int shownWeekCount = 16843585; // 0x1010341
    field public static final int shrinkColumns = 16843082; // 0x101014a
    field public static final deprecated int singleLine = 16843101; // 0x101015d
    field public static final int singleLineTitle = 16844127; // 0x101055f
    field public static final int singleUser = 16843711; // 0x10103bf
    field public static final int slideEdge = 16843824; // 0x1010430
    field public static final int smallIcon = 16843422; // 0x101029e
@@ -32153,6 +32154,7 @@ package android.preference {
    method public boolean isPersistent();
    method public boolean isRecycleEnabled();
    method public boolean isSelectable();
    method public boolean isSingleLineTitle();
    method protected void notifyChanged();
    method public void notifyDependencyChange(boolean);
    method protected void notifyHierarchyChanged();
@@ -32194,6 +32196,7 @@ package android.preference {
    method public void setRecycleEnabled(boolean);
    method public void setSelectable(boolean);
    method public void setShouldDisableView(boolean);
    method public void setSingleLineTitle(boolean);
    method public void setSummary(java.lang.CharSequence);
    method public void setSummary(int);
    method public void setTitle(java.lang.CharSequence);
+28 −0
Original line number Diff line number Diff line
@@ -82,6 +82,7 @@ import java.util.Set;
 * @attr ref android.R.styleable#Preference_defaultValue
 * @attr ref android.R.styleable#Preference_shouldDisableView
 * @attr ref android.R.styleable#Preference_recycleEnabled
 * @attr ref android.R.styleable#Preference_singleLineTitle
 */
public class Preference implements Comparable<Preference> {
    /**
@@ -133,6 +134,7 @@ public class Preference implements Comparable<Preference> {
    private boolean mDependencyMet = true;
    private boolean mParentDependencyMet = true;
    private boolean mRecycleEnabled = true;
    private boolean mSingleLineTitle = true;

    /**
     * @see #setShouldDisableView(boolean)
@@ -296,6 +298,10 @@ public class Preference implements Comparable<Preference> {
                case com.android.internal.R.styleable.Preference_recycleEnabled:
                    mRecycleEnabled = a.getBoolean(attr, mRecycleEnabled);
                    break;

                case com.android.internal.R.styleable.Preference_singleLineTitle:
                    mSingleLineTitle = a.getBoolean(attr, mSingleLineTitle);
                    break;
            }
        }
        a.recycle();
@@ -597,6 +603,7 @@ public class Preference implements Comparable<Preference> {
            if (!TextUtils.isEmpty(title)) {
                titleView.setText(title);
                titleView.setVisibility(View.VISIBLE);
                titleView.setSingleLine(mSingleLineTitle);
            } else {
                titleView.setVisibility(View.GONE);
            }
@@ -902,6 +909,27 @@ public class Preference implements Comparable<Preference> {
        return mRecycleEnabled;
    }

    /**
     * Sets whether to constrain the title of this Preference to a single line instead of
     * letting it wrap onto multiple lines.
     *
     * @param singleLineTitle set {@code true} if the title should be constrained to one line
     */
    public void setSingleLineTitle(boolean singleLineTitle) {
        mSingleLineTitle = singleLineTitle;
        notifyChanged();
    }

    /**
     * Gets whether the title of this preference is constrained to a single line.
     *
     * @see #setSingleLineTitle(boolean)
     * @return {@code true} if the title of this preference is constrained to a single line
     */
    public boolean isSingleLineTitle() {
        return mSingleLineTitle;
    }

    /**
     * Returns a unique ID for this Preference.  This ID should be unique across all
     * Preference objects in a hierarchy.
+3 −0
Original line number Diff line number Diff line
@@ -7198,6 +7198,9 @@
        <!-- Whether the preference has enabled to have its view recycled when used in the list
             view. This is true by default. -->
        <attr name="recycleEnabled" format="boolean" />
        <!-- Whether to use single line for the preference title text. By default, preference title
             will be constrained to one line, so the default value of this attribute is true. -->
        <attr name="singleLineTitle" format="boolean" />
    </declare-styleable>

    <!-- Base attributes available to CheckBoxPreference. -->
Loading