changes: themes support, scale for direction text

This commit is contained in:
serso
2011-10-15 21:11:11 +04:00
parent 91acb760f1
commit c3817e417a
28 changed files with 276 additions and 103 deletions

View File

@@ -1,6 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<gradient android:startColor="#0f2e47" android:endColor="#3a5366" android:angle="90"/>
<corners android:radius="0dp" />
<shape xmlns:a="http://schemas.android.com/apk/res/android">
<gradient a:startColor="#002761"
a:endColor="#005ce5"
a:angle="90"/>
<corners a:radius="0dp" />
</shape>

View File

@@ -0,0 +1,14 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
~ 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
-->
<shape xmlns:a="http://schemas.android.com/apk/res/android">
<gradient a:startColor="#520546"
a:endColor="#8a307c"
a:angle="90"/>
<corners a:radius="0dp"/>
</shape>

View File

@@ -10,5 +10,6 @@
xmlns:calc="http://schemas.android.com/apk/res/org.solovyev.android.calculator"
a:id="@+id/divisionButton" a:text="/"
calc:textUp="√"
style="@style/digit_button_style"
calc:directionTextScale="0.5"
style="?digitButtonStyle"
a:onClick="digitButtonClickHandler"/>

View File

@@ -11,5 +11,7 @@
a:id="@+id/eightDigitButton" a:text="8"
calc:textUp="ln"
calc:textDown=""
style="@style/digit_button_style"
calc:directionTextScale="0.5"
style="?digitButtonStyle"
a:onClick="digitButtonClickHandler"/>

View File

@@ -11,5 +11,5 @@
a:text="5"
calc:textUp="cosh"
calc:textDown="acosh"
style="@style/digit_button_style"
style="?digitButtonStyle"
a:onClick="digitButtonClickHandler"/>

View File

@@ -11,5 +11,5 @@
a:text="4"
calc:textUp="sinh"
calc:textDown="asinh"
style="@style/digit_button_style"
style="?digitButtonStyle"
a:onClick="digitButtonClickHandler"/>

View File

@@ -12,5 +12,7 @@
a:text="×"
calc:textUp="^"
calc:textDown="^2"
style="@style/digit_button_style"
style="?digitButtonStyle"
calc:directionTextScale="0.5"
a:onClick="digitButtonClickHandler"/>

View File

@@ -11,5 +11,7 @@
a:id="@+id/nineDigitButton" a:text="9"
calc:textDown="e"
calc:textUp="π"
style="@style/digit_button_style"
calc:directionTextScale="0.5"
style="?digitButtonStyle"
a:onClick="digitButtonClickHandler"/>

View File

@@ -12,5 +12,5 @@
a:text="1"
calc:textUp="sin"
calc:textDown="asin"
style="@style/digit_button_style"
style="?digitButtonStyle"
a:onClick="digitButtonClickHandler"/>

View File

@@ -7,6 +7,9 @@
-->
<org.solovyev.android.view.widgets.DirectionDragButton xmlns:a="http://schemas.android.com/apk/res/android"
xmlns:calc="http://schemas.android.com/apk/res/org.solovyev.android.calculator"
a:id="@+id/plusButton" a:text="+"
style="@style/digit_button_style"
a:id="@+id/plusButton"
calc:directionTextScale="0.5"
a:text="+"
style="?digitButtonStyle"
a:onClick="digitButtonClickHandler"/>

View File

@@ -11,5 +11,7 @@
a:id="@+id/roundBracketsButton" a:text="()"
calc:textUp="("
calc:textDown=")"
style="@style/digit_button_style"
calc:directionTextScale="0.5"
style="?digitButtonStyle"
a:onClick="digitButtonClickHandler"/>

View File

@@ -11,5 +11,7 @@
a:id="@+id/sevenDigitButton" a:text="7"
calc:textUp="i"
calc:textDown=""
style="@style/digit_button_style"
calc:directionTextScale="0.5"
style="?digitButtonStyle"
a:onClick="digitButtonClickHandler"/>

View File

@@ -11,5 +11,5 @@
a:id="@+id/sixDigitButton" a:text="6"
calc:textUp="tanh"
calc:textDown="atanh"
style="@style/digit_button_style"
style="?digitButtonStyle"
a:onClick="digitButtonClickHandler"/>

View File

@@ -11,5 +11,7 @@
a:id="@+id/squareBracketsButton" a:text="[]"
calc:textUp="["
calc:textDown="]"
style="@style/digit_button_style"
calc:directionTextScale="0.5"
style="?digitButtonStyle"
a:onClick="digitButtonClickHandler"/>

View File

@@ -10,5 +10,7 @@
a:id="@+id/subtractionButton" a:text="-"
calc:textUp="{"
calc:textDown="}"
style="@style/digit_button_style"
calc:directionTextScale="0.5"
style="?digitButtonStyle"
a:onClick="digitButtonClickHandler"/>

View File

@@ -12,5 +12,5 @@
a:text="3"
calc:textUp="tan"
calc:textDown="atan"
style="@style/digit_button_style"
style="?digitButtonStyle"
a:onClick="digitButtonClickHandler"/>

View File

@@ -12,5 +12,5 @@
a:text="2"
calc:textUp="cos"
calc:textDown="acos"
style="@style/digit_button_style"
style="?digitButtonStyle"
a:onClick="digitButtonClickHandler"/>

View File

@@ -11,5 +11,7 @@
a:id="@+id/zeroDigitButton" a:text="0"
calc:textUp="."
calc:textDown=","
style="@style/digit_button_style"
calc:directionTextScale="0.5"
style="?digitButtonStyle"
a:onClick="digitButtonClickHandler"/>

View File

