layout
This commit is contained in:
parent
53ed2854fb
commit
a3929945a8
@ -13,15 +13,7 @@
|
||||
a:orientation="vertical"
|
||||
a:layout_gravity="center">
|
||||
|
||||
<LinearLayout a:layout_weight="2" a:layout_width="match_parent" a:layout_height="0dp">
|
||||
|
||||
<org.solovyev.android.calculator.CalculatorEditor
|
||||
a:id="@+id/editText"
|
||||
style="@style/display_style"
|
||||
a:inputType="textMultiLine"
|
||||
a:singleLine="false"/>
|
||||
|
||||
</LinearLayout>
|
||||
<include layout="@layout/calc_editor"/>
|
||||
|
||||
<LinearLayout a:layout_weight="1" a:layout_width="match_parent" a:layout_height="0dp">
|
||||
|
||||
@ -33,21 +25,13 @@
|
||||
a:onClick="moveLeftButtonClickHandler"/>
|
||||
|
||||
<org.solovyev.android.view.widgets.DirectionDragButton a:id="@+id/eraseButton"
|
||||
a:text="↚"
|
||||
a:text="@string/c_erase"
|
||||
a:layout_weight="1.5"
|
||||
style="@style/control_button_style"
|
||||
a:onClick="eraseButtonClickHandler"/>
|
||||
|
||||
<org.solovyev.android.calculator.CalculatorDisplay
|
||||
a:id="@+id/resultEditText"
|
||||
style="@style/display_style"
|
||||
a:gravity="right|top"
|
||||
a:layout_weight="1"
|
||||
a:minLines="1"
|
||||
a:maxLines="1"
|
||||
a:textStyle="bold"
|
||||
a:scrollHorizontally="true"
|
||||
a:scrollbars="none"/>
|
||||
<include layout="@layout/calc_display"/>
|
||||
|
||||
|
||||
<org.solovyev.android.view.widgets.DirectionDragButton a:id="@+id/clearButton"
|
||||
a:text="@string/c_clear"
|
||||
@ -67,129 +51,38 @@
|
||||
|
||||
<LinearLayout a:layout_weight="1" a:layout_width="match_parent" a:layout_height="0dp">
|
||||
|
||||
<org.solovyev.android.view.widgets.DirectionDragButton a:id="@+id/oneDigitButton"
|
||||
a:text="1"
|
||||
calc:textUp="sin"
|
||||
calc:textDown="asin"
|
||||
style="@style/digit_button_style"
|
||||
a:onClick="digitButtonClickHandler"/>
|
||||
<include layout="@layout/calc_one_digit_button"/>
|
||||
<include layout="@layout/calc_two_digit_button"/>
|
||||
<include layout="@layout/calc_three_digit_button"/>
|
||||
<include layout="@layout/calc_multiplication_button"/>
|
||||
<include layout="@layout/calc_division_button"/>
|
||||
<include layout="@layout/calc_equals_button"/>
|
||||
<include layout="@layout/calc_paste_button"/>
|
||||
|
||||
<org.solovyev.android.view.widgets.DirectionDragButton a:id="@+id/twoDigitButton"
|
||||
a:text="2"
|
||||
calc:textUp="cos"
|
||||
calc:textDown="acos" style="@style/digit_button_style"
|
||||
a:onClick="digitButtonClickHandler"/>
|
||||
|
||||
<org.solovyev.android.view.widgets.DirectionDragButton a:id="@+id/threeDigitButton" a:text="3" calc:textUp="tan"
|
||||
calc:textDown="atan" style="@style/digit_button_style"
|
||||
a:onClick="digitButtonClickHandler"/>
|
||||
|
||||
<org.solovyev.android.view.widgets.DirectionDragButton a:id="@+id/multiplicationButton" a:text="×"
|
||||
calc:textUp="^"
|
||||
calc:textDown="^2" style="@style/digit_button_style"
|
||||
a:onClick="digitButtonClickHandler"/>
|
||||
|
||||
<org.solovyev.android.view.widgets.DirectionDragButton a:id="@+id/divisionButton" a:text="/"
|
||||
calc:textUp="√"
|
||||
style="@style/digit_button_style"
|
||||
a:onClick="digitButtonClickHandler"/>
|
||||
|
||||
<org.solovyev.android.view.widgets.DirectionDragButton a:id="@+id/equalsButton"
|
||||
a:text="="
|
||||
a:layout_width="fill_parent"
|
||||
style="@style/control_button_style"
|
||||
a:onClick="numericButtonClickHandler"/>
|
||||
|
||||
<ImageButton a:id="@+id/pasteButton"
|
||||
a:src="@drawable/paste"
|
||||
style="@style/control_button_style"
|
||||
a:onClick="pasteButtonClickHandler"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout a:layout_weight="1" a:layout_width="match_parent" a:layout_height="0dp">
|
||||
|
||||
<org.solovyev.android.view.widgets.DirectionDragButton a:id="@+id/fourDigitButton"
|
||||
a:text="4"
|
||||
calc:textUp="sinh"
|
||||
calc:textDown="asinh"
|
||||
style="@style/digit_button_style"
|
||||
a:onClick="digitButtonClickHandler"/>
|
||||
<include layout="@layout/calc_four_digit_button"/>
|
||||
<include layout="@layout/calc_five_digit_button"/>
|
||||
<include layout="@layout/calc_six_digit_button"/>
|
||||
<include layout="@layout/calc_plus_button"/>
|
||||
<include layout="@layout/calc_subtraction_button"/>
|
||||
<include layout="@layout/calc_square_brackets_button"/>
|
||||
<include layout="@layout/calc_history_button"/>
|
||||
|
||||
<org.solovyev.android.view.widgets.DirectionDragButton a:id="@+id/fiveDigitButton"
|
||||
a:text="5"
|
||||
calc:textUp="cosh"
|
||||
calc:textDown="acosh"
|
||||
style="@style/digit_button_style"
|
||||
a:onClick="digitButtonClickHandler"/>
|
||||
|
||||
<org.solovyev.android.view.widgets.DirectionDragButton a:id="@+id/sixDigitButton" a:text="6"
|
||||
calc:textUp="tanh"
|
||||
calc:textDown="atanh"
|
||||
style="@style/digit_button_style"
|
||||
a:onClick="digitButtonClickHandler"/>
|
||||
|
||||
<org.solovyev.android.view.widgets.DirectionDragButton a:id="@+id/plusButton" a:text="+"
|
||||
style="@style/digit_button_style"
|
||||
a:onClick="digitButtonClickHandler"/>
|
||||
|
||||
<org.solovyev.android.view.widgets.DirectionDragButton a:id="@+id/minusButton" a:text="-"
|
||||
calc:textUp="{"
|
||||
calc:textDown="}"
|
||||
style="@style/digit_button_style"
|
||||
a:onClick="digitButtonClickHandler"/>
|
||||
|
||||
<org.solovyev.android.view.widgets.DirectionDragButton a:id="@+id/squareBracketsButton" a:text="[]"
|
||||
calc:textUp="["
|
||||
calc:textDown="]" style="@style/digit_button_style"
|
||||
a:onClick="digitButtonClickHandler"/>
|
||||
|
||||
<org.solovyev.android.view.widgets.DirectionDragButton a:id="@+id/historyButton"
|
||||
a:text=""
|
||||
calc:textUp="@string/c_undo"
|
||||
calc:textDown="@string/c_redo"
|
||||
style="@style/control_button_style"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout a:layout_weight="1" a:layout_width="match_parent" a:layout_height="0dp">
|
||||
|
||||
<org.solovyev.android.view.widgets.DirectionDragButton a:id="@+id/sevenDigitButton" a:text="7"
|
||||
calc:textUp="i"
|
||||
calc:textDown=""
|
||||
style="@style/digit_button_style"
|
||||
a:onClick="digitButtonClickHandler"/>
|
||||
|
||||
<org.solovyev.android.view.widgets.DirectionDragButton a:id="@+id/eightDigitButton" a:text="8"
|
||||
calc:textUp="ln"
|
||||
calc:textDown=""
|
||||
style="@style/digit_button_style"
|
||||
a:onClick="digitButtonClickHandler"/>
|
||||
|
||||
<org.solovyev.android.view.widgets.DirectionDragButton a:id="@+id/nineDigitButton" a:text="9"
|
||||
calc:textDown="e"
|
||||
calc:textUp="π"
|
||||
style="@style/digit_button_style"
|
||||
a:onClick="digitButtonClickHandler"/>
|
||||
|
||||
<org.solovyev.android.view.widgets.DirectionDragButton a:id="@+id/zeroDigitButton" a:text="0"
|
||||
calc:textUp="."
|
||||
calc:textDown=","
|
||||
style="@style/digit_button_style"
|
||||
a:onClick="digitButtonClickHandler"/>
|
||||
|
||||
<org.solovyev.android.view.widgets.DirectionDragButton a:id="@+id/roundBracketsButton" a:text="()"
|
||||
calc:textUp="("
|
||||
calc:textDown=")" style="@style/digit_button_style"
|
||||
a:onClick="digitButtonClickHandler"/>
|
||||
|
||||
<org.solovyev.android.view.widgets.DirectionDragButton
|
||||
a:id="@+id/varsButton"
|
||||
a:text="π,e,…"
|
||||
a:textStyle="italic"
|
||||
a:onClick="varsButtonClickHandler"
|
||||
style="@style/control_button_style"/>
|
||||
|
||||
<include layout="@layout/calc_seven_digit_button"/>
|
||||
<include layout="@layout/calc_eight_digit_button"/>
|
||||
<include layout="@layout/calc_nine_digit_button"/>
|
||||
<include layout="@layout/calc_zero_digit_button"/>
|
||||
<include layout="@layout/calc_round_brackets_button"/>
|
||||
<include layout="@layout/calc_vars_button"/>
|
||||
<org.solovyev.android.view.widgets.DirectionDragButton a:text="" style="@style/control_button_style"/>
|
||||
|
||||
|
||||
|
@ -1,7 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
|
||||
<LinearLayout xmlns:a="http://schemas.android.com/apk/res/android"
|
||||
xmlns:calc="http://schemas.android.com/apk/res/org.solovyev.android.calculator"
|
||||
a:orientation="vertical"
|
||||
a:layout_width="match_parent"
|
||||
a:layout_height="match_parent"
|
||||
@ -13,195 +12,69 @@
|
||||
a:orientation="vertical"
|
||||
a:layout_gravity="center">
|
||||
|
||||
<LinearLayout a:layout_weight="2" a:layout_width="match_parent" a:layout_height="0dp">
|
||||
<include layout="@layout/calc_editor"/>
|
||||
|
||||
<org.solovyev.android.calculator.CalculatorEditor
|
||||
a:id="@+id/editText"
|
||||
style="@style/display_style"
|
||||
a:inputType="textMultiLine"
|
||||
a:singleLine="false"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout a:layout_weight="1" a:layout_width="match_parent" a:layout_height="0dp">
|
||||
|
||||
|
||||
<org.solovyev.android.view.widgets.DirectionDragButton a:id="@+id/equalsButton"
|
||||
<org.solovyev.android.view.widgets.DirectionDragButton
|
||||
xmlns:a="http://schemas.android.com/apk/res/android"
|
||||
a:id="@+id/equalsButton"
|
||||
a:text="="
|
||||
a:layout_width="fill_parent"
|
||||
a:layout_weight="4"
|
||||
style="@style/control_button_style"
|
||||
a:onClick="numericButtonClickHandler"/>
|
||||
|
||||
<org.solovyev.android.calculator.CalculatorDisplay
|
||||
a:id="@+id/resultEditText"
|
||||
style="@style/display_style"
|
||||
a:gravity="right|top"
|
||||
a:layout_weight="1"
|
||||
a:minLines="1"
|
||||
a:maxLines="1"
|
||||
a:textStyle="bold"
|
||||
a:scrollHorizontally="true"
|
||||
a:scrollbars="none"/>
|
||||
<include layout="@layout/calc_display"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout a:layout_weight="1" a:layout_width="match_parent" a:layout_height="0dp">
|
||||
|
||||
<org.solovyev.android.view.widgets.DirectionDragButton a:id="@+id/oneDigitButton" a:text="1" calc:textUp="sin"
|
||||
calc:textDown="asin" style="@style/digit_button_style"
|
||||
a:onClick="digitButtonClickHandler"/>
|
||||
|
||||
<org.solovyev.android.view.widgets.DirectionDragButton a:id="@+id/twoDigitButton" a:text="2" calc:textUp="cos"
|
||||
calc:textDown="acos" style="@style/digit_button_style"
|
||||
a:onClick="digitButtonClickHandler"/>
|
||||
|
||||
<org.solovyev.android.view.widgets.DirectionDragButton a:id="@+id/threeDigitButton" a:text="3" calc:textUp="tan"
|
||||
calc:textDown="atan" style="@style/digit_button_style"
|
||||
a:onClick="digitButtonClickHandler"/>
|
||||
|
||||
<org.solovyev.android.view.widgets.DirectionDragButton a:id="@+id/multiplicationButton" a:text="×"
|
||||
calc:textUp="^"
|
||||
calc:textDown="^2" style="@style/digit_button_style"
|
||||
a:onClick="digitButtonClickHandler"/>
|
||||
|
||||
<org.solovyev.android.view.widgets.DirectionDragButton a:id="@+id/clearButton"
|
||||
a:text="@string/c_clear"
|
||||
style="@style/control_button_style"
|
||||
a:onClick="clearButtonClickHandler"/>
|
||||
<include layout="@layout/calc_one_digit_button"/>
|
||||
<include layout="@layout/calc_two_digit_button"/>
|
||||
<include layout="@layout/calc_three_digit_button"/>
|
||||
<include layout="@layout/calc_multiplication_button"/>
|
||||
<include layout="@layout/calc_clear_button"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout a:layout_weight="1" a:layout_width="match_parent" a:layout_height="0dp">
|
||||
|
||||
<org.solovyev.android.view.widgets.DirectionDragButton a:id="@+id/fourDigitButton"
|
||||
a:text="4"
|
||||
calc:textUp="sinh"
|
||||
calc:textDown="asinh"
|
||||
style="@style/digit_button_style"
|
||||
a:onClick="digitButtonClickHandler"/>
|
||||
|
||||
<org.solovyev.android.view.widgets.DirectionDragButton a:id="@+id/fiveDigitButton"
|
||||
a:text="5"
|
||||
calc:textUp="cosh"
|
||||
calc:textDown="acosh"
|
||||
style="@style/digit_button_style"
|
||||
a:onClick="digitButtonClickHandler"/>
|
||||
|
||||
<org.solovyev.android.view.widgets.DirectionDragButton a:id="@+id/sixDigitButton" a:text="6"
|
||||
calc:textUp="tanh"
|
||||
calc:textDown="atanh"
|
||||
style="@style/digit_button_style"
|
||||
a:onClick="digitButtonClickHandler"/>
|
||||
|
||||
<org.solovyev.android.view.widgets.DirectionDragButton a:id="@+id/divisionButton" a:text="/"
|
||||
calc:textUp="√"
|
||||
style="@style/digit_button_style"
|
||||
a:onClick="digitButtonClickHandler"/>
|
||||
|
||||
<org.solovyev.android.view.widgets.DirectionDragButton a:id="@+id/eraseButton"
|
||||
a:text="↚"
|
||||
style="@style/control_button_style"
|
||||
a:onClick="eraseButtonClickHandler"/>
|
||||
<include layout="@layout/calc_four_digit_button"/>
|
||||
<include layout="@layout/calc_five_digit_button"/>
|
||||
<include layout="@layout/calc_six_digit_button"/>
|
||||
<include layout="@layout/calc_division_button"/>
|
||||
<include layout="@layout/calc_erase_button"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout a:layout_weight="1" a:layout_width="match_parent" a:layout_height="0dp">
|
||||
|
||||
<org.solovyev.android.view.widgets.DirectionDragButton a:id="@+id/sevenDigitButton" a:text="7"
|
||||
calc:textUp="i"
|
||||
calc:textDown=""
|
||||
style="@style/digit_button_style"
|
||||
a:onClick="digitButtonClickHandler"/>
|
||||
|
||||
<org.solovyev.android.view.widgets.DirectionDragButton a:id="@+id/eightDigitButton" a:text="8"
|
||||
calc:textUp="ln"
|
||||
calc:textDown=""
|
||||
style="@style/digit_button_style"
|
||||
a:onClick="digitButtonClickHandler"/>
|
||||
|
||||
<org.solovyev.android.view.widgets.DirectionDragButton a:id="@+id/nineDigitButton" a:text="9"
|
||||
calc:textDown="e"
|
||||
calc:textUp="π"
|
||||
style="@style/digit_button_style"
|
||||
a:onClick="digitButtonClickHandler"/>
|
||||
|
||||
<org.solovyev.android.view.widgets.DirectionDragButton a:id="@+id/plusButton" a:text="+"
|
||||
style="@style/digit_button_style"
|
||||
a:onClick="digitButtonClickHandler"/>
|
||||
|
||||
<ImageButton a:id="@+id/pasteButton"
|
||||
a:src="@drawable/paste"
|
||||
style="@style/control_button_style"
|
||||
a:onClick="pasteButtonClickHandler"/>
|
||||
|
||||
<include layout="@layout/calc_seven_digit_button"/>
|
||||
<include layout="@layout/calc_eight_digit_button"/>
|
||||
<include layout="@layout/calc_nine_digit_button"/>
|
||||
<include layout="@layout/calc_plus_button"/>
|
||||
<include layout="@layout/calc_paste_button"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout a:layout_weight="1" a:layout_width="match_parent" a:layout_height="0dp">
|
||||
|
||||
<org.solovyev.android.view.widgets.DirectionDragButton a:id="@+id/roundBracketsButton" a:text="()"
|
||||
calc:textUp="("
|
||||
calc:textDown=")" style="@style/digit_button_style"
|
||||
a:onClick="digitButtonClickHandler"/>
|
||||
|
||||
<org.solovyev.android.view.widgets.DirectionDragButton a:id="@+id/zeroDigitButton" a:text="0"
|
||||
calc:textUp="."
|
||||
calc:textDown=","
|
||||
style="@style/digit_button_style"
|
||||
a:onClick="digitButtonClickHandler"/>
|
||||
|
||||
|
||||
<org.solovyev.android.view.widgets.DirectionDragButton a:id="@+id/squareBracketsButton" a:text="[]"
|
||||
calc:textUp="["
|
||||
calc:textDown="]" style="@style/digit_button_style"
|
||||
a:onClick="digitButtonClickHandler"/>
|
||||
|
||||
<org.solovyev.android.view.widgets.DirectionDragButton a:id="@+id/subtractionButton" a:text="-"
|
||||
calc:textUp="{"
|
||||
calc:textDown="}"
|
||||
style="@style/digit_button_style"
|
||||
a:onClick="digitButtonClickHandler"/>
|
||||
|
||||
<org.solovyev.android.view.widgets.DirectionDragButton a:id="@+id/historyButton"
|
||||
a:text=""
|
||||
calc:textUp="@string/c_undo"
|
||||
calc:textDown="@string/c_redo"
|
||||
style="@style/control_button_style"/>
|
||||
<include layout="@layout/calc_round_brackets_button"/>
|
||||
<include layout="@layout/calc_zero_digit_button"/>
|
||||
<include layout="@layout/calc_square_brackets_button"/>
|
||||
<include layout="@layout/calc_subtraction_button"/>
|
||||
<include layout="@layout/calc_history_button"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
|
||||
<LinearLayout a:layout_weight="1" a:layout_width="match_parent" a:layout_height="0dp">
|
||||
|
||||
|
||||
<!-- <org.solovyev.android.view.widgets.DirectionDragButton a:id="@+id/numericButton" a:text="numeric"
|
||||
style="@style/digit_button_style"
|
||||
a:onClick="numericButtonClickHandler"/>
|
||||
|
||||
<org.solovyev.android.view.widgets.DirectionDragButton a:id="@+id/simplifyButton" a:text="simplify"
|
||||
style="@style/digit_button_style"
|
||||
a:onClick="simplifyButtonClickHandler"/>-->
|
||||
|
||||
<org.solovyev.android.view.widgets.DirectionDragButton a:id="@+id/leftButton"
|
||||
calc:textUp="↞"
|
||||
a:text="←"
|
||||
style="@style/control_button_style"
|
||||
a:onClick="moveLeftButtonClickHandler"/>
|
||||
|
||||
<org.solovyev.android.view.widgets.DirectionDragButton
|
||||
a:id="@+id/rightButton"
|
||||
calc:textUp="↠"
|
||||
a:text="→"
|
||||
style="@style/control_button_style"
|
||||
a:onClick="moveRightButtonClickHandler"/>
|
||||
|
||||
<org.solovyev.android.view.widgets.DirectionDragButton
|
||||
a:id="@+id/varsButton"
|
||||
a:text="π,e,…"
|
||||
a:textStyle="italic"
|
||||
a:onClick="varsButtonClickHandler"
|
||||
style="@style/control_button_style"/>
|
||||
<include layout="@layout/calc_left_button"/>
|
||||
<include layout="@layout/calc_right_button"/>
|
||||
<include layout="@layout/calc_vars_button"/>
|
||||
|
||||
<org.solovyev.android.view.widgets.DirectionDragButton a:text="" style="@style/control_button_style"/>
|
||||
|
||||
|
14
res/layout/calc_clear_button.xml
Normal file
14
res/layout/calc_clear_button.xml
Normal 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
|
||||
-->
|
||||
|
||||
<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/clearButton"
|
||||
a:text="@string/c_clear"
|
||||
style="@style/control_button_style"
|
||||
a:onClick="clearButtonClickHandler"/>
|
18
res/layout/calc_display.xml
Normal file
18
res/layout/calc_display.xml
Normal file
@ -0,0 +1,18 @@
|
||||
<?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
|
||||
-->
|
||||
|
||||
<org.solovyev.android.calculator.CalculatorDisplay
|
||||
xmlns:a="http://schemas.android.com/apk/res/android"
|
||||
a:id="@+id/resultEditText"
|
||||
style="@style/display_style"
|
||||
a:layout_weight="1"
|
||||
a:minLines="1"
|
||||
a:maxLines="1"
|
||||
a:textStyle="bold"
|
||||
a:scrollHorizontally="true"
|
||||
a:scrollbars="none"/>
|
14
res/layout/calc_division_button.xml
Normal file
14
res/layout/calc_division_button.xml
Normal 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
|
||||
-->
|
||||
|
||||
<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/divisionButton" a:text="/"
|
||||
calc:textUp="√"
|
||||
style="@style/digit_button_style"
|
||||
a:onClick="digitButtonClickHandler"/>
|
22
res/layout/calc_editor.xml
Normal file
22
res/layout/calc_editor.xml
Normal file
@ -0,0 +1,22 @@
|
||||
<?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
|
||||
-->
|
||||
|
||||
<LinearLayout xmlns:a="http://schemas.android.com/apk/res/android"
|
||||
a:layout_weight="2"
|
||||
a:layout_width="match_parent"
|
||||
a:layout_height="0dp">
|
||||
|
||||
<org.solovyev.android.calculator.CalculatorEditor
|
||||
a:id="@+id/editText"
|
||||
style="@style/editor_style"
|
||||
a:inputType="textMultiLine"
|
||||
a:maxLines="4"
|
||||
a:scrollbars="vertical"
|
||||
a:hint ="@string/c_calc_editor_hint"/>
|
||||
|
||||
</LinearLayout>
|
15
res/layout/calc_eight_digit_button.xml
Normal file
15
res/layout/calc_eight_digit_button.xml
Normal file
@ -0,0 +1,15 @@
|
||||
<?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
|
||||
-->
|
||||
|
||||
<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/eightDigitButton" a:text="8"
|
||||
calc:textUp="ln"
|
||||
calc:textDown=""
|
||||
style="@style/digit_button_style"
|
||||
a:onClick="digitButtonClickHandler"/>
|
15
res/layout/calc_equals_button.xml
Normal file
15
res/layout/calc_equals_button.xml
Normal file
@ -0,0 +1,15 @@
|
||||
<?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
|
||||
-->
|
||||
<org.solovyev.android.view.widgets.DirectionDragButton
|
||||
xmlns:a="http://schemas.android.com/apk/res/android"
|
||||
a:id="@+id/equalsButton"
|
||||
a:text="="
|
||||
a:layout_width="match_parent"
|
||||
a:layout_height="match_parent"
|
||||
style="@style/control_button_style"
|
||||
a:onClick="numericButtonClickHandler"/>
|
14
res/layout/calc_erase_button.xml
Normal file
14
res/layout/calc_erase_button.xml
Normal 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
|
||||
-->
|
||||
|
||||
<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/eraseButton"
|
||||
a:text="@string/c_erase"
|
||||
style="@style/control_button_style"
|
||||
a:onClick="eraseButtonClickHandler"/>
|
15
res/layout/calc_five_digit_button.xml
Normal file
15
res/layout/calc_five_digit_button.xml
Normal file
@ -0,0 +1,15 @@
|
||||
<?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
|
||||
-->
|
||||
<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/fiveDigitButton"
|
||||
a:text="5"
|
||||
calc:textUp="cosh"
|
||||
calc:textDown="acosh"
|
||||
style="@style/digit_button_style"
|
||||
a:onClick="digitButtonClickHandler"/>
|
15
res/layout/calc_four_digit_button.xml
Normal file
15
res/layout/calc_four_digit_button.xml
Normal file
@ -0,0 +1,15 @@
|
||||
<?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
|
||||
-->
|
||||
<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/fourDigitButton"
|
||||
a:text="4"
|
||||
calc:textUp="sinh"
|
||||
calc:textDown="asinh"
|
||||
style="@style/digit_button_style"
|
||||
a:onClick="digitButtonClickHandler"/>
|
14
res/layout/calc_history_button.xml
Normal file
14
res/layout/calc_history_button.xml
Normal 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
|
||||
-->
|
||||
<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/historyButton"
|
||||
a:text=""
|
||||
calc:textUp="@string/c_undo"
|
||||
calc:textDown="@string/c_redo"
|
||||
style="@style/control_button_style"/>
|
15
res/layout/calc_left_button.xml
Normal file
15
res/layout/calc_left_button.xml
Normal file
@ -0,0 +1,15 @@
|
||||
<?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
|
||||
-->
|
||||
|
||||
<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/leftButton"
|
||||
calc:textUp="↞"
|
||||
a:text="←"
|
||||
style="@style/control_button_style"
|
||||
a:onClick="moveLeftButtonClickHandler"/>
|
16
res/layout/calc_multiplication_button.xml
Normal file
16
res/layout/calc_multiplication_button.xml
Normal file
@ -0,0 +1,16 @@
|
||||
<?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
|
||||
-->
|
||||
|
||||
<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/multiplicationButton"
|
||||
a:text="×"
|
||||
calc:textUp="^"
|
||||
calc:textDown="^2"
|
||||
style="@style/digit_button_style"
|
||||
a:onClick="digitButtonClickHandler"/>
|
15
res/layout/calc_nine_digit_button.xml
Normal file
15
res/layout/calc_nine_digit_button.xml
Normal file
@ -0,0 +1,15 @@
|
||||
<?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
|
||||
-->
|
||||
|
||||
<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/nineDigitButton" a:text="9"
|
||||
calc:textDown="e"
|
||||
calc:textUp="π"
|
||||
style="@style/digit_button_style"
|
||||
a:onClick="digitButtonClickHandler"/>
|
16
res/layout/calc_one_digit_button.xml
Normal file
16
res/layout/calc_one_digit_button.xml
Normal file
@ -0,0 +1,16 @@
|
||||
<?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
|
||||
-->
|
||||
|
||||
<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/oneDigitButton"
|
||||
a:text="1"
|
||||
calc:textUp="sin"
|
||||
calc:textDown="asin"
|
||||
style="@style/digit_button_style"
|
||||
a:onClick="digitButtonClickHandler"/>
|
15
res/layout/calc_paste_button.xml
Normal file
15
res/layout/calc_paste_button.xml
Normal file
@ -0,0 +1,15 @@
|
||||
<?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
|
||||
-->
|
||||
|
||||
<ImageButton xmlns:a="http://schemas.android.com/apk/res/android"
|
||||
xmlns:calc="http://schemas.android.com/apk/res/org.solovyev.android.calculator"
|
||||
a:id="@+id/pasteButton"
|
||||
a:src="@drawable/paste"
|
||||
style="@style/control_button_style"
|
||||
a:padding="6dp"
|
||||
a:onClick="pasteButtonClickHandler"/>
|
12
res/layout/calc_plus_button.xml
Normal file
12
res/layout/calc_plus_button.xml
Normal file
@ -0,0 +1,12 @@
|
||||
<?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
|
||||
-->
|
||||
<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:onClick="digitButtonClickHandler"/>
|
15
res/layout/calc_right_button.xml
Normal file
15
res/layout/calc_right_button.xml
Normal file
@ -0,0 +1,15 @@
|
||||
<?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
|
||||
-->
|
||||
|
||||
<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/rightButton"
|
||||
calc:textUp="↠"
|
||||
a:text="→"
|
||||
style="@style/control_button_style"
|
||||
a:onClick="moveRightButtonClickHandler"/>
|
14
res/layout/calc_round_brackets_button.xml
Normal file
14
res/layout/calc_round_brackets_button.xml
Normal 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
|
||||
-->
|
||||
|
||||
<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/roundBracketsButton" a:text="()"
|
||||
calc:textUp="("
|
||||
calc:textDown=")" style="@style/digit_button_style"
|
||||
a:onClick="digitButtonClickHandler"/>
|
15
res/layout/calc_seven_digit_button.xml
Normal file
15
res/layout/calc_seven_digit_button.xml
Normal file
@ -0,0 +1,15 @@
|
||||
<?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
|
||||
-->
|
||||
|
||||
<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/sevenDigitButton" a:text="7"
|
||||
calc:textUp="i"
|
||||
calc:textDown=""
|
||||
style="@style/digit_button_style"
|
||||
a:onClick="digitButtonClickHandler"/>
|
15
res/layout/calc_six_digit_button.xml
Normal file
15
res/layout/calc_six_digit_button.xml
Normal file
@ -0,0 +1,15 @@
|
||||
<?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
|
||||
-->
|
||||
|
||||
<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/sixDigitButton" a:text="6"
|
||||
calc:textUp="tanh"
|
||||
calc:textDown="atanh"
|
||||
style="@style/digit_button_style"
|
||||
a:onClick="digitButtonClickHandler"/>
|
14
res/layout/calc_square_brackets_button.xml
Normal file
14
res/layout/calc_square_brackets_button.xml
Normal 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
|
||||
-->
|
||||
|
||||
<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/squareBracketsButton" a:text="[]"
|
||||
calc:textUp="["
|
||||
calc:textDown="]" style="@style/digit_button_style"
|
||||
a:onClick="digitButtonClickHandler"/>
|
14
res/layout/calc_subtraction_button.xml
Normal file
14
res/layout/calc_subtraction_button.xml
Normal 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
|
||||
-->
|
||||
<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/subtractionButton" a:text="-"
|
||||
calc:textUp="{"
|
||||
calc:textDown="}"
|
||||
style="@style/digit_button_style"
|
||||
a:onClick="digitButtonClickHandler"/>
|
16
res/layout/calc_three_digit_button.xml
Normal file
16
res/layout/calc_three_digit_button.xml
Normal file
@ -0,0 +1,16 @@
|
||||
<?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
|
||||
-->
|
||||
|
||||
<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/threeDigitButton"
|
||||
a:text="3"
|
||||
calc:textUp="tan"
|
||||
calc:textDown="atan"
|
||||
style="@style/digit_button_style"
|
||||
a:onClick="digitButtonClickHandler"/>
|
16
res/layout/calc_two_digit_button.xml
Normal file
16
res/layout/calc_two_digit_button.xml
Normal file
@ -0,0 +1,16 @@
|
||||
<?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
|
||||
-->
|
||||
|
||||
<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/twoDigitButton"
|
||||
a:text="2"
|
||||
calc:textUp="cos"
|
||||
calc:textDown="acos"
|
||||
style="@style/digit_button_style"
|
||||
a:onClick="digitButtonClickHandler"/>
|
14
res/layout/calc_vars_button.xml
Normal file
14
res/layout/calc_vars_button.xml
Normal 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
|
||||
-->
|
||||
|
||||
<org.solovyev.android.view.widgets.DirectionDragButton xmlns:a="http://schemas.android.com/apk/res/android"
|
||||
a:id="@+id/varsButton"
|
||||
a:text="π,e,…"
|
||||
a:textStyle="italic"
|
||||
a:onClick="varsButtonClickHandler"
|
||||
style="@style/control_button_style"/>
|
15
res/layout/calc_zero_digit_button.xml
Normal file
15
res/layout/calc_zero_digit_button.xml
Normal file
@ -0,0 +1,15 @@
|
||||
<?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
|
||||
-->
|
||||
|
||||
<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/zeroDigitButton" a:text="0"
|
||||
calc:textUp="."
|
||||
calc:textDown=","
|
||||
style="@style/digit_button_style"
|
||||
a:onClick="digitButtonClickHandler"/>
|
@ -27,7 +27,8 @@
|
||||
|
||||
<string name="c_undo">undo</string>
|
||||
<string name="c_redo">redo</string>
|
||||
<string name="c_clear">clr</string>
|
||||
<string name="c_clear">CE</string>
|
||||
<string name="c_erase">C</string>
|
||||
<string name="c_paste">paste</string>
|
||||
<string name="c_vars">vars</string>
|
||||
|
||||
@ -57,4 +58,5 @@
|
||||
<string name="c_pi_description">Ratio of any circle\'s circumference to its diameter</string>
|
||||
<string name="c_e_description">Unique real number such that the value of the derivative (slope of the tangent line) of the function f(x) = e^x at the point x = 0 is equal to 1</string>
|
||||
<string name="c_i_description">Imaginary unit, defined such that i^2 = −1</string>
|
||||
<string name="c_calc_editor_hint"></string>
|
||||
</resources>
|
||||
|
@ -26,7 +26,7 @@
|
||||
<item name="android:textSize">30dp</item>
|
||||
</style>
|
||||
|
||||
<style name="display_style">
|
||||
<style name="editor_style">
|
||||
<item name="android:textSize">25dp</item>
|
||||
<item name="android:background">#000000</item>
|
||||
<item name="android:textColor">@color/text_color</item>
|
||||
@ -36,4 +36,14 @@
|
||||
<item name="android:layout_height">match_parent</item>
|
||||
</style>
|
||||
|
||||
<style name="display_style">
|
||||
<item name="android:textSize">25dp</item>
|
||||
<item name="android:background">#000000</item>
|
||||
<item name="android:textColor">@color/text_color</item>
|
||||
<item name="android:gravity">right|center_vertical</item>
|
||||
<item name="android:padding">5dp</item>
|
||||
<item name="android:layout_width">match_parent</item>
|
||||
<item name="android:layout_height">match_parent</item>
|
||||
</style>
|
||||
|
||||
</resources>
|
||||
|
@ -23,6 +23,11 @@ public class CalculatorEditor extends EditText {
|
||||
|
||||
private boolean highlightText = true;
|
||||
|
||||
private final static int BASE_COLOUR = Color.WHITE;
|
||||
private final static int BASE_COLOUR_RED_COMPONENT = Color.red(BASE_COLOUR);
|
||||
private final static int BASE_COLOUR_GREEN_COMPONENT = Color.green(BASE_COLOUR);
|
||||
private final static int BASE_COLOUR_BLUE_COMPONENT = Color.blue(BASE_COLOUR);
|
||||
|
||||
public CalculatorEditor(Context context) {
|
||||
super(context);
|
||||
}
|
||||
@ -135,13 +140,11 @@ public class CalculatorEditor extends EditText {
|
||||
}
|
||||
|
||||
private String getColor(int numberOfOpenGroupSymbols, int numberOfOpenings) {
|
||||
final int baseColor = Color.WHITE;
|
||||
double c = 0.7;
|
||||
|
||||
double c = 1;
|
||||
int offset = ((int) (255 * c)) * numberOfOpenings / (numberOfOpenGroupSymbols + 1);
|
||||
|
||||
int i = ((int) (255 * c)) * numberOfOpenings / (numberOfOpenGroupSymbols + 1);
|
||||
|
||||
int result = Color.rgb(Color.red(baseColor) - i, Color.green(baseColor) - i, Color.blue(baseColor) - i);
|
||||
int result = Color.rgb(BASE_COLOUR_RED_COMPONENT - offset, BASE_COLOUR_GREEN_COMPONENT - offset, BASE_COLOUR_BLUE_COMPONENT - offset);
|
||||
|
||||
return "#" + Integer.toHexString(result).substring(2);
|
||||
}
|
||||
|
@ -6,13 +6,10 @@
|
||||
package org.solovyev.android.calculator;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.Context;
|
||||
import android.os.Handler;
|
||||
import android.text.ClipboardManager;
|
||||
import android.text.InputType;
|
||||
import android.util.Log;
|
||||
import android.view.View;
|
||||
import android.view.inputmethod.InputMethodManager;
|
||||
import android.widget.EditText;
|
||||
import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
@ -38,7 +35,7 @@ import org.solovyev.common.utils.history.SimpleHistoryHelper;
|
||||
public class CalculatorView implements CursorControl, HistoryControl<CalculatorHistoryState> {
|
||||
|
||||
// millis to wait before evaluation after user edit action
|
||||
public static final int EVAL_DELAY_MILLIS = 700;
|
||||
public static final int EVAL_DELAY_MILLIS = 1000;
|
||||
|
||||
@NotNull
|
||||
private final CalculatorEditor editor;
|
||||
@ -55,11 +52,7 @@ public class CalculatorView implements CursorControl, HistoryControl<CalculatorH
|
||||
public CalculatorView(@NotNull final Activity activity, @NotNull CalculatorModel calculator) {
|
||||
this.calculatorModel = calculator;
|
||||
|
||||
final InputMethodManager imm = (InputMethodManager) activity.getSystemService(Context.INPUT_METHOD_SERVICE);
|
||||
|
||||
this.editor = (CalculatorEditor) activity.findViewById(R.id.editText);
|
||||
this.editor.setInputType(InputType.TYPE_NULL);
|
||||
imm.hideSoftInputFromWindow(this.editor.getWindowToken(), 0);
|
||||
|
||||
this.display = (CalculatorDisplay) activity.findViewById(R.id.resultEditText);
|
||||
this.display.setOnClickListener(new View.OnClickListener() {
|
||||
|
@ -9,6 +9,7 @@ import bsh.EvalError;
|
||||
import org.junit.Assert;
|
||||
import org.junit.BeforeClass;
|
||||
import org.junit.Test;
|
||||
import org.simpleframework.xml.Attribute;
|
||||
import org.solovyev.android.calculator.JsclOperation;
|
||||
|
||||
/**
|
||||
@ -79,4 +80,50 @@ public class CalculatorModelTest {
|
||||
Assert.assertEquals("i", cm.createResultForComplexNumber("i"));
|
||||
|
||||
}
|
||||
|
||||
public interface TestInterface {
|
||||
Integer getField();
|
||||
}
|
||||
|
||||
public class TestClass implements TestInterface{
|
||||
|
||||
@Attribute(required = true)
|
||||
private Integer field;
|
||||
|
||||
public TestClass() {
|
||||
}
|
||||
|
||||
public TestClass(Integer field) {
|
||||
this.field = field;
|
||||
}
|
||||
|
||||
public Integer getField() {
|
||||
return field;
|
||||
}
|
||||
|
||||
public void setField(Integer field) {
|
||||
this.field = field;
|
||||
}
|
||||
}
|
||||
|
||||
public class NewTestClass implements TestInterface{
|
||||
|
||||
@Attribute
|
||||
private Integer field;
|
||||
|
||||
public NewTestClass() {
|
||||
}
|
||||
|
||||
public NewTestClass(Integer field) {
|
||||
this.field = field;
|
||||
}
|
||||
|
||||
public Integer getField() {
|
||||
return field;
|
||||
}
|
||||
|
||||
public void setField(Integer field) {
|
||||
this.field = field;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user