Skip to content

Commit

Permalink
Update transition for theme previews
Browse files Browse the repository at this point in the history
  • Loading branch information
pranavpandey committed Jul 24, 2024
1 parent 486cb18 commit f8b3613
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 10 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2018-2022 Pranav Pandey
* Copyright 2018-2024 Pranav Pandey
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -38,6 +38,7 @@
import com.pranavpandey.android.dynamic.support.listener.DynamicColorResolver;
import com.pranavpandey.android.dynamic.support.model.DynamicRemoteTheme;
import com.pranavpandey.android.dynamic.support.model.DynamicWidgetTheme;
import com.pranavpandey.android.dynamic.support.motion.DynamicMotion;
import com.pranavpandey.android.dynamic.support.permission.DynamicPermissions;
import com.pranavpandey.android.dynamic.support.setting.base.DynamicColorPreference;
import com.pranavpandey.android.dynamic.support.setting.base.DynamicSliderPreference;
Expand Down Expand Up @@ -767,6 +768,11 @@ public void onSharedPreferenceChanged(SharedPreferences sharedPreferences,
}

switch (key) {
case ADS_PREF_THEME_FONT_SCALE:
case ADS_PREF_THEME_FONT_SCALE_ALT:
case ADS_PREF_THEME_BACKGROUND_AWARE:
case ADS_PREF_THEME_STYLE:
DynamicMotion.getInstance().beginDelayedTransition(mThemePreview);
case ADS_PREF_THEME_COLOR_BACKGROUND:
case ADS_PREF_THEME_COLOR_TINT_BACKGROUND:
case ADS_PREF_THEME_COLOR_SURFACE:
Expand All @@ -785,17 +791,13 @@ public void onSharedPreferenceChanged(SharedPreferences sharedPreferences,
case ADS_PREF_THEME_TEXT_INVERSE_PRIMARY:
case ADS_PREF_THEME_TEXT_SECONDARY:
case ADS_PREF_THEME_TEXT_INVERSE_SECONDARY:
case ADS_PREF_THEME_FONT_SCALE:
case ADS_PREF_THEME_FONT_SCALE_ALT:
case ADS_PREF_THEME_CORNER_SIZE:
case ADS_PREF_THEME_CORNER_SIZE_ALT:
case ADS_PREF_THEME_BACKGROUND_AWARE:
case ADS_PREF_THEME_CONTRAST:
case ADS_PREF_THEME_CONTRAST_ALT:
case ADS_PREF_THEME_OPACITY:
case ADS_PREF_THEME_OPACITY_ALT:
case ADS_PREF_THEME_ELEVATION:
case ADS_PREF_THEME_STYLE:
updatePreferences();
break;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2018-2022 Pranav Pandey
* Copyright 2018-2024 Pranav Pandey
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -36,6 +36,7 @@
import com.pranavpandey.android.dynamic.support.intent.DynamicIntent;
import com.pranavpandey.android.dynamic.support.listener.DynamicColorResolver;
import com.pranavpandey.android.dynamic.support.model.DynamicAppTheme;
import com.pranavpandey.android.dynamic.support.motion.DynamicMotion;
import com.pranavpandey.android.dynamic.support.permission.DynamicPermissions;
import com.pranavpandey.android.dynamic.support.setting.base.DynamicColorPreference;
import com.pranavpandey.android.dynamic.support.setting.base.DynamicSliderPreference;
Expand Down Expand Up @@ -747,6 +748,11 @@ public void onSharedPreferenceChanged(SharedPreferences sharedPreferences,
}

switch (key) {
case ADS_PREF_THEME_FONT_SCALE:
case ADS_PREF_THEME_FONT_SCALE_ALT:
case ADS_PREF_THEME_BACKGROUND_AWARE:
case ADS_PREF_THEME_STYLE:
DynamicMotion.getInstance().beginDelayedTransition(mThemePreview);
case ADS_PREF_THEME_COLOR_BACKGROUND:
case ADS_PREF_THEME_COLOR_TINT_BACKGROUND:
case ADS_PREF_THEME_COLOR_SURFACE:
Expand All @@ -765,17 +771,13 @@ public void onSharedPreferenceChanged(SharedPreferences sharedPreferences,
case ADS_PREF_THEME_TEXT_INVERSE_PRIMARY:
case ADS_PREF_THEME_TEXT_SECONDARY:
case ADS_PREF_THEME_TEXT_INVERSE_SECONDARY:
case ADS_PREF_THEME_FONT_SCALE:
case ADS_PREF_THEME_FONT_SCALE_ALT:
case ADS_PREF_THEME_CORNER_SIZE:
case ADS_PREF_THEME_CORNER_SIZE_ALT:
case ADS_PREF_THEME_BACKGROUND_AWARE:
case ADS_PREF_THEME_CONTRAST:
case ADS_PREF_THEME_CONTRAST_ALT:
case ADS_PREF_THEME_OPACITY:
case ADS_PREF_THEME_OPACITY_ALT:
case ADS_PREF_THEME_ELEVATION:
case ADS_PREF_THEME_STYLE:
updatePreferences();
break;
}
Expand Down

0 comments on commit f8b3613

Please sign in to comment.