Merge "Push flags from top-level TypedValue into ComplexColor changing configs" into nyc-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
f068cff176
@@ -10117,7 +10117,6 @@ package android.content.res {
|
||||
method public static deprecated android.content.res.ColorStateList createFromXml(android.content.res.Resources, org.xmlpull.v1.XmlPullParser) throws java.io.IOException, org.xmlpull.v1.XmlPullParserException;
|
||||
method public static android.content.res.ColorStateList createFromXml(android.content.res.Resources, org.xmlpull.v1.XmlPullParser, android.content.res.Resources.Theme) throws java.io.IOException, org.xmlpull.v1.XmlPullParserException;
|
||||
method public int describeContents();
|
||||
method public int getChangingConfigurations();
|
||||
method public int getColorForState(int[], int);
|
||||
method public int getDefaultColor();
|
||||
method public boolean isOpaque();
|
||||
@@ -10129,6 +10128,7 @@ package android.content.res {
|
||||
|
||||
public abstract class ComplexColor {
|
||||
ctor public ComplexColor();
|
||||
method public int getChangingConfigurations();
|
||||
method public abstract int getDefaultColor();
|
||||
method public boolean isStateful();
|
||||
}
|
||||
|
||||
@@ -10512,7 +10512,6 @@ package android.content.res {
|
||||
method public static deprecated android.content.res.ColorStateList createFromXml(android.content.res.Resources, org.xmlpull.v1.XmlPullParser) throws java.io.IOException, org.xmlpull.v1.XmlPullParserException;
|
||||
method public static android.content.res.ColorStateList createFromXml(android.content.res.Resources, org.xmlpull.v1.XmlPullParser, android.content.res.Resources.Theme) throws java.io.IOException, org.xmlpull.v1.XmlPullParserException;
|
||||
method public int describeContents();
|
||||
method public int getChangingConfigurations();
|
||||
method public int getColorForState(int[], int);
|
||||
method public int getDefaultColor();
|
||||
method public boolean isOpaque();
|
||||
@@ -10524,6 +10523,7 @@ package android.content.res {
|
||||
|
||||
public abstract class ComplexColor {
|
||||
ctor public ComplexColor();
|
||||
method public int getChangingConfigurations();
|
||||
method public abstract int getDefaultColor();
|
||||
method public boolean isStateful();
|
||||
}
|
||||
|
||||
@@ -10127,7 +10127,6 @@ package android.content.res {
|
||||
method public static deprecated android.content.res.ColorStateList createFromXml(android.content.res.Resources, org.xmlpull.v1.XmlPullParser) throws java.io.IOException, org.xmlpull.v1.XmlPullParserException;
|
||||
method public static android.content.res.ColorStateList createFromXml(android.content.res.Resources, org.xmlpull.v1.XmlPullParser, android.content.res.Resources.Theme) throws java.io.IOException, org.xmlpull.v1.XmlPullParserException;
|
||||
method public int describeContents();
|
||||
method public int getChangingConfigurations();
|
||||
method public int getColorForState(int[], int);
|
||||
method public int getDefaultColor();
|
||||
method public boolean isOpaque();
|
||||
@@ -10139,6 +10138,7 @@ package android.content.res {
|
||||
|
||||
public abstract class ComplexColor {
|
||||
ctor public ComplexColor();
|
||||
method public int getChangingConfigurations();
|
||||
method public abstract int getDefaultColor();
|
||||
method public boolean isStateful();
|
||||
}
|
||||
|
||||
@@ -442,7 +442,7 @@ public class ColorStateList extends ComplexColor implements Parcelable {
|
||||
* @see android.content.pm.ActivityInfo
|
||||
*/
|
||||
public @Config int getChangingConfigurations() {
|
||||
return mChangingConfigurations;
|
||||
return super.getChangingConfigurations() | mChangingConfigurations;
|
||||
}
|
||||
|
||||
private int modulateColorAlpha(int baseColor, float alphaMod) {
|
||||
|
||||
@@ -25,6 +25,8 @@ import android.graphics.Color;
|
||||
* {@link android.content.res.ColorStateList} or {@link android.content.res.GradientColor}
|
||||
*/
|
||||
public abstract class ComplexColor {
|
||||
private int mChangingConfigurations;
|
||||
|
||||
/**
|
||||
* @return {@code true} if this ComplexColor changes color based on state, {@code false}
|
||||
* otherwise.
|
||||
@@ -52,4 +54,24 @@ public abstract class ComplexColor {
|
||||
* @hide only for resource preloading
|
||||
*/
|
||||
public abstract ComplexColor obtainForTheme(Theme t);
|
||||
|
||||
/**
|
||||
* @hide only for resource preloading
|
||||
*/
|
||||
final void setBaseChangingConfigurations(int changingConfigurations) {
|
||||
mChangingConfigurations = changingConfigurations;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a mask of the configuration parameters for which this color
|
||||
* may change, requiring that it be re-created.
|
||||
*
|
||||
* @return a mask of the changing configuration parameters, as defined by
|
||||
* {@link android.content.pm.ActivityInfo}
|
||||
*
|
||||
* @see android.content.pm.ActivityInfo
|
||||
*/
|
||||
public int getChangingConfigurations() {
|
||||
return mChangingConfigurations;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -542,6 +542,19 @@ public class GradientColor extends ComplexColor {
|
||||
return clone;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a mask of the configuration parameters for which this gradient
|
||||
* may change, requiring that it be re-created.
|
||||
*
|
||||
* @return a mask of the changing configuration parameters, as defined by
|
||||
* {@link android.content.pm.ActivityInfo}
|
||||
*
|
||||
* @see android.content.pm.ActivityInfo
|
||||
*/
|
||||
public int getChangingConfigurations() {
|
||||
return super.getChangingConfigurations() | mChangingConfigurations;
|
||||
}
|
||||
|
||||
private void applyTheme(Theme t) {
|
||||
if (mThemeAttrs != null) {
|
||||
applyRootAttrsTheme(t);
|
||||
|
||||
@@ -713,9 +713,11 @@ public class ResourcesImpl {
|
||||
}
|
||||
|
||||
if (complexColor != null) {
|
||||
complexColor.setBaseChangingConfigurations(value.changingConfigurations);
|
||||
|
||||
if (mPreloading) {
|
||||
if (verifyPreloadConfig(value.changingConfigurations, 0, value.resourceId,
|
||||
"color")) {
|
||||
if (verifyPreloadConfig(complexColor.getChangingConfigurations(),
|
||||
0, value.resourceId, "color")) {
|
||||
sPreloadedComplexColors.put(key, complexColor.getConstantState());
|
||||
}
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user