This commit is contained in:
Sergey Solovyev 2012-11-18 17:17:54 +04:00
parent b3396d0ffe
commit 5ae964a8b2
6 changed files with 29 additions and 4 deletions

View File

@ -4,7 +4,11 @@
<dimen name="cpp_editor_text_size">25sp</dimen> <dimen name="cpp_editor_text_size">25sp</dimen>
<dimen name="cpp_display_text_size">25sp</dimen> <dimen name="cpp_display_text_size">25sp</dimen>
<dimen name="cpp_button_text_size_mobile">35dp</dimen>
<dimen name="cpp_keyboard_button_text_size_mobile">35dp</dimen>
<dimen name="cpp_display_text_size_mobile">35sp</dimen>
<dimen name="cpp_editor_text_size_mobile">35sp</dimen>
<dimen name="cpp_keyboard_button_text_size">40dp</dimen> <dimen name="cpp_keyboard_button_text_size">40dp</dimen>
<dimen name="cpp_math_entity_text_size">25sp</dimen> <dimen name="cpp_math_entity_text_size">25sp</dimen>
<dimen name="cpp_math_entity_description_text_size">20sp</dimen> <dimen name="cpp_math_entity_description_text_size">20sp</dimen>

View File

@ -4,7 +4,11 @@
<dimen name="cpp_editor_text_size">30sp</dimen> <dimen name="cpp_editor_text_size">30sp</dimen>
<dimen name="cpp_display_text_size">30sp</dimen> <dimen name="cpp_display_text_size">30sp</dimen>
<dimen name="cpp_button_text_size_mobile">65dp</dimen>
<dimen name="cpp_keyboard_button_text_size_mobile">75dp</dimen>
<dimen name="cpp_display_text_size_mobile">75sp</dimen>
<dimen name="cpp_editor_text_size_mobile">75sp</dimen>
<dimen name="cpp_keyboard_button_text_size">40dp</dimen> <dimen name="cpp_keyboard_button_text_size">40dp</dimen>
<dimen name="cpp_math_entity_text_size">30sp</dimen> <dimen name="cpp_math_entity_text_size">30sp</dimen>
<dimen name="cpp_math_entity_description_text_size">20sp</dimen> <dimen name="cpp_math_entity_description_text_size">20sp</dimen>

View File

@ -8,7 +8,11 @@
<dimen name="cpp_keyboard_button_text_size">30dp</dimen> <dimen name="cpp_keyboard_button_text_size">30dp</dimen>
<dimen name="cpp_button_text_size">20dp</dimen> <dimen name="cpp_button_text_size">20dp</dimen>
<dimen name="cpp_button_text_size_mobile">25dp</dimen>
<dimen name="cpp_keyboard_button_text_size_mobile">20dp</dimen>
<dimen name="cpp_display_text_size_mobile">25sp</dimen>
<dimen name="cpp_editor_text_size_mobile">25sp</dimen>
<dimen name="cpp_display_text_size">25sp</dimen> <dimen name="cpp_display_text_size">25sp</dimen>
<dimen name="cpp_editor_text_size">25sp</dimen> <dimen name="cpp_editor_text_size">25sp</dimen>
<dimen name="cpp_pane_margin">5dp</dimen> <dimen name="cpp_pane_margin">5dp</dimen>

View File

@ -6,8 +6,10 @@
package org.solovyev.android.calculator; package org.solovyev.android.calculator;
import android.content.Context; import android.content.Context;
import android.content.SharedPreferences;
import android.graphics.Color; import android.graphics.Color;
import android.os.Handler; import android.os.Handler;
import android.preference.PreferenceManager;
import android.text.Html; import android.text.Html;
import android.util.AttributeSet; import android.util.AttributeSet;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
@ -167,6 +169,12 @@ public class AndroidCalculatorDisplayView extends AutoResizeTextView implements
public synchronized void init(@NotNull Context context) { public synchronized void init(@NotNull Context context) {
if (!initialized) { 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.setOnClickListener(new CalculatorDisplayOnClickListener(context));
this.initialized = true; this.initialized = true;

View File

@ -141,6 +141,11 @@ public class AndroidCalculatorEditorView extends EditText implements SharedPrefe
if (!initialized) { if (!initialized) {
final SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(context); 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); preferences.registerOnSharedPreferenceChangeListener(this);
this.addTextChangedListener(new TextWatcherImpl()); this.addTextChangedListener(new TextWatcherImpl());

View File

@ -39,7 +39,7 @@ public final class CalculatorButtons {
@NotNull View root) { @NotNull View root) {
if ( layout == CalculatorPreferences.Gui.Layout.main_calculator_mobile ) { 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<DragButton>() { AndroidUtils.processViewsOfType(root, DragButton.class, new AndroidUtils.ViewProcessor<DragButton>() {
@Override @Override