Update local state when creating LayerDrawable from constant state
Also clears DrawableContainer's futures list when it's no longer needed, correctly sets deep copy of state set in StateListDrawable, makes some private methods into package-protected to avoid thunk, and propagates state to StateListDrawable's super class so that getState() has correct information. Bug: 21840003 Change-Id: I0d4232807f280d663c03b4a80e4aab8626806440
This commit is contained in:
@@ -730,7 +730,7 @@ public class DrawableContainer extends Drawable implements Drawable.Callback {
|
||||
if (origDf != null) {
|
||||
mDrawableFutures = origDf.clone();
|
||||
} else {
|
||||
mDrawableFutures = new SparseArray<ConstantStateFuture>(mNumChildren);
|
||||
mDrawableFutures = new SparseArray<>(mNumChildren);
|
||||
}
|
||||
|
||||
// Create futures for drawables with constant states. If a
|
||||
@@ -823,6 +823,9 @@ public class DrawableContainer extends Drawable implements Drawable.Callback {
|
||||
final Drawable prepared = mDrawableFutures.valueAt(keyIndex).get(this);
|
||||
mDrawables[index] = prepared;
|
||||
mDrawableFutures.removeAt(keyIndex);
|
||||
if (mDrawableFutures.size() == 0) {
|
||||
mDrawableFutures = null;
|
||||
}
|
||||
return prepared;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user