landscape mode enabled

This commit is contained in:
Sergey Solovyev 2011-09-13 11:20:17 +04:00
parent 782a8063cf
commit 327e2ddb12
6 changed files with 273 additions and 35 deletions

View File

@ -9,7 +9,7 @@
<application a:icon="@drawable/icon" a:label="@string/c_app_name"> <application a:icon="@drawable/icon" a:label="@string/c_app_name">
<activity a:name=".CalculatorActivity" a:label="@string/c_app_name" a:screenOrientation="portrait"> <activity a:name=".CalculatorActivity" a:label="@string/c_app_name">
<intent-filter> <intent-filter>
<action a:name="android.intent.action.MAIN" /> <action a:name="android.intent.action.MAIN" />
<category a:name="android.intent.category.LAUNCHER" /> <category a:name="android.intent.category.LAUNCHER" />

View File

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

183
res/layout-land/main.xml Normal file
View File

@ -0,0 +1,183 @@
<?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"
a:background="#ff000000">
<LinearLayout
a:layout_width="match_parent"
a:layout_height="match_parent"
a:orientation="vertical"
a:layout_gravity="center">
<LinearLayout a:layout_weight="2" a:layout_width="match_parent" a:layout_height="0dp">
<EditText
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.DirectionDragButton a:id="@+id/leftButton"
calc:textUp="↞"
a:text="←"
a:layout_weight="1.5"
style="@style/control_button_style"
a:onClick="moveLeftButtonClickHandler"/>
<org.solovyev.android.view.DirectionDragButton a:id="@+id/eraseButton"
a:text="↚"
a:layout_weight="1.5"
style="@style/control_button_style"
a:onClick="eraseButtonClickHandler"/>
<TextView
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"/>
<org.solovyev.android.view.DirectionDragButton a:id="@+id/clearButton"
a:text="clear"
a:layout_weight="1.5"
style="@style/control_button_style"
a:onClick="clearButtonClickHandler"/>
<org.solovyev.android.view.DirectionDragButton a:id="@+id/rightButton"
calc:textUp="↠"
a:text="→"
a:layout_weight="1.5"
style="@style/control_button_style"
a:onClick="moveRightButtonClickHandler"/>
</LinearLayout>
<LinearLayout a:layout_weight="1" a:layout_width="match_parent" a:layout_height="0dp">
<org.solovyev.android.view.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.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.DirectionDragButton a:id="@+id/threeDigitButton" a:text="3" calc:textUp="tg"
calc:textDown="atg" style="@style/digit_button_style"
a:onClick="digitButtonClickHandler"/>
<org.solovyev.android.view.DirectionDragButton a:id="@+id/multiplicationButton" a:text="×"
calc:textUp="^"
calc:textDown="^2" style="@style/digit_button_style"
a:onClick="digitButtonClickHandler"/>
<org.solovyev.android.view.DirectionDragButton a:id="@+id/divisionButton" a:text="/"
calc:textUp="√"
style="@style/digit_button_style"
a:onClick="digitButtonClickHandler"/>
<org.solovyev.android.view.DirectionDragButton a:id="@+id/equalsButton"
a:text="="
a:layout_width="fill_parent"
style="@style/control_button_style"
a:onClick="numericButtonClickHandler"/>
<org.solovyev.android.view.DirectionDragButton a:id="@+id/pasteButton"
a:text="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.DirectionDragButton a:id="@+id/fourDigitButton"
a:text="4"
calc:textUp=""
calc:textDown=""
style="@style/digit_button_style"
a:onClick="digitButtonClickHandler"/>
<org.solovyev.android.view.DirectionDragButton a:id="@+id/fiveDigitButton"
a:text="5"
calc:textUp="ln"
style="@style/digit_button_style"
a:onClick="digitButtonClickHandler"/>
<org.solovyev.android.view.DirectionDragButton a:id="@+id/sixDigitButton" a:text="6"
calc:textUp=""
calc:textDown="" style="@style/digit_button_style"
a:onClick="digitButtonClickHandler"/>
<org.solovyev.android.view.DirectionDragButton a:id="@+id/plusButton" a:text="+"
style="@style/digit_button_style"
a:onClick="digitButtonClickHandler"/>
<org.solovyev.android.view.DirectionDragButton a:id="@+id/minusButton" a:text="-"
calc:textUp="{"
calc:textDown="}"
style="@style/digit_button_style"
a:onClick="digitButtonClickHandler"/>
<org.solovyev.android.view.DirectionDragButton a:id="@+id/squareBracketsButton" a:text="[]"
calc:textUp="["
calc:textDown="]" style="@style/digit_button_style"
a:onClick="digitButtonClickHandler"/>
<org.solovyev.android.view.DirectionDragButton a:id="@+id/historyButton"
a:text=""
calc:textUp="undo"
calc:textDown="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.DirectionDragButton a:id="@+id/sevenDigitButton" a:text="7" calc:textUp=""
calc:textDown="" style="@style/digit_button_style"
a:onClick="digitButtonClickHandler"/>
<org.solovyev.android.view.DirectionDragButton a:id="@+id/eightDigitButton" a:text="8" calc:textUp=""
calc:textDown="" style="@style/digit_button_style"
a:onClick="digitButtonClickHandler"/>
<org.solovyev.android.view.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.DirectionDragButton a:id="@+id/zeroDigitButton" a:text="0"
calc:textUp="."
calc:textDown=","
style="@style/digit_button_style"
a:onClick="digitButtonClickHandler"/>
<org.solovyev.android.view.DirectionDragButton a:id="@+id/roundBracketsButton" a:text="()"
calc:textUp="("
calc:textDown=")" style="@style/digit_button_style"
a:onClick="digitButtonClickHandler"/>
<org.solovyev.android.view.DirectionDragButton a:text="" style="@style/control_button_style"/>
<org.solovyev.android.view.DirectionDragButton a:text="" style="@style/control_button_style"/>
</LinearLayout>
</LinearLayout>
</LinearLayout>

