am 62b780e8: Avoid creating futures for drawables with no constant state

* commit '62b780e85ff2fcefd4324c3bfbf49b14963cf58b':
  Avoid creating futures for drawables with no constant state
This commit is contained in:
Alan Viverette
2014-12-10 21:59:32 +00:00
committed by Android Git Automerger
3 changed files with 12 additions and 4 deletions

View File

@@ -56,6 +56,7 @@
<dimen name="action_bar_overflow_padding_start_material">6dp</dimen>
<!-- Padding to add to the end of the overflow action button. -->
<dimen name="action_bar_overflow_padding_end_material">10dp</dimen>
<dimen name="action_bar_elevation_material">4dp</dimen>
<dimen name="action_button_min_width_overflow_material">36dp</dimen>
<dimen name="action_button_min_width_material">48dp</dimen>
@@ -87,9 +88,9 @@
<dimen name="floating_window_margin_bottom">32dp</dimen>
<!-- Elevation when button is pressed -->
<dimen name="button_elevation_material">4dp</dimen>
<dimen name="button_elevation_material">2dp</dimen>
<!-- Z translation to apply when button is pressed -->
<dimen name="button_pressed_z_material">2dp</dimen>
<dimen name="button_pressed_z_material">4dp</dimen>
<!-- Default insets (outer padding) around buttons -->
<dimen name="button_inset_vertical_material">6dp</dimen>
<dimen name="button_inset_horizontal_material">@dimen/control_inset_material</dimen>

View File

@@ -917,7 +917,7 @@ please see styles_device_defaults.xml.
<item name="gravity">center_vertical</item>
<item name="contentInsetStart">@dimen/action_bar_content_inset_material</item>
<item name="contentInsetEnd">@dimen/action_bar_content_inset_material</item>
<item name="elevation">8dp</item>
<item name="elevation">@dimen/action_bar_elevation_material</item>
<item name="popupTheme">?attr/actionBarPopupTheme</item>
</style>

View File

@@ -714,10 +714,17 @@ public class DrawableContainer extends Drawable implements Drawable.Callback {
mDrawableFutures = new SparseArray<ConstantStateFuture>(mNumChildren);
}
// Create futures for drawables with constant states. If a
// drawable doesn't have a constant state, then we can't clone
// it and we'll have to reference the original.
final int N = mNumChildren;
for (int i = 0; i < N; i++) {
if (origDr[i] != null) {
mDrawableFutures.put(i, new ConstantStateFuture(origDr[i]));
if (origDr[i].getConstantState() != null) {
mDrawableFutures.put(i, new ConstantStateFuture(origDr[i]));
} else {
mDrawables[i] = origDr[i];
}
}
}
} else {