Check if singleLineTitle attribute is set for the preference.
Only call setSingleLine() on the preference title if the attribute is set. Bug: 37328004 Test: manual Change-Id: Ia95230cd08feaf8213cb5917c105d070eb30c11c
This commit is contained in:
@@ -135,6 +135,7 @@ public class Preference implements Comparable<Preference> {
|
||||
private boolean mDependencyMet = true;
|
||||
private boolean mParentDependencyMet = true;
|
||||
private boolean mRecycleEnabled = true;
|
||||
private boolean mHasSingleLineTitleAttr;
|
||||
private boolean mSingleLineTitle = true;
|
||||
private boolean mIconSpaceReserved;
|
||||
|
||||
@@ -303,6 +304,7 @@ public class Preference implements Comparable<Preference> {
|
||||
|
||||
case com.android.internal.R.styleable.Preference_singleLineTitle:
|
||||
mSingleLineTitle = a.getBoolean(attr, mSingleLineTitle);
|
||||
mHasSingleLineTitleAttr = true;
|
||||
break;
|
||||
|
||||
case com.android.internal.R.styleable.Preference_iconSpaceReserved:
|
||||
@@ -609,7 +611,9 @@ public class Preference implements Comparable<Preference> {
|
||||
if (!TextUtils.isEmpty(title)) {
|
||||
titleView.setText(title);
|
||||
titleView.setVisibility(View.VISIBLE);
|
||||
titleView.setSingleLine(mSingleLineTitle);
|
||||
if (mHasSingleLineTitleAttr) {
|
||||
titleView.setSingleLine(mSingleLineTitle);
|
||||
}
|
||||
} else {
|
||||
titleView.setVisibility(View.GONE);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user