From 5ae964a8b2139c978f60f97972616b6b74a882e7 Mon Sep 17 00:00:00 2001 From: Sergey Solovyev Date: Sun, 18 Nov 2012 17:17:54 +0400 Subject: [PATCH] Changes --- calculatorpp/res/values-large/dimens.xml | 6 +++++- calculatorpp/res/values-xlarge/dimens.xml | 6 +++++- calculatorpp/res/values/dimens.xml | 6 +++++- .../android/calculator/AndroidCalculatorDisplayView.java | 8 ++++++++ .../android/calculator/AndroidCalculatorEditorView.java | 5 +++++ .../solovyev/android/calculator/CalculatorButtons.java | 2 +- 6 files changed, 29 insertions(+), 4 deletions(-) diff --git a/calculatorpp/res/values-large/dimens.xml b/calculatorpp/res/values-large/dimens.xml index a63eddf6..be3c703a 100644 --- a/calculatorpp/res/values-large/dimens.xml +++ b/calculatorpp/res/values-large/dimens.xml @@ -4,7 +4,11 @@ 25sp 25sp - 35dp + + 35dp + 35sp + 35sp + 40dp 25sp 20sp diff --git a/calculatorpp/res/values-xlarge/dimens.xml b/calculatorpp/res/values-xlarge/dimens.xml index 1e5865e7..c395eb6e 100644 --- a/calculatorpp/res/values-xlarge/dimens.xml +++ b/calculatorpp/res/values-xlarge/dimens.xml @@ -4,7 +4,11 @@ 30sp 30sp - 65dp + + 75dp + 75sp + 75sp + 40dp 30sp 20sp diff --git a/calculatorpp/res/values/dimens.xml b/calculatorpp/res/values/dimens.xml index e0332951..b9a22b58 100644 --- a/calculatorpp/res/values/dimens.xml +++ b/calculatorpp/res/values/dimens.xml @@ -8,7 +8,11 @@ 30dp 20dp - 25dp + + 20dp + 25sp + 25sp + 25sp 25sp 5dp diff --git a/calculatorpp/src/main/java/org/solovyev/android/calculator/AndroidCalculatorDisplayView.java b/calculatorpp/src/main/java/org/solovyev/android/calculator/AndroidCalculatorDisplayView.java index 997eea5a..9c038f73 100644 --- a/calculatorpp/src/main/java/org/solovyev/android/calculator/AndroidCalculatorDisplayView.java +++ b/calculatorpp/src/main/java/org/solovyev/android/calculator/AndroidCalculatorDisplayView.java @@ -6,8 +6,10 @@ package org.solovyev.android.calculator; import android.content.Context; +import android.content.SharedPreferences; import android.graphics.Color; import android.os.Handler; +import android.preference.PreferenceManager; import android.text.Html; import android.util.AttributeSet; import org.jetbrains.annotations.NotNull; @@ -167,6 +169,12 @@ public class AndroidCalculatorDisplayView extends AutoResizeTextView implements public synchronized void init(@NotNull Context context) { if (!initialized) { + final SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(context); + final CalculatorPreferences.Gui.Layout layout = CalculatorPreferences.Gui.getLayout(preferences); + if ( layout == CalculatorPreferences.Gui.Layout.main_calculator_mobile ) { + setTextSize(getResources().getDimension(R.dimen.cpp_display_text_size_mobile)); + } + this.setOnClickListener(new CalculatorDisplayOnClickListener(context)); this.initialized = true; diff --git a/calculatorpp/src/main/java/org/solovyev/android/calculator/AndroidCalculatorEditorView.java b/calculatorpp/src/main/java/org/solovyev/android/calculator/AndroidCalculatorEditorView.java index c2711fb5..3a7f081d 100644 --- a/calculatorpp/src/main/java/org/solovyev/android/calculator/AndroidCalculatorEditorView.java +++ b/calculatorpp/src/main/java/org/solovyev/android/calculator/AndroidCalculatorEditorView.java @@ -141,6 +141,11 @@ public class AndroidCalculatorEditorView extends EditText implements SharedPrefe if (!initialized) { final SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(context); + final CalculatorPreferences.Gui.Layout layout = CalculatorPreferences.Gui.getLayout(preferences); + if ( layout == CalculatorPreferences.Gui.Layout.main_calculator_mobile ) { + setTextSize(getResources().getDimension(R.dimen.cpp_editor_text_size_mobile)); + } + preferences.registerOnSharedPreferenceChangeListener(this); this.addTextChangedListener(new TextWatcherImpl()); diff --git a/calculatorpp/src/main/java/org/solovyev/android/calculator/CalculatorButtons.java b/calculatorpp/src/main/java/org/solovyev/android/calculator/CalculatorButtons.java index 835500b2..db2dad20 100644 --- a/calculatorpp/src/main/java/org/solovyev/android/calculator/CalculatorButtons.java +++ b/calculatorpp/src/main/java/org/solovyev/android/calculator/CalculatorButtons.java @@ -39,7 +39,7 @@ public final class CalculatorButtons { @NotNull View root) { if ( layout == CalculatorPreferences.Gui.Layout.main_calculator_mobile ) { - final float textSize = root.getResources().getDimension(R.dimen.cpp_button_text_size_mobile); + final float textSize = root.getResources().getDimension(R.dimen.cpp_keyboard_button_text_size_mobile); AndroidUtils.processViewsOfType(root, DragButton.class, new AndroidUtils.ViewProcessor() { @Override