From 4b413022a145b00df8ed3936b47cae3e33e64d4a Mon Sep 17 00:00:00 2001 From: serso Date: Tue, 22 Mar 2016 17:30:05 +0100 Subject: [PATCH] Fix a startup flicker on Android M --- .../android/calculator/Preferences.java | 25 +++++++++++++------ app/src/main/res/values/theme.xml | 1 + app/src/main/res/values/theme_material.xml | 1 + .../main/res/values/theme_material_light.xml | 5 ++++ app/src/main/res/values/theme_metro_blue.xml | 1 + app/src/main/res/values/theme_metro_green.xml | 1 + .../main/res/values/theme_metro_purple.xml | 1 + 7 files changed, 28 insertions(+), 7 deletions(-) diff --git a/app/src/main/java/org/solovyev/android/calculator/Preferences.java b/app/src/main/java/org/solovyev/android/calculator/Preferences.java index 8067db82..ce7acb4f 100644 --- a/app/src/main/java/org/solovyev/android/calculator/Preferences.java +++ b/app/src/main/java/org/solovyev/android/calculator/Preferences.java @@ -29,11 +29,14 @@ import android.content.SharedPreferences; import android.content.res.TypedArray; import android.graphics.Color; import android.provider.Settings; -import android.support.annotation.*; +import android.support.annotation.ColorRes; +import android.support.annotation.LayoutRes; +import android.support.annotation.NonNull; +import android.support.annotation.StringRes; +import android.support.annotation.StyleRes; import android.support.v7.view.ContextThemeWrapper; import android.util.SparseArray; -import jscl.AngleUnit; -import jscl.NumeralBase; + import org.solovyev.android.Check; import org.solovyev.android.calculator.about.AboutActivity; import org.solovyev.android.calculator.functions.FunctionsActivity; @@ -44,15 +47,23 @@ import org.solovyev.android.calculator.operators.OperatorsActivity; import org.solovyev.android.calculator.preferences.PreferencesActivity; import org.solovyev.android.calculator.variables.VariablesActivity; import org.solovyev.android.calculator.wizard.WizardActivity; -import org.solovyev.android.prefs.*; +import org.solovyev.android.prefs.BooleanPreference; +import org.solovyev.android.prefs.IntegerPreference; +import org.solovyev.android.prefs.NumberToStringPreference; +import org.solovyev.android.prefs.Preference; +import org.solovyev.android.prefs.StringPreference; -import javax.annotation.Nonnull; -import javax.annotation.Nullable; import java.text.DecimalFormatSymbols; import java.util.EnumMap; import java.util.Locale; import java.util.Map; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; + +import jscl.AngleUnit; +import jscl.NumeralBase; + import static org.solovyev.android.prefs.IntegerPreference.DEF_VALUE; public final class Preferences { @@ -301,7 +312,7 @@ public final class Preferences { metro_purple_theme(R.string.p_metro_purple_theme, R.style.Cpp_Theme_Metro_Purple, R.style.Cpp_Theme_Metro_Purple_Calculator, R.style.Cpp_Theme_Wizard, R.style.Cpp_Theme_Metro_Purple_Dialog, R.style.Cpp_Theme_Material_Dialog_Alert), metro_green_theme(R.string.p_metro_green_theme, R.style.Cpp_Theme_Metro_Green, R.style.Cpp_Theme_Metro_Green_Calculator, R.style.Cpp_Theme_Wizard, R.style.Cpp_Theme_Metro_Green_Dialog, R.style.Cpp_Theme_Material_Dialog_Alert), material_theme(R.string.cpp_theme_dark, R.style.Cpp_Theme_Material, R.style.Cpp_Theme_Material_Calculator), - material_light_theme(R.string.cpp_theme_light, R.style.Cpp_Theme_Material_Light, R.style.Cpp_Theme_Material_Light, R.style.Cpp_Theme_Wizard_Light, R.style.Cpp_Theme_Material_Light_Dialog, R.style.Cpp_Theme_Material_Light_Dialog_Alert); + material_light_theme(R.string.cpp_theme_light, R.style.Cpp_Theme_Material_Light, R.style.Cpp_Theme_Material_Light_Calculator, R.style.Cpp_Theme_Wizard_Light, R.style.Cpp_Theme_Material_Light_Dialog, R.style.Cpp_Theme_Material_Light_Dialog_Alert); private static final SparseArray textColors = new SparseArray<>(); diff --git a/app/src/main/res/values/theme.xml b/app/src/main/res/values/theme.xml index bae340c6..bb113cd5 100644 --- a/app/src/main/res/values/theme.xml +++ b/app/src/main/res/values/theme.xml @@ -24,6 +24,7 @@ + + \ No newline at end of file diff --git a/app/src/main/res/values/theme_metro_blue.xml b/app/src/main/res/values/theme_metro_blue.xml index 4f006d40..2167f6bb 100644 --- a/app/src/main/res/values/theme_metro_blue.xml +++ b/app/src/main/res/values/theme_metro_blue.xml @@ -92,6 +92,7 @@ \ No newline at end of file diff --git a/app/src/main/res/values/theme_metro_green.xml b/app/src/main/res/values/theme_metro_green.xml index 77cb431d..8b052a64 100644 --- a/app/src/main/res/values/theme_metro_green.xml +++ b/app/src/main/res/values/theme_metro_green.xml @@ -40,6 +40,7 @@ \ No newline at end of file diff --git a/app/src/main/res/values/theme_metro_purple.xml b/app/src/main/res/values/theme_metro_purple.xml index 44be4593..8b5a8838 100644 --- a/app/src/main/res/values/theme_metro_purple.xml +++ b/app/src/main/res/values/theme_metro_purple.xml @@ -40,6 +40,7 @@ \ No newline at end of file