Disable animation in alertdialogs

This commit is contained in:
PavelRatushny 2017-08-29 15:20:45 +03:00
parent d0c1acd685
commit c48fc51d0d
2 changed files with 27 additions and 2 deletions

View file

@ -262,6 +262,14 @@
<item name="android:textColorSecondary">@color/color_white</item>
</style>
<style name="OsmandDarkTheme.NoAnimation">
<item name="alertDialogTheme">@style/Theme.AppCompat.Dialog.Alert.NoAnimation</item>
</style>
<style name="OsmandLightTheme.NoAnimation">
<item name="alertDialogTheme">@style/Theme.AppCompat.Light.Dialog.Alert.NoAnimation</item>
</style>
<style name="OsmandDarkTheme" parent="Theme.AppCompat">
<item name="mapBackground">@color/map_background_color_dark</item>
<item name="chart_marker_background">@drawable/chart_marker_background_dark</item>
@ -339,6 +347,14 @@
<item name="android:textColor">@color/color_white</item>
</style>
<style name="Theme.AppCompat.Dialog.Alert.NoAnimation">
<item name="android:windowAnimationStyle">@null</item>
</style>
<style name="Theme.AppCompat.Light.Dialog.Alert.NoAnimation">
<item name="android:windowAnimationStyle">@null</item>
</style>
<!-- Standard action bar override -->
<style name="Widget.Styled.ActionBarDark" parent="Widget.AppCompat.Light.ActionBar.Solid.Inverse">
<item name="background">@color/actionbar_dark_color</item>

View file

@ -694,10 +694,19 @@ public class OsmandApplication extends MultiDexApplication {
public void applyTheme(Context c) {
int t = R.style.OsmandDarkTheme;
boolean doNotUseAnimations = osmandSettings.DO_NOT_USE_ANIMATIONS.get();
if (osmandSettings.OSMAND_THEME.get() == OsmandSettings.OSMAND_DARK_THEME) {
t = R.style.OsmandDarkTheme;
if (doNotUseAnimations) {
t = R.style.OsmandDarkTheme_NoAnimation;
} else {
t = R.style.OsmandDarkTheme;
}
} else if (osmandSettings.OSMAND_THEME.get() == OsmandSettings.OSMAND_LIGHT_THEME) {
t = R.style.OsmandLightTheme;
if (doNotUseAnimations) {
t = R.style.OsmandLightTheme_NoAnimation;
} else {
t = R.style.OsmandLightTheme;
}
}
setLanguage(c);
c.setTheme(t);