Adding getContext, startActivity to CordovaInterface

This commit is contained in:
macdonst 2012-06-08 14:03:20 -04:00
parent 6c1a2e1230
commit 95b48705fe

View File

@ -19,6 +19,7 @@
package org.apache.cordova.api; package org.apache.cordova.api;
import android.app.Activity; import android.app.Activity;
import android.content.Context;
import android.content.Intent; import android.content.Intent;
/** /**
@ -28,39 +29,46 @@ import android.content.Intent;
public interface CordovaInterface { public interface CordovaInterface {
/** /**
* Launch an activity for which you would like a result when it finished. When this activity exits, * Launch an activity for which you would like a result when it finished. When this activity exits,
* your onActivityResult() method will be called. * your onActivityResult() method will be called.
* *
* @param command The command object * @param command The command object
* @param intent The intent to start * @param intent The intent to start
* @param requestCode The request code that is passed to callback to identify the activity * @param requestCode The request code that is passed to callback to identify the activity
*/ */
abstract public void startActivityForResult(IPlugin command, Intent intent, int requestCode); abstract public void startActivityForResult(IPlugin command, Intent intent, int requestCode);
/**
* Launch an activity for which you would not like a result when it finished.
*
* @param intent The intent to start
*/
abstract public void startActivity(Intent intent);
/** /**
* Set the plugin to be called when a sub-activity exits. * Set the plugin to be called when a sub-activity exits.
* *
* @param plugin The plugin on which onActivityResult is to be called * @param plugin The plugin on which onActivityResult is to be called
*/ */
abstract public void setActivityResultCallback(IPlugin plugin); abstract public void setActivityResultCallback(IPlugin plugin);
/** /**
* Causes the Activity to override the back button behavior. * Causes the Activity to override the back button behavior.
* *
* @param override * @param override
*/ */
public abstract void bindBackButton(boolean override); public abstract void bindBackButton(boolean override);
/** /**
* A hook required to check if the Back Button is bound. * A hook required to check if the Back Button is bound.
* *
* @return * @return
*/ */
public abstract boolean isBackButtonBound(); public abstract boolean isBackButtonBound();
/** /**
* Get the Android activity. * Get the Android activity.
* *
* @return * @return
*/ */
public abstract Activity getActivity(); public abstract Activity getActivity();
@ -69,12 +77,13 @@ public interface CordovaInterface {
public abstract void cancelLoadUrl(); public abstract void cancelLoadUrl();
/** /**
* Called when a message is sent to plugin. * Called when a message is sent to plugin.
* *
* @param id The message id * @param id The message id
* @param data The message data * @param data The message data
* @return Object or null * @return Object or null
*/ */
public Object onMessage(String id, Object data); public Object onMessage(String id, Object data);
abstract public Context getContext();
} }