Merge "Reserve space for preference icon." into oc-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
ddb280b1ac
@@ -696,6 +696,7 @@ package android {
|
|||||||
field public static final int hyphenationFrequency = 16843998; // 0x10104de
|
field public static final int hyphenationFrequency = 16843998; // 0x10104de
|
||||||
field public static final int icon = 16842754; // 0x1010002
|
field public static final int icon = 16842754; // 0x1010002
|
||||||
field public static final int iconPreview = 16843337; // 0x1010249
|
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 iconTint = 16844129; // 0x1010561
|
||||||
field public static final int iconTintMode = 16844130; // 0x1010562
|
field public static final int iconTintMode = 16844130; // 0x1010562
|
||||||
field public static final int iconifiedByDefault = 16843514; // 0x10102fa
|
field public static final int iconifiedByDefault = 16843514; // 0x10102fa
|
||||||
@@ -32047,6 +32048,7 @@ package android.preference {
|
|||||||
method public int getWidgetLayoutResource();
|
method public int getWidgetLayoutResource();
|
||||||
method public boolean hasKey();
|
method public boolean hasKey();
|
||||||
method public boolean isEnabled();
|
method public boolean isEnabled();
|
||||||
|
method public boolean isIconSpaceReserved();
|
||||||
method public boolean isPersistent();
|
method public boolean isPersistent();
|
||||||
method public boolean isRecycleEnabled();
|
method public boolean isRecycleEnabled();
|
||||||
method public boolean isSelectable();
|
method public boolean isSelectable();
|
||||||
@@ -32081,6 +32083,7 @@ package android.preference {
|
|||||||
method public void setFragment(java.lang.String);
|
method public void setFragment(java.lang.String);
|
||||||
method public void setIcon(android.graphics.drawable.Drawable);
|
method public void setIcon(android.graphics.drawable.Drawable);
|
||||||
method public void setIcon(int);
|
method public void setIcon(int);
|
||||||
|
method public void setIconSpaceReserved(boolean);
|
||||||
method public void setIntent(android.content.Intent);
|
method public void setIntent(android.content.Intent);
|
||||||
method public void setKey(java.lang.String);
|
method public void setKey(java.lang.String);
|
||||||
method public void setLayoutResource(int);
|
method public void setLayoutResource(int);
|
||||||
|
|||||||
@@ -810,6 +810,7 @@ package android {
|
|||||||
field public static final int hyphenationFrequency = 16843998; // 0x10104de
|
field public static final int hyphenationFrequency = 16843998; // 0x10104de
|
||||||
field public static final int icon = 16842754; // 0x1010002
|
field public static final int icon = 16842754; // 0x1010002
|
||||||
field public static final int iconPreview = 16843337; // 0x1010249
|
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 iconTint = 16844129; // 0x1010561
|
||||||
field public static final int iconTintMode = 16844130; // 0x1010562
|
field public static final int iconTintMode = 16844130; // 0x1010562
|
||||||
field public static final int iconifiedByDefault = 16843514; // 0x10102fa
|
field public static final int iconifiedByDefault = 16843514; // 0x10102fa
|
||||||
@@ -34892,6 +34893,7 @@ package android.preference {
|
|||||||
method public int getWidgetLayoutResource();
|
method public int getWidgetLayoutResource();
|
||||||
method public boolean hasKey();
|
method public boolean hasKey();
|
||||||
method public boolean isEnabled();
|
method public boolean isEnabled();
|
||||||
|
method public boolean isIconSpaceReserved();
|
||||||
method public boolean isPersistent();
|
method public boolean isPersistent();
|
||||||
method public boolean isRecycleEnabled();
|
method public boolean isRecycleEnabled();
|
||||||
method public boolean isSelectable();
|
method public boolean isSelectable();
|
||||||
@@ -34926,6 +34928,7 @@ package android.preference {
|
|||||||
method public void setFragment(java.lang.String);
|
method public void setFragment(java.lang.String);
|
||||||
method public void setIcon(android.graphics.drawable.Drawable);
|
method public void setIcon(android.graphics.drawable.Drawable);
|
||||||
method public void setIcon(int);
|
method public void setIcon(int);
|
||||||
|
method public void setIconSpaceReserved(boolean);
|
||||||
method public void setIntent(android.content.Intent);
|
method public void setIntent(android.content.Intent);
|
||||||
method public void setKey(java.lang.String);
|
method public void setKey(java.lang.String);
|
||||||
method public void setLayoutResource(int);
|
method public void setLayoutResource(int);
|
||||||
|
|||||||
@@ -696,6 +696,7 @@ package android {
|
|||||||
field public static final int hyphenationFrequency = 16843998; // 0x10104de
|
field public static final int hyphenationFrequency = 16843998; // 0x10104de
|
||||||
field public static final int icon = 16842754; // 0x1010002
|
field public static final int icon = 16842754; // 0x1010002
|
||||||
field public static final int iconPreview = 16843337; // 0x1010249
|
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 iconTint = 16844129; // 0x1010561
|
||||||
field public static final int iconTintMode = 16844130; // 0x1010562
|
field public static final int iconTintMode = 16844130; // 0x1010562
|
||||||
field public static final int iconifiedByDefault = 16843514; // 0x10102fa
|
field public static final int iconifiedByDefault = 16843514; // 0x10102fa
|
||||||
@@ -32184,6 +32185,7 @@ package android.preference {
|
|||||||
method public int getWidgetLayoutResource();
|
method public int getWidgetLayoutResource();
|
||||||
method public boolean hasKey();
|
method public boolean hasKey();
|
||||||
method public boolean isEnabled();
|
method public boolean isEnabled();
|
||||||
|
method public boolean isIconSpaceReserved();
|
||||||
method public boolean isPersistent();
|
method public boolean isPersistent();
|
||||||
method public boolean isRecycleEnabled();
|
method public boolean isRecycleEnabled();
|
||||||
method public boolean isSelectable();
|
method public boolean isSelectable();
|
||||||
@@ -32218,6 +32220,7 @@ package android.preference {
|
|||||||
method public void setFragment(java.lang.String);
|
method public void setFragment(java.lang.String);
|
||||||
method public void setIcon(android.graphics.drawable.Drawable);
|
method public void setIcon(android.graphics.drawable.Drawable);
|
||||||
method public void setIcon(int);
|
method public void setIcon(int);
|
||||||
|
method public void setIconSpaceReserved(boolean);
|
||||||
method public void setIntent(android.content.Intent);
|
method public void setIntent(android.content.Intent);
|
||||||
method public void setKey(java.lang.String);
|
method public void setKey(java.lang.String);
|
||||||
method public void setLayoutResource(int);
|
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_shouldDisableView
|
||||||
* @attr ref android.R.styleable#Preference_recycleEnabled
|
* @attr ref android.R.styleable#Preference_recycleEnabled
|
||||||
* @attr ref android.R.styleable#Preference_singleLineTitle
|
* @attr ref android.R.styleable#Preference_singleLineTitle
|
||||||
|
* @attr ref android.R.styleable#Preference_iconSpaceReserved
|
||||||
*/
|
*/
|
||||||
public class Preference implements Comparable<Preference> {
|
public class Preference implements Comparable<Preference> {
|
||||||
/**
|
/**
|
||||||
@@ -135,6 +136,7 @@ public class Preference implements Comparable<Preference> {
|
|||||||
private boolean mParentDependencyMet = true;
|
private boolean mParentDependencyMet = true;
|
||||||
private boolean mRecycleEnabled = true;
|
private boolean mRecycleEnabled = true;
|
||||||
private boolean mSingleLineTitle = true;
|
private boolean mSingleLineTitle = true;
|
||||||
|
private boolean mIconSpaceReserved;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see #setShouldDisableView(boolean)
|
* @see #setShouldDisableView(boolean)
|
||||||
@@ -302,6 +304,10 @@ public class Preference implements Comparable<Preference> {
|
|||||||
case com.android.internal.R.styleable.Preference_singleLineTitle:
|
case com.android.internal.R.styleable.Preference_singleLineTitle:
|
||||||
mSingleLineTitle = a.getBoolean(attr, mSingleLineTitle);
|
mSingleLineTitle = a.getBoolean(attr, mSingleLineTitle);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case com.android.internal.R.styleable.Preference_iconSpaceReserved:
|
||||||
|
mIconSpaceReserved = a.getBoolean(attr, mIconSpaceReserved);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
a.recycle();
|
a.recycle();
|
||||||
@@ -631,7 +637,11 @@ public class Preference implements Comparable<Preference> {
|
|||||||
imageView.setImageDrawable(mIcon);
|
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);
|
final View imageFrame = view.findViewById(com.android.internal.R.id.icon_frame);
|
||||||
@@ -930,6 +940,25 @@ public class Preference implements Comparable<Preference> {
|
|||||||
return mSingleLineTitle;
|
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
|
* Returns a unique ID for this Preference. This ID should be unique across all
|
||||||
* Preference objects in a hierarchy.
|
* Preference objects in a hierarchy.
|
||||||
|
|||||||
@@ -7226,6 +7226,10 @@
|
|||||||
<!-- Whether to use single line for the preference title text. By default, preference title
|
<!-- 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. -->
|
will be constrained to one line, so the default value of this attribute is true. -->
|
||||||
<attr name="singleLineTitle" format="boolean" />
|
<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>
|
</declare-styleable>
|
||||||
|
|
||||||
<!-- Base attributes available to CheckBoxPreference. -->
|
<!-- Base attributes available to CheckBoxPreference. -->
|
||||||
|
|||||||
@@ -2813,6 +2813,7 @@
|
|||||||
<public name="iconTint" />
|
<public name="iconTint" />
|
||||||
<public name="iconTintMode" />
|
<public name="iconTintMode" />
|
||||||
<public name="maxAspectRatio"/>
|
<public name="maxAspectRatio"/>
|
||||||
|
<public name="iconSpaceReserved"/>
|
||||||
</public-group>
|
</public-group>
|
||||||
|
|
||||||
<public-group type="style" first-id="0x010302e0">
|
<public-group type="style" first-id="0x010302e0">
|
||||||
|
|||||||
Reference in New Issue
Block a user