From 81648f19c6b16777301067179e46f478aa4bb1b0 Mon Sep 17 00:00:00 2001 From: serso Date: Mon, 22 Feb 2016 11:06:19 +0100 Subject: [PATCH] Tablet boolean + dialog theme fixes --- .../android/calculator/Preferences.java | 28 ++++++++++++------- app/src/main/res/values-sw600dp/bools.xml | 4 +++ app/src/main/res/values/bools.xml | 4 +++ app/src/main/res/values/theme.xml | 8 +++--- 4 files changed, 30 insertions(+), 14 deletions(-) create mode 100644 app/src/main/res/values-sw600dp/bools.xml create mode 100644 app/src/main/res/values/bools.xml 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 29617bf3..73bbf8ff 100644 --- a/app/src/main/java/org/solovyev/android/calculator/Preferences.java +++ b/app/src/main/java/org/solovyev/android/calculator/Preferences.java @@ -22,6 +22,11 @@ package org.solovyev.android.calculator; +import static org.solovyev.android.Android.isPhoneModel; +import static org.solovyev.android.DeviceModel.samsung_galaxy_s; +import static org.solovyev.android.DeviceModel.samsung_galaxy_s_2; +import static org.solovyev.android.prefs.IntegerPreference.DEF_VALUE; + import android.app.Application; import android.content.ContentResolver; import android.content.Context; @@ -34,25 +39,27 @@ import android.support.annotation.LayoutRes; import android.support.annotation.StyleRes; import android.util.SparseArray; import android.view.ContextThemeWrapper; -import jscl.AngleUnit; -import jscl.NumeralBase; + import org.solovyev.android.Check; import org.solovyev.android.calculator.language.Languages; import org.solovyev.android.calculator.math.MathType; 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 jscl.AngleUnit; +import jscl.NumeralBase; -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 static org.solovyev.android.Android.isPhoneModel; -import static org.solovyev.android.DeviceModel.samsung_galaxy_s; -import static org.solovyev.android.DeviceModel.samsung_galaxy_s_2; -import static org.solovyev.android.prefs.IntegerPreference.DEF_VALUE; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; public final class Preferences { @@ -323,10 +330,11 @@ public final class Preferences { this.light = theme == R.style.Cpp_Theme_Material_Light; } - public int getThemeFor(@Nullable Context context) { + public int getThemeFor(@Nonnull Context context) { if (context instanceof WizardActivity) { return wizardTheme; } + final boolean tablet = context.getResources().getBoolean(R.bool.cpp_tablet); return theme; } diff --git a/app/src/main/res/values-sw600dp/bools.xml b/app/src/main/res/values-sw600dp/bools.xml new file mode 100644 index 00000000..3a85818a --- /dev/null +++ b/app/src/main/res/values-sw600dp/bools.xml @@ -0,0 +1,4 @@ + + + true + \ No newline at end of file diff --git a/app/src/main/res/values/bools.xml b/app/src/main/res/values/bools.xml new file mode 100644 index 00000000..6aedf128 --- /dev/null +++ b/app/src/main/res/values/bools.xml @@ -0,0 +1,4 @@ + + + false + \ No newline at end of file diff --git a/app/src/main/res/values/theme.xml b/app/src/main/res/values/theme.xml index 6d1a884e..8dbfd44d 100644 --- a/app/src/main/res/values/theme.xml +++ b/app/src/main/res/values/theme.xml @@ -51,8 +51,8 @@ @color/cpp_metro_button_dark @color/cpp_material_accent - false - false + true + true @android:color/transparent false @@ -101,8 +101,8 @@ @color/cpp_material_light @color/cpp_material_light - false - false + true + true @android:color/transparent false