package com.phonegap.api;

import org.json.JSONArray;

import com.phonegap.DroidGap;

import android.content.Context;
import android.content.Intent;
import android.webkit.WebView;

/**
 * Plugin interface must be implemented by any plugin classes.
 *
 * The execute method is called by the PluginManager.
 */
public interface Plugin {
	/**
	 * Executes the request and returns PluginResult.
	 * 
	 * @param action The plugin to execute.
	 * @param args JSONArry of arguments for the plugin.
	 * @return A PluginResult object with a status and message.
	 */
	PluginResult execute(String action, JSONArray args);

	/**
	 * Sets the context of the Plugin. This can then be used to do things like
	 * get file paths associated with the Activity.
	 * 
	 * @param ctx The context of the main Activity.
	 */
	void setContext(DroidGap ctx);

	/**
	 * Sets the main View of the application, this is the WebView within which 
	 * a PhoneGap app runs.
	 * 
	 * @param webView The PhoneGap WebView
	 */
	void setView(WebView webView);
		
    /**
     * Called when the system is about to start resuming a previous activity. 
     */
    void onPause();

    /**
     * Called when the activity will start interacting with the user. 
     */
    void onResume();
    
    /**
     * The final call you receive before your activity is destroyed. 
     */
    void onDestroy();
	
    /**
     * Called when an activity you launched exits, giving you the requestCode you started it with,
     * the resultCode it returned, and any additional data from it. 
     * 
     * @param requestCode		The request code originally supplied to startActivityForResult(), 
     * 							allowing you to identify who this result came from.
     * @param resultCode		The integer result code returned by the child activity through its setResult().
     * @param data				An Intent, which can return result data to the caller (various data can be attached to Intent "extras").
     */
    void onActivityResult(int requestCode, int resultCode, Intent intent);

}

@@ -411,17 +411,18 @@
 ion 
+%09
 The 
-plugi
+actio
 n to
@@ -447,16 +447,18 @@
 am args 
+%09%09
 JSONArry
@@ -499,16 +499,19 @@
 @return 
+%09%09%09
 A Plugin
@@ -607,24 +607,214 @@
 ray args);%0A%0A
+%09/**%0A%09 * Identifies if action to be executed returns a value.%0A%09 * %0A%09 * @param action%09The action to execute%0A%09 * @return%09%09%09T=returns value%0A%09 */%0A%09public boolean hasReturnValue(String action);%0A%0A
 %09/**%0A%09 * Set

Add hasReturnValue() so that PluginManager can make decision to run an action sync or async.