This commit is contained in:
Sergey Solovyev 2012-09-27 23:40:16 +04:00
parent 8df6c0ceab
commit 8882cb32ee
10 changed files with 377 additions and 569 deletions

View File

@ -1,46 +0,0 @@
<!--
~ Copyright (c) 2009-2011. Created by serso aka se.solovyev.
~ For more information, please, contact se.solovyev@gmail.com
~ or visit http://se.solovyev.org
-->
<resources>
<style name="default_text_size">
<item name="android:textSize">20dp</item>
</style>
<style name="button_style_parent">
<item name="android:textSize">20dp</item>
<item name="android:textColor">@color/button_text_color</item>
</style>
<style name="display_style_parent" parent="default_text">
<item name="android:textSize">25dp</item>
<item name="android:padding">3dp</item>
</style>
<style name="editor_style_parent" parent="default_text">
<item name="android:textSize">25dp</item>
<item name="android:padding">5dp</item>
</style>
<style name="about_style_parent" parent="default_text">
<item name="android:textSize">15dp</item>
<item name="android:padding">5dp</item>
</style>
<style name="math_entity_text_parent">
<item name="android:textSize">20dp</item>
</style>
<style name="math_entity_description_parent">
<item name="android:textSize">15dp</item>
</style>
<style name="add_var_button_parent">
<item name="android:paddingLeft">40dp</item>
<item name="android:paddingRight">40dp</item>
</style>
</resources>

View File

@ -0,0 +1,3 @@
<resources>
<dimen name="button_text_size">20dp</dimen>
</resources>

View File

@ -0,0 +1,3 @@
<resources>
<dimen name="button_text_size">40dp</dimen>
</resources>

View File

@ -1,46 +0,0 @@
<!--
~ Copyright (c) 2009-2011. Created by serso aka se.solovyev.
~ For more information, please, contact se.solovyev@gmail.com
~ or visit http://se.solovyev.org
-->
<resources>
<style name="default_text_size">
<item name="android:textSize">40dp</item>
</style>
<style name="button_style_parent">
<item name="android:textSize">40dp</item>
<item name="android:textColor">@color/button_text_color</item>
</style>
<style name="display_style_parent" parent="default_text">
<item name="android:textSize">35dp</item>
<item name="android:padding">3dp</item>
</style>
<style name="editor_style_parent" parent="default_text">
<item name="android:textSize">35dp</item>
<item name="android:padding">5dp</item>
</style>
<style name="about_style_parent" parent="default_text">
<item name="android:textSize">15dp</item>
<item name="android:padding">5dp</item>
</style>
<style name="math_entity_text_parent">
<item name="android:textSize">20dp</item>
</style>
<style name="math_entity_description_parent">
<item name="android:textSize">15dp</item>
</style>
<style name="add_var_button_parent">
<item name="android:paddingLeft">80dp</item>
<item name="android:paddingRight">80dp</item>
</style>
</resources>

View File

@ -1,46 +0,0 @@
<!--
~ Copyright (c) 2009-2011. Created by serso aka se.solovyev.
~ For more information, please, contact se.solovyev@gmail.com
~ or visit http://se.solovyev.org
-->
<resources>
<style name="default_text_size">
<item name="android:textSize">30dp</item>
</style>
<style name="button_style_parent">
<item name="android:textSize">30dp</item>
<item name="android:textColor">@color/button_text_color</item>
</style>
<style name="display_style_parent" parent="default_text">
<item name="android:textSize">30dp</item>
<item name="android:padding">3dp</item>
</style>
<style name="editor_style_parent" parent="default_text">
<item name="android:textSize">30dp</item>
<item name="android:padding">5dp</item>
</style>
<style name="about_style_parent" parent="default_text">
<item name="android:textSize">15dp</item>
<item name="android:padding">5dp</item>
</style>
<style name="math_entity_text_parent">
<item name="android:textSize">20dp</item>
</style>
<style name="math_entity_description_parent">
<item name="android:textSize">15dp</item>
</style>
<style name="add_var_button_parent">
<item name="android:paddingLeft">60dp</item>
<item name="android:paddingRight">60dp</item>
</style>
</resources>

View File

