// Path: src/org/sagemath/droid/events/CodeReceivedEvent.java
// public class CodeReceivedEvent {
//     private String receivedCode;
//     private boolean forRun;
// 
//     public boolean isForRun() {
//         return forRun;
//     }
// 
//     public void setForRun(boolean forRun) {
//         this.forRun = forRun;
//     }
// 
//     public CodeReceivedEvent(String receivedCode) {
//         this.receivedCode = receivedCode;
//     }
// 
//     public String getReceivedCode() {
//         return receivedCode;
//     }
// }
// 
// Path: src/org/sagemath/droid/utils/BusProvider.java
// public class BusProvider {
// 
//     private static Bus bus;
// 
//     public static Bus getInstance() {
//         if (bus == null) {
//             bus = new Bus();
//         }
// 
//         return bus;
//     }
// }


import android.app.Activity;
import android.util.Log;
import android.webkit.JavascriptInterface;
import org.sagemath.droid.events.CodeReceivedEvent;
import org.sagemath.droid.utils.BusProvider;
package org.sagemath.droid.views;


/**
 * The JavaScript Interface to communicate with CodeMirror.
 *
 * @author Nikhil Peter Raj
 */
public class SageJavascriptInterface {
    private static String TAG = "SageDroid:JavaScriptInterface";

    private boolean forRun = false;
    private Activity activity;

    public SageJavascriptInterface(Activity activity) {
        this.activity = activity;
    }

    public boolean isForRun() {
        return forRun;
    }

    public void setForRun(boolean forRun) {
        this.forRun = forRun;
    }

    /**
     * Obtain the text in the CodeMirror editor via the Javascript function of the same name.
     *
     * @param html
     */
    @JavascriptInterface
    public void getHtml(String html) {
        Log.i(TAG, "Got Text from Editor: " + html);
        if (html != null) {
// Path: src/org/sagemath/droid/events/CodeReceivedEvent.java
// public class CodeReceivedEvent {
//     private String receivedCode;
//     private boolean forRun;
// 
//     public boolean isForRun() {
//         return forRun;
//     }
// 
//     public void setForRun(boolean forRun) {
//         this.forRun = forRun;
//     }
// 
//     public CodeReceivedEvent(String receivedCode) {
//         this.receivedCode = receivedCode;
//     }
// 
//     public String getReceivedCode() {
//         return receivedCode;
//     }
// }
// 
// Path: src/org/sagemath/droid/utils/BusProvider.java
// public class BusProvider {
// 
//     private static Bus bus;
// 
//     public static Bus getInstance() {
//         if (bus == null) {
//             bus = new Bus();
//         }
// 
//         return bus;
//     }
// }


// Path: src/org/sagemath/droid/views/SageJavascriptInterface.java
import android.app.Activity;
import android.util.Log;
import android.webkit.JavascriptInterface;
import org.sagemath.droid.events.CodeReceivedEvent;
import org.sagemath.droid.utils.BusProvider;

package org.sagemath.droid.views;


/**
 * The JavaScript Interface to communicate with CodeMirror.
 *
 * @author Nikhil Peter Raj
 */
public class SageJavascriptInterface {
    private static String TAG = "SageDroid:JavaScriptInterface";

    private boolean forRun = false;
    private Activity activity;

    public SageJavascriptInterface(Activity activity) {
        this.activity = activity;
    }

    public boolean isForRun() {
        return forRun;
    }

    public void setForRun(boolean forRun) {
        this.forRun = forRun;
    }

    /**
     * Obtain the text in the CodeMirror editor via the Javascript function of the same name.
     *
     * @param html
     */
    @JavascriptInterface
    public void getHtml(String html) {
        Log.i(TAG, "Got Text from Editor: " + html);
        if (html != null) {
            final CodeReceivedEvent event = new CodeReceivedEvent(html);