Fix a startup flicker on Android M

This commit is contained in:
serso 2016-03-22 17:30:05 +01:00
parent 0b15eddf7c
commit 4b413022a1
7 changed files with 28 additions and 7 deletions

View File

@ -29,11 +29,14 @@ import android.content.SharedPreferences;
import android.content.res.TypedArray; import android.content.res.TypedArray;
import android.graphics.Color; import android.graphics.Color;
import android.provider.Settings; 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.support.v7.view.ContextThemeWrapper;
import android.util.SparseArray; import android.util.SparseArray;
import jscl.AngleUnit;
import jscl.NumeralBase;
import org.solovyev.android.Check; import org.solovyev.android.Check;
import org.solovyev.android.calculator.about.AboutActivity; import org.solovyev.android.calculator.about.AboutActivity;
import org.solovyev.android.calculator.functions.FunctionsActivity; 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.preferences.PreferencesActivity;
import org.solovyev.android.calculator.variables.VariablesActivity; import org.solovyev.android.calculator.variables.VariablesActivity;
import org.solovyev.android.calculator.wizard.WizardActivity; 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.text.DecimalFormatSymbols;
import java.util.EnumMap; import java.util.EnumMap;
import java.util.Locale; import java.util.Locale;
import java.util.Map; 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; import static org.solovyev.android.prefs.IntegerPreference.DEF_VALUE;
public final class Preferences { 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_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), 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_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<TextColor> textColors = new SparseArray<>(); private static final SparseArray<TextColor> textColors = new SparseArray<>();

View File

@ -24,6 +24,7 @@
<style name="Cpp.Theme.Calculator" parent="@style/Cpp.Theme"> <style name="Cpp.Theme.Calculator" parent="@style/Cpp.Theme">
<item name="android:windowBackground">@color/cpp_editor_bg</item> <item name="android:windowBackground">@color/cpp_editor_bg</item>
<item name="android:windowAnimationStyle">@null</item>
</style> </style>
<style name="Cpp.Theme" parent="@style/Theme.AppCompat.NoActionBar"> <style name="Cpp.Theme" parent="@style/Theme.AppCompat.NoActionBar">

View File

@ -78,6 +78,7 @@
<style name="Cpp.Theme.Material.Calculator" parent="Cpp.Theme.Material"> <style name="Cpp.Theme.Material.Calculator" parent="Cpp.Theme.Material">
<item name="android:windowBackground">@color/cpp_editor_bg</item> <item name="android:windowBackground">@color/cpp_editor_bg</item>
<item name="android:windowAnimationStyle">@null</item>
</style> </style>
<style name="Cpp.Theme.Material" parent="Cpp.Theme"> <style name="Cpp.Theme.Material" parent="Cpp.Theme">

View File

@ -102,4 +102,9 @@
<item name="cpp_button_style_operation_highlighted">@style/CppKeyboardButton.Material.Light.Operation.Highlighted</item> <item name="cpp_button_style_operation_highlighted">@style/CppKeyboardButton.Material.Light.Operation.Highlighted</item>
</style> </style>
<style name="Cpp.Theme.Material.Light.Calculator" parent="Cpp.Theme.Material.Light">
<item name="android:windowBackground">@color/cpp_bg_light</item>
<item name="android:windowAnimationStyle">@null</item>
</style>
</resources> </resources>

View File

@ -92,6 +92,7 @@
<style name="Cpp.Theme.Metro.Blue.Calculator" parent="Cpp.Theme.Metro.Blue"> <style name="Cpp.Theme.Metro.Blue.Calculator" parent="Cpp.Theme.Metro.Blue">
<item name="android:windowBackground">@color/cpp_editor_bg</item> <item name="android:windowBackground">@color/cpp_editor_bg</item>
<item name="android:windowAnimationStyle">@null</item>
</style> </style>
</resources> </resources>

View File

@ -40,6 +40,7 @@
<style name="Cpp.Theme.Metro.Green.Calculator" parent="Cpp.Theme.Metro.Green"> <style name="Cpp.Theme.Metro.Green.Calculator" parent="Cpp.Theme.Metro.Green">
<item name="android:windowBackground">@color/cpp_editor_bg</item> <item name="android:windowBackground">@color/cpp_editor_bg</item>
<item name="android:windowAnimationStyle">@null</item>
</style> </style>
</resources> </resources>

View File

@ -40,6 +40,7 @@
<style name="Cpp.Theme.Metro.Purple.Calculator" parent="Cpp.Theme.Metro.Purple"> <style name="Cpp.Theme.Metro.Purple.Calculator" parent="Cpp.Theme.Metro.Purple">
<item name="android:windowBackground">@color/cpp_editor_bg</item> <item name="android:windowBackground">@color/cpp_editor_bg</item>
<item name="android:windowAnimationStyle">@null</item>
</style> </style>
</resources> </resources>