Android Open Source - phonegap-lite-android I Plugin






From Project

Back to project page phonegap-lite-android.

License

The source code is released under:

MIT License

If you think the Android project phonegap-lite-android listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

/*
 * PhoneGap is available under *either* the terms of the modified BSD license *or* the
 * MIT License (2008). See http://opensource.org/licenses/alphabetical for full text.
 * /*from w ww  . ja  v  a 2  s. co  m*/
 * Copyright (c) 2005-2010, Nitobi Software Inc.
 * Copyright (c) 2010, IBM Corporation
 */
package com.phonegap.api;

import org.json.JSONArray;
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 IPlugin {
    
  /**
   * Executes the request and returns PluginResult.
   * 
   * @param action     The action to execute.
   * @param args       JSONArry of arguments for the plugin.
   * @param callbackId  The callback id used when calling back into JavaScript.
   * @return         A PluginResult object with a status and message.
   */
  PluginResult execute(String action, JSONArray args, String callbackId);

  /**
   * Identifies if action to be executed returns a value and should be run synchronously.
   * 
   * @param action  The action to execute
   * @return      T=returns value
   */
  public boolean isSynch(String action);

  /**
   * 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(PhonegapActivity 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. 
     * 
     * @param multitasking    Flag indicating if multitasking is turned on for app
     */
    void onPause(boolean multitasking);

    /**
     * Called when the activity will start interacting with the user. 
     * 
     * @param multitasking    Flag indicating if multitasking is turned on for app
     */
    void onResume(boolean multitasking);
    
    /**
     * Called when the activity receives a new intent. 
     */
    void onNewIntent(Intent intent);

    /**
     * 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);

    /**
     * By specifying a <url-filter> in plugins.xml you can map a URL (using startsWith atm) to this method.
     * 
     * @param url        The URL that is trying to be loaded in the PhoneGap webview.
     * @return          Return true to prevent the URL from loading. Default is false.
     */
    boolean onOverrideUrlLoading(String url);
}




Java Source Code List

__ID__.Activity.java
com.phonegap.App.java
com.phonegap.CallbackServer.java
com.phonegap.Device.java
com.phonegap.DroidGap.java
com.phonegap.HttpHandler.java
com.phonegap.StandAlone.java
com.phonegap.TempListener.java
com.phonegap.WebViewReflect.java
com.phonegap.api.IPlugin.java
com.phonegap.api.LOG.java
com.phonegap.api.PhonegapActivity.java
com.phonegap.api.PluginManager.java
com.phonegap.api.PluginResult.java
com.phonegap.api.Plugin.java
com.phonegap.file.EncodingException.java
com.phonegap.plugin.sqlitePlugin.SQLitePlugin.java