layout changed

This commit is contained in:
serso 2011-09-13 00:32:02 +04:00
parent a58c37eb75
commit 782a8063cf
3 changed files with 29 additions and 18 deletions

View File

@ -29,7 +29,7 @@
<org.solovyev.android.view.DirectionDragButton a:id="@+id/equalsButton" <org.solovyev.android.view.DirectionDragButton a:id="@+id/equalsButton"
a:text="=" a:text="="
a:layout_width="fill_parent" a:layout_width="fill_parent"
a:layout_weight="3" a:layout_weight="4"
style="@style/controlButtonStyle" style="@style/controlButtonStyle"
a:onClick="numericButtonClickHandler"/> a:onClick="numericButtonClickHandler"/>
@ -64,6 +64,11 @@
calc:textDown="^2" style="@style/digitButtonStyle" calc:textDown="^2" style="@style/digitButtonStyle"
a:onClick="digitButtonClickHandler"/> a:onClick="digitButtonClickHandler"/>
<org.solovyev.android.view.DirectionDragButton a:id="@+id/clearButton"
a:text="clear"
style="@style/controlButtonStyle"
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">
@ -90,6 +95,11 @@
style="@style/digitButtonStyle" style="@style/digitButtonStyle"
a:onClick="digitButtonClickHandler"/> a:onClick="digitButtonClickHandler"/>
<org.solovyev.android.view.DirectionDragButton a:id="@+id/eraseButton"
a:text="↚"
style="@style/controlButtonStyle"
a:onClick="eraseButtonClickHandler"/>
</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">
@ -112,6 +122,11 @@
style="@style/digitButtonStyle" style="@style/digitButtonStyle"
a:onClick="digitButtonClickHandler"/> a:onClick="digitButtonClickHandler"/>
<org.solovyev.android.view.DirectionDragButton a:id="@+id/pasteButton"
a:text="paste"
style="@style/controlButtonStyle"
a:onClick="pasteButtonClickHandler"/>
</LinearLayout> </LinearLayout>
@ -140,6 +155,11 @@
style="@style/digitButtonStyle" style="@style/digitButtonStyle"
a:onClick="digitButtonClickHandler"/> a:onClick="digitButtonClickHandler"/>
<org.solovyev.android.view.DirectionDragButton a:id="@+id/historyButton"
a:text=""
calc:textUp="undo"
calc:textDown="redo"
style="@style/controlButtonStyle"/>
</LinearLayout> </LinearLayout>
@ -154,10 +174,6 @@
<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/digitButtonStyle"
a:onClick="simplifyButtonClickHandler"/>--> a:onClick="simplifyButtonClickHandler"/>-->
<org.solovyev.android.view.DirectionDragButton a:id="@+id/eraseButton"
a:text="↚"
style="@style/controlButtonStyle"
a:onClick="eraseButtonClickHandler"/>
<org.solovyev.android.view.DirectionDragButton a:id="@+id/leftButton" <org.solovyev.android.view.DirectionDragButton a:id="@+id/leftButton"
calc:textUp="↞" calc:textUp="↞"
@ -171,17 +187,12 @@
style="@style/controlButtonStyle" style="@style/controlButtonStyle"
a:onClick="moveRightButtonClickHandler"/> a:onClick="moveRightButtonClickHandler"/>
<org.solovyev.android.view.DirectionDragButton a:id="@+id/pasteButton" <org.solovyev.android.view.DirectionDragButton a:text="" style="@style/controlButtonStyle"/>
a:text="paste"
calc:textUp="redo" <org.solovyev.android.view.DirectionDragButton a:text="" style="@style/controlButtonStyle"/>
style="@style/controlButtonStyle"
a:onClick="pasteButtonClickHandler"/> <org.solovyev.android.view.DirectionDragButton a:text="" style="@style/controlButtonStyle"/>
<org.solovyev.android.view.DirectionDragButton a:id="@+id/clearButton"
a:text="clear"
calc:textUp="undo"
style="@style/controlButtonStyle"
a:onClick="clearButtonClickHandler"/>
</LinearLayout> </LinearLayout>
</LinearLayout> </LinearLayout>

View File

@ -87,8 +87,7 @@ public class CalculatorActivity extends Activity implements FontSizeAdjuster {
} }
final SimpleOnDragListener historyOnDragListener = new SimpleOnDragListener(new HistoryDragProcessor(), dragPreferences); final SimpleOnDragListener historyOnDragListener = new SimpleOnDragListener(new HistoryDragProcessor(), dragPreferences);
((DragButton) findViewById(R.id.clearButton)).setOnDragListener(historyOnDragListener); ((DragButton) findViewById(R.id.historyButton)).setOnDragListener(historyOnDragListener);
((DragButton) findViewById(R.id.pasteButton)).setOnDragListener(historyOnDragListener);
onDragListeners.add(historyOnDragListener); onDragListeners.add(historyOnDragListener);
final SimpleOnDragListener toPositionOnDragListener = new SimpleOnDragListener(new SimpleOnDragListener.DragProcessor() { final SimpleOnDragListener toPositionOnDragListener = new SimpleOnDragListener(new SimpleOnDragListener.DragProcessor() {

View File

@ -101,13 +101,14 @@ public class CalculatorView implements CursorControl{
} catch (EvalError evalError) { } catch (EvalError evalError) {
// actually nothing shall be logged while text operations are done // actually nothing shall be logged while text operations are done
} }
saveHistoryState();
} }
} }
private void evaluate(@Nullable String expression) throws EvalError { private void evaluate(@Nullable String expression) throws EvalError {
if (!StringUtils.isEmpty(expression)) { if (!StringUtils.isEmpty(expression)) {
display.setText(calculator.evaluate(JsclOperation.numeric, expression)); display.setText(calculator.evaluate(JsclOperation.numeric, expression));
saveHistoryState();
} }
} }