* commit 'eecfb52ad56a3bb4f5bf2cdaeb83cfe8b33fa0c1': Update preload list, clean up drawable theming
This commit is contained in:
@@ -17,7 +17,8 @@
|
|||||||
android:height="76dp"
|
android:height="76dp"
|
||||||
android:width="76dp"
|
android:width="76dp"
|
||||||
android:viewportHeight="48"
|
android:viewportHeight="48"
|
||||||
android:viewportWidth="48" >
|
android:viewportWidth="48"
|
||||||
|
android:tint="?attr/colorControlActivated">
|
||||||
|
|
||||||
<group
|
<group
|
||||||
android:name="root"
|
android:name="root"
|
||||||
@@ -27,7 +28,7 @@
|
|||||||
android:name="progressBar"
|
android:name="progressBar"
|
||||||
android:fillColor="#00000000"
|
android:fillColor="#00000000"
|
||||||
android:pathData="M0, 0 m 0, -19 a 19,19 0 1,1 0,38 a 19,19 0 1,1 0,-38"
|
android:pathData="M0, 0 m 0, -19 a 19,19 0 1,1 0,38 a 19,19 0 1,1 0,-38"
|
||||||
android:strokeColor="?attr/colorControlActivated"
|
android:strokeColor="@color/white"
|
||||||
android:strokeLineCap="square"
|
android:strokeLineCap="square"
|
||||||
android:strokeLineJoin="miter"
|
android:strokeLineJoin="miter"
|
||||||
android:strokeWidth="4"
|
android:strokeWidth="4"
|
||||||
|
|||||||
@@ -17,7 +17,8 @@
|
|||||||
android:height="48dp"
|
android:height="48dp"
|
||||||
android:width="48dp"
|
android:width="48dp"
|
||||||
android:viewportHeight="48"
|
android:viewportHeight="48"
|
||||||
android:viewportWidth="48" >
|
android:viewportWidth="48"
|
||||||
|
android:tint="?attr/colorControlActivated">
|
||||||
|
|
||||||
<group
|
<group
|
||||||
android:name="root"
|
android:name="root"
|
||||||
@@ -27,7 +28,7 @@
|
|||||||
android:name="progressBar"
|
android:name="progressBar"
|
||||||
android:fillColor="#00000000"
|
android:fillColor="#00000000"
|
||||||
android:pathData="M0, 0 m 0, -19 a 19,19 0 1,1 0,38 a 19,19 0 1,1 0,-38"
|
android:pathData="M0, 0 m 0, -19 a 19,19 0 1,1 0,38 a 19,19 0 1,1 0,-38"
|
||||||
android:strokeColor="?attr/colorControlActivated"
|
android:strokeColor="@color/white"
|
||||||
android:strokeLineCap="square"
|
android:strokeLineCap="square"
|
||||||
android:strokeLineJoin="miter"
|
android:strokeLineJoin="miter"
|
||||||
android:strokeWidth="4"
|
android:strokeWidth="4"
|
||||||
|
|||||||
@@ -17,7 +17,8 @@
|
|||||||
android:height="16dp"
|
android:height="16dp"
|
||||||
android:width="16dp"
|
android:width="16dp"
|
||||||
android:viewportHeight="48"
|
android:viewportHeight="48"
|
||||||
android:viewportWidth="48" >
|
android:viewportWidth="48"
|
||||||
|
android:tint="?attr/colorControlActivated">
|
||||||
|
|
||||||
<group
|
<group
|
||||||
android:name="root"
|
android:name="root"
|
||||||
@@ -27,7 +28,7 @@
|
|||||||
android:name="progressBar"
|
android:name="progressBar"
|
||||||
android:fillColor="#00000000"
|
android:fillColor="#00000000"
|
||||||
android:pathData="M0, 0 m 0, -19 a 19,19 0 1,1 0,38 a 19,19 0 1,1 0,-38"
|
android:pathData="M0, 0 m 0, -19 a 19,19 0 1,1 0,38 a 19,19 0 1,1 0,-38"
|
||||||
android:strokeColor="?attr/colorControlActivated"
|
android:strokeColor="@color/white"
|
||||||
android:strokeLineCap="square"
|
android:strokeLineCap="square"
|
||||||
android:strokeLineJoin="miter"
|
android:strokeLineJoin="miter"
|
||||||
android:strokeWidth="4"
|
android:strokeWidth="4"
|
||||||
|
|||||||
@@ -298,162 +298,75 @@
|
|||||||
<item>@drawable/quickcontact_badge_overlay_pressed_light</item>
|
<item>@drawable/quickcontact_badge_overlay_pressed_light</item>
|
||||||
|
|
||||||
<!-- Material assets -->
|
<!-- Material assets -->
|
||||||
<item>@drawable/ab_share_pack_mtrl_alpha</item>
|
<item>@drawable/ab_share_pack_material</item>
|
||||||
<item>@drawable/ab_solid_shadow_mtrl_alpha</item>
|
<item>@drawable/ab_solid_shadow_material</item>
|
||||||
<item>@drawable/btn_cab_done_mtrl_alpha</item>
|
<item>@drawable/activated_background_material</item>
|
||||||
<item>@drawable/btn_check_to_off_mtrl_000</item>
|
<item>@drawable/btn_borderless_material</item>
|
||||||
<item>@drawable/btn_check_to_off_mtrl_001</item>
|
<item>@drawable/btn_cab_done_material</item>
|
||||||
<item>@drawable/btn_check_to_off_mtrl_002</item>
|
<item>@drawable/btn_check_material_anim</item>
|
||||||
<item>@drawable/btn_check_to_off_mtrl_003</item>
|
<item>@drawable/btn_default_material</item>
|
||||||
<item>@drawable/btn_check_to_off_mtrl_004</item>
|
<item>@drawable/btn_radio_material_anim</item>
|
||||||
<item>@drawable/btn_check_to_off_mtrl_005</item>
|
<item>@drawable/btn_star_material</item>
|
||||||
<item>@drawable/btn_check_to_off_mtrl_006</item>
|
<item>@drawable/btn_toggle_material</item>
|
||||||
<item>@drawable/btn_check_to_off_mtrl_007</item>
|
<item>@drawable/cab_background_bottom_material</item>
|
||||||
<item>@drawable/btn_check_to_off_mtrl_008</item>
|
<item>@drawable/cab_background_top_material</item>
|
||||||
<item>@drawable/btn_check_to_off_mtrl_009</item>
|
<item>@drawable/dialog_background_material</item>
|
||||||
<item>@drawable/btn_check_to_off_mtrl_010</item>
|
<item>@drawable/dialog_background_shadow_material</item>
|
||||||
<item>@drawable/btn_check_to_off_mtrl_011</item>
|
<item>@drawable/edit_text_material</item>
|
||||||
<item>@drawable/btn_check_to_off_mtrl_012</item>
|
<item>@drawable/expander_group_material</item>
|
||||||
<item>@drawable/btn_check_to_off_mtrl_013</item>
|
<item>@drawable/fastscroll_label_left_material</item>
|
||||||
<item>@drawable/btn_check_to_off_mtrl_014</item>
|
<item>@drawable/fastscroll_label_right_material</item>
|
||||||
<item>@drawable/btn_check_to_off_mtrl_015</item>
|
<item>@drawable/fastscroll_thumb_material</item>
|
||||||
<item>@drawable/btn_check_to_on_mtrl_000</item>
|
<item>@drawable/fastscroll_track_material</item>
|
||||||
<item>@drawable/btn_check_to_on_mtrl_001</item>
|
|
||||||
<item>@drawable/btn_check_to_on_mtrl_002</item>
|
|
||||||
<item>@drawable/btn_check_to_on_mtrl_003</item>
|
|
||||||
<item>@drawable/btn_check_to_on_mtrl_004</item>
|
|
||||||
<item>@drawable/btn_check_to_on_mtrl_005</item>
|
|
||||||
<item>@drawable/btn_check_to_on_mtrl_006</item>
|
|
||||||
<item>@drawable/btn_check_to_on_mtrl_007</item>
|
|
||||||
<item>@drawable/btn_check_to_on_mtrl_008</item>
|
|
||||||
<item>@drawable/btn_check_to_on_mtrl_009</item>
|
|
||||||
<item>@drawable/btn_check_to_on_mtrl_010</item>
|
|
||||||
<item>@drawable/btn_check_to_on_mtrl_011</item>
|
|
||||||
<item>@drawable/btn_check_to_on_mtrl_012</item>
|
|
||||||
<item>@drawable/btn_check_to_on_mtrl_013</item>
|
|
||||||
<item>@drawable/btn_check_to_on_mtrl_014</item>
|
|
||||||
<item>@drawable/btn_check_to_on_mtrl_015</item>
|
|
||||||
<item>@drawable/btn_radio_to_off_mtrl_000</item>
|
|
||||||
<item>@drawable/btn_radio_to_off_mtrl_001</item>
|
|
||||||
<item>@drawable/btn_radio_to_off_mtrl_002</item>
|
|
||||||
<item>@drawable/btn_radio_to_off_mtrl_003</item>
|
|
||||||
<item>@drawable/btn_radio_to_off_mtrl_004</item>
|
|
||||||
<item>@drawable/btn_radio_to_off_mtrl_005</item>
|
|
||||||
<item>@drawable/btn_radio_to_off_mtrl_006</item>
|
|
||||||
<item>@drawable/btn_radio_to_off_mtrl_007</item>
|
|
||||||
<item>@drawable/btn_radio_to_off_mtrl_008</item>
|
|
||||||
<item>@drawable/btn_radio_to_off_mtrl_009</item>
|
|
||||||
<item>@drawable/btn_radio_to_off_mtrl_010</item>
|
|
||||||
<item>@drawable/btn_radio_to_off_mtrl_011</item>
|
|
||||||
<item>@drawable/btn_radio_to_off_mtrl_012</item>
|
|
||||||
<item>@drawable/btn_radio_to_off_mtrl_013</item>
|
|
||||||
<item>@drawable/btn_radio_to_off_mtrl_014</item>
|
|
||||||
<item>@drawable/btn_radio_to_off_mtrl_015</item>
|
|
||||||
<item>@drawable/btn_radio_to_on_mtrl_000</item>
|
|
||||||
<item>@drawable/btn_radio_to_on_mtrl_001</item>
|
|
||||||
<item>@drawable/btn_radio_to_on_mtrl_002</item>
|
|
||||||
<item>@drawable/btn_radio_to_on_mtrl_003</item>
|
|
||||||
<item>@drawable/btn_radio_to_on_mtrl_004</item>
|
|
||||||
<item>@drawable/btn_radio_to_on_mtrl_005</item>
|
|
||||||
<item>@drawable/btn_radio_to_on_mtrl_006</item>
|
|
||||||
<item>@drawable/btn_radio_to_on_mtrl_007</item>
|
|
||||||
<item>@drawable/btn_radio_to_on_mtrl_008</item>
|
|
||||||
<item>@drawable/btn_radio_to_on_mtrl_009</item>
|
|
||||||
<item>@drawable/btn_radio_to_on_mtrl_010</item>
|
|
||||||
<item>@drawable/btn_radio_to_on_mtrl_011</item>
|
|
||||||
<item>@drawable/btn_radio_to_on_mtrl_012</item>
|
|
||||||
<item>@drawable/btn_radio_to_on_mtrl_013</item>
|
|
||||||
<item>@drawable/btn_radio_to_on_mtrl_014</item>
|
|
||||||
<item>@drawable/btn_radio_to_on_mtrl_015</item>
|
|
||||||
<item>@drawable/btn_rating_star_off_mtrl_alpha</item>
|
|
||||||
<item>@drawable/btn_rating_star_on_mtrl_alpha</item>
|
|
||||||
<item>@drawable/btn_star_mtrl_alpha</item>
|
|
||||||
<item>@drawable/btn_switch_to_off_mtrl_00001</item>
|
|
||||||
<item>@drawable/btn_switch_to_off_mtrl_00002</item>
|
|
||||||
<item>@drawable/btn_switch_to_off_mtrl_00003</item>
|
|
||||||
<item>@drawable/btn_switch_to_off_mtrl_00004</item>
|
|
||||||
<item>@drawable/btn_switch_to_off_mtrl_00005</item>
|
|
||||||
<item>@drawable/btn_switch_to_off_mtrl_00006</item>
|
|
||||||
<item>@drawable/btn_switch_to_off_mtrl_00007</item>
|
|
||||||
<item>@drawable/btn_switch_to_off_mtrl_00008</item>
|
|
||||||
<item>@drawable/btn_switch_to_off_mtrl_00009</item>
|
|
||||||
<item>@drawable/btn_switch_to_off_mtrl_00010</item>
|
|
||||||
<item>@drawable/btn_switch_to_off_mtrl_00011</item>
|
|
||||||
<item>@drawable/btn_switch_to_off_mtrl_00012</item>
|
|
||||||
<item>@drawable/btn_switch_to_on_mtrl_00001</item>
|
|
||||||
<item>@drawable/btn_switch_to_on_mtrl_00002</item>
|
|
||||||
<item>@drawable/btn_switch_to_on_mtrl_00003</item>
|
|
||||||
<item>@drawable/btn_switch_to_on_mtrl_00004</item>
|
|
||||||
<item>@drawable/btn_switch_to_on_mtrl_00005</item>
|
|
||||||
<item>@drawable/btn_switch_to_on_mtrl_00006</item>
|
|
||||||
<item>@drawable/btn_switch_to_on_mtrl_00007</item>
|
|
||||||
<item>@drawable/btn_switch_to_on_mtrl_00008</item>
|
|
||||||
<item>@drawable/btn_switch_to_on_mtrl_00009</item>
|
|
||||||
<item>@drawable/btn_switch_to_on_mtrl_00010</item>
|
|
||||||
<item>@drawable/btn_switch_to_on_mtrl_00011</item>
|
|
||||||
<item>@drawable/btn_switch_to_on_mtrl_00012</item>
|
|
||||||
<item>@drawable/btn_toggle_indicator_mtrl_alpha</item>
|
|
||||||
<item>@drawable/expander_close_mtrl_alpha</item>
|
|
||||||
<item>@drawable/expander_open_mtrl_alpha</item>
|
|
||||||
<item>@drawable/fastscroll_thumb_mtrl_alpha</item>
|
|
||||||
<item>@drawable/fastscroll_track_mtrl_alpha</item>
|
|
||||||
<item>@drawable/ic_ab_back_material</item>
|
<item>@drawable/ic_ab_back_material</item>
|
||||||
<item>@drawable/ic_cab_done_mtrl_alpha</item>
|
<item>@drawable/ic_clear_material</item>
|
||||||
<item>@drawable/ic_clear_mtrl_alpha</item>
|
<item>@drawable/ic_commit_search_api_material</item>
|
||||||
<item>@drawable/ic_commit_search_api_mtrl_alpha</item>
|
|
||||||
<item>@drawable/ic_dialog_alert_material</item>
|
<item>@drawable/ic_dialog_alert_material</item>
|
||||||
<item>@drawable/ic_find_next_mtrl_alpha</item>
|
<item>@drawable/ic_find_next_material</item>
|
||||||
<item>@drawable/ic_find_previous_mtrl_alpha</item>
|
<item>@drawable/ic_find_previous_material</item>
|
||||||
<item>@drawable/ic_go_search_api_material</item>
|
<item>@drawable/ic_go_search_api_material</item>
|
||||||
<item>@drawable/ic_media_route_disabled_mtrl_alpha</item>
|
<item>@drawable/ic_media_route_connecting_material</item>
|
||||||
<item>@drawable/ic_media_route_off_mtrl_alpha</item>
|
<item>@drawable/ic_media_route_material</item>
|
||||||
<item>@drawable/ic_media_route_on_0_mtrl_alpha</item>
|
|
||||||
<item>@drawable/ic_media_route_on_1_mtrl_alpha</item>
|
|
||||||
<item>@drawable/ic_media_route_on_2_mtrl_alpha</item>
|
|
||||||
<item>@drawable/ic_media_route_on_mtrl_alpha</item>
|
|
||||||
<item>@drawable/ic_menu_copy_material</item>
|
<item>@drawable/ic_menu_copy_material</item>
|
||||||
<item>@drawable/ic_menu_cut_material</item>
|
<item>@drawable/ic_menu_cut_material</item>
|
||||||
<item>@drawable/ic_menu_find_mtrl_alpha</item>
|
<item>@drawable/ic_menu_find_material</item>
|
||||||
<item>@drawable/ic_menu_moreoverflow_material</item>
|
<item>@drawable/ic_menu_moreoverflow_material</item>
|
||||||
<item>@drawable/ic_menu_paste_material</item>
|
<item>@drawable/ic_menu_paste_material</item>
|
||||||
<item>@drawable/ic_menu_search_mtrl_alpha</item>
|
<item>@drawable/ic_menu_search_material</item>
|
||||||
<item>@drawable/ic_menu_selectall_material</item>
|
<item>@drawable/ic_menu_selectall_material</item>
|
||||||
<item>@drawable/ic_menu_share_material</item>
|
<item>@drawable/ic_menu_share_material</item>
|
||||||
<item>@drawable/ic_search_api_material</item>
|
<item>@drawable/ic_search_api_material</item>
|
||||||
<item>@drawable/ic_voice_search_api_material</item>
|
<item>@drawable/ic_voice_search_api_material</item>
|
||||||
<item>@drawable/list_divider_mtrl_alpha</item>
|
<item>@drawable/item_background_borderless_material</item>
|
||||||
<item>@drawable/list_section_divider_mtrl_alpha</item>
|
<item>@drawable/item_background_material</item>
|
||||||
<item>@drawable/popup_background_mtrl_mult</item>
|
<item>@drawable/list_divider_material</item>
|
||||||
<item>@drawable/progress_mtrl_alpha</item>
|
<item>@drawable/list_section_divider_material</item>
|
||||||
<item>@drawable/scrollbar_handle_mtrl_alpha</item>
|
<item>@drawable/notification_material_action_background</item>
|
||||||
<item>@drawable/scrubber_control_from_pressed_mtrl_000</item>
|
<item>@drawable/notification_material_media_action_background</item>
|
||||||
<item>@drawable/scrubber_control_from_pressed_mtrl_001</item>
|
<item>@drawable/popup_background_material</item>
|
||||||
<item>@drawable/scrubber_control_from_pressed_mtrl_002</item>
|
<item>@drawable/progress_horizontal_material</item>
|
||||||
<item>@drawable/scrubber_control_from_pressed_mtrl_003</item>
|
<item>@drawable/progress_indeterminate_horizontal_material</item>
|
||||||
<item>@drawable/scrubber_control_from_pressed_mtrl_004</item>
|
<item>@drawable/progress_large_material</item>
|
||||||
<item>@drawable/scrubber_control_from_pressed_mtrl_005</item>
|
<item>@drawable/progress_medium_material</item>
|
||||||
<item>@drawable/scrubber_control_off_pressed_mtrl_alpha</item>
|
<item>@drawable/progress_small_material</item>
|
||||||
<item>@drawable/scrubber_control_off_mtrl_alpha</item>
|
<item>@drawable/ratingbar_full_empty_material</item>
|
||||||
<item>@drawable/scrubber_control_on_pressed_mtrl_alpha</item>
|
<item>@drawable/ratingbar_full_filled_material</item>
|
||||||
<item>@drawable/scrubber_control_on_mtrl_alpha</item>
|
<item>@drawable/ratingbar_full_material</item>
|
||||||
<item>@drawable/scrubber_control_to_pressed_mtrl_000</item>
|
<item>@drawable/scrollbar_handle_material</item>
|
||||||
<item>@drawable/scrubber_control_to_pressed_mtrl_001</item>
|
<item>@drawable/scrubber_control_material_anim</item>
|
||||||
<item>@drawable/scrubber_control_to_pressed_mtrl_002</item>
|
<item>@drawable/scrubber_control_selector_material</item>
|
||||||
<item>@drawable/scrubber_control_to_pressed_mtrl_003</item>
|
<item>@drawable/scrubber_progress_horizontal_material</item>
|
||||||
<item>@drawable/scrubber_control_to_pressed_mtrl_004</item>
|
<item>@drawable/spinner_background_material</item>
|
||||||
<item>@drawable/scrubber_control_to_pressed_mtrl_005</item>
|
<item>@drawable/spinner_textfield_background_material</item>
|
||||||
<item>@drawable/scrubber_primary_mtrl_alpha</item>
|
<item>@drawable/switch_thumb_material_anim</item>
|
||||||
<item>@drawable/scrubber_track_mtrl_alpha</item>
|
<item>@drawable/switch_track_material</item>
|
||||||
<item>@drawable/spinner_mtrl_am_alpha</item>
|
<item>@drawable/tab_indicator_material</item>
|
||||||
<item>@drawable/switch_track_mtrl_alpha</item>
|
<item>@drawable/text_cursor_material</item>
|
||||||
<item>@drawable/text_cursor_mtrl_alpha</item>
|
<item>@drawable/textfield_search_material</item>
|
||||||
<item>@drawable/textfield_activated_mtrl_alpha</item>
|
<item>@drawable/text_select_handle_left_material</item>
|
||||||
<item>@drawable/textfield_default_mtrl_alpha</item>
|
<item>@drawable/text_select_handle_middle_material</item>
|
||||||
<item>@drawable/textfield_search_activated_mtrl_alpha</item>
|
<item>@drawable/text_select_handle_right_material</item>
|
||||||
<item>@drawable/textfield_search_default_mtrl_alpha</item>
|
<item>@drawable/ic_account_circle</item>
|
||||||
<item>@drawable/text_select_handle_left_mtrl_alpha</item>
|
|
||||||
<item>@drawable/text_select_handle_middle_mtrl_alpha</item>
|
|
||||||
<item>@drawable/text_select_handle_right_mtrl_alpha</item>
|
|
||||||
</array>
|
</array>
|
||||||
|
|
||||||
<!-- Do not translate. These are all of the color state list resources that should be
|
<!-- Do not translate. These are all of the color state list resources that should be
|
||||||
|
|||||||
@@ -313,6 +313,26 @@ public class AnimatedRotateDrawable extends Drawable implements Drawable.Callbac
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void applyTheme(Theme t) {
|
||||||
|
super.applyTheme(t);
|
||||||
|
|
||||||
|
final AnimatedRotateState state = mState;
|
||||||
|
if (state == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (state.mDrawable != null) {
|
||||||
|
state.mDrawable.applyTheme(t);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean canApplyTheme() {
|
||||||
|
final AnimatedRotateState state = mState;
|
||||||
|
return state != null && state.mDrawable != null && state.mDrawable.canApplyTheme();
|
||||||
|
}
|
||||||
|
|
||||||
public void setFramesCount(int framesCount) {
|
public void setFramesCount(int framesCount) {
|
||||||
mState.mFramesCount = framesCount;
|
mState.mFramesCount = framesCount;
|
||||||
mIncrement = 360.0f / mState.mFramesCount;
|
mIncrement = 360.0f / mState.mFramesCount;
|
||||||
|
|||||||
@@ -16,7 +16,6 @@ package android.graphics.drawable;
|
|||||||
|
|
||||||
import android.animation.Animator;
|
import android.animation.Animator;
|
||||||
import android.animation.AnimatorInflater;
|
import android.animation.AnimatorInflater;
|
||||||
import android.animation.ValueAnimator;
|
|
||||||
import android.annotation.NonNull;
|
import android.annotation.NonNull;
|
||||||
import android.content.res.ColorStateList;
|
import android.content.res.ColorStateList;
|
||||||
import android.content.res.Resources;
|
import android.content.res.Resources;
|
||||||
@@ -137,15 +136,11 @@ public class AnimatedVectorDrawable extends Drawable implements Animatable {
|
|||||||
private boolean mMutated;
|
private boolean mMutated;
|
||||||
|
|
||||||
public AnimatedVectorDrawable() {
|
public AnimatedVectorDrawable() {
|
||||||
mAnimatedVectorState = new AnimatedVectorDrawableState(null);
|
this(null, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
private AnimatedVectorDrawable(AnimatedVectorDrawableState state, Resources res,
|
private AnimatedVectorDrawable(AnimatedVectorDrawableState state, Resources res) {
|
||||||
Theme theme) {
|
mAnimatedVectorState = new AnimatedVectorDrawableState(state, mCallback, res);
|
||||||
mAnimatedVectorState = new AnimatedVectorDrawableState(state);
|
|
||||||
if (theme != null && canApplyTheme()) {
|
|
||||||
applyTheme(theme);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -290,7 +285,11 @@ public class AnimatedVectorDrawable extends Drawable implements Animatable {
|
|||||||
VectorDrawable vectorDrawable = (VectorDrawable) res.getDrawable(
|
VectorDrawable vectorDrawable = (VectorDrawable) res.getDrawable(
|
||||||
drawableRes, theme).mutate();
|
drawableRes, theme).mutate();
|
||||||
vectorDrawable.setAllowCaching(false);
|
vectorDrawable.setAllowCaching(false);
|
||||||
|
vectorDrawable.setCallback(mCallback);
|
||||||
pathErrorScale = vectorDrawable.getPixelSize();
|
pathErrorScale = vectorDrawable.getPixelSize();
|
||||||
|
if (mAnimatedVectorState.mVectorDrawable != null) {
|
||||||
|
mAnimatedVectorState.mVectorDrawable.setCallback(null);
|
||||||
|
}
|
||||||
mAnimatedVectorState.mVectorDrawable = vectorDrawable;
|
mAnimatedVectorState.mVectorDrawable = vectorDrawable;
|
||||||
}
|
}
|
||||||
a.recycle();
|
a.recycle();
|
||||||
@@ -338,14 +337,22 @@ public class AnimatedVectorDrawable extends Drawable implements Animatable {
|
|||||||
ArrayList<Animator> mAnimators;
|
ArrayList<Animator> mAnimators;
|
||||||
ArrayMap<Animator, String> mTargetNameMap;
|
ArrayMap<Animator, String> mTargetNameMap;
|
||||||
|
|
||||||
public AnimatedVectorDrawableState(AnimatedVectorDrawableState copy) {
|
public AnimatedVectorDrawableState(AnimatedVectorDrawableState copy,
|
||||||
|
Callback owner, Resources res) {
|
||||||
if (copy != null) {
|
if (copy != null) {
|
||||||
mChangingConfigurations = copy.mChangingConfigurations;
|
mChangingConfigurations = copy.mChangingConfigurations;
|
||||||
if (copy.mVectorDrawable != null) {
|
if (copy.mVectorDrawable != null) {
|
||||||
mVectorDrawable = (VectorDrawable) copy.mVectorDrawable.getConstantState().newDrawable();
|
final ConstantState cs = copy.mVectorDrawable.getConstantState();
|
||||||
mVectorDrawable.mutate();
|
if (res != null) {
|
||||||
mVectorDrawable.setAllowCaching(false);
|
mVectorDrawable = (VectorDrawable) cs.newDrawable(res);
|
||||||
|
} else {
|
||||||
|
mVectorDrawable = (VectorDrawable) cs.newDrawable();
|
||||||
|
}
|
||||||
|
mVectorDrawable = (VectorDrawable) mVectorDrawable.mutate();
|
||||||
|
mVectorDrawable.setCallback(owner);
|
||||||
|
mVectorDrawable.setLayoutDirection(copy.mVectorDrawable.getLayoutDirection());
|
||||||
mVectorDrawable.setBounds(copy.mVectorDrawable.getBounds());
|
mVectorDrawable.setBounds(copy.mVectorDrawable.getBounds());
|
||||||
|
mVectorDrawable.setAllowCaching(false);
|
||||||
}
|
}
|
||||||
if (copy.mAnimators != null) {
|
if (copy.mAnimators != null) {
|
||||||
final int numAnimators = copy.mAnimators.size();
|
final int numAnimators = copy.mAnimators.size();
|
||||||
@@ -368,17 +375,12 @@ public class AnimatedVectorDrawable extends Drawable implements Animatable {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Drawable newDrawable() {
|
public Drawable newDrawable() {
|
||||||
return new AnimatedVectorDrawable(this, null, null);
|
return new AnimatedVectorDrawable(this, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Drawable newDrawable(Resources res) {
|
public Drawable newDrawable(Resources res) {
|
||||||
return new AnimatedVectorDrawable(this, res, null);
|
return new AnimatedVectorDrawable(this, res);
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Drawable newDrawable(Resources res, Theme theme) {
|
|
||||||
return new AnimatedVectorDrawable(this, res, theme);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -482,4 +484,21 @@ public class AnimatedVectorDrawable extends Drawable implements Animatable {
|
|||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private final Callback mCallback = new Callback() {
|
||||||
|
@Override
|
||||||
|
public void invalidateDrawable(Drawable who) {
|
||||||
|
invalidateSelf();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void scheduleDrawable(Drawable who, Runnable what, long when) {
|
||||||
|
scheduleSelf(what, when);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void unscheduleDrawable(Drawable who, Runnable what) {
|
||||||
|
unscheduleSelf(what);
|
||||||
|
}
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -132,7 +132,7 @@ public class BitmapDrawable extends Drawable {
|
|||||||
*/
|
*/
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public BitmapDrawable(Bitmap bitmap) {
|
public BitmapDrawable(Bitmap bitmap) {
|
||||||
this(new BitmapState(bitmap), null, null);
|
this(new BitmapState(bitmap), null);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -140,7 +140,7 @@ public class BitmapDrawable extends Drawable {
|
|||||||
* the display metrics of the resources.
|
* the display metrics of the resources.
|
||||||
*/
|
*/
|
||||||
public BitmapDrawable(Resources res, Bitmap bitmap) {
|
public BitmapDrawable(Resources res, Bitmap bitmap) {
|
||||||
this(new BitmapState(bitmap), res, null);
|
this(new BitmapState(bitmap), res);
|
||||||
mBitmapState.mTargetDensity = mTargetDensity;
|
mBitmapState.mTargetDensity = mTargetDensity;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -151,7 +151,7 @@ public class BitmapDrawable extends Drawable {
|
|||||||
*/
|
*/
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public BitmapDrawable(String filepath) {
|
public BitmapDrawable(String filepath) {
|
||||||
this(new BitmapState(BitmapFactory.decodeFile(filepath)), null, null);
|
this(new BitmapState(BitmapFactory.decodeFile(filepath)), null);
|
||||||
if (mBitmapState.mBitmap == null) {
|
if (mBitmapState.mBitmap == null) {
|
||||||
android.util.Log.w("BitmapDrawable", "BitmapDrawable cannot decode " + filepath);
|
android.util.Log.w("BitmapDrawable", "BitmapDrawable cannot decode " + filepath);
|
||||||
}
|
}
|
||||||
@@ -162,7 +162,7 @@ public class BitmapDrawable extends Drawable {
|
|||||||
*/
|
*/
|
||||||
@SuppressWarnings("unused")
|
@SuppressWarnings("unused")
|
||||||
public BitmapDrawable(Resources res, String filepath) {
|
public BitmapDrawable(Resources res, String filepath) {
|
||||||
this(new BitmapState(BitmapFactory.decodeFile(filepath)), null, null);
|
this(new BitmapState(BitmapFactory.decodeFile(filepath)), null);
|
||||||
mBitmapState.mTargetDensity = mTargetDensity;
|
mBitmapState.mTargetDensity = mTargetDensity;
|
||||||
if (mBitmapState.mBitmap == null) {
|
if (mBitmapState.mBitmap == null) {
|
||||||
android.util.Log.w("BitmapDrawable", "BitmapDrawable cannot decode " + filepath);
|
android.util.Log.w("BitmapDrawable", "BitmapDrawable cannot decode " + filepath);
|
||||||
@@ -176,7 +176,7 @@ public class BitmapDrawable extends Drawable {
|
|||||||
*/
|
*/
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public BitmapDrawable(java.io.InputStream is) {
|
public BitmapDrawable(java.io.InputStream is) {
|
||||||
this(new BitmapState(BitmapFactory.decodeStream(is)), null, null);
|
this(new BitmapState(BitmapFactory.decodeStream(is)), null);
|
||||||
if (mBitmapState.mBitmap == null) {
|
if (mBitmapState.mBitmap == null) {
|
||||||
android.util.Log.w("BitmapDrawable", "BitmapDrawable cannot decode " + is);
|
android.util.Log.w("BitmapDrawable", "BitmapDrawable cannot decode " + is);
|
||||||
}
|
}
|
||||||
@@ -187,7 +187,7 @@ public class BitmapDrawable extends Drawable {
|
|||||||
*/
|
*/
|
||||||
@SuppressWarnings("unused")
|
@SuppressWarnings("unused")
|
||||||
public BitmapDrawable(Resources res, java.io.InputStream is) {
|
public BitmapDrawable(Resources res, java.io.InputStream is) {
|
||||||
this(new BitmapState(BitmapFactory.decodeStream(is)), null, null);
|
this(new BitmapState(BitmapFactory.decodeStream(is)), null);
|
||||||
mBitmapState.mTargetDensity = mTargetDensity;
|
mBitmapState.mTargetDensity = mTargetDensity;
|
||||||
if (mBitmapState.mBitmap == null) {
|
if (mBitmapState.mBitmap == null) {
|
||||||
android.util.Log.w("BitmapDrawable", "BitmapDrawable cannot decode " + is);
|
android.util.Log.w("BitmapDrawable", "BitmapDrawable cannot decode " + is);
|
||||||
@@ -919,17 +919,12 @@ public class BitmapDrawable extends Drawable {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Drawable newDrawable() {
|
public Drawable newDrawable() {
|
||||||
return new BitmapDrawable(this, null, null);
|
return new BitmapDrawable(this, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Drawable newDrawable(Resources res) {
|
public Drawable newDrawable(Resources res) {
|
||||||
return new BitmapDrawable(this, res, null);
|
return new BitmapDrawable(this, res);
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Drawable newDrawable(Resources res, Theme theme) {
|
|
||||||
return new BitmapDrawable(this, res, theme);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -942,16 +937,10 @@ public class BitmapDrawable extends Drawable {
|
|||||||
* The one constructor to rule them all. This is called by all public
|
* The one constructor to rule them all. This is called by all public
|
||||||
* constructors to set the state and initialize local properties.
|
* constructors to set the state and initialize local properties.
|
||||||
*/
|
*/
|
||||||
private BitmapDrawable(BitmapState state, Resources res, Theme theme) {
|
private BitmapDrawable(BitmapState state, Resources res) {
|
||||||
if (theme != null && state.canApplyTheme()) {
|
mBitmapState = state;
|
||||||
// If we need to apply a theme, implicitly mutate.
|
|
||||||
mBitmapState = new BitmapState(state);
|
|
||||||
applyTheme(theme);
|
|
||||||
} else {
|
|
||||||
mBitmapState = state;
|
|
||||||
}
|
|
||||||
|
|
||||||
initializeWithState(state, res);
|
initializeWithState(mBitmapState, res);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -114,6 +114,26 @@ public class ClipDrawable extends Drawable implements Drawable.Callback {
|
|||||||
dr.setCallback(this);
|
dr.setCallback(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void applyTheme(Theme t) {
|
||||||
|
super.applyTheme(t);
|
||||||
|
|
||||||
|
final ClipState state = mClipState;
|
||||||
|
if (state == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (state.mDrawable != null) {
|
||||||
|
state.mDrawable.applyTheme(t);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean canApplyTheme() {
|
||||||
|
final ClipState state = mClipState;
|
||||||
|
return state != null && state.mDrawable != null && state.mDrawable.canApplyTheme();
|
||||||
|
}
|
||||||
|
|
||||||
// overrides from Drawable.Callback
|
// overrides from Drawable.Callback
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -299,17 +299,12 @@ public class ColorDrawable extends Drawable {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Drawable newDrawable() {
|
public Drawable newDrawable() {
|
||||||
return new ColorDrawable(this, null, null);
|
return new ColorDrawable(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Drawable newDrawable(Resources res) {
|
public Drawable newDrawable(Resources res) {
|
||||||
return new ColorDrawable(this, res, null);
|
return new ColorDrawable(this);
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Drawable newDrawable(Resources res, Theme theme) {
|
|
||||||
return new ColorDrawable(this, res, theme);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -318,14 +313,8 @@ public class ColorDrawable extends Drawable {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private ColorDrawable(ColorState state, Resources res, Theme theme) {
|
private ColorDrawable(ColorState state) {
|
||||||
if (theme != null && state.canApplyTheme()) {
|
mColorState = state;
|
||||||
mColorState = new ColorState(state);
|
|
||||||
applyTheme(theme);
|
|
||||||
} else {
|
|
||||||
mColorState = state;
|
|
||||||
}
|
|
||||||
|
|
||||||
mTintFilter = updateTintFilter(mTintFilter, state.mTint, state.mTintMode);
|
mTintFilter = updateTintFilter(mTintFilter, state.mTint, state.mTintMode);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1216,7 +1216,7 @@ public abstract class Drawable {
|
|||||||
* implemented for drawables that can have a theme applied.
|
* implemented for drawables that can have a theme applied.
|
||||||
*/
|
*/
|
||||||
public Drawable newDrawable(Resources res, Theme theme) {
|
public Drawable newDrawable(Resources res, Theme theme) {
|
||||||
return newDrawable();
|
return newDrawable(null);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -592,8 +592,6 @@ public class DrawableContainer extends Drawable implements Drawable.Callback {
|
|||||||
final DrawableContainer mOwner;
|
final DrawableContainer mOwner;
|
||||||
final Resources mRes;
|
final Resources mRes;
|
||||||
|
|
||||||
Theme mTheme;
|
|
||||||
|
|
||||||
SparseArray<ConstantStateFuture> mDrawableFutures;
|
SparseArray<ConstantStateFuture> mDrawableFutures;
|
||||||
|
|
||||||
int mChangingConfigurations;
|
int mChangingConfigurations;
|
||||||
@@ -801,17 +799,17 @@ public class DrawableContainer extends Drawable implements Drawable.Callback {
|
|||||||
}
|
}
|
||||||
|
|
||||||
final void applyTheme(Theme theme) {
|
final void applyTheme(Theme theme) {
|
||||||
// No need to call createAllFutures, since future drawables will
|
if (theme != null) {
|
||||||
// apply the theme when they are prepared.
|
createAllFutures();
|
||||||
final int N = mNumChildren;
|
|
||||||
final Drawable[] drawables = mDrawables;
|
final int N = mNumChildren;
|
||||||
for (int i = 0; i < N; i++) {
|
final Drawable[] drawables = mDrawables;
|
||||||
if (drawables[i] != null) {
|
for (int i = 0; i < N; i++) {
|
||||||
drawables[i].applyTheme(theme);
|
if (drawables[i] != null && drawables[i].canApplyTheme()) {
|
||||||
|
drawables[i].applyTheme(theme);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
mTheme = theme;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -1068,10 +1066,8 @@ public class DrawableContainer extends Drawable implements Drawable.Callback {
|
|||||||
final Drawable result;
|
final Drawable result;
|
||||||
if (state.mRes == null) {
|
if (state.mRes == null) {
|
||||||
result = mConstantState.newDrawable();
|
result = mConstantState.newDrawable();
|
||||||
} else if (state.mTheme == null) {
|
|
||||||
result = mConstantState.newDrawable(state.mRes);
|
|
||||||
} else {
|
} else {
|
||||||
result = mConstantState.newDrawable(state.mRes, state.mTheme);
|
result = mConstantState.newDrawable(state.mRes);
|
||||||
}
|
}
|
||||||
result.setLayoutDirection(state.mLayoutDirection);
|
result.setLayoutDirection(state.mLayoutDirection);
|
||||||
result.setCallback(state.mOwner);
|
result.setCallback(state.mOwner);
|
||||||
|
|||||||
@@ -174,7 +174,7 @@ public class GradientDrawable extends Drawable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public GradientDrawable() {
|
public GradientDrawable() {
|
||||||
this(new GradientState(Orientation.TOP_BOTTOM, null), null);
|
this(new GradientState(Orientation.TOP_BOTTOM, null));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -182,7 +182,7 @@ public class GradientDrawable extends Drawable {
|
|||||||
* of colors for the gradient.
|
* of colors for the gradient.
|
||||||
*/
|
*/
|
||||||
public GradientDrawable(Orientation orientation, int[] colors) {
|
public GradientDrawable(Orientation orientation, int[] colors) {
|
||||||
this(new GradientState(orientation, colors), null);
|
this(new GradientState(orientation, colors));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -1022,13 +1022,16 @@ public class GradientDrawable extends Drawable {
|
|||||||
super.applyTheme(t);
|
super.applyTheme(t);
|
||||||
|
|
||||||
final GradientState state = mGradientState;
|
final GradientState state = mGradientState;
|
||||||
if (state == null || state.mThemeAttrs == null) {
|
if (state == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
final TypedArray a = t.resolveAttributes(state.mThemeAttrs, R.styleable.GradientDrawable);
|
if (state.mThemeAttrs != null) {
|
||||||
updateStateFromTypedArray(a);
|
final TypedArray a = t.resolveAttributes(
|
||||||
a.recycle();
|
state.mThemeAttrs, R.styleable.GradientDrawable);
|
||||||
|
updateStateFromTypedArray(a);
|
||||||
|
a.recycle();
|
||||||
|
}
|
||||||
|
|
||||||
applyThemeChildElements(t);
|
applyThemeChildElements(t);
|
||||||
|
|
||||||
@@ -1086,11 +1089,7 @@ public class GradientDrawable extends Drawable {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean canApplyTheme() {
|
public boolean canApplyTheme() {
|
||||||
final GradientState st = mGradientState;
|
return super.canApplyTheme() || mGradientState != null && mGradientState.canApplyTheme();
|
||||||
return st != null && (st.mThemeAttrs != null || st.mAttrSize != null
|
|
||||||
|| st.mAttrGradient != null || st.mAttrSolid != null
|
|
||||||
|| st.mAttrStroke != null || st.mAttrCorners != null
|
|
||||||
|| st.mAttrPadding != null);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void applyThemeChildElements(Theme t) {
|
private void applyThemeChildElements(Theme t) {
|
||||||
@@ -1627,22 +1626,19 @@ public class GradientDrawable extends Drawable {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean canApplyTheme() {
|
public boolean canApplyTheme() {
|
||||||
return mThemeAttrs != null;
|
return mThemeAttrs != null || mAttrSize != null || mAttrGradient != null
|
||||||
|
|| mAttrSolid != null || mAttrStroke != null || mAttrCorners != null
|
||||||
|
|| mAttrPadding != null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Drawable newDrawable() {
|
public Drawable newDrawable() {
|
||||||
return new GradientDrawable(this, null);
|
return new GradientDrawable(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Drawable newDrawable(Resources res) {
|
public Drawable newDrawable(Resources res) {
|
||||||
return new GradientDrawable(this, null);
|
return new GradientDrawable(this);
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Drawable newDrawable(Resources res, Theme theme) {
|
|
||||||
return new GradientDrawable(this, theme);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -1746,18 +1742,11 @@ public class GradientDrawable extends Drawable {
|
|||||||
* The resulting drawable is guaranteed to have a new constant state.
|
* The resulting drawable is guaranteed to have a new constant state.
|
||||||
*
|
*
|
||||||
* @param state Constant state from which the drawable inherits
|
* @param state Constant state from which the drawable inherits
|
||||||
* @param theme Theme to apply to the drawable
|
|
||||||
*/
|
*/
|
||||||
private GradientDrawable(GradientState state, Theme theme) {
|
private GradientDrawable(GradientState state) {
|
||||||
if (theme != null && state.canApplyTheme()) {
|
mGradientState = state;
|
||||||
// If we need to apply a theme, implicitly mutate.
|
|
||||||
mGradientState = new GradientState(state);
|
|
||||||
applyTheme(theme);
|
|
||||||
} else {
|
|
||||||
mGradientState = state;
|
|
||||||
}
|
|
||||||
|
|
||||||
initializeWithState(state);
|
initializeWithState(mGradientState);
|
||||||
|
|
||||||
mGradientIsDirty = true;
|
mGradientIsDirty = true;
|
||||||
mMutated = false;
|
mMutated = false;
|
||||||
|
|||||||
@@ -170,24 +170,30 @@ public class InsetDrawable extends Drawable implements Drawable.Callback {
|
|||||||
super.applyTheme(t);
|
super.applyTheme(t);
|
||||||
|
|
||||||
final InsetState state = mInsetState;
|
final InsetState state = mInsetState;
|
||||||
if (state == null || state.mThemeAttrs == null) {
|
if (state == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
final TypedArray a = t.resolveAttributes(state.mThemeAttrs, R.styleable.InsetDrawable);
|
if (state.mThemeAttrs != null) {
|
||||||
try {
|
final TypedArray a = t.resolveAttributes(state.mThemeAttrs, R.styleable.InsetDrawable);
|
||||||
updateStateFromTypedArray(a);
|
try {
|
||||||
verifyRequiredAttributes(a);
|
updateStateFromTypedArray(a);
|
||||||
} catch (XmlPullParserException e) {
|
verifyRequiredAttributes(a);
|
||||||
throw new RuntimeException(e);
|
} catch (XmlPullParserException e) {
|
||||||
} finally {
|
throw new RuntimeException(e);
|
||||||
a.recycle();
|
} finally {
|
||||||
|
a.recycle();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (state.mDrawable != null && state.mDrawable.canApplyTheme()) {
|
||||||
|
state.mDrawable.applyTheme(t);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean canApplyTheme() {
|
public boolean canApplyTheme() {
|
||||||
return mInsetState != null && mInsetState.mThemeAttrs != null;
|
return super.canApplyTheme() || mInsetState != null && mInsetState.canApplyTheme();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -438,6 +444,12 @@ public class InsetDrawable extends Drawable implements Drawable.Callback {
|
|||||||
return mChangingConfigurations;
|
return mChangingConfigurations;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean canApplyTheme() {
|
||||||
|
return super.canApplyTheme() || mThemeAttrs != null
|
||||||
|
|| mDrawable != null && mDrawable.canApplyTheme();
|
||||||
|
}
|
||||||
|
|
||||||
boolean canConstantState() {
|
boolean canConstantState() {
|
||||||
if (!mCheckedConstantState) {
|
if (!mCheckedConstantState) {
|
||||||
mCanConstantState = mDrawable.getConstantState() != null;
|
mCanConstantState = mDrawable.getConstantState() != null;
|
||||||
|
|||||||
@@ -100,10 +100,10 @@ public class LayerDrawable extends Drawable implements Drawable.Callback {
|
|||||||
* @param state The constant drawable state.
|
* @param state The constant drawable state.
|
||||||
*/
|
*/
|
||||||
LayerDrawable(Drawable[] layers, LayerState state) {
|
LayerDrawable(Drawable[] layers, LayerState state) {
|
||||||
this(state, null, null);
|
this(state, null);
|
||||||
int length = layers.length;
|
|
||||||
ChildDrawable[] r = new ChildDrawable[length];
|
|
||||||
|
|
||||||
|
final int length = layers.length;
|
||||||
|
final ChildDrawable[] r = new ChildDrawable[length];
|
||||||
for (int i = 0; i < length; i++) {
|
for (int i = 0; i < length; i++) {
|
||||||
r[i] = new ChildDrawable();
|
r[i] = new ChildDrawable();
|
||||||
r[i].mDrawable = layers[i];
|
r[i].mDrawable = layers[i];
|
||||||
@@ -117,18 +117,14 @@ public class LayerDrawable extends Drawable implements Drawable.Callback {
|
|||||||
}
|
}
|
||||||
|
|
||||||
LayerDrawable() {
|
LayerDrawable() {
|
||||||
this((LayerState) null, null, null);
|
this((LayerState) null, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
LayerDrawable(LayerState state, Resources res, Theme theme) {
|
LayerDrawable(LayerState state, Resources res) {
|
||||||
final LayerState as = createConstantState(state, res);
|
mLayerState = createConstantState(state, res);
|
||||||
mLayerState = as;
|
if (mLayerState.mNum > 0) {
|
||||||
if (as.mNum > 0) {
|
|
||||||
ensurePadding();
|
ensurePadding();
|
||||||
}
|
}
|
||||||
if (theme != null && canApplyTheme()) {
|
|
||||||
applyTheme(theme);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
LayerState createConstantState(LayerState state, Resources res) {
|
LayerState createConstantState(LayerState state, Resources res) {
|
||||||
@@ -256,8 +252,8 @@ public class LayerDrawable extends Drawable implements Drawable.Callback {
|
|||||||
a.recycle();
|
a.recycle();
|
||||||
}
|
}
|
||||||
|
|
||||||
final ChildDrawable[] array = mLayerState.mChildren;
|
final ChildDrawable[] array = state.mChildren;
|
||||||
final int N = mLayerState.mNum;
|
final int N = state.mNum;
|
||||||
for (int i = 0; i < N; i++) {
|
for (int i = 0; i < N; i++) {
|
||||||
final ChildDrawable layer = array[i];
|
final ChildDrawable layer = array[i];
|
||||||
if (layer.mThemeAttrs != null) {
|
if (layer.mThemeAttrs != null) {
|
||||||
@@ -279,25 +275,7 @@ public class LayerDrawable extends Drawable implements Drawable.Callback {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean canApplyTheme() {
|
public boolean canApplyTheme() {
|
||||||
final LayerState state = mLayerState;
|
return super.canApplyTheme() || mLayerState != null && mLayerState.canApplyTheme();
|
||||||
if (state == null) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (state.mThemeAttrs != null) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
final ChildDrawable[] array = state.mChildren;
|
|
||||||
final int N = state.mNum;
|
|
||||||
for (int i = 0; i < N; i++) {
|
|
||||||
final ChildDrawable layer = array[i];
|
|
||||||
if (layer.mThemeAttrs != null || layer.mDrawable.canApplyTheme()) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -1042,22 +1020,30 @@ public class LayerDrawable extends Drawable implements Drawable.Callback {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean canApplyTheme() {
|
public boolean canApplyTheme() {
|
||||||
return mThemeAttrs != null;
|
if (mThemeAttrs != null) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
final ChildDrawable[] array = mChildren;
|
||||||
|
final int N = mNum;
|
||||||
|
for (int i = 0; i < N; i++) {
|
||||||
|
final ChildDrawable layer = array[i];
|
||||||
|
if (layer.mThemeAttrs != null || layer.mDrawable.canApplyTheme()) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Drawable newDrawable() {
|
public Drawable newDrawable() {
|
||||||
return new LayerDrawable(this, null, null);
|
return new LayerDrawable(this, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Drawable newDrawable(Resources res) {
|
public Drawable newDrawable(Resources res) {
|
||||||
return new LayerDrawable(this, res, null);
|
return new LayerDrawable(this, res);
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Drawable newDrawable(Resources res, Theme theme) {
|
|
||||||
return new LayerDrawable(this, res, theme);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -90,7 +90,7 @@ public class NinePatchDrawable extends Drawable {
|
|||||||
*/
|
*/
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public NinePatchDrawable(Bitmap bitmap, byte[] chunk, Rect padding, String srcName) {
|
public NinePatchDrawable(Bitmap bitmap, byte[] chunk, Rect padding, String srcName) {
|
||||||
this(new NinePatchState(new NinePatch(bitmap, chunk, srcName), padding), null, null);
|
this(new NinePatchState(new NinePatch(bitmap, chunk, srcName), padding), null);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -99,7 +99,7 @@ public class NinePatchDrawable extends Drawable {
|
|||||||
*/
|
*/
|
||||||
public NinePatchDrawable(Resources res, Bitmap bitmap, byte[] chunk,
|
public NinePatchDrawable(Resources res, Bitmap bitmap, byte[] chunk,
|
||||||
Rect padding, String srcName) {
|
Rect padding, String srcName) {
|
||||||
this(new NinePatchState(new NinePatch(bitmap, chunk, srcName), padding), res, null);
|
this(new NinePatchState(new NinePatch(bitmap, chunk, srcName), padding), res);
|
||||||
mNinePatchState.mTargetDensity = mTargetDensity;
|
mNinePatchState.mTargetDensity = mTargetDensity;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -112,7 +112,7 @@ public class NinePatchDrawable extends Drawable {
|
|||||||
public NinePatchDrawable(Resources res, Bitmap bitmap, byte[] chunk,
|
public NinePatchDrawable(Resources res, Bitmap bitmap, byte[] chunk,
|
||||||
Rect padding, Rect opticalInsets, String srcName) {
|
Rect padding, Rect opticalInsets, String srcName) {
|
||||||
this(new NinePatchState(new NinePatch(bitmap, chunk, srcName), padding, opticalInsets),
|
this(new NinePatchState(new NinePatch(bitmap, chunk, srcName), padding, opticalInsets),
|
||||||
res, null);
|
res);
|
||||||
mNinePatchState.mTargetDensity = mTargetDensity;
|
mNinePatchState.mTargetDensity = mTargetDensity;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -123,7 +123,7 @@ public class NinePatchDrawable extends Drawable {
|
|||||||
*/
|
*/
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public NinePatchDrawable(NinePatch patch) {
|
public NinePatchDrawable(NinePatch patch) {
|
||||||
this(new NinePatchState(patch, new Rect()), null, null);
|
this(new NinePatchState(patch, new Rect()), null);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -131,7 +131,7 @@ public class NinePatchDrawable extends Drawable {
|
|||||||
* based on the display metrics of the resources.
|
* based on the display metrics of the resources.
|
||||||
*/
|
*/
|
||||||
public NinePatchDrawable(Resources res, NinePatch patch) {
|
public NinePatchDrawable(Resources res, NinePatch patch) {
|
||||||
this(new NinePatchState(patch, new Rect()), res, null);
|
this(new NinePatchState(patch, new Rect()), res);
|
||||||
mNinePatchState.mTargetDensity = mTargetDensity;
|
mNinePatchState.mTargetDensity = mTargetDensity;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -654,17 +654,12 @@ public class NinePatchDrawable extends Drawable {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Drawable newDrawable() {
|
public Drawable newDrawable() {
|
||||||
return new NinePatchDrawable(this, null, null);
|
return new NinePatchDrawable(this, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Drawable newDrawable(Resources res) {
|
public Drawable newDrawable(Resources res) {
|
||||||
return new NinePatchDrawable(this, res, null);
|
return new NinePatchDrawable(this, res);
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Drawable newDrawable(Resources res, Theme theme) {
|
|
||||||
return new NinePatchDrawable(this, res, theme);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -677,16 +672,10 @@ public class NinePatchDrawable extends Drawable {
|
|||||||
* The one constructor to rule them all. This is called by all public
|
* The one constructor to rule them all. This is called by all public
|
||||||
* constructors to set the state and initialize local properties.
|
* constructors to set the state and initialize local properties.
|
||||||
*/
|
*/
|
||||||
private NinePatchDrawable(NinePatchState state, Resources res, Theme theme) {
|
private NinePatchDrawable(NinePatchState state, Resources res) {
|
||||||
if (theme != null && state.canApplyTheme()) {
|
mNinePatchState = state;
|
||||||
// If we need to apply a theme, implicitly mutate.
|
|
||||||
mNinePatchState = new NinePatchState(state);
|
|
||||||
applyTheme(theme);
|
|
||||||
} else {
|
|
||||||
mNinePatchState = state;
|
|
||||||
}
|
|
||||||
|
|
||||||
initializeWithState(state, res);
|
initializeWithState(mNinePatchState, res);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -167,7 +167,7 @@ public class RippleDrawable extends LayerDrawable {
|
|||||||
* Constructor used for drawable inflation.
|
* Constructor used for drawable inflation.
|
||||||
*/
|
*/
|
||||||
RippleDrawable() {
|
RippleDrawable() {
|
||||||
this(new RippleState(null, null, null), null, null);
|
this(new RippleState(null, null, null), null);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -180,7 +180,7 @@ public class RippleDrawable extends LayerDrawable {
|
|||||||
*/
|
*/
|
||||||
public RippleDrawable(@NonNull ColorStateList color, @Nullable Drawable content,
|
public RippleDrawable(@NonNull ColorStateList color, @Nullable Drawable content,
|
||||||
@Nullable Drawable mask) {
|
@Nullable Drawable mask) {
|
||||||
this(new RippleState(null, null, null), null, null);
|
this(new RippleState(null, null, null), null);
|
||||||
|
|
||||||
if (color == null) {
|
if (color == null) {
|
||||||
throw new IllegalArgumentException("RippleDrawable requires a non-null color");
|
throw new IllegalArgumentException("RippleDrawable requires a non-null color");
|
||||||
@@ -473,7 +473,7 @@ public class RippleDrawable extends LayerDrawable {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean canApplyTheme() {
|
public boolean canApplyTheme() {
|
||||||
return super.canApplyTheme() || mState != null && mState.mTouchThemeAttrs != null;
|
return super.canApplyTheme() || mState != null && mState.canApplyTheme();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -927,17 +927,12 @@ public class RippleDrawable extends LayerDrawable {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Drawable newDrawable() {
|
public Drawable newDrawable() {
|
||||||
return new RippleDrawable(this, null, null);
|
return new RippleDrawable(this, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Drawable newDrawable(Resources res) {
|
public Drawable newDrawable(Resources res) {
|
||||||
return new RippleDrawable(this, res, null);
|
return new RippleDrawable(this, res);
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Drawable newDrawable(Resources res, Theme theme) {
|
|
||||||
return new RippleDrawable(this, res, theme);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -971,37 +966,18 @@ public class RippleDrawable extends LayerDrawable {
|
|||||||
return mState.mMaxRadius;
|
return mState.mMaxRadius;
|
||||||
}
|
}
|
||||||
|
|
||||||
private RippleDrawable(RippleState state, Resources res, Theme theme) {
|
private RippleDrawable(RippleState state, Resources res) {
|
||||||
boolean needsTheme = false;
|
mState = new RippleState(state, this, res);
|
||||||
|
mLayerState = mState;
|
||||||
|
|
||||||
final RippleState ns;
|
if (mState.mNum > 0) {
|
||||||
if (theme != null && state != null && state.canApplyTheme()) {
|
ensurePadding();
|
||||||
ns = new RippleState(state, this, res);
|
|
||||||
needsTheme = true;
|
|
||||||
} else if (state == null) {
|
|
||||||
ns = new RippleState(null, this, res);
|
|
||||||
} else {
|
|
||||||
// We always need a new state since child drawables contain local
|
|
||||||
// state but live within the parent's constant state.
|
|
||||||
// TODO: Move child drawables into local state.
|
|
||||||
ns = new RippleState(state, this, res);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (res != null) {
|
if (res != null) {
|
||||||
mDensity = res.getDisplayMetrics().density;
|
mDensity = res.getDisplayMetrics().density;
|
||||||
}
|
}
|
||||||
|
|
||||||
mState = ns;
|
|
||||||
mLayerState = ns;
|
|
||||||
|
|
||||||
if (ns.mNum > 0) {
|
|
||||||
ensurePadding();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (needsTheme) {
|
|
||||||
applyTheme(theme);
|
|
||||||
}
|
|
||||||
|
|
||||||
initializeFromState();
|
initializeFromState();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -16,6 +16,8 @@
|
|||||||
|
|
||||||
package android.graphics.drawable;
|
package android.graphics.drawable;
|
||||||
|
|
||||||
|
import com.android.internal.R;
|
||||||
|
|
||||||
import org.xmlpull.v1.XmlPullParser;
|
import org.xmlpull.v1.XmlPullParser;
|
||||||
import org.xmlpull.v1.XmlPullParserException;
|
import org.xmlpull.v1.XmlPullParserException;
|
||||||
|
|
||||||
@@ -475,6 +477,26 @@ public class RotateDrawable extends Drawable implements Drawable.Callback {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void applyTheme(Theme t) {
|
||||||
|
super.applyTheme(t);
|
||||||
|
|
||||||
|
final RotateState state = mState;
|
||||||
|
if (state == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (state.mDrawable != null) {
|
||||||
|
state.mDrawable.applyTheme(t);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean canApplyTheme() {
|
||||||
|
final RotateState state = mState;
|
||||||
|
return state != null && state.mDrawable != null && state.mDrawable.canApplyTheme();
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Drawable mutate() {
|
public Drawable mutate() {
|
||||||
if (!mMutated && super.mutate() == this) {
|
if (!mMutated && super.mutate() == this) {
|
||||||
|
|||||||
@@ -128,6 +128,26 @@ public class ScaleDrawable extends Drawable implements Drawable.Callback {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void applyTheme(Theme t) {
|
||||||
|
super.applyTheme(t);
|
||||||
|
|
||||||
|
final ScaleState state = mScaleState;
|
||||||
|
if (state == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (state.mDrawable != null) {
|
||||||
|
state.mDrawable.applyTheme(t);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean canApplyTheme() {
|
||||||
|
final ScaleState state = mScaleState;
|
||||||
|
return state != null && state.mDrawable != null && state.mDrawable.canApplyTheme();
|
||||||
|
}
|
||||||
|
|
||||||
// overrides from Drawable.Callback
|
// overrides from Drawable.Callback
|
||||||
|
|
||||||
public void invalidateDrawable(Drawable who) {
|
public void invalidateDrawable(Drawable who) {
|
||||||
|
|||||||
@@ -76,7 +76,7 @@ public class ShapeDrawable extends Drawable {
|
|||||||
* ShapeDrawable constructor.
|
* ShapeDrawable constructor.
|
||||||
*/
|
*/
|
||||||
public ShapeDrawable() {
|
public ShapeDrawable() {
|
||||||
this(new ShapeState(null), null, null);
|
this(new ShapeState(null), null);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -85,7 +85,7 @@ public class ShapeDrawable extends Drawable {
|
|||||||
* @param s the Shape that this ShapeDrawable should be
|
* @param s the Shape that this ShapeDrawable should be
|
||||||
*/
|
*/
|
||||||
public ShapeDrawable(Shape s) {
|
public ShapeDrawable(Shape s) {
|
||||||
this(new ShapeState(null), null, null);
|
this(new ShapeState(null), null);
|
||||||
|
|
||||||
mShapeState.mShape = s;
|
mShapeState.mShape = s;
|
||||||
}
|
}
|
||||||
@@ -555,17 +555,12 @@ public class ShapeDrawable extends Drawable {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Drawable newDrawable() {
|
public Drawable newDrawable() {
|
||||||
return new ShapeDrawable(this, null, null);
|
return new ShapeDrawable(this, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Drawable newDrawable(Resources res) {
|
public Drawable newDrawable(Resources res) {
|
||||||
return new ShapeDrawable(this, res, null);
|
return new ShapeDrawable(this, res);
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Drawable newDrawable(Resources res, Theme theme) {
|
|
||||||
return new ShapeDrawable(this, res, theme);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -578,13 +573,8 @@ public class ShapeDrawable extends Drawable {
|
|||||||
* The one constructor to rule them all. This is called by all public
|
* The one constructor to rule them all. This is called by all public
|
||||||
* constructors to set the state and initialize local properties.
|
* constructors to set the state and initialize local properties.
|
||||||
*/
|
*/
|
||||||
private ShapeDrawable(ShapeState state, Resources res, Theme theme) {
|
private ShapeDrawable(ShapeState state, Resources res) {
|
||||||
if (theme != null && state.canApplyTheme()) {
|
mShapeState = state;
|
||||||
mShapeState = new ShapeState(state);
|
|
||||||
applyTheme(theme);
|
|
||||||
} else {
|
|
||||||
mShapeState = state;
|
|
||||||
}
|
|
||||||
|
|
||||||
initializeWithState(state, res);
|
initializeWithState(state, res);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -288,7 +288,16 @@ public class StateListDrawable extends DrawableContainer {
|
|||||||
super(orig, owner, res);
|
super(orig, owner, res);
|
||||||
|
|
||||||
if (orig != null) {
|
if (orig != null) {
|
||||||
mStateSets = Arrays.copyOf(orig.mStateSets, orig.mStateSets.length);
|
// Perform a deep copy.
|
||||||
|
final int[][] sets = orig.mStateSets;
|
||||||
|
final int count = sets.length;
|
||||||
|
mStateSets = new int[count][];
|
||||||
|
for (int i = 0; i < count; i++) {
|
||||||
|
final int[] set = sets[i];
|
||||||
|
if (set != null) {
|
||||||
|
mStateSets[i] = set.clone();
|
||||||
|
}
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
mStateSets = new int[getCapacity()][];
|
mStateSets = new int[getCapacity()][];
|
||||||
}
|
}
|
||||||
@@ -330,6 +339,13 @@ public class StateListDrawable extends DrawableContainer {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void applyTheme(Theme theme) {
|
||||||
|
super.applyTheme(theme);
|
||||||
|
|
||||||
|
onStateChange(getState());
|
||||||
|
}
|
||||||
|
|
||||||
void setConstantState(StateListState state) {
|
void setConstantState(StateListState state) {
|
||||||
super.setConstantState(state);
|
super.setConstantState(state);
|
||||||
|
|
||||||
|
|||||||
@@ -17,7 +17,6 @@
|
|||||||
package android.graphics.drawable;
|
package android.graphics.drawable;
|
||||||
|
|
||||||
import android.content.res.Resources;
|
import android.content.res.Resources;
|
||||||
import android.content.res.Resources.Theme;
|
|
||||||
import android.graphics.Canvas;
|
import android.graphics.Canvas;
|
||||||
import android.os.SystemClock;
|
import android.os.SystemClock;
|
||||||
|
|
||||||
@@ -86,11 +85,11 @@ public class TransitionDrawable extends LayerDrawable implements Drawable.Callba
|
|||||||
* @see #TransitionDrawable(Drawable[])
|
* @see #TransitionDrawable(Drawable[])
|
||||||
*/
|
*/
|
||||||
TransitionDrawable() {
|
TransitionDrawable() {
|
||||||
this(new TransitionState(null, null, null), null, null);
|
this(new TransitionState(null, null, null), (Resources) null);
|
||||||
}
|
}
|
||||||
|
|
||||||
private TransitionDrawable(TransitionState state, Resources res, Theme theme) {
|
private TransitionDrawable(TransitionState state, Resources res) {
|
||||||
super(state, res, theme);
|
super(state, res);
|
||||||
}
|
}
|
||||||
|
|
||||||
private TransitionDrawable(TransitionState state, Drawable[] layers) {
|
private TransitionDrawable(TransitionState state, Drawable[] layers) {
|
||||||
@@ -245,24 +244,18 @@ public class TransitionDrawable extends LayerDrawable implements Drawable.Callba
|
|||||||
}
|
}
|
||||||
|
|
||||||
static class TransitionState extends LayerState {
|
static class TransitionState extends LayerState {
|
||||||
TransitionState(TransitionState orig, TransitionDrawable owner,
|
TransitionState(TransitionState orig, TransitionDrawable owner, Resources res) {
|
||||||
Resources res) {
|
|
||||||
super(orig, owner, res);
|
super(orig, owner, res);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Drawable newDrawable() {
|
public Drawable newDrawable() {
|
||||||
return new TransitionDrawable(this, null, null);
|
return new TransitionDrawable(this, (Resources) null);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Drawable newDrawable(Resources res) {
|
public Drawable newDrawable(Resources res) {
|
||||||
return new TransitionDrawable(this, res, null);
|
return new TransitionDrawable(this, res);
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Drawable newDrawable(Resources res, Theme theme) {
|
|
||||||
return new TransitionDrawable(this, res, theme);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -14,6 +14,7 @@
|
|||||||
|
|
||||||
package android.graphics.drawable;
|
package android.graphics.drawable;
|
||||||
|
|
||||||
|
import android.annotation.NonNull;
|
||||||
import android.content.res.ColorStateList;
|
import android.content.res.ColorStateList;
|
||||||
import android.content.res.Resources;
|
import android.content.res.Resources;
|
||||||
import android.content.res.Resources.Theme;
|
import android.content.res.Resources.Theme;
|
||||||
@@ -212,15 +213,8 @@ public class VectorDrawable extends Drawable {
|
|||||||
mVectorState = new VectorDrawableState();
|
mVectorState = new VectorDrawableState();
|
||||||
}
|
}
|
||||||
|
|
||||||
private VectorDrawable(VectorDrawableState state, Resources res, Theme theme) {
|
private VectorDrawable(@NonNull VectorDrawableState state) {
|
||||||
if (theme != null && state.canApplyTheme()) {
|
mVectorState = state;
|
||||||
// If we need to apply a theme, implicitly mutate.
|
|
||||||
mVectorState = new VectorDrawableState(state);
|
|
||||||
applyTheme(theme);
|
|
||||||
} else {
|
|
||||||
mVectorState = state;
|
|
||||||
}
|
|
||||||
|
|
||||||
mTintFilter = updateTintFilter(mTintFilter, state.mTint, state.mTintMode);
|
mTintFilter = updateTintFilter(mTintFilter, state.mTint, state.mTintMode);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -765,17 +759,12 @@ public class VectorDrawable extends Drawable {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Drawable newDrawable() {
|
public Drawable newDrawable() {
|
||||||
return new VectorDrawable(this, null, null);
|
return new VectorDrawable(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Drawable newDrawable(Resources res) {
|
public Drawable newDrawable(Resources res) {
|
||||||
return new VectorDrawable(this, res, null);
|
return new VectorDrawable(this);
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Drawable newDrawable(Resources res, Theme theme) {
|
|
||||||
return new VectorDrawable(this, res, theme);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
Reference in New Issue
Block a user