Loading api/current.txt +3 −0 Original line number Diff line number Diff line Loading @@ -9260,6 +9260,7 @@ package android.content.res { method public int getType(int); method public boolean getValue(int, android.util.TypedValue); method public boolean hasValue(int); method public boolean hasValueOrEmpty(int); method public int length(); method public android.util.TypedValue peekValue(int); method public void recycle(); Loading Loading @@ -32172,6 +32173,8 @@ package android.util { field public static final int COMPLEX_UNIT_PX = 0; // 0x0 field public static final int COMPLEX_UNIT_SHIFT = 0; // 0x0 field public static final int COMPLEX_UNIT_SP = 2; // 0x2 field public static final int DATA_NULL_EMPTY = 1; // 0x1 field public static final int DATA_NULL_UNDEFINED = 0; // 0x0 field public static final int DENSITY_DEFAULT = 0; // 0x0 field public static final int DENSITY_NONE = 65535; // 0xffff field public static final int TYPE_ATTRIBUTE = 2; // 0x2 core/java/android/content/res/TypedArray.java +24 −0 Original line number Diff line number Diff line Loading @@ -807,6 +807,9 @@ public class TypedArray { /** * Determines whether there is an attribute at <var>index</var>. * <p> * <strong>Note:</strong> If the attribute was set to {@code @empty} or * {@code @undefined}, this method returns {@code false}. * * @param index Index of attribute to retrieve. * Loading @@ -823,6 +826,27 @@ public class TypedArray { return type != TypedValue.TYPE_NULL; } /** * Determines whether there is an attribute at <var>index</var>, returning * {@code true} if the attribute was explicitly set to {@code @empty} and * {@code false} only if the attribute was undefined. * * @param index Index of attribute to retrieve. * * @return True if the attribute has a value or is empty, false otherwise. */ public boolean hasValueOrEmpty(int index) { if (mRecycled) { throw new RuntimeException("Cannot make calls to a recycled instance!"); } index *= AssetManager.STYLE_NUM_ENTRIES; final int[] data = mData; final int type = data[index+AssetManager.STYLE_TYPE]; return type != TypedValue.TYPE_NULL || data[index+AssetManager.STYLE_DATA] == TypedValue.DATA_NULL_EMPTY; } /** * Retrieve the raw TypedValue for the attribute at <var>index</var> * and return a temporary object holding its data. This object is only Loading core/java/android/util/TypedValue.java +11 −0 Original line number Diff line number Diff line Loading @@ -138,6 +138,17 @@ public class TypedValue { /* ------------------------------------------------------------ */ /** * {@link #TYPE_NULL} data indicating the value was not specified. */ public static final int DATA_NULL_UNDEFINED = 0; /** * {@link #TYPE_NULL} data indicating the value was explicitly set to null. */ public static final int DATA_NULL_EMPTY = 1; /* ------------------------------------------------------------ */ /** * If {@link #density} is equal to this value, then the density should be * treated as the system's default density value: {@link DisplayMetrics#DENSITY_DEFAULT}. Loading core/jni/android_util_AssetManager.cpp +7 −3 Original line number Diff line number Diff line Loading @@ -1095,7 +1095,7 @@ static jboolean android_content_AssetManager_resolveAttrs(JNIEnv* env, jobject c // coming from, first XML attributes, then XML style, then default // style, and finally the theme. value.dataType = Res_value::TYPE_NULL; value.data = 0; value.data = Res_value::DATA_NULL_UNDEFINED; typeSetFlags = 0; config.density = 0; Loading Loading @@ -1157,6 +1157,7 @@ static jboolean android_content_AssetManager_resolveAttrs(JNIEnv* env, jobject c if (value.dataType == Res_value::TYPE_REFERENCE && value.data == 0) { DEBUG_STYLES(ALOGI("-> Setting to @null!")); value.dataType = Res_value::TYPE_NULL; value.data = Res_value::DATA_NULL_UNDEFINED; block = -1; } Loading Loading @@ -1319,7 +1320,7 @@ static jboolean android_content_AssetManager_applyStyle(JNIEnv* env, jobject cla // coming from, first XML attributes, then XML style, then default // style, and finally the theme. value.dataType = Res_value::TYPE_NULL; value.data = 0; value.data = Res_value::DATA_NULL_UNDEFINED; typeSetFlags = 0; config.density = 0; Loading Loading @@ -1403,6 +1404,7 @@ static jboolean android_content_AssetManager_applyStyle(JNIEnv* env, jobject cla if (value.dataType == Res_value::TYPE_REFERENCE && value.data == 0) { DEBUG_STYLES(ALOGI("-> Setting to @null!")); value.dataType = Res_value::TYPE_NULL; value.data = Res_value::DATA_NULL_UNDEFINED; block = kXmlBlock; } Loading Loading @@ -1512,7 +1514,7 @@ static jboolean android_content_AssetManager_retrieveAttributes(JNIEnv* env, job // Try to find a value for this attribute... value.dataType = Res_value::TYPE_NULL; value.data = 0; value.data = Res_value::DATA_NULL_UNDEFINED; typeSetFlags = 0; config.density = 0; Loading Loading @@ -1548,6 +1550,7 @@ static jboolean android_content_AssetManager_retrieveAttributes(JNIEnv* env, job // Deal with the special @null value -- it turns back to TYPE_NULL. if (value.dataType == Res_value::TYPE_REFERENCE && value.data == 0) { value.dataType = Res_value::TYPE_NULL; value.data = Res_value::DATA_NULL_UNDEFINED; } //printf("Attribute 0x%08x: final type=0x%x, data=0x%08x\n", curIdent, value.dataType, value.data); Loading Loading @@ -1661,6 +1664,7 @@ static jint android_content_AssetManager_retrieveArray(JNIEnv* env, jobject claz // Deal with the special @null value -- it turns back to TYPE_NULL. if (value.dataType == Res_value::TYPE_REFERENCE && value.data == 0) { value.dataType = Res_value::TYPE_NULL; value.data = Res_value::DATA_NULL_UNDEFINED; } //printf("Attribute 0x%08x: final type=0x%x, data=0x%08x\n", curIdent, value.dataType, value.data); Loading core/res/res/values/styles_material.xml +10 −10 Original line number Diff line number Diff line Loading @@ -1091,16 +1091,16 @@ please see styles_device_defaults.xml. <!-- Dialog styles --> <style name="AlertDialog.Material" parent="AlertDialog"> <item name="fullDark">@null</item> <item name="topDark">@null</item> <item name="centerDark">@null</item> <item name="bottomDark">@null</item> <item name="fullBright">@null</item> <item name="topBright">@null</item> <item name="centerBright">@null</item> <item name="bottomBright">@null</item> <item name="bottomMedium">@null</item> <item name="centerMedium">@null</item> <item name="fullDark">@empty</item> <item name="topDark">@empty</item> <item name="centerDark">@empty</item> <item name="bottomDark">@empty</item> <item name="fullBright">@empty</item> <item name="topBright">@empty</item> <item name="centerBright">@empty</item> <item name="bottomBright">@empty</item> <item name="bottomMedium">@empty</item> <item name="centerMedium">@empty</item> <item name="layout">@layout/alert_dialog_material</item> <item name="listLayout">@layout/select_dialog_material</item> <item name="progressLayout">@layout/progress_dialog_material</item> Loading Loading
api/current.txt +3 −0 Original line number Diff line number Diff line Loading @@ -9260,6 +9260,7 @@ package android.content.res { method public int getType(int); method public boolean getValue(int, android.util.TypedValue); method public boolean hasValue(int); method public boolean hasValueOrEmpty(int); method public int length(); method public android.util.TypedValue peekValue(int); method public void recycle(); Loading Loading @@ -32172,6 +32173,8 @@ package android.util { field public static final int COMPLEX_UNIT_PX = 0; // 0x0 field public static final int COMPLEX_UNIT_SHIFT = 0; // 0x0 field public static final int COMPLEX_UNIT_SP = 2; // 0x2 field public static final int DATA_NULL_EMPTY = 1; // 0x1 field public static final int DATA_NULL_UNDEFINED = 0; // 0x0 field public static final int DENSITY_DEFAULT = 0; // 0x0 field public static final int DENSITY_NONE = 65535; // 0xffff field public static final int TYPE_ATTRIBUTE = 2; // 0x2
core/java/android/content/res/TypedArray.java +24 −0 Original line number Diff line number Diff line Loading @@ -807,6 +807,9 @@ public class TypedArray { /** * Determines whether there is an attribute at <var>index</var>. * <p> * <strong>Note:</strong> If the attribute was set to {@code @empty} or * {@code @undefined}, this method returns {@code false}. * * @param index Index of attribute to retrieve. * Loading @@ -823,6 +826,27 @@ public class TypedArray { return type != TypedValue.TYPE_NULL; } /** * Determines whether there is an attribute at <var>index</var>, returning * {@code true} if the attribute was explicitly set to {@code @empty} and * {@code false} only if the attribute was undefined. * * @param index Index of attribute to retrieve. * * @return True if the attribute has a value or is empty, false otherwise. */ public boolean hasValueOrEmpty(int index) { if (mRecycled) { throw new RuntimeException("Cannot make calls to a recycled instance!"); } index *= AssetManager.STYLE_NUM_ENTRIES; final int[] data = mData; final int type = data[index+AssetManager.STYLE_TYPE]; return type != TypedValue.TYPE_NULL || data[index+AssetManager.STYLE_DATA] == TypedValue.DATA_NULL_EMPTY; } /** * Retrieve the raw TypedValue for the attribute at <var>index</var> * and return a temporary object holding its data. This object is only Loading
core/java/android/util/TypedValue.java +11 −0 Original line number Diff line number Diff line Loading @@ -138,6 +138,17 @@ public class TypedValue { /* ------------------------------------------------------------ */ /** * {@link #TYPE_NULL} data indicating the value was not specified. */ public static final int DATA_NULL_UNDEFINED = 0; /** * {@link #TYPE_NULL} data indicating the value was explicitly set to null. */ public static final int DATA_NULL_EMPTY = 1; /* ------------------------------------------------------------ */ /** * If {@link #density} is equal to this value, then the density should be * treated as the system's default density value: {@link DisplayMetrics#DENSITY_DEFAULT}. Loading
core/jni/android_util_AssetManager.cpp +7 −3 Original line number Diff line number Diff line Loading @@ -1095,7 +1095,7 @@ static jboolean android_content_AssetManager_resolveAttrs(JNIEnv* env, jobject c // coming from, first XML attributes, then XML style, then default // style, and finally the theme. value.dataType = Res_value::TYPE_NULL; value.data = 0; value.data = Res_value::DATA_NULL_UNDEFINED; typeSetFlags = 0; config.density = 0; Loading Loading @@ -1157,6 +1157,7 @@ static jboolean android_content_AssetManager_resolveAttrs(JNIEnv* env, jobject c if (value.dataType == Res_value::TYPE_REFERENCE && value.data == 0) { DEBUG_STYLES(ALOGI("-> Setting to @null!")); value.dataType = Res_value::TYPE_NULL; value.data = Res_value::DATA_NULL_UNDEFINED; block = -1; } Loading Loading @@ -1319,7 +1320,7 @@ static jboolean android_content_AssetManager_applyStyle(JNIEnv* env, jobject cla // coming from, first XML attributes, then XML style, then default // style, and finally the theme. value.dataType = Res_value::TYPE_NULL; value.data = 0; value.data = Res_value::DATA_NULL_UNDEFINED; typeSetFlags = 0; config.density = 0; Loading Loading @@ -1403,6 +1404,7 @@ static jboolean android_content_AssetManager_applyStyle(JNIEnv* env, jobject cla if (value.dataType == Res_value::TYPE_REFERENCE && value.data == 0) { DEBUG_STYLES(ALOGI("-> Setting to @null!")); value.dataType = Res_value::TYPE_NULL; value.data = Res_value::DATA_NULL_UNDEFINED; block = kXmlBlock; } Loading Loading @@ -1512,7 +1514,7 @@ static jboolean android_content_AssetManager_retrieveAttributes(JNIEnv* env, job // Try to find a value for this attribute... value.dataType = Res_value::TYPE_NULL; value.data = 0; value.data = Res_value::DATA_NULL_UNDEFINED; typeSetFlags = 0; config.density = 0; Loading Loading @@ -1548,6 +1550,7 @@ static jboolean android_content_AssetManager_retrieveAttributes(JNIEnv* env, job // Deal with the special @null value -- it turns back to TYPE_NULL. if (value.dataType == Res_value::TYPE_REFERENCE && value.data == 0) { value.dataType = Res_value::TYPE_NULL; value.data = Res_value::DATA_NULL_UNDEFINED; } //printf("Attribute 0x%08x: final type=0x%x, data=0x%08x\n", curIdent, value.dataType, value.data); Loading Loading @@ -1661,6 +1664,7 @@ static jint android_content_AssetManager_retrieveArray(JNIEnv* env, jobject claz // Deal with the special @null value -- it turns back to TYPE_NULL. if (value.dataType == Res_value::TYPE_REFERENCE && value.data == 0) { value.dataType = Res_value::TYPE_NULL; value.data = Res_value::DATA_NULL_UNDEFINED; } //printf("Attribute 0x%08x: final type=0x%x, data=0x%08x\n", curIdent, value.dataType, value.data); Loading
core/res/res/values/styles_material.xml +10 −10 Original line number Diff line number Diff line Loading @@ -1091,16 +1091,16 @@ please see styles_device_defaults.xml. <!-- Dialog styles --> <style name="AlertDialog.Material" parent="AlertDialog"> <item name="fullDark">@null</item> <item name="topDark">@null</item> <item name="centerDark">@null</item> <item name="bottomDark">@null</item> <item name="fullBright">@null</item> <item name="topBright">@null</item> <item name="centerBright">@null</item> <item name="bottomBright">@null</item> <item name="bottomMedium">@null</item> <item name="centerMedium">@null</item> <item name="fullDark">@empty</item> <item name="topDark">@empty</item> <item name="centerDark">@empty</item> <item name="bottomDark">@empty</item> <item name="fullBright">@empty</item> <item name="topBright">@empty</item> <item name="centerBright">@empty</item> <item name="bottomBright">@empty</item> <item name="bottomMedium">@empty</item> <item name="centerMedium">@empty</item> <item name="layout">@layout/alert_dialog_material</item> <item name="listLayout">@layout/select_dialog_material</item> <item name="progressLayout">@layout/progress_dialog_material</item> Loading