new interface implementation

This commit is contained in:
serso 2011-09-10 22:32:54 +04:00
parent 32941504d9
commit 22e56d6618
4 changed files with 31 additions and 23 deletions

View File

@ -49,25 +49,23 @@ containing a value of this type.
public static final int divisionButton=0x7f090011; public static final int divisionButton=0x7f090011;
public static final int editText=0x7f090006; public static final int editText=0x7f090006;
public static final int eigthDigitButton=0x7f090014; public static final int eigthDigitButton=0x7f090014;
public static final int equalsButton=0x7f090016; public static final int equalsButton=0x7f09001d;
public static final int fiveDigitButton=0x7f09000f; public static final int fiveDigitButton=0x7f09000f;
public static final int fourDigitButton=0x7f09000e; public static final int fourDigitButton=0x7f09000e;
public static final int historyButton=0x7f090020; public static final int historyButton=0x7f09001e;
public static final int menu_item_help=0x7f090022; public static final int menu_item_help=0x7f090020;
public static final int menu_item_settings=0x7f090021; public static final int menu_item_settings=0x7f09001f;
public static final int muliplicationButton=0x7f09000c; public static final int muliplicationButton=0x7f09000c;
public static final int nineDigitButton=0x7f090015; public static final int nineDigitButton=0x7f090015;
public static final int numericButton=0x7f09001e;
public static final int oneDigitButton=0x7f090009; public static final int oneDigitButton=0x7f090009;
public static final int panelswitch=0x7f090008; public static final int panelswitch=0x7f090008;
public static final int piButton=0x7f09001c; public static final int piButton=0x7f09001c;
public static final int plusButton=0x7f09000d; public static final int plusButton=0x7f09000d;
public static final int pointDigitButton=0x7f09001d; public static final int pointDigitButton=0x7f090016;
public static final int resultEditText=0x7f090007; public static final int resultEditText=0x7f090007;
public static final int roundBracketsButton=0x7f090019; public static final int roundBracketsButton=0x7f090019;
public static final int sevenDigitButton=0x7f090013; public static final int sevenDigitButton=0x7f090013;
public static final int simplePad=0x7f090000; public static final int simplePad=0x7f090000;
public static final int simplifyButton=0x7f09001f;
public static final int sixDigitButton=0x7f090010; public static final int sixDigitButton=0x7f090010;
public static final int sqrtButton=0x7f090017; public static final int sqrtButton=0x7f090017;
public static final int squareBracketsButton=0x7f09001a; public static final int squareBracketsButton=0x7f09001a;

View File

@ -101,22 +101,26 @@
<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/digitButtonStyle"
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/eigthDigitButton" a:text="8" calc:textUp=""
calc:textDown="" style="@style/digitButtonStyle" calc:textDown="" style="@style/digitButtonStyle"
a:onClick="digitButtonClickHandler"/> a:onClick="digitButtonClickHandler"/>
<org.solovyev.android.view.DirectionDragButton a:id="@+id/nineDigitButton" a:text="9" calc:textUp="" <org.solovyev.android.view.DirectionDragButton a:id="@+id/nineDigitButton" a:text="9" calc:textUp=""
calc:textDown="" style="@style/digitButtonStyle" calc:textDown="" style="@style/digitButtonStyle"
a:onClick="digitButtonClickHandler"/> a:onClick="digitButtonClickHandler"/>
<org.solovyev.android.view.DirectionDragButton a:id="@+id/equalsButton" a:text="=" <org.solovyev.android.view.DirectionDragButton a:id="@+id/pointDigitButton" a:text="." calc:textDown=","
style="@style/digitButtonStyle" style="@style/digitButtonStyle"
a:onClick="digitButtonClickHandler"/> a:onClick="digitButtonClickHandler"/>
<org.solovyev.android.view.DirectionDragButton a:id="@+id/sqrtButton" a:text="sqrt"
<org.solovyev.android.view.DirectionDragButton a:id="@+id/sqrtButton" a:text="√"
style="@style/digitButtonStyle" style="@style/digitButtonStyle"
a:onClick="digitButtonClickHandler"/> a:onClick="digitButtonClickHandler"/>
</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/zeroDigitButton" a:text="0" <org.solovyev.android.view.DirectionDragButton a:id="@+id/zeroDigitButton" a:text="0"
style="@style/digitButtonStyle" style="@style/digitButtonStyle"
a:onClick="digitButtonClickHandler"/> a:onClick="digitButtonClickHandler"/>
@ -136,7 +140,7 @@
calc:textDown="}" style="@style/digitButtonStyle" calc:textDown="}" style="@style/digitButtonStyle"
a:onClick="digitButtonClickHandler"/> a:onClick="digitButtonClickHandler"/>
<org.solovyev.android.view.DirectionDragButton a:id="@+id/piButton" a:text="pi" calc:textUp="e" <org.solovyev.android.view.DirectionDragButton a:id="@+id/piButton" a:text="π" calc:textUp="e"
style="@style/digitButtonStyle" style="@style/digitButtonStyle"
a:onClick="digitButtonClickHandler"/> a:onClick="digitButtonClickHandler"/>
@ -145,17 +149,19 @@
<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/pointDigitButton" a:text="." calc:textDown="," <org.solovyev.android.view.DirectionDragButton a:id="@+id/equalsButton"
a:text="="
a:layout_width="fill_parent"
style="@style/digitButtonStyle" style="@style/digitButtonStyle"
a:onClick="digitButtonClickHandler"/> a:onClick="numericButtonClickHandler"/>
<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/digitButtonStyle"
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/digitButtonStyle"
a:onClick="simplifyButtonClickHandler"/> a:onClick="simplifyButtonClickHandler"/>-->
<org.solovyev.android.view.DirectionDragButton a:id="@+id/historyButton" calc:textUp="undo" <org.solovyev.android.view.DirectionDragButton a:id="@+id/historyButton" calc:textUp="undo"
calc:textDown="redo" style="@style/digitButtonStyle"/> calc:textDown="redo" style="@style/digitButtonStyle"/>

View File

@ -15,8 +15,12 @@ public class Preprocessor {
sb.append('('); sb.append('(');
} else if (ch == ']' || ch == '}') { } else if (ch == ']' || ch == '}') {
sb.append(')'); sb.append(')');
} else if ( ch == ',' ) { } else if (ch == ',') {
sb.append('.'); sb.append('.');
} else if (ch == 'π') {
sb.append("pi");
} else if (ch == '√') {
sb.append("sqrt");
} else { } else {
sb.append(ch); sb.append(ch);
} }
@ -25,7 +29,7 @@ public class Preprocessor {
return sb.toString(); return sb.toString();
} }
public static String wrap (@NotNull JsclOperation operation, @NotNull String s) { public static String wrap(@NotNull JsclOperation operation, @NotNull String s) {
return operation.name() + "(\"" + s + "\");"; return operation.name() + "(\"" + s + "\");";
} }
} }

View File

@ -19,7 +19,7 @@ public enum MathEntityType {
private static final List<Character> binaryOperations = Arrays.asList('-', '+', '*', '/', '^' ); private static final List<Character> binaryOperations = Arrays.asList('-', '+', '*', '/', '^' );
private static final List<String> functions = Arrays.asList("sin", "asin", "cos", "acos", "tg", "atg", "exp", "log", "ln", "mod", "sqrt"); private static final List<String> functions = Arrays.asList("sin", "asin", "cos", "acos", "tg", "atg", "exp", "log", "ln", "mod", "");
private static final List<String> groupSymbols = Arrays.asList("[]", "()", "{}"); private static final List<String> groupSymbols = Arrays.asList("[]", "()", "{}");