@@ -27,7 +27,7 @@
calc:textDown="@string/c_down"
a:layout_width="80dp"
a:layout_height="80dp"
style="@style/digit_button_style"/>
style="?digitButtonStyle"/>
<org.solovyev.android.view.widgets.DirectionDragButton a:id="@+id/calibrationButtonRight"
a:text=""
@@ -35,7 +35,7 @@
calc:textDown="@string/c_down"
a:layout_width="80dp"
a:layout_height="80dp"
style="@style/digit_button_style"/>
style="?digitButtonStyle"/>
<ImageView a:id="@+id/calibrationArrowRight"
a:layout_gravity="right"

18
res/values/arrays.xml Normal file
View File

@@ -0,0 +1,18 @@
<!--
~ 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>
<string-array name="p_theme_names">
<item>Default</item>
<item>Violet</item>
<item>Light blue</item>
</string-array>
<string-array name="p_theme_values">
<item>default_theme</item>
<item>violet_theme</item>
<item>light_blue_theme</item>
</string-array>
</resources>

View File

@@ -3,6 +3,7 @@
<declare-styleable name="DragButton">
<attr name="textUp" format="string"/>
<attr name="textDown" format="string"/>
<attr name="directionTextScale" format="float"/>
</declare-styleable>
<declare-styleable name="NumberRangeSeekBar">
@@ -10,4 +11,6 @@
<attr name="steps" format="integer"/>
</declare-styleable>
<attr name="digitButtonStyle" format="reference" />
</resources>

View File

@@ -20,4 +20,8 @@
<string name="p_calc_color_display">true</string>
<string name="p_calc_vars">org.solovyev.android.calculator.CalculatorModel_vars</string>
<string name="p_calc_theme_key">org.solovyev.android.calculator.CalculatorActivity_calc_theme</string>
<string name="p_calc_theme">default_theme</string>
</resources>

View File

@@ -75,4 +75,5 @@
<string name="c_history_is_empty">History is empty!</string>
<string name="c_app_history">History</string>
<string name="c_char_is_not_accepted">Character \'%s\' is not accepted in variable name!</string>
<string name="c_calc_theme">Theme</string>
</resources>

View File

@@ -15,13 +15,23 @@
<item name="android:textSize">20dp</item>
<item name="android:background">@drawable/button</item>
<item name="android:layout_marginLeft">1dp</item>
<item name="android:layout_marginBottom">1dp</item>
</style>
<style name="digit_button_style" parent="button_style">
<style name="default_digit_button_style" parent="button_style">
<item name="android:background">@drawable/blue_button</item>
</style>
<style name="violet_digit_button_style" parent="button_style">
<item name="android:background">@drawable/violet_button</item>
</style>
<style name="light_blue_digit_button_style" parent="button_style">
<item name="android:background">@drawable/light_blue_button</item>
</style>
<style name="control_button_style" parent="button_style"/>
<style name="control_image_button_style" parent="control_button_style">
<item name="android:padding">6dp</item>
</style>
@@ -56,5 +66,16 @@
<item name="android:layout_height">match_parent</item>
</style>
<style name="default_theme">
<item name="digitButtonStyle">@style/default_digit_button_style</item>
</style>
<style name="violet_theme">
<item name="digitButtonStyle">@style/violet_digit_button_style</item>
</style>
<style name="light_blue_theme">
<item name="digitButtonStyle">@style/light_blue_digit_button_style</item>
</style>
</resources>

View File

@@ -11,33 +11,42 @@
range:boundaries="0;10"/>
<android.preference.CheckBoxPreference
a:key="@string/p_calc_color_display_key"
a:title="@string/c_calc_color_display_title"
a:defaultValue="true"/>
a:key="@string/p_calc_color_display_key"
a:title="@string/c_calc_color_display_title"
a:defaultValue="true"/>
<!-- <org.solovyev.android.view.prefs.FloatRangeSeekBarPreference
a:key="@string/p_drag_distance_key"
a:title="Distance of drag event"
a:text=" pxs"
a:defaultValue="15;350"
range:steps="10"
range:boundaries="10;500"/>
<ListPreference a:key="@string/p_calc_theme_key"
a:title="@string/c_calc_theme"
a:entries="@array/p_theme_names"
a:entryValues="@array/p_theme_values"
a:persistent="true"
a:defaultValue="2"
a:shouldDisableView="false"/>
<org.solovyev.android.view.prefs.FloatRangeSeekBarPreference
a:key="@string/p_drag_duration_key"
a:title="Duration of drag event"
a:text=" ms"
a:defaultValue="40;2500"
range:steps="10"
range:boundaries="5;4000"/>
<org.solovyev.android.view.prefs.FloatRangeSeekBarPreference
a:key="@string/p_drag_angle_key"
a:title="Angle of drag event"
a:text=" degrees"
a:defaultValue="0;45"
range:steps="5"
range:boundaries="0;45"/>-->
<!-- <org.solovyev.android.view.prefs.FloatRangeSeekBarPreference
a:key="@string/p_drag_distance_key"
a:title="Distance of drag event"
a:text=" pxs"
a:defaultValue="15;350"
range:steps="10"
range:boundaries="10;500"/>
<org.solovyev.android.view.prefs.FloatRangeSeekBarPreference
a:key="@string/p_drag_duration_key"
a:title="Duration of drag event"
a:text=" ms"
a:defaultValue="40;2500"
range:steps="10"
range:boundaries="5;4000"/>
<org.solovyev.android.view.prefs.FloatRangeSeekBarPreference
a:key="@string/p_drag_angle_key"
a:title="Angle of drag event"
a:text=" degrees"
a:defaultValue="0;45"
range:steps="5"
range:boundaries="0;45"/>-->
</PreferenceCategory>