From 4a58f03ca391f86703bab38d11239c3aadfd1593 Mon Sep 17 00:00:00 2001 From: serso Date: Mon, 9 Feb 2015 23:03:38 +0100 Subject: [PATCH] Light dialog preference fixed + Purchase dialog theme --- .../org/solovyev/android/calculator/Preferences.java | 12 +++++++++--- .../preferences/PurchaseDialogActivity.java | 9 +++++---- android-app/src/main/res/values/theme.xml | 3 --- 3 files changed, 14 insertions(+), 10 deletions(-) diff --git a/android-app/src/main/java/org/solovyev/android/calculator/Preferences.java b/android-app/src/main/java/org/solovyev/android/calculator/Preferences.java index 5304b51d..7b8848ce 100644 --- a/android-app/src/main/java/org/solovyev/android/calculator/Preferences.java +++ b/android-app/src/main/java/org/solovyev/android/calculator/Preferences.java @@ -34,6 +34,7 @@ import jscl.NumeralBase; import org.solovyev.android.calculator.math.MathType; import org.solovyev.android.calculator.model.AndroidCalculatorEngine; import org.solovyev.android.calculator.preferences.BasePreferencesActivity; +import org.solovyev.android.calculator.preferences.PurchaseDialogActivity; import org.solovyev.android.calculator.wizard.WizardActivity; import org.solovyev.android.prefs.*; import org.solovyev.android.view.VibratorContainer; @@ -114,7 +115,7 @@ public final class Preferences { metro_purple_theme(R.style.cpp_metro_purple_theme), metro_green_theme(R.style.cpp_metro_green_theme), material_theme(R.style.Cpp_Theme_Material), - material_light_theme(R.style.Cpp_Theme_Material_Light, R.style.Cpp_Theme_Wizard_Light, R.style.Cpp_Theme_Settings_Light), + material_light_theme(R.style.Cpp_Theme_Material_Light, R.style.Cpp_Theme_Wizard_Light, R.style.Cpp_Theme_Settings_Light, R.style.Cpp_Theme_Dialog_Material_Light), ; private static final SparseArray textColors = new SparseArray<>(); @@ -122,15 +123,17 @@ public final class Preferences { private final int themeId; private final int wizardThemeId; private final int settingsThemeId; + private final int dialogThemeId; Theme(@StyleRes int themeId) { - this(themeId, R.style.Cpp_Theme_Wizard, R.style.Cpp_Theme_Settings); + this(themeId, R.style.Cpp_Theme_Wizard, R.style.Cpp_Theme_Settings, R.style.Cpp_Theme_Dialog_Material); } - Theme(@StyleRes int themeId, @StyleRes int wizardThemeId, @StyleRes int settingsThemeId) { + Theme(@StyleRes int themeId, @StyleRes int wizardThemeId, @StyleRes int settingsThemeId, int dialogThemeId) { this.themeId = themeId; this.wizardThemeId = wizardThemeId; this.settingsThemeId = settingsThemeId; + this.dialogThemeId = dialogThemeId; } public int getThemeId() { @@ -144,6 +147,9 @@ public final class Preferences { if (context instanceof BasePreferencesActivity) { return settingsThemeId; } + if (context instanceof PurchaseDialogActivity) { + return dialogThemeId; + } return themeId; } diff --git a/android-app/src/main/java/org/solovyev/android/calculator/preferences/PurchaseDialogActivity.java b/android-app/src/main/java/org/solovyev/android/calculator/preferences/PurchaseDialogActivity.java index d3cb6466..48ebe3ae 100644 --- a/android-app/src/main/java/org/solovyev/android/calculator/preferences/PurchaseDialogActivity.java +++ b/android-app/src/main/java/org/solovyev/android/calculator/preferences/PurchaseDialogActivity.java @@ -28,7 +28,6 @@ import android.os.Bundle; import android.text.method.ScrollingMovementMethod; import android.view.View; import android.widget.TextView; -import android.support.v7.app.ActionBarActivity; import org.solovyev.android.calculator.*; import org.solovyev.android.checkout.*; import org.solovyev.android.fragments.FragmentUtils; @@ -41,7 +40,7 @@ import javax.annotation.Nullable; * Date: 1/20/13 * Time: 2:36 PM */ -public class PurchaseDialogActivity extends ActionBarActivity { +public class PurchaseDialogActivity extends BaseActivity { @Nonnull private final ActivityCheckout checkout = Checkout.forActivity(this, App.getBilling(), App.getProducts()); @@ -59,12 +58,14 @@ public class PurchaseDialogActivity extends ActionBarActivity { } }; + public PurchaseDialogActivity() { + super(R.layout.cpp_dialog); + } + @Override protected void onCreate(@Nullable Bundle savedInstanceState) { super.onCreate(savedInstanceState); - setContentView(R.layout.cpp_dialog); - FragmentUtils.createFragment(this, PurchaseDialogFragment.class, R.id.dialog_layout, "purchase-dialog"); checkout.start(); diff --git a/android-app/src/main/res/values/theme.xml b/android-app/src/main/res/values/theme.xml index 552a7172..565e60a7 100644 --- a/android-app/src/main/res/values/theme.xml +++ b/android-app/src/main/res/values/theme.xml @@ -85,8 +85,6 @@