Move AppCompat's drawable compat classes to public API
Nullability is missing because the platform classes are also missing
nullability.
Relnote: "Move DrawableWrapper, DrawableContainer, and StateListDrawable
compat classes to public API."
Fixes: 227789566
Test: DrawableContainerCompatTest, AnimatedStateListDrawableCompatTest
Change-Id: I37f3e188d926628853c3ef37ce7a32f28afd2823
diff --git a/appcompat/appcompat-resources/api/api_lint.ignore b/appcompat/appcompat-resources/api/api_lint.ignore
index 5d3b096..61eb45f 100644
--- a/appcompat/appcompat-resources/api/api_lint.ignore
+++ b/appcompat/appcompat-resources/api/api_lint.ignore
@@ -1,17 +1,59 @@
// Baseline format: 1.0
-HiddenSuperclass: androidx.appcompat.graphics.drawable.AnimatedStateListDrawableCompat:
- Public class androidx.appcompat.graphics.drawable.AnimatedStateListDrawableCompat stripped of unavailable superclass androidx.appcompat.graphics.drawable.StateListDrawable
-
-
-InvalidNullabilityOverride: androidx.appcompat.graphics.drawable.AnimatedStateListDrawableCompat#setTintMode(android.graphics.PorterDuff.Mode) parameter #0:
+InvalidNullabilityOverride: androidx.appcompat.graphics.drawable.DrawableContainerCompat#onStateChange(int[]) parameter #0:
+ Invalid nullability on parameter `state` in method `onStateChange`. Parameters of overrides cannot be NonNull if the super parameter is unannotated.
+InvalidNullabilityOverride: androidx.appcompat.graphics.drawable.DrawableContainerCompat#setTintMode(android.graphics.PorterDuff.Mode) parameter #0:
Invalid nullability on parameter `tintMode` in method `setTintMode`. Parameters of overrides cannot be NonNull if super parameter is Nullable.
MissingNullability: androidx.appcompat.content.res.AppCompatResources#getColorStateList(android.content.Context, int):
Missing nullability on method `getColorStateList` return
-MissingNullability: androidx.appcompat.graphics.drawable.AnimatedStateListDrawableCompat#createFromXmlInner(android.content.Context, android.content.res.Resources, org.xmlpull.v1.XmlPullParser, android.util.AttributeSet, android.content.res.Resources.Theme):
- Missing nullability on method `createFromXmlInner` return
-MissingNullability: androidx.appcompat.graphics.drawable.AnimatedStateListDrawableCompat#mutate():
+MissingNullability: androidx.appcompat.graphics.drawable.DrawableContainerCompat#getConstantState():
+ Missing nullability on method `getConstantState` return
+MissingNullability: androidx.appcompat.graphics.drawable.DrawableContainerCompat#mutate():
Missing nullability on method `mutate` return
-MissingNullability: androidx.appcompat.graphics.drawable.AnimatedStateListDrawableCompat#onStateChange(int[]) parameter #0:
- Missing nullability on parameter `stateSet` in method `onStateChange`
+MissingNullability: androidx.appcompat.graphics.drawable.DrawableContainerCompat#onBoundsChange(android.graphics.Rect) parameter #0:
+ Missing nullability on parameter `bounds` in method `onBoundsChange`
+MissingNullability: androidx.appcompat.graphics.drawable.DrawableContainerCompat#setColorFilter(android.graphics.ColorFilter) parameter #0:
+ Missing nullability on parameter `colorFilter` in method `setColorFilter`
+MissingNullability: androidx.appcompat.graphics.drawable.DrawableContainerCompat#setTintList(android.content.res.ColorStateList) parameter #0:
+ Missing nullability on parameter `tint` in method `setTintList`
+MissingNullability: androidx.appcompat.graphics.drawable.DrawableWrapperCompat#DrawableWrapperCompat(android.graphics.drawable.Drawable) parameter #0:
+ Missing nullability on parameter `drawable` in method `DrawableWrapperCompat`
+MissingNullability: androidx.appcompat.graphics.drawable.DrawableWrapperCompat#draw(android.graphics.Canvas) parameter #0:
+ Missing nullability on parameter `canvas` in method `draw`
+MissingNullability: androidx.appcompat.graphics.drawable.DrawableWrapperCompat#getCurrent():
+ Missing nullability on method `getCurrent` return
+MissingNullability: androidx.appcompat.graphics.drawable.DrawableWrapperCompat#getPadding(android.graphics.Rect) parameter #0:
+ Missing nullability on parameter `padding` in method `getPadding`
+MissingNullability: androidx.appcompat.graphics.drawable.DrawableWrapperCompat#getState():
+ Missing nullability on method `getState` return
+MissingNullability: androidx.appcompat.graphics.drawable.DrawableWrapperCompat#getTransparentRegion():
+ Missing nullability on method `getTransparentRegion` return
+MissingNullability: androidx.appcompat.graphics.drawable.DrawableWrapperCompat#getWrappedDrawable():
+ Missing nullability on method `getWrappedDrawable` return
+MissingNullability: androidx.appcompat.graphics.drawable.DrawableWrapperCompat#invalidateDrawable(android.graphics.drawable.Drawable) parameter #0:
+ Missing nullability on parameter `who` in method `invalidateDrawable`
+MissingNullability: androidx.appcompat.graphics.drawable.DrawableWrapperCompat#onBoundsChange(android.graphics.Rect) parameter #0:
+ Missing nullability on parameter `bounds` in method `onBoundsChange`
+MissingNullability: androidx.appcompat.graphics.drawable.DrawableWrapperCompat#scheduleDrawable(android.graphics.drawable.Drawable, Runnable, long) parameter #0:
+ Missing nullability on parameter `who` in method `scheduleDrawable`
+MissingNullability: androidx.appcompat.graphics.drawable.DrawableWrapperCompat#scheduleDrawable(android.graphics.drawable.Drawable, Runnable, long) parameter #1:
+ Missing nullability on parameter `what` in method `scheduleDrawable`
+MissingNullability: androidx.appcompat.graphics.drawable.DrawableWrapperCompat#setColorFilter(android.graphics.ColorFilter) parameter #0:
+ Missing nullability on parameter `cf` in method `setColorFilter`
+MissingNullability: androidx.appcompat.graphics.drawable.DrawableWrapperCompat#setState(int[]) parameter #0:
+ Missing nullability on parameter `stateSet` in method `setState`
+MissingNullability: androidx.appcompat.graphics.drawable.DrawableWrapperCompat#setTintList(android.content.res.ColorStateList) parameter #0:
+ Missing nullability on parameter `tint` in method `setTintList`
+MissingNullability: androidx.appcompat.graphics.drawable.DrawableWrapperCompat#setTintMode(android.graphics.PorterDuff.Mode) parameter #0:
+ Missing nullability on parameter `tintMode` in method `setTintMode`
+MissingNullability: androidx.appcompat.graphics.drawable.DrawableWrapperCompat#setWrappedDrawable(android.graphics.drawable.Drawable) parameter #0:
+ Missing nullability on parameter `drawable` in method `setWrappedDrawable`
+MissingNullability: androidx.appcompat.graphics.drawable.DrawableWrapperCompat#unscheduleDrawable(android.graphics.drawable.Drawable, Runnable) parameter #0:
+ Missing nullability on parameter `who` in method `unscheduleDrawable`
+MissingNullability: androidx.appcompat.graphics.drawable.DrawableWrapperCompat#unscheduleDrawable(android.graphics.drawable.Drawable, Runnable) parameter #1:
+ Missing nullability on parameter `what` in method `unscheduleDrawable`
+MissingNullability: androidx.appcompat.graphics.drawable.StateListDrawableCompat#addState(int[], android.graphics.drawable.Drawable) parameter #0:
+ Missing nullability on parameter `stateSet` in method `addState`
+MissingNullability: androidx.appcompat.graphics.drawable.StateListDrawableCompat#addState(int[], android.graphics.drawable.Drawable) parameter #1:
+ Missing nullability on parameter `drawable` in method `addState`
diff --git a/appcompat/appcompat-resources/api/current.txt b/appcompat/appcompat-resources/api/current.txt
index 488a7e8..0d2a788 100644
--- a/appcompat/appcompat-resources/api/current.txt
+++ b/appcompat/appcompat-resources/api/current.txt
@@ -10,17 +10,19 @@
package androidx.appcompat.graphics.drawable {
- public class AnimatedStateListDrawableCompat extends android.graphics.drawable.Drawable implements android.graphics.drawable.Drawable.Callback {
+ public class AnimatedStateListDrawableCompat extends androidx.appcompat.graphics.drawable.StateListDrawableCompat {
ctor public AnimatedStateListDrawableCompat();
method public void addState(int[], android.graphics.drawable.Drawable, int);
- method public void addState(int[]!, android.graphics.drawable.Drawable!);
method public <T extends android.graphics.drawable.Drawable & android.graphics.drawable.Animatable> void addTransition(int, int, T, boolean);
method public static androidx.appcompat.graphics.drawable.AnimatedStateListDrawableCompat? create(android.content.Context, @DrawableRes int, android.content.res.Resources.Theme?);
method public static androidx.appcompat.graphics.drawable.AnimatedStateListDrawableCompat createFromXmlInner(android.content.Context, android.content.res.Resources, org.xmlpull.v1.XmlPullParser, android.util.AttributeSet, android.content.res.Resources.Theme?) throws java.io.IOException, org.xmlpull.v1.XmlPullParserException;
+ }
+
+ public class DrawableContainerCompat extends android.graphics.drawable.Drawable implements android.graphics.drawable.Drawable.Callback {
+ ctor public DrawableContainerCompat();
method public void draw(android.graphics.Canvas);
method public final android.graphics.drawable.Drawable.ConstantState! getConstantState();
method public int getOpacity();
- method public void inflate(android.content.Context, android.content.res.Resources, org.xmlpull.v1.XmlPullParser, android.util.AttributeSet, android.content.res.Resources.Theme?) throws java.io.IOException, org.xmlpull.v1.XmlPullParserException;
method public void invalidateDrawable(android.graphics.drawable.Drawable);
method public void scheduleDrawable(android.graphics.drawable.Drawable, Runnable, long);
method public void setAlpha(int);
@@ -31,5 +33,25 @@
method public void unscheduleDrawable(android.graphics.drawable.Drawable, Runnable);
}
+ public class DrawableWrapperCompat extends android.graphics.drawable.Drawable implements android.graphics.drawable.Drawable.Callback {
+ ctor public DrawableWrapperCompat(android.graphics.drawable.Drawable!);
+ method public void draw(android.graphics.Canvas!);
+ method public android.graphics.drawable.Drawable? getDrawable();
+ method public int getOpacity();
+ method public void invalidateDrawable(android.graphics.drawable.Drawable!);
+ method public void scheduleDrawable(android.graphics.drawable.Drawable!, Runnable!, long);
+ method public void setAlpha(int);
+ method public void setColorFilter(android.graphics.ColorFilter!);
+ method public void setDither(boolean);
+ method public void setDrawable(android.graphics.drawable.Drawable?);
+ method public void unscheduleDrawable(android.graphics.drawable.Drawable!, Runnable!);
+ }
+
+ public class StateListDrawableCompat extends androidx.appcompat.graphics.drawable.DrawableContainerCompat {
+ ctor public StateListDrawableCompat();
+ method public void addState(int[]!, android.graphics.drawable.Drawable!);
+ method public void inflate(android.content.Context, android.content.res.Resources, org.xmlpull.v1.XmlPullParser, android.util.AttributeSet, android.content.res.Resources.Theme?) throws java.io.IOException, org.xmlpull.v1.XmlPullParserException;
+ }
+
}
diff --git a/appcompat/appcompat-resources/api/public_plus_experimental_current.txt b/appcompat/appcompat-resources/api/public_plus_experimental_current.txt
index 488a7e8..0d2a788 100644
--- a/appcompat/appcompat-resources/api/public_plus_experimental_current.txt
+++ b/appcompat/appcompat-resources/api/public_plus_experimental_current.txt
@@ -10,17 +10,19 @@
package androidx.appcompat.graphics.drawable {
- public class AnimatedStateListDrawableCompat extends android.graphics.drawable.Drawable implements android.graphics.drawable.Drawable.Callback {
+ public class AnimatedStateListDrawableCompat extends androidx.appcompat.graphics.drawable.StateListDrawableCompat {
ctor public AnimatedStateListDrawableCompat();
method public void addState(int[], android.graphics.drawable.Drawable, int);
- method public void addState(int[]!, android.graphics.drawable.Drawable!);
method public <T extends android.graphics.drawable.Drawable & android.graphics.drawable.Animatable> void addTransition(int, int, T, boolean);
method public static androidx.appcompat.graphics.drawable.AnimatedStateListDrawableCompat? create(android.content.Context, @DrawableRes int, android.content.res.Resources.Theme?);
method public static androidx.appcompat.graphics.drawable.AnimatedStateListDrawableCompat createFromXmlInner(android.content.Context, android.content.res.Resources, org.xmlpull.v1.XmlPullParser, android.util.AttributeSet, android.content.res.Resources.Theme?) throws java.io.IOException, org.xmlpull.v1.XmlPullParserException;
+ }
+
+ public class DrawableContainerCompat extends android.graphics.drawable.Drawable implements android.graphics.drawable.Drawable.Callback {
+ ctor public DrawableContainerCompat();
method public void draw(android.graphics.Canvas);
method public final android.graphics.drawable.Drawable.ConstantState! getConstantState();
method public int getOpacity();
- method public void inflate(android.content.Context, android.content.res.Resources, org.xmlpull.v1.XmlPullParser, android.util.AttributeSet, android.content.res.Resources.Theme?) throws java.io.IOException, org.xmlpull.v1.XmlPullParserException;
method public void invalidateDrawable(android.graphics.drawable.Drawable);
method public void scheduleDrawable(android.graphics.drawable.Drawable, Runnable, long);
method public void setAlpha(int);
@@ -31,5 +33,25 @@
method public void unscheduleDrawable(android.graphics.drawable.Drawable, Runnable);
}
+ public class DrawableWrapperCompat extends android.graphics.drawable.Drawable implements android.graphics.drawable.Drawable.Callback {
+ ctor public DrawableWrapperCompat(android.graphics.drawable.Drawable!);
+ method public void draw(android.graphics.Canvas!);
+ method public android.graphics.drawable.Drawable? getDrawable();
+ method public int getOpacity();
+ method public void invalidateDrawable(android.graphics.drawable.Drawable!);
+ method public void scheduleDrawable(android.graphics.drawable.Drawable!, Runnable!, long);
+ method public void setAlpha(int);
+ method public void setColorFilter(android.graphics.ColorFilter!);
+ method public void setDither(boolean);
+ method public void setDrawable(android.graphics.drawable.Drawable?);
+ method public void unscheduleDrawable(android.graphics.drawable.Drawable!, Runnable!);
+ }
+
+ public class StateListDrawableCompat extends androidx.appcompat.graphics.drawable.DrawableContainerCompat {
+ ctor public StateListDrawableCompat();
+ method public void addState(int[]!, android.graphics.drawable.Drawable!);
+ method public void inflate(android.content.Context, android.content.res.Resources, org.xmlpull.v1.XmlPullParser, android.util.AttributeSet, android.content.res.Resources.Theme?) throws java.io.IOException, org.xmlpull.v1.XmlPullParserException;
+ }
+
}
diff --git a/appcompat/appcompat-resources/api/restricted_current.ignore b/appcompat/appcompat-resources/api/restricted_current.ignore
new file mode 100644
index 0000000..93d6e5f
--- /dev/null
+++ b/appcompat/appcompat-resources/api/restricted_current.ignore
@@ -0,0 +1,3 @@
+// Baseline format: 1.0
+RemovedClass: androidx.appcompat.graphics.drawable.DrawableWrapper:
+ Removed class androidx.appcompat.graphics.drawable.DrawableWrapper
diff --git a/appcompat/appcompat-resources/api/restricted_current.txt b/appcompat/appcompat-resources/api/restricted_current.txt
index c4d31b2..d998c06 100644
--- a/appcompat/appcompat-resources/api/restricted_current.txt
+++ b/appcompat/appcompat-resources/api/restricted_current.txt
@@ -10,17 +10,19 @@
package androidx.appcompat.graphics.drawable {
- public class AnimatedStateListDrawableCompat extends android.graphics.drawable.Drawable implements android.graphics.drawable.Drawable.Callback androidx.core.graphics.drawable.TintAwareDrawable {
+ public class AnimatedStateListDrawableCompat extends androidx.appcompat.graphics.drawable.StateListDrawableCompat implements androidx.core.graphics.drawable.TintAwareDrawable {
ctor public AnimatedStateListDrawableCompat();
method public void addState(int[], android.graphics.drawable.Drawable, int);
- method public void addState(int[]!, android.graphics.drawable.Drawable!);
method public <T extends android.graphics.drawable.Drawable & android.graphics.drawable.Animatable> void addTransition(int, int, T, boolean);
method public static androidx.appcompat.graphics.drawable.AnimatedStateListDrawableCompat? create(android.content.Context, @DrawableRes int, android.content.res.Resources.Theme?);
method public static androidx.appcompat.graphics.drawable.AnimatedStateListDrawableCompat createFromXmlInner(android.content.Context, android.content.res.Resources, org.xmlpull.v1.XmlPullParser, android.util.AttributeSet, android.content.res.Resources.Theme?) throws java.io.IOException, org.xmlpull.v1.XmlPullParserException;
+ }
+
+ public class DrawableContainerCompat extends android.graphics.drawable.Drawable implements android.graphics.drawable.Drawable.Callback {
+ ctor public DrawableContainerCompat();
method public void draw(android.graphics.Canvas);
method public final android.graphics.drawable.Drawable.ConstantState! getConstantState();
method public int getOpacity();
- method public void inflate(android.content.Context, android.content.res.Resources, org.xmlpull.v1.XmlPullParser, android.util.AttributeSet, android.content.res.Resources.Theme?) throws java.io.IOException, org.xmlpull.v1.XmlPullParserException;
method public void invalidateDrawable(android.graphics.drawable.Drawable);
method public void scheduleDrawable(android.graphics.drawable.Drawable, Runnable, long);
method public void setAlpha(int);
@@ -31,20 +33,26 @@
method public void unscheduleDrawable(android.graphics.drawable.Drawable, Runnable);
}
- @RestrictTo(androidx.annotation.RestrictTo.Scope.LIBRARY_GROUP_PREFIX) public class DrawableWrapper extends android.graphics.drawable.Drawable implements android.graphics.drawable.Drawable.Callback {
- ctor public DrawableWrapper(android.graphics.drawable.Drawable!);
+ public class DrawableWrapperCompat extends android.graphics.drawable.Drawable implements android.graphics.drawable.Drawable.Callback {
+ ctor public DrawableWrapperCompat(android.graphics.drawable.Drawable!);
method public void draw(android.graphics.Canvas!);
+ method public android.graphics.drawable.Drawable? getDrawable();
method public int getOpacity();
- method public android.graphics.drawable.Drawable! getWrappedDrawable();
method public void invalidateDrawable(android.graphics.drawable.Drawable!);
method public void scheduleDrawable(android.graphics.drawable.Drawable!, Runnable!, long);
method public void setAlpha(int);
method public void setColorFilter(android.graphics.ColorFilter!);
method public void setDither(boolean);
- method public void setWrappedDrawable(android.graphics.drawable.Drawable!);
+ method public void setDrawable(android.graphics.drawable.Drawable?);
method public void unscheduleDrawable(android.graphics.drawable.Drawable!, Runnable!);
}
+ public class StateListDrawableCompat extends androidx.appcompat.graphics.drawable.DrawableContainerCompat {
+ ctor public StateListDrawableCompat();
+ method public void addState(int[]!, android.graphics.drawable.Drawable!);
+ method public void inflate(android.content.Context, android.content.res.Resources, org.xmlpull.v1.XmlPullParser, android.util.AttributeSet, android.content.res.Resources.Theme?) throws java.io.IOException, org.xmlpull.v1.XmlPullParserException;
+ }
+
}
package androidx.appcompat.widget {
diff --git a/appcompat/appcompat-resources/lint-baseline.xml b/appcompat/appcompat-resources/lint-baseline.xml
index a9a30d2..432e438 100644
--- a/appcompat/appcompat-resources/lint-baseline.xml
+++ b/appcompat/appcompat-resources/lint-baseline.xml
@@ -124,6 +124,51 @@
<issue
id="UnknownNullness"
message="Unknown nullability; explicitly declare as `@Nullable` or `@NonNull` to improve Kotlin interoperability; see https://developer.android.com/kotlin/interop#nullability_annotations"
+ errorLine1=" public void setColorFilter(ColorFilter colorFilter) {"
+ errorLine2=" ~~~~~~~~~~~">
+ <location
+ file="src/main/java/androidx/appcompat/graphics/drawable/DrawableContainerCompat.java"/>
+ </issue>
+
+ <issue
+ id="UnknownNullness"
+ message="Unknown nullability; explicitly declare as `@Nullable` or `@NonNull` to improve Kotlin interoperability; see https://developer.android.com/kotlin/interop#nullability_annotations"
+ errorLine1=" public void setTintList(ColorStateList tint) {"
+ errorLine2=" ~~~~~~~~~~~~~~">
+ <location
+ file="src/main/java/androidx/appcompat/graphics/drawable/DrawableContainerCompat.java"/>
+ </issue>
+
+ <issue
+ id="UnknownNullness"
+ message="Unknown nullability; explicitly declare as `@Nullable` or `@NonNull` to improve Kotlin interoperability; see https://developer.android.com/kotlin/interop#nullability_annotations"
+ errorLine1=" protected void onBoundsChange(Rect bounds) {"
+ errorLine2=" ~~~~">
+ <location
+ file="src/main/java/androidx/appcompat/graphics/drawable/DrawableContainerCompat.java"/>
+ </issue>
+
+ <issue
+ id="UnknownNullness"
+ message="Unknown nullability; explicitly declare as `@Nullable` or `@NonNull` to improve Kotlin interoperability; see https://developer.android.com/kotlin/interop#nullability_annotations"
+ errorLine1=" public final ConstantState getConstantState() {"
+ errorLine2=" ~~~~~~~~~~~~~">
+ <location
+ file="src/main/java/androidx/appcompat/graphics/drawable/DrawableContainerCompat.java"/>
+ </issue>
+
+ <issue
+ id="UnknownNullness"
+ message="Unknown nullability; explicitly declare as `@Nullable` or `@NonNull` to improve Kotlin interoperability; see https://developer.android.com/kotlin/interop#nullability_annotations"
+ errorLine1=" public Drawable mutate() {"
+ errorLine2=" ~~~~~~~~">
+ <location
+ file="src/main/java/androidx/appcompat/graphics/drawable/DrawableContainerCompat.java"/>
+ </issue>
+
+ <issue
+ id="UnknownNullness"
+ message="Unknown nullability; explicitly declare as `@Nullable` or `@NonNull` to improve Kotlin interoperability; see https://developer.android.com/kotlin/interop#nullability_annotations"
errorLine1=" public static PorterDuff.Mode parseTintMode(int value, PorterDuff.Mode defaultMode) {"
errorLine2=" ~~~~~~~~~~~~~~~">
<location
@@ -142,10 +187,10 @@
<issue
id="UnknownNullness"
message="Unknown nullability; explicitly declare as `@Nullable` or `@NonNull` to improve Kotlin interoperability; see https://developer.android.com/kotlin/interop#nullability_annotations"
- errorLine1=" public DrawableWrapper(Drawable drawable) {"
- errorLine2=" ~~~~~~~~">
+ errorLine1=" public DrawableWrapperCompat(Drawable drawable) {"
+ errorLine2=" ~~~~~~~~">
<location
- file="src/main/java/androidx/appcompat/graphics/drawable/DrawableWrapper.java"/>
+ file="src/main/java/androidx/appcompat/graphics/drawable/DrawableWrapperCompat.java"/>
</issue>
<issue
@@ -154,7 +199,7 @@
errorLine1=" public void draw(Canvas canvas) {"
errorLine2=" ~~~~~~">
<location
- file="src/main/java/androidx/appcompat/graphics/drawable/DrawableWrapper.java"/>
+ file="src/main/java/androidx/appcompat/graphics/drawable/DrawableWrapperCompat.java"/>
</issue>
<issue
@@ -163,7 +208,7 @@
errorLine1=" protected void onBoundsChange(Rect bounds) {"
errorLine2=" ~~~~">
<location
- file="src/main/java/androidx/appcompat/graphics/drawable/DrawableWrapper.java"/>
+ file="src/main/java/androidx/appcompat/graphics/drawable/DrawableWrapperCompat.java"/>
</issue>
<issue
@@ -172,7 +217,7 @@
errorLine1=" public void setColorFilter(ColorFilter cf) {"
errorLine2=" ~~~~~~~~~~~">
<location
- file="src/main/java/androidx/appcompat/graphics/drawable/DrawableWrapper.java"/>
+ file="src/main/java/androidx/appcompat/graphics/drawable/DrawableWrapperCompat.java"/>
</issue>
<issue
@@ -181,7 +226,7 @@
errorLine1=" public boolean setState(final int[] stateSet) {"
errorLine2=" ~~~~~">
<location
- file="src/main/java/androidx/appcompat/graphics/drawable/DrawableWrapper.java"/>
+ file="src/main/java/androidx/appcompat/graphics/drawable/DrawableWrapperCompat.java"/>
</issue>
<issue
@@ -190,7 +235,7 @@
errorLine1=" public int[] getState() {"
errorLine2=" ~~~~~">
<location
- file="src/main/java/androidx/appcompat/graphics/drawable/DrawableWrapper.java"/>
+ file="src/main/java/androidx/appcompat/graphics/drawable/DrawableWrapperCompat.java"/>
</issue>
<issue
@@ -199,7 +244,7 @@
errorLine1=" public Drawable getCurrent() {"
errorLine2=" ~~~~~~~~">
<location
- file="src/main/java/androidx/appcompat/graphics/drawable/DrawableWrapper.java"/>
+ file="src/main/java/androidx/appcompat/graphics/drawable/DrawableWrapperCompat.java"/>
</issue>
<issue
@@ -208,7 +253,7 @@
errorLine1=" public Region getTransparentRegion() {"
errorLine2=" ~~~~~~">
<location
- file="src/main/java/androidx/appcompat/graphics/drawable/DrawableWrapper.java"/>
+ file="src/main/java/androidx/appcompat/graphics/drawable/DrawableWrapperCompat.java"/>
</issue>
<issue
@@ -217,7 +262,7 @@
errorLine1=" public boolean getPadding(Rect padding) {"
errorLine2=" ~~~~">
<location
- file="src/main/java/androidx/appcompat/graphics/drawable/DrawableWrapper.java"/>
+ file="src/main/java/androidx/appcompat/graphics/drawable/DrawableWrapperCompat.java"/>
</issue>
<issue
@@ -226,7 +271,7 @@
errorLine1=" public void invalidateDrawable(Drawable who) {"
errorLine2=" ~~~~~~~~">
<location
- file="src/main/java/androidx/appcompat/graphics/drawable/DrawableWrapper.java"/>
+ file="src/main/java/androidx/appcompat/graphics/drawable/DrawableWrapperCompat.java"/>
</issue>
<issue
@@ -235,7 +280,7 @@
errorLine1=" public void scheduleDrawable(Drawable who, Runnable what, long when) {"
errorLine2=" ~~~~~~~~">
<location
- file="src/main/java/androidx/appcompat/graphics/drawable/DrawableWrapper.java"/>
+ file="src/main/java/androidx/appcompat/graphics/drawable/DrawableWrapperCompat.java"/>
</issue>
<issue
@@ -244,7 +289,7 @@
errorLine1=" public void scheduleDrawable(Drawable who, Runnable what, long when) {"
errorLine2=" ~~~~~~~~">
<location
- file="src/main/java/androidx/appcompat/graphics/drawable/DrawableWrapper.java"/>
+ file="src/main/java/androidx/appcompat/graphics/drawable/DrawableWrapperCompat.java"/>
</issue>
<issue
@@ -253,7 +298,7 @@
errorLine1=" public void unscheduleDrawable(Drawable who, Runnable what) {"
errorLine2=" ~~~~~~~~">
<location
- file="src/main/java/androidx/appcompat/graphics/drawable/DrawableWrapper.java"/>
+ file="src/main/java/androidx/appcompat/graphics/drawable/DrawableWrapperCompat.java"/>
</issue>
<issue
@@ -262,7 +307,7 @@
errorLine1=" public void unscheduleDrawable(Drawable who, Runnable what) {"
errorLine2=" ~~~~~~~~">
<location
- file="src/main/java/androidx/appcompat/graphics/drawable/DrawableWrapper.java"/>
+ file="src/main/java/androidx/appcompat/graphics/drawable/DrawableWrapperCompat.java"/>
</issue>
<issue
@@ -271,7 +316,7 @@
errorLine1=" public void setTintList(ColorStateList tint) {"
errorLine2=" ~~~~~~~~~~~~~~">
<location
- file="src/main/java/androidx/appcompat/graphics/drawable/DrawableWrapper.java"/>
+ file="src/main/java/androidx/appcompat/graphics/drawable/DrawableWrapperCompat.java"/>
</issue>
<issue
@@ -280,25 +325,7 @@
errorLine1=" public void setTintMode(PorterDuff.Mode tintMode) {"
errorLine2=" ~~~~~~~~~~~~~~~">
<location
- file="src/main/java/androidx/appcompat/graphics/drawable/DrawableWrapper.java"/>
- </issue>
-
- <issue
- id="UnknownNullness"
- message="Unknown nullability; explicitly declare as `@Nullable` or `@NonNull` to improve Kotlin interoperability; see https://developer.android.com/kotlin/interop#nullability_annotations"
- errorLine1=" public Drawable getWrappedDrawable() {"
- errorLine2=" ~~~~~~~~">
- <location
- file="src/main/java/androidx/appcompat/graphics/drawable/DrawableWrapper.java"/>
- </issue>
-
- <issue
- id="UnknownNullness"
- message="Unknown nullability; explicitly declare as `@Nullable` or `@NonNull` to improve Kotlin interoperability; see https://developer.android.com/kotlin/interop#nullability_annotations"
- errorLine1=" public void setWrappedDrawable(Drawable drawable) {"
- errorLine2=" ~~~~~~~~">
- <location
- file="src/main/java/androidx/appcompat/graphics/drawable/DrawableWrapper.java"/>
+ file="src/main/java/androidx/appcompat/graphics/drawable/DrawableWrapperCompat.java"/>
</issue>
<issue
@@ -349,6 +376,24 @@
<issue
id="UnknownNullness"
message="Unknown nullability; explicitly declare as `@Nullable` or `@NonNull` to improve Kotlin interoperability; see https://developer.android.com/kotlin/interop#nullability_annotations"
+ errorLine1=" public void addState(int[] stateSet, Drawable drawable) {"
+ errorLine2=" ~~~~~">
+ <location
+ file="src/main/java/androidx/appcompat/graphics/drawable/StateListDrawableCompat.java"/>
+ </issue>
+
+ <issue
+ id="UnknownNullness"
+ message="Unknown nullability; explicitly declare as `@Nullable` or `@NonNull` to improve Kotlin interoperability; see https://developer.android.com/kotlin/interop#nullability_annotations"
+ errorLine1=" public void addState(int[] stateSet, Drawable drawable) {"
+ errorLine2=" ~~~~~~~~">
+ <location
+ file="src/main/java/androidx/appcompat/graphics/drawable/StateListDrawableCompat.java"/>
+ </issue>
+
+ <issue
+ id="UnknownNullness"
+ message="Unknown nullability; explicitly declare as `@Nullable` or `@NonNull` to improve Kotlin interoperability; see https://developer.android.com/kotlin/interop#nullability_annotations"
errorLine1=" public static Context wrap(@NonNull final Context context) {"
errorLine2=" ~~~~~~~">
<location
diff --git a/appcompat/appcompat-resources/src/androidTest/java/androidx/appcompat/graphics/drawable/DrawableContainerTest.kt b/appcompat/appcompat-resources/src/androidTest/java/androidx/appcompat/graphics/drawable/DrawableContainerCompatTest.kt
similarity index 85%
rename from appcompat/appcompat-resources/src/androidTest/java/androidx/appcompat/graphics/drawable/DrawableContainerTest.kt
rename to appcompat/appcompat-resources/src/androidTest/java/androidx/appcompat/graphics/drawable/DrawableContainerCompatTest.kt
index 8d924de..a8de789 100644
--- a/appcompat/appcompat-resources/src/androidTest/java/androidx/appcompat/graphics/drawable/DrawableContainerTest.kt
+++ b/appcompat/appcompat-resources/src/androidTest/java/androidx/appcompat/graphics/drawable/DrawableContainerCompatTest.kt
@@ -27,7 +27,7 @@
@RunWith(AndroidJUnit4::class)
@SmallTest
-class DrawableContainerTest {
+class DrawableContainerCompatTest {
/**
* Regression test for b/171913944 where DrawableContainer fails to copy when there are no
* children in the constant state.
@@ -48,20 +48,20 @@
assertTrue(container.calledSetTintList)
}
- internal class MyDrawableContainerState : DrawableContainer.DrawableContainerState {
+ internal class MyDrawableContainerState : DrawableContainerCompat.DrawableContainerState {
constructor() : super(null, null, null)
- constructor(orig: DrawableContainer.DrawableContainerState?) : super(orig, null, null)
+ constructor(orig: DrawableContainerCompat.DrawableContainerState?) : super(orig, null, null)
init {
addChild(ColorDrawable(Color.WHITE))
}
override fun newDrawable(): Drawable {
- return DrawableContainer()
+ return DrawableContainerCompat()
}
}
- internal class MyDrawableContainer : DrawableContainer() {
+ internal class MyDrawableContainer : DrawableContainerCompat() {
var calledSetTintList = false
init {
diff --git a/appcompat/appcompat-resources/src/main/java/androidx/appcompat/graphics/drawable/AnimatedStateListDrawableCompat.java b/appcompat/appcompat-resources/src/main/java/androidx/appcompat/graphics/drawable/AnimatedStateListDrawableCompat.java
index 812be2a..02e7743 100644
--- a/appcompat/appcompat-resources/src/main/java/androidx/appcompat/graphics/drawable/AnimatedStateListDrawableCompat.java
+++ b/appcompat/appcompat-resources/src/main/java/androidx/appcompat/graphics/drawable/AnimatedStateListDrawableCompat.java
@@ -88,7 +88,7 @@
* {@link android.R.attr#state_last}
* {@link android.R.attr#state_pressed}
*/
-public class AnimatedStateListDrawableCompat extends StateListDrawable
+public class AnimatedStateListDrawableCompat extends StateListDrawableCompat
implements TintAwareDrawable {
private static final String LOGTAG = AnimatedStateListDrawableCompat.class.getSimpleName();
private static final String ELEMENT_TRANSITION = "transition";
diff --git a/appcompat/appcompat-resources/src/main/java/androidx/appcompat/graphics/drawable/DrawableContainer.java b/appcompat/appcompat-resources/src/main/java/androidx/appcompat/graphics/drawable/DrawableContainerCompat.java
similarity index 98%
rename from appcompat/appcompat-resources/src/main/java/androidx/appcompat/graphics/drawable/DrawableContainer.java
rename to appcompat/appcompat-resources/src/main/java/androidx/appcompat/graphics/drawable/DrawableContainerCompat.java
index e688f37..d9730ce 100644
--- a/appcompat/appcompat-resources/src/main/java/androidx/appcompat/graphics/drawable/DrawableContainer.java
+++ b/appcompat/appcompat-resources/src/main/java/androidx/appcompat/graphics/drawable/DrawableContainerCompat.java
@@ -18,8 +18,6 @@
import static android.os.Build.VERSION_CODES.LOLLIPOP;
-import static androidx.annotation.RestrictTo.Scope.LIBRARY_GROUP_PREFIX;
-
import android.content.res.ColorStateList;
import android.content.res.Resources;
import android.content.res.Resources.Theme;
@@ -39,22 +37,17 @@
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.annotation.RequiresApi;
-import androidx.annotation.RestrictTo;
import androidx.core.graphics.drawable.DrawableCompat;
import androidx.core.view.ViewCompat;
/**
* A helper class that contains several {@link Drawable}s and selects which one to use.
- *
+ * <p>
* Adapted from platform class, altered with API level checks as necessary.
- *
- * @hide
*/
-@SuppressWarnings("RedundantSuppression") // Incorrect warning, see b/179893144 for details.
-@RestrictTo(LIBRARY_GROUP_PREFIX)
-class DrawableContainer extends Drawable implements Drawable.Callback {
+public class DrawableContainerCompat extends Drawable implements Drawable.Callback {
private static final boolean DEBUG = false;
- private static final String TAG = "DrawableContainer";
+ private static final String TAG = "DrawableContainerCompat";
/**
* To be proper, we should have a getter for dither (and alpha, etc.)
* so that proxy classes like this can save/restore their delegates'
@@ -648,7 +641,7 @@
* release.
*/
abstract static class DrawableContainerState extends ConstantState {
- final DrawableContainer mOwner;
+ final DrawableContainerCompat mOwner;
Resources mSourceRes;
int mDensity;
int mChangingConfigurations;
@@ -684,7 +677,7 @@
boolean mHasTintList;
boolean mHasTintMode;
- DrawableContainerState(DrawableContainerState orig, DrawableContainer owner,
+ DrawableContainerState(DrawableContainerState orig, DrawableContainerCompat owner,
Resources res) {
mOwner = owner;
mSourceRes = res != null ? res : (orig != null ? orig.mSourceRes : null);
diff --git a/appcompat/appcompat-resources/src/main/java/androidx/appcompat/graphics/drawable/DrawableWrapper.java b/appcompat/appcompat-resources/src/main/java/androidx/appcompat/graphics/drawable/DrawableWrapperCompat.java
similarity index 89%
rename from appcompat/appcompat-resources/src/main/java/androidx/appcompat/graphics/drawable/DrawableWrapper.java
rename to appcompat/appcompat-resources/src/main/java/androidx/appcompat/graphics/drawable/DrawableWrapperCompat.java
index 2c1d49d..f2b04b1 100644
--- a/appcompat/appcompat-resources/src/main/java/androidx/appcompat/graphics/drawable/DrawableWrapper.java
+++ b/appcompat/appcompat-resources/src/main/java/androidx/appcompat/graphics/drawable/DrawableWrapperCompat.java
@@ -16,8 +16,6 @@
package androidx.appcompat.graphics.drawable;
-import static androidx.annotation.RestrictTo.Scope.LIBRARY_GROUP_PREFIX;
-
import android.content.res.ColorStateList;
import android.graphics.Canvas;
import android.graphics.ColorFilter;
@@ -27,7 +25,7 @@
import android.graphics.drawable.Drawable;
import android.view.View;
-import androidx.annotation.RestrictTo;
+import androidx.annotation.Nullable;
import androidx.core.graphics.drawable.DrawableCompat;
/**
@@ -35,16 +33,18 @@
* <p>
* The wrapped {@link Drawable} <em>must</em> be fully released from any {@link View}
* before wrapping, otherwise internal {@link Callback} may be dropped.
- *
- * @hide
+ * <p>
+ * Adapted from platform class, altered with API level checks as necessary.
*/
-@RestrictTo(LIBRARY_GROUP_PREFIX)
-public class DrawableWrapper extends Drawable implements Drawable.Callback {
+public class DrawableWrapperCompat extends Drawable implements Drawable.Callback {
private Drawable mDrawable;
- public DrawableWrapper(Drawable drawable) {
- setWrappedDrawable(drawable);
+ /**
+ * Creates a new wrapper around the specified drawable.
+ */
+ public DrawableWrapperCompat(Drawable drawable) {
+ setDrawable(drawable);
}
@Override
@@ -218,11 +218,20 @@
DrawableCompat.setHotspotBounds(mDrawable, left, top, right, bottom);
}
- public Drawable getWrappedDrawable() {
+ /**
+ * @return the wrapped drawable
+ */
+ @Nullable
+ public Drawable getDrawable() {
return mDrawable;
}
- public void setWrappedDrawable(Drawable drawable) {
+ /**
+ * Sets the wrapped drawable.
+ *
+ * @param drawable the wrapped drawable
+ */
+ public void setDrawable(@Nullable Drawable drawable) {
if (mDrawable != null) {
mDrawable.setCallback(null);
}
diff --git a/appcompat/appcompat-resources/src/main/java/androidx/appcompat/graphics/drawable/StateListDrawable.java b/appcompat/appcompat-resources/src/main/java/androidx/appcompat/graphics/drawable/StateListDrawableCompat.java
similarity index 92%
rename from appcompat/appcompat-resources/src/main/java/androidx/appcompat/graphics/drawable/StateListDrawable.java
rename to appcompat/appcompat-resources/src/main/java/androidx/appcompat/graphics/drawable/StateListDrawableCompat.java
index 506a1ce..7e33bca 100644
--- a/appcompat/appcompat-resources/src/main/java/androidx/appcompat/graphics/drawable/StateListDrawable.java
+++ b/appcompat/appcompat-resources/src/main/java/androidx/appcompat/graphics/drawable/StateListDrawableCompat.java
@@ -19,10 +19,8 @@
import static android.os.Build.VERSION.SDK_INT;
import static android.os.Build.VERSION_CODES.LOLLIPOP;
-import static androidx.annotation.RestrictTo.Scope.LIBRARY_GROUP_PREFIX;
import static androidx.core.content.res.TypedArrayUtils.obtainAttributes;
-import android.annotation.SuppressLint;
import android.content.Context;
import android.content.res.Resources;
import android.content.res.Resources.Theme;
@@ -34,7 +32,6 @@
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.annotation.RequiresApi;
-import androidx.annotation.RestrictTo;
import androidx.appcompat.resources.Compatibility;
import androidx.appcompat.resources.R;
import androidx.appcompat.widget.ResourceManagerInternal;
@@ -47,13 +44,12 @@
/**
* Lets you assign a number of graphic images to a single Drawable and swap out the visible item by
- * a string
- * ID value.
- *
- * <p>It can be defined in an XML file with the <code><selector></code> element.
+ * a string ID value.
+ * <p>
+ * It can be defined in an XML file with the <code><selector></code> element.
* Each state Drawable is defined in a nested <code><item></code> element. For more
- * information, see the guide to <a
- * href="{@docRoot}guide/topics/resources/drawable-resource.html">Drawable Resources</a>.</p>
+ * information, see the guide to
+ * <a href="{@docRoot}guide/topics/resources/drawable-resource.html">Drawable Resources</a>.
*
* {@link android.R.attr#visible}
* {@link android.R.attr#variablePadding}
@@ -71,21 +67,20 @@
* {@link android.R.attr#state_middle}
* {@link android.R.attr#state_last}
* {@link android.R.attr#state_pressed}
- *
+ * <p>
* Adapted from platform class; altered with API level checks as necessary & uses
- * {@link ResourceManagerInternal} for <code>Drawable</code> inflation.
- *
- * @hide
+ * {@code ResourceManagerInternal} for <code>Drawable</code> inflation.
*/
-@RestrictTo(LIBRARY_GROUP_PREFIX)
-@SuppressLint("RestrictedAPI") // Temporary until we have correct restriction scopes for 1.0
-class StateListDrawable extends DrawableContainer {
- private static final String TAG = "StateListDrawable";
+public class StateListDrawableCompat extends DrawableContainerCompat {
+ private static final String TAG = "StateListDrawableCompat";
private static final boolean DEBUG = false;
private StateListState mStateListState;
private boolean mMutated;
- StateListDrawable() {
+ /**
+ * Creates an empty state list drawable.
+ */
+ public StateListDrawableCompat() {
this(null, null);
}
@@ -329,7 +324,7 @@
static class StateListState extends DrawableContainerState {
int[][] mStateSets;
- StateListState(StateListState orig, StateListDrawable owner, Resources res) {
+ StateListState(StateListState orig, StateListDrawableCompat owner, Resources res) {
super(orig, owner, res);
if (orig != null) {
// Perform a shallow copy and rely on mutate() to deep-copy.
@@ -368,13 +363,13 @@
@NonNull
@Override
public Drawable newDrawable() {
- return new StateListDrawable(this, null);
+ return new StateListDrawableCompat(this, null);
}
@NonNull
@Override
public Drawable newDrawable(Resources res) {
- return new StateListDrawable(this, res);
+ return new StateListDrawableCompat(this, res);
}
@Override
@@ -401,7 +396,7 @@
}
}
- StateListDrawable(StateListState state, Resources res) {
+ StateListDrawableCompat(StateListState state, Resources res) {
// Every state list drawable has its own constant state.
final StateListState newState = new StateListState(state, this, res);
setConstantState(newState);
@@ -412,7 +407,7 @@
* This constructor exists so subclasses can avoid calling the default
* constructor and setting up a StateListDrawable-specific constant state.
*/
- StateListDrawable(@Nullable StateListState state) {
+ StateListDrawableCompat(@Nullable StateListState state) {
if (state != null) {
setConstantState(state);
}
diff --git a/appcompat/appcompat-resources/src/main/java/androidx/appcompat/widget/DrawableUtils.java b/appcompat/appcompat-resources/src/main/java/androidx/appcompat/widget/DrawableUtils.java
index 30bac6d..360cc38 100644
--- a/appcompat/appcompat-resources/src/main/java/androidx/appcompat/widget/DrawableUtils.java
+++ b/appcompat/appcompat-resources/src/main/java/androidx/appcompat/widget/DrawableUtils.java
@@ -35,7 +35,7 @@
import androidx.annotation.NonNull;
import androidx.annotation.RequiresApi;
import androidx.annotation.RestrictTo;
-import androidx.appcompat.graphics.drawable.DrawableWrapper;
+import androidx.appcompat.graphics.drawable.DrawableWrapperCompat;
import androidx.core.graphics.drawable.DrawableCompat;
import androidx.core.graphics.drawable.WrappedDrawable;
@@ -133,8 +133,8 @@
}
} else if (drawable instanceof WrappedDrawable) {
return canSafelyMutateDrawable(((WrappedDrawable) drawable).getWrappedDrawable());
- } else if (drawable instanceof DrawableWrapper) {
- return canSafelyMutateDrawable(((DrawableWrapper) drawable).getWrappedDrawable());
+ } else if (drawable instanceof DrawableWrapperCompat) {
+ return canSafelyMutateDrawable(((DrawableWrapperCompat) drawable).getDrawable());
} else if (drawable instanceof ScaleDrawable) {
return canSafelyMutateDrawable(((ScaleDrawable) drawable).getDrawable());
}
diff --git a/appcompat/appcompat/src/main/java/androidx/appcompat/widget/DropDownListView.java b/appcompat/appcompat/src/main/java/androidx/appcompat/widget/DropDownListView.java
index 561672f..7575f3c 100644
--- a/appcompat/appcompat/src/main/java/androidx/appcompat/widget/DropDownListView.java
+++ b/appcompat/appcompat/src/main/java/androidx/appcompat/widget/DropDownListView.java
@@ -37,7 +37,7 @@
import androidx.annotation.OptIn;
import androidx.annotation.RequiresApi;
import androidx.appcompat.R;
-import androidx.appcompat.graphics.drawable.DrawableWrapper;
+import androidx.appcompat.graphics.drawable.DrawableWrapperCompat;
import androidx.core.graphics.drawable.DrawableCompat;
import androidx.core.os.BuildCompat;
import androidx.core.view.ViewPropertyAnimatorCompat;
@@ -392,7 +392,7 @@
}
}
- private static class GateKeeperDrawable extends DrawableWrapper {
+ private static class GateKeeperDrawable extends DrawableWrapperCompat {
private boolean mEnabled;
GateKeeperDrawable(Drawable drawable) {