package com.evgenii.jsevaluatortests;

import android.app.Activity;
import android.os.Bundle;
import android.view.Menu;
import android.view.View;
import android.widget.EditText;
import android.widget.TextView;

import com.evgenii.jsevaluator.JsEvaluator;
import com.evgenii.jsevaluator.interfaces.JsCallback;

public class CallJsFunctionActivity extends Activity {

	public void onCallFuncitonClicked(View view) {
		final JsEvaluator jsEvaluator = new JsEvaluator(this);
		final EditText functionText = (EditText) findViewById(R.id.js_function_edit_text);
		jsEvaluator.evaluate(functionText.getText().toString(),
				new JsCallback() {
					@Override
					public void onResult(final String resultValue) {
					}
				});

		final EditText parameterText = (EditText) findViewById(R.id.editTextParameter);
		jsEvaluator.callFunction(new JsCallback() {
			@Override
			public void onResult(final String resultValue) {
				final TextView jsResultTextView = (TextView) findViewById(R.id.textViewCallFunctionResult);
				jsResultTextView.setText(String.format("Result: %s",
						resultValue));
			}
		}, "greet", parameterText.getText().toString());
	}

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_call_js_function);
	}

	@Override
	public boolean onCreateOptionsMenu(Menu menu) {
		// Inflate the menu; this adds items to the action bar if it is present.
		getMenuInflater().inflate(R.menu.call_js_function, menu);
		return true;
	}

}

@@ -609,114 +609,8 @@
 ng()
-,%0A%09%09%09%09new JsCallback() %7B%0A%09%09%09%09%09@Override%0A%09%09%09%09%09public void onResult(final String resultValue) %7B%0A%09%09%09%09%09%7D%0A%09%09%09%09%7D
 );%0A%0A

Remove unused code