Merge "Reserve space for preference icon." into oc-dev am: ddb280b1ac
am: 21bb27f716
Change-Id: I8dc434a901a2c4cb75a12dd79dd7f55cbba1ae35
This commit is contained in:
@@ -696,6 +696,7 @@ package android {
|
||||
field public static final int hyphenationFrequency = 16843998; // 0x10104de
|
||||
field public static final int icon = 16842754; // 0x1010002
|
||||
field public static final int iconPreview = 16843337; // 0x1010249
|
||||
field public static final int iconSpaceReserved = 16844132; // 0x1010564
|
||||
field public static final int iconTint = 16844129; // 0x1010561
|
||||
field public static final int iconTintMode = 16844130; // 0x1010562
|
||||
field public static final int iconifiedByDefault = 16843514; // 0x10102fa
|
||||
@@ -32045,6 +32046,7 @@ package android.preference {
|
||||
method public int getWidgetLayoutResource();
|
||||
method public boolean hasKey();
|
||||
method public boolean isEnabled();
|
||||
method public boolean isIconSpaceReserved();
|
||||
method public boolean isPersistent();
|
||||
method public boolean isRecycleEnabled();
|
||||
method public boolean isSelectable();
|
||||
@@ -32079,6 +32081,7 @@ package android.preference {
|
||||
method public void setFragment(java.lang.String);
|
||||
method public void setIcon(android.graphics.drawable.Drawable);
|
||||
method public void setIcon(int);
|
||||
method public void setIconSpaceReserved(boolean);
|
||||
method public void setIntent(android.content.Intent);
|
||||
method public void setKey(java.lang.String);
|
||||
method public void setLayoutResource(int);
|
||||
|
||||
@@ -810,6 +810,7 @@ package android {
|
||||
field public static final int hyphenationFrequency = 16843998; // 0x10104de
|
||||
field public static final int icon = 16842754; // 0x1010002
|
||||
field public static final int iconPreview = 16843337; // 0x1010249
|
||||
field public static final int iconSpaceReserved = 16844132; // 0x1010564
|
||||
field public static final int iconTint = 16844129; // 0x1010561
|
||||
field public static final int iconTintMode = 16844130; // 0x1010562
|
||||
field public static final int iconifiedByDefault = 16843514; // 0x10102fa
|
||||
@@ -34890,6 +34891,7 @@ package android.preference {
|
||||
method public int getWidgetLayoutResource();
|
||||
method public boolean hasKey();
|
||||
method public boolean isEnabled();
|
||||
method public boolean isIconSpaceReserved();
|
||||
method public boolean isPersistent();
|
||||
method public boolean isRecycleEnabled();
|
||||
method public boolean isSelectable();
|
||||
@@ -34924,6 +34926,7 @@ package android.preference {
|
||||
method public void setFragment(java.lang.String);
|
||||
method public void setIcon(android.graphics.drawable.Drawable);
|
||||
method public void setIcon(int);
|
||||
method public void setIconSpaceReserved(boolean);
|
||||
method public void setIntent(android.content.Intent);
|
||||
method public void setKey(java.lang.String);
|
||||
method public void setLayoutResource(int);
|
||||
|
||||
@@ -696,6 +696,7 @@ package android {
|
||||
field public static final int hyphenationFrequency = 16843998; // 0x10104de
|
||||
field public static final int icon = 16842754; // 0x1010002
|
||||
field public static final int iconPreview = 16843337; // 0x1010249
|
||||
field public static final int iconSpaceReserved = 16844132; // 0x1010564
|
||||
field public static final int iconTint = 16844129; // 0x1010561
|
||||
field public static final int iconTintMode = 16844130; // 0x1010562
|
||||
field public static final int iconifiedByDefault = 16843514; // 0x10102fa
|
||||
@@ -32182,6 +32183,7 @@ package android.preference {
|
||||
method public int getWidgetLayoutResource();
|
||||
method public boolean hasKey();
|
||||
method public boolean isEnabled();
|
||||
method public boolean isIconSpaceReserved();
|
||||
method public boolean isPersistent();
|
||||
method public boolean isRecycleEnabled();
|
||||
method public boolean isSelectable();
|
||||
@@ -32216,6 +32218,7 @@ package android.preference {
|
||||
method public void setFragment(java.lang.String);
|
||||
method public void setIcon(android.graphics.drawable.Drawable);
|
||||
method public void setIcon(int);
|
||||
method public void setIconSpaceReserved(boolean);
|
||||
method public void setIntent(android.content.Intent);
|
||||
method public void setKey(java.lang.String);
|
||||
method public void setLayoutResource(int);
|
||||
|
||||
@@ -83,6 +83,7 @@ import java.util.Set;
|
||||
* @attr ref android.R.styleable#Preference_shouldDisableView
|
||||
* @attr ref android.R.styleable#Preference_recycleEnabled
|
||||
* @attr ref android.R.styleable#Preference_singleLineTitle
|
||||
* @attr ref android.R.styleable#Preference_iconSpaceReserved
|
||||
*/
|
||||
public class Preference implements Comparable<Preference> {
|
||||
/**
|
||||
@@ -135,6 +136,7 @@ public class Preference implements Comparable<Preference> {
|
||||
private boolean mParentDependencyMet = true;
|
||||
private boolean mRecycleEnabled = true;
|
||||
private boolean mSingleLineTitle = true;
|
||||
private boolean mIconSpaceReserved;
|
||||
|
||||
/**
|
||||
* @see #setShouldDisableView(boolean)
|
||||
@@ -302,7 +304,11 @@ public class Preference implements Comparable<Preference> {
|
||||
case com.android.internal.R.styleable.Preference_singleLineTitle:
|
||||
mSingleLineTitle = a.getBoolean(attr, mSingleLineTitle);
|
||||
break;
|
||||
}
|
||||
|
||||
case com.android.internal.R.styleable.Preference_iconSpaceReserved:
|
||||
mIconSpaceReserved = a.getBoolean(attr, mIconSpaceReserved);
|
||||
break;
|
||||
}
|
||||
}
|
||||
a.recycle();
|
||||
}
|
||||
@@ -631,7 +637,11 @@ public class Preference implements Comparable<Preference> {
|
||||
imageView.setImageDrawable(mIcon);
|
||||
}
|
||||
}
|
||||
imageView.setVisibility(mIcon != null ? View.VISIBLE : View.GONE);
|
||||
if (mIcon != null) {
|
||||
imageView.setVisibility(View.VISIBLE);
|
||||
} else {
|
||||
imageView.setVisibility(mIconSpaceReserved ? View.INVISIBLE : View.GONE);
|
||||
}
|
||||
}
|
||||
|
||||
final View imageFrame = view.findViewById(com.android.internal.R.id.icon_frame);
|
||||
@@ -930,6 +940,25 @@ public class Preference implements Comparable<Preference> {
|
||||
return mSingleLineTitle;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets whether to reserve the space of this Preference icon view when no icon is provided.
|
||||
*
|
||||
* @param iconSpaceReserved set {@code true} if the space for the icon view should be reserved
|
||||
*/
|
||||
public void setIconSpaceReserved(boolean iconSpaceReserved) {
|
||||
mIconSpaceReserved = iconSpaceReserved;
|
||||
notifyChanged();
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets whether the space this preference icon view is reserved.
|
||||
*
|
||||
* @see #setIconSpaceReserved(boolean)
|
||||
* @return {@code true} if the space of this preference icon view is reserved
|
||||
*/
|
||||
public boolean isIconSpaceReserved() {
|
||||
return mIconSpaceReserved;
|
||||
}
|
||||
/**
|
||||
* Returns a unique ID for this Preference. This ID should be unique across all
|
||||
* Preference objects in a hierarchy.
|
||||
|
||||
@@ -7226,6 +7226,10 @@
|
||||
<!-- 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" />
|
||||
<!-- Whether the space for the preference icon view will be reserved. By default, preference
|
||||
icon view visibility will be set to GONE when there is no icon provided, so the default
|
||||
value of this attribute is false. -->
|
||||
<attr name="iconSpaceReserved" format="boolean" />
|
||||
</declare-styleable>
|
||||
|
||||
<!-- Base attributes available to CheckBoxPreference. -->
|
||||
|
||||
@@ -2813,6 +2813,7 @@
|
||||
<public name="iconTint" />
|
||||
<public name="iconTintMode" />
|
||||
<public name="maxAspectRatio"/>
|
||||
<public name="iconSpaceReserved"/>
|
||||
</public-group>
|
||||
|
||||
<public-group type="style" first-id="0x010302e0">
|
||||
|
||||
Reference in New Issue
Block a user