Search in sources :

Example 1 with CalcEngineImpl

use of com.sfeir.calc.CalcEngineImpl in project jhybrid by Sfeir.

the class DisplayResultActivity method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    Intent intent = getIntent();
    String expr = intent.getStringExtra(MainActivity.EXPR);
    /**
         * Call the core library
         */
    CalcEngine calcEngine = new CalcEngineImpl();
    int evaluate = calcEngine.evaluate(expr);
    // Create the text view
    TextView textView = new TextView(this);
    textView.setTextSize(40);
    textView.setText("" + evaluate);
    setContentView(textView);
}
Also used : CalcEngineImpl(com.sfeir.calc.CalcEngineImpl) Intent(android.content.Intent) TextView(android.widget.TextView) CalcEngine(com.sfeir.calc.CalcEngine)

Example 2 with CalcEngineImpl

use of com.sfeir.calc.CalcEngineImpl in project jhybrid by Sfeir.

the class Calc method clicButton.

@UiHandler("button")
void clicButton(ClickEvent event) {
    CalcEngineImpl calcEngine = new CalcEngineImpl();
    String expr = text.getText();
    int result = calcEngine.evaluate(expr);
    label.setText("" + result);
}
Also used : CalcEngineImpl(com.sfeir.calc.CalcEngineImpl) UiHandler(com.google.gwt.uibinder.client.UiHandler)

Aggregations

CalcEngineImpl (com.sfeir.calc.CalcEngineImpl)2 Intent (android.content.Intent)1 TextView (android.widget.TextView)1 UiHandler (com.google.gwt.uibinder.client.UiHandler)1 CalcEngine (com.sfeir.calc.CalcEngine)1