Tablet boolean + dialog theme fixes

This commit is contained in:
serso 2016-02-22 11:06:19 +01:00
parent 161e99f1db
commit 81648f19c6
4 changed files with 30 additions and 14 deletions

View File

@ -22,6 +22,11 @@
package org.solovyev.android.calculator; 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.app.Application;
import android.content.ContentResolver; import android.content.ContentResolver;
import android.content.Context; import android.content.Context;
@ -34,25 +39,27 @@ import android.support.annotation.LayoutRes;
import android.support.annotation.StyleRes; import android.support.annotation.StyleRes;
import android.util.SparseArray; import android.util.SparseArray;
import android.view.ContextThemeWrapper; import android.view.ContextThemeWrapper;
import jscl.AngleUnit;
import jscl.NumeralBase;
import org.solovyev.android.Check; import org.solovyev.android.Check;
import org.solovyev.android.calculator.language.Languages; import org.solovyev.android.calculator.language.Languages;
import org.solovyev.android.calculator.math.MathType; import org.solovyev.android.calculator.math.MathType;
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 jscl.AngleUnit;
import jscl.NumeralBase;
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 static org.solovyev.android.Android.isPhoneModel; import javax.annotation.Nonnull;
import static org.solovyev.android.DeviceModel.samsung_galaxy_s; import javax.annotation.Nullable;
import static org.solovyev.android.DeviceModel.samsung_galaxy_s_2;
import static org.solovyev.android.prefs.IntegerPreference.DEF_VALUE;
public final class Preferences { public final class Preferences {
@ -323,10 +330,11 @@ public final class Preferences {
this.light = theme == R.style.Cpp_Theme_Material_Light; 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) { if (context instanceof WizardActivity) {
return wizardTheme; return wizardTheme;
} }
final boolean tablet = context.getResources().getBoolean(R.bool.cpp_tablet);
return theme; return theme;
} }

View File

@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<bool name="cpp_tablet">true</bool>
</resources>

View File

@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<bool name="cpp_tablet">false</bool>
</resources>

View File

@ -51,8 +51,8 @@
<item name="colorPrimaryDark">@color/cpp_metro_button_dark</item> <item name="colorPrimaryDark">@color/cpp_metro_button_dark</item>
<item name="colorAccent">@color/cpp_material_accent</item> <item name="colorAccent">@color/cpp_material_accent</item>
<item name="windowNoTitle">false</item> <item name="windowNoTitle">true</item>
<item name="android:windowNoTitle">false</item> <item name="android:windowNoTitle">true</item>
<item name="android:windowTitleBackgroundStyle">@android:color/transparent</item> <item name="android:windowTitleBackgroundStyle">@android:color/transparent</item>
<item name="windowActionBar">false</item> <item name="windowActionBar">false</item>
@ -101,8 +101,8 @@
<item name="colorPrimaryDark">@color/cpp_material_light</item> <item name="colorPrimaryDark">@color/cpp_material_light</item>
<item name="colorAccent">@color/cpp_material_light</item> <item name="colorAccent">@color/cpp_material_light</item>
<item name="windowNoTitle">false</item> <item name="windowNoTitle">true</item>
<item name="android:windowNoTitle">false</item> <item name="android:windowNoTitle">true</item>
<item name="android:windowTitleBackgroundStyle">@android:color/transparent</item> <item name="android:windowTitleBackgroundStyle">@android:color/transparent</item>
<item name="windowActionBar">false</item> <item name="windowActionBar">false</item>