Theme changes

This commit is contained in:
Sergey Solovyev 2012-11-19 21:47:38 +04:00
parent 1f0188be4b
commit 3467ba828f
5 changed files with 10 additions and 8 deletions

View File

@ -15,7 +15,7 @@
<org.solovyev.android.calculator.AndroidCalculatorEditorView
a:id="@+id/calculator_editor"
style="@style/cpp_editor_style"
style="@style/cpp_editor_mobile_style"
a:textIsSelectable="true"
a:singleLine="false"
a:scrollbars="vertical"

View File

@ -51,6 +51,10 @@
<item name="android:textSize">@dimen/cpp_editor_text_size</item>
</style>
<style name="cpp_editor_mobile_style" parent="cpp_editor_style">
<item name="android:textSize">@dimen/cpp_editor_text_size_mobile</item>
</style>
<style name="cpp_display_style" parent="cpp_default_text">
<item name="android:gravity">top|right</item>
<item name="android:layout_width">match_parent</item>

View File

@ -12,6 +12,7 @@ import android.os.Handler;
import android.preference.PreferenceManager;
import android.text.Html;
import android.util.AttributeSet;
import android.util.TypedValue;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.solovyev.android.calculator.text.TextProcessor;
@ -172,7 +173,7 @@ public class AndroidCalculatorDisplayView extends AutoResizeTextView implements
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));
setTextSize(TypedValue.COMPLEX_UNIT_SP, getResources().getDimension(R.dimen.cpp_display_text_size_mobile));
}
this.setOnClickListener(new CalculatorDisplayOnClickListener(context));

View File

@ -16,6 +16,7 @@ import android.text.Html;
import android.text.TextWatcher;
import android.util.AttributeSet;
import android.util.Log;
import android.util.TypedValue;
import android.view.ContextMenu;
import android.widget.EditText;
import org.jetbrains.annotations.NotNull;
@ -141,11 +142,6 @@ 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());

View File

@ -6,6 +6,7 @@ import android.content.SharedPreferences;
import android.content.res.Configuration;
import android.preference.PreferenceManager;
import android.util.Log;
import android.util.TypedValue;
import android.view.MotionEvent;
import android.view.View;
import android.widget.Button;
@ -44,7 +45,7 @@ public final class CalculatorButtons {
AndroidUtils.processViewsOfType(root, DragButton.class, new AndroidUtils.ViewProcessor<DragButton>() {
@Override
public void process(@NotNull DragButton button) {
button.setTextSize(textSize);
button.setTextSize(TypedValue.COMPLEX_UNIT_DIP, textSize);
}
});
}