@ -1,46 +0,0 @@
<!--
~ Copyright (c) 2009-2011. Created by serso aka se.solovyev.
~ For more information, please, contact se.solovyev@gmail.com
~ or visit http://se.solovyev.org
-->
<resources>
<style name="default_text_size">
<item name="android:textSize">15dp</item>
</style>
<style name="button_style_parent">
<item name="android:textSize">15dp</item>
<item name="android:textColor">@color/button_text_color</item>
</style>
<style name="display_style_parent" parent="default_text">
<item name="android:textSize">20dp</item>
<item name="android:padding">3dp</item>
</style>
<style name="editor_style_parent" parent="default_text">
<item name="android:textSize">20dp</item>
<item name="android:padding">5dp</item>
</style>
<style name="about_style_parent" parent="default_text">
<item name="android:textSize">10dp</item>
<item name="android:padding">5dp</item>
</style>
<style name="math_entity_text_parent">
<item name="android:textSize">15dp</item>
</style>
<style name="math_entity_description_parent">
<item name="android:textSize">10dp</item>
</style>
<style name="add_var_button_parent">
<item name="android:paddingLeft">30dp</item>
<item name="android:paddingRight">30dp</item>
</style>
</resources>

View File

@ -0,0 +1,7 @@
<resources>
<dimen name="button_margin">0.5dp</dimen>
<dimen name="text_size">20sp</dimen>
<dimen name="button_text_size">30dp</dimen>
<dimen name="display_text_size">25sp</dimen>
<dimen name="editor_text_size">25sp</dimen>
</resources>

View File

@ -1,3 +0,0 @@
<resources>
<dimen name="button_margin">0.5dp</dimen>
</resources>

View File

@ -21,21 +21,21 @@
<style name="default_text_size"> <style name="default_text_size">
<item name="android:textSize">20dp</item> <item name="android:textSize">@dimen/text_size</item>
</style> </style>
<style name="button_style_parent"> <style name="button_style_parent">
<item name="android:textSize">20dp</item> <item name="android:textSize">@dimen/button_text_size</item>
<item name="android:textColor">@color/button_text_color</item> <item name="android:textColor">@color/button_text_color</item>
</style> </style>
<style name="display_style_parent" parent="default_text"> <style name="display_style_parent" parent="default_text">
<item name="android:textSize">25dp</item> <item name="android:textSize">@dimen/display_text_size</item>
<item name="android:padding">3dp</item> <item name="android:padding">3dp</item>
</style> </style>
<style name="editor_style_parent" parent="default_text"> <style name="editor_style_parent" parent="default_text">
<item name="android:textSize">25dp</item> <item name="android:textSize">@dimen/editor_text_size</item>
<item name="android:padding">5dp</item> <item name="android:padding">5dp</item>
</style> </style>

View File

@ -25,7 +25,6 @@ import net.robotmedia.billing.IBillingObserver;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable; import org.jetbrains.annotations.Nullable;
import org.solovyev.android.AndroidUtils; import org.solovyev.android.AndroidUtils;
import org.solovyev.android.FontSizeAdjuster;
import org.solovyev.android.calculator.about.CalculatorReleaseNotesActivity; import org.solovyev.android.calculator.about.CalculatorReleaseNotesActivity;
import org.solovyev.android.calculator.history.CalculatorHistoryFragment; import org.solovyev.android.calculator.history.CalculatorHistoryFragment;
import org.solovyev.android.calculator.history.CalculatorSavedHistoryFragment; import org.solovyev.android.calculator.history.CalculatorSavedHistoryFragment;
@ -39,13 +38,11 @@ import org.solovyev.common.equals.EqualsTool;
import org.solovyev.common.history.HistoryAction; import org.solovyev.common.history.HistoryAction;
import org.solovyev.common.text.StringUtils; import org.solovyev.common.text.StringUtils;
public class CalculatorActivity extends SherlockFragmentActivity implements FontSizeAdjuster, SharedPreferences.OnSharedPreferenceChangeListener { public class CalculatorActivity extends SherlockFragmentActivity implements SharedPreferences.OnSharedPreferenceChangeListener {
@NotNull @NotNull
public static final String TAG = CalculatorActivity.class.getSimpleName(); public static final String TAG = CalculatorActivity.class.getSimpleName();
private static final int HVGA_WIDTH_PIXELS = 320;
@Nullable @Nullable
private IBillingObserver billingObserver; private IBillingObserver billingObserver;
@ -213,21 +210,6 @@ public class CalculatorActivity extends SherlockFragmentActivity implements Font
getCalculator().evaluate(); getCalculator().evaluate();
} }
/**
* The font sizes in the layout files are specified for a HVGA display.
* Adjust the font sizes accordingly if we are running on a different
* display.
*/
@Override
public void adjustFontSize(@NotNull TextView view) {
/*float fontPixelSize = view.getTextSize();
Display display = getWindowManager().getDefaultDisplay();
int h = Math.min(display.getWidth(), display.getHeight());
float ratio = (float) h / HVGA_WIDTH_PIXELS;
view.setTextSize(TypedValue.COMPLEX_UNIT_PX, fontPixelSize * ratio);*/
}
@Override @Override
protected void onPause() { protected void onPause() {
super.onPause(); super.onPause();