View File

@ -0,0 +1,53 @@
<?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"
a:background="#ff000000">
<LinearLayout
a:id="@+id/simplePad"
a:layout_width="match_parent"
a:layout_height="match_parent"
a:orientation="vertical"
a:layout_gravity="center">
<LinearLayout a:layout_weight="1" a:layout_width="match_parent" a:layout_height="0dp">
<ImageView a:id="@+id/calibrationArrowLeft"
a:layout_gravity="left"
a:layout_width="80dp"
a:layout_height="80dp"/>
<org.solovyev.android.view.DirectionDragButton a:id="@+id/calibrationButtonLeft"
a:text=""
calc:textUp="@string/c_up"
calc:textDown="@string/c_down"
a:layout_width="80dp"
a:layout_height="80dp"
style="@style/digit_button_style"/>
<org.solovyev.android.view.DirectionDragButton a:id="@+id/calibrationButtonRight"
a:text=""
calc:textUp="@string/c_up"
calc:textDown="@string/c_down"
a:layout_width="80dp"
a:layout_height="80dp"
style="@style/digit_button_style"/>
<ImageView a:id="@+id/calibrationArrowRight"
a:layout_gravity="right"
a:layout_width="80dp"
a:layout_height="80dp"/>
</LinearLayout>
</LinearLayout>
<Button a:id="@+id/calibrationStart"
a:text="@string/c_restart"
a:layout_width="wrap_content"
a:layout_height="wrap_content"
a:onClick="restartClickHandler"
a:layout_gravity="bottom"/>
</LinearLayout>

View File

@ -30,7 +30,7 @@
a:text="=" a:text="="
a:layout_width="fill_parent" a:layout_width="fill_parent"
a:layout_weight="4" a:layout_weight="4"
style="@style/controlButtonStyle" style="@style/control_button_style"
a:onClick="numericButtonClickHandler"/> a:onClick="numericButtonClickHandler"/>
<TextView <TextView
@ -47,57 +47,59 @@
</LinearLayout> </LinearLayout>
<LinearLayout a:layout_weight="1" a:layout_width="match_parent" a:layout_height="0dp"> <LinearLayout a:layout_weight="1" a:layout_width="match_parent" a:layout_height="0dp">
<org.solovyev.android.view.DirectionDragButton a:id="@+id/oneDigitButton" a:text="1" calc:textUp="sin" <org.solovyev.android.view.DirectionDragButton a:id="@+id/oneDigitButton" a:text="1" calc:textUp="sin"
calc:textDown="asin" style="@style/digitButtonStyle" calc:textDown="asin" style="@style/digit_button_style"
a:onClick="digitButtonClickHandler"/> a:onClick="digitButtonClickHandler"/>
<org.solovyev.android.view.DirectionDragButton a:id="@+id/twoDigitButton" a:text="2" calc:textUp="cos" <org.solovyev.android.view.DirectionDragButton a:id="@+id/twoDigitButton" a:text="2" calc:textUp="cos"
calc:textDown="acos" style="@style/digitButtonStyle" calc:textDown="acos" style="@style/digit_button_style"
a:onClick="digitButtonClickHandler"/> a:onClick="digitButtonClickHandler"/>
<org.solovyev.android.view.DirectionDragButton a:id="@+id/threeDigitButton" a:text="3" calc:textUp="tg" <org.solovyev.android.view.DirectionDragButton a:id="@+id/threeDigitButton" a:text="3" calc:textUp="tg"
calc:textDown="atg" style="@style/digitButtonStyle" calc:textDown="atg" style="@style/digit_button_style"
a:onClick="digitButtonClickHandler"/> a:onClick="digitButtonClickHandler"/>
<org.solovyev.android.view.DirectionDragButton a:id="@+id/muliplicationButton" a:text="×" <org.solovyev.android.view.DirectionDragButton a:id="@+id/multiplicationButton" a:text="×"
calc:textUp="^" calc:textUp="^"
calc:textDown="^2" style="@style/digitButtonStyle" calc:textDown="^2" style="@style/digit_button_style"
a:onClick="digitButtonClickHandler"/> a:onClick="digitButtonClickHandler"/>
<org.solovyev.android.view.DirectionDragButton a:id="@+id/clearButton" <org.solovyev.android.view.DirectionDragButton a:id="@+id/clearButton"
a:text="clear" a:text="clear"
style="@style/controlButtonStyle" style="@style/control_button_style"
a:onClick="clearButtonClickHandler"/> a:onClick="clearButtonClickHandler"/>
</LinearLayout> </LinearLayout>
<LinearLayout a:layout_weight="1" a:layout_width="match_parent" a:layout_height="0dp"> <LinearLayout a:layout_weight="1" a:layout_width="match_parent" a:layout_height="0dp">
<org.solovyev.android.view.DirectionDragButton a:id="@+id/fourDigitButton" <org.solovyev.android.view.DirectionDragButton a:id="@+id/fourDigitButton"
a:text="4" a:text="4"
calc:textUp="" calc:textUp=""
calc:textDown="" calc:textDown=""
style="@style/digitButtonStyle" style="@style/digit_button_style"
a:onClick="digitButtonClickHandler"/> a:onClick="digitButtonClickHandler"/>
<org.solovyev.android.view.DirectionDragButton a:id="@+id/fiveDigitButton" <org.solovyev.android.view.DirectionDragButton a:id="@+id/fiveDigitButton"
a:text="5" a:text="5"
calc:textUp="ln" calc:textUp="ln"
style="@style/digitButtonStyle" style="@style/digit_button_style"
a:onClick="digitButtonClickHandler"/> a:onClick="digitButtonClickHandler"/>
<org.solovyev.android.view.DirectionDragButton a:id="@+id/sixDigitButton" a:text="6" <org.solovyev.android.view.DirectionDragButton a:id="@+id/sixDigitButton" a:text="6"
calc:textUp="" calc:textUp=""
calc:textDown="" style="@style/digitButtonStyle" calc:textDown="" style="@style/digit_button_style"
a:onClick="digitButtonClickHandler"/> a:onClick="digitButtonClickHandler"/>
<org.solovyev.android.view.DirectionDragButton a:id="@+id/divisionButton" a:text="/" <org.solovyev.android.view.DirectionDragButton a:id="@+id/divisionButton" a:text="/"
calc:textUp="√" calc:textUp="√"
style="@style/digitButtonStyle" style="@style/digit_button_style"
a:onClick="digitButtonClickHandler"/> a:onClick="digitButtonClickHandler"/>
<org.solovyev.android.view.DirectionDragButton a:id="@+id/eraseButton" <org.solovyev.android.view.DirectionDragButton a:id="@+id/eraseButton"
a:text="↚" a:text="↚"
style="@style/controlButtonStyle" style="@style/control_button_style"
a:onClick="eraseButtonClickHandler"/> a:onClick="eraseButtonClickHandler"/>
</LinearLayout> </LinearLayout>
@ -105,26 +107,26 @@
<LinearLayout a:layout_weight="1" a:layout_width="match_parent" a:layout_height="0dp"> <LinearLayout a:layout_weight="1" a:layout_width="match_parent" a:layout_height="0dp">
<org.solovyev.android.view.DirectionDragButton a:id="@+id/sevenDigitButton" a:text="7" calc:textUp="" <org.solovyev.android.view.DirectionDragButton a:id="@+id/sevenDigitButton" a:text="7" calc:textUp=""
calc:textDown="" style="@style/digitButtonStyle" calc:textDown="" style="@style/digit_button_style"
a:onClick="digitButtonClickHandler"/> a:onClick="digitButtonClickHandler"/>
<org.solovyev.android.view.DirectionDragButton a:id="@+id/eigthDigitButton" a:text="8" calc:textUp="" <org.solovyev.android.view.DirectionDragButton a:id="@+id/eightDigitButton" a:text="8" calc:textUp=""
calc:textDown="" style="@style/digitButtonStyle" calc:textDown="" style="@style/digit_button_style"
a:onClick="digitButtonClickHandler"/> a:onClick="digitButtonClickHandler"/>
<org.solovyev.android.view.DirectionDragButton a:id="@+id/nineDigitButton" a:text="9" <org.solovyev.android.view.DirectionDragButton a:id="@+id/nineDigitButton" a:text="9"
calc:textDown="e" calc:textDown="e"
calc:textUp="π" calc:textUp="π"
style="@style/digitButtonStyle" style="@style/digit_button_style"
a:onClick="digitButtonClickHandler"/> a:onClick="digitButtonClickHandler"/>
<org.solovyev.android.view.DirectionDragButton a:id="@+id/plusButton" a:text="+" <org.solovyev.android.view.DirectionDragButton a:id="@+id/plusButton" a:text="+"
style="@style/digitButtonStyle" style="@style/digit_button_style"
a:onClick="digitButtonClickHandler"/> a:onClick="digitButtonClickHandler"/>
<org.solovyev.android.view.DirectionDragButton a:id="@+id/pasteButton" <org.solovyev.android.view.DirectionDragButton a:id="@+id/pasteButton"
a:text="paste" a:text="paste"
style="@style/controlButtonStyle" style="@style/control_button_style"
a:onClick="pasteButtonClickHandler"/> a:onClick="pasteButtonClickHandler"/>
@ -134,32 +136,32 @@
<org.solovyev.android.view.DirectionDragButton a:id="@+id/roundBracketsButton" a:text="()" <org.solovyev.android.view.DirectionDragButton a:id="@+id/roundBracketsButton" a:text="()"
calc:textUp="(" calc:textUp="("
calc:textDown=")" style="@style/digitButtonStyle" calc:textDown=")" style="@style/digit_button_style"
a:onClick="digitButtonClickHandler"/> a:onClick="digitButtonClickHandler"/>
<org.solovyev.android.view.DirectionDragButton a:id="@+id/zeroDigitButton" a:text="0" <org.solovyev.android.view.DirectionDragButton a:id="@+id/zeroDigitButton" a:text="0"
calc:textUp="." calc:textUp="."
calc:textDown="," calc:textDown=","
style="@style/digitButtonStyle" style="@style/digit_button_style"
a:onClick="digitButtonClickHandler"/> a:onClick="digitButtonClickHandler"/>
<org.solovyev.android.view.DirectionDragButton a:id="@+id/squareBracketsButton" a:text="[]" <org.solovyev.android.view.DirectionDragButton a:id="@+id/squareBracketsButton" a:text="[]"
calc:textUp="[" calc:textUp="["
calc:textDown="]" style="@style/digitButtonStyle" calc:textDown="]" style="@style/digit_button_style"
a:onClick="digitButtonClickHandler"/> a:onClick="digitButtonClickHandler"/>
<org.solovyev.android.view.DirectionDragButton a:id="@+id/subtractionButton" a:text="-" <org.solovyev.android.view.DirectionDragButton a:id="@+id/subtractionButton" a:text="-"
calc:textUp="{" calc:textUp="{"
calc:textDown="}" calc:textDown="}"
style="@style/digitButtonStyle" style="@style/digit_button_style"
a:onClick="digitButtonClickHandler"/> a:onClick="digitButtonClickHandler"/>
<org.solovyev.android.view.DirectionDragButton a:id="@+id/historyButton" <org.solovyev.android.view.DirectionDragButton a:id="@+id/historyButton"
a:text="" a:text=""
calc:textUp="undo" calc:textUp="undo"
calc:textDown="redo" calc:textDown="redo"
style="@style/controlButtonStyle"/> style="@style/control_button_style"/>
</LinearLayout> </LinearLayout>
@ -168,30 +170,30 @@
<!-- <org.solovyev.android.view.DirectionDragButton a:id="@+id/numericButton" a:text="numeric" <!-- <org.solovyev.android.view.DirectionDragButton a:id="@+id/numericButton" a:text="numeric"
style="@style/digitButtonStyle" style="@style/digit_button_style"
a:onClick="numericButtonClickHandler"/> a:onClick="numericButtonClickHandler"/>
<org.solovyev.android.view.DirectionDragButton a:id="@+id/simplifyButton" a:text="simplify" <org.solovyev.android.view.DirectionDragButton a:id="@+id/simplifyButton" a:text="simplify"
style="@style/digitButtonStyle" style="@style/digit_button_style"
a:onClick="simplifyButtonClickHandler"/>--> a:onClick="simplifyButtonClickHandler"/>-->
<org.solovyev.android.view.DirectionDragButton a:id="@+id/leftButton" <org.solovyev.android.view.DirectionDragButton a:id="@+id/leftButton"
calc:textUp="↞" calc:textUp="↞"
a:text="←" a:text="←"
style="@style/controlButtonStyle" style="@style/control_button_style"
a:onClick="moveLeftButtonClickHandler"/> a:onClick="moveLeftButtonClickHandler"/>
<org.solovyev.android.view.DirectionDragButton a:id="@+id/rightButton" <org.solovyev.android.view.DirectionDragButton a:id="@+id/rightButton"
calc:textUp="↠" calc:textUp="↠"
a:text="→" a:text="→"
style="@style/controlButtonStyle" style="@style/control_button_style"
a:onClick="moveRightButtonClickHandler"/> a:onClick="moveRightButtonClickHandler"/>
<org.solovyev.android.view.DirectionDragButton a:text="" style="@style/controlButtonStyle"/> <org.solovyev.android.view.DirectionDragButton a:text="" style="@style/control_button_style"/>
<org.solovyev.android.view.DirectionDragButton a:text="" style="@style/controlButtonStyle"/> <org.solovyev.android.view.DirectionDragButton a:text="" style="@style/control_button_style"/>
<org.solovyev.android.view.DirectionDragButton a:text="" style="@style/controlButtonStyle"/> <org.solovyev.android.view.DirectionDragButton a:text="" style="@style/control_button_style"/>
</LinearLayout> </LinearLayout>

View File

@ -16,11 +16,11 @@
<item name="android:layout_marginLeft">1dp</item> <item name="android:layout_marginLeft">1dp</item>
</style> </style>
<style name="digitButtonStyle" parent="button_style"> <style name="digit_button_style" parent="button_style">
<item name="android:background">@drawable/blue_button</item> <item name="android:background">@drawable/blue_button</item>
</style> </style>
<style name="controlButtonStyle" parent="button_style"/> <style name="control_button_style" parent="button_style"/>
<style name="button_small_style" parent="button_style"> <style name="button_small_style" parent="button_style">
<item name="android:textSize">30dp</item> <item name="android:textSize">30dp</item>