cordova-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From agri...@apache.org
Subject [2/3] android commit: Tweak CordovaPlugin.initialize method to be less deprecated.
Date Thu, 10 Jul 2014 19:06:20 GMT
Tweak CordovaPlugin.initialize method to be less deprecated.

Thinking here is that we need a while for both initialize and
pluginInitialize to exist before plugin authors would bother not using
the deprecated one anyways. Really, no harm in keeping both for some
time.


Project: http://git-wip-us.apache.org/repos/asf/cordova-android/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-android/commit/3792f752
Tree: http://git-wip-us.apache.org/repos/asf/cordova-android/tree/3792f752
Diff: http://git-wip-us.apache.org/repos/asf/cordova-android/diff/3792f752

Branch: refs/heads/master
Commit: 3792f752815fd5aa5a23198a56e6d12bee01217b
Parents: a14c794
Author: Andrew Grieve <agrieve@chromium.org>
Authored: Thu Jul 10 15:03:53 2014 -0400
Committer: Andrew Grieve <agrieve@chromium.org>
Committed: Thu Jul 10 15:03:53 2014 -0400

----------------------------------------------------------------------
 .../src/org/apache/cordova/CordovaPlugin.java   | 20 ++++++++++++++------
 1 file changed, 14 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-android/blob/3792f752/framework/src/org/apache/cordova/CordovaPlugin.java
----------------------------------------------------------------------
diff --git a/framework/src/org/apache/cordova/CordovaPlugin.java b/framework/src/org/apache/cordova/CordovaPlugin.java
index eff66c8..a68d3d7 100644
--- a/framework/src/org/apache/cordova/CordovaPlugin.java
+++ b/framework/src/org/apache/cordova/CordovaPlugin.java
@@ -34,27 +34,35 @@ import android.net.Uri;
 public class CordovaPlugin {
     @Deprecated // This is never set.
     public String id;
-    public CordovaWebView webView;					// WebView object
+    public CordovaWebView webView;
     public CordovaInterface cordova;
     protected CordovaPreferences preferences;
 
-    void privateInitialize(CordovaInterface cordova, CordovaWebView webView, CordovaPreferences
preferences) {
+    /**
+     * Call this after constructing to initialize the plugin.
+     * Final because we want to be able to change args without breaking plugins.
+     */
+    public final void privateInitialize(CordovaInterface cordova, CordovaWebView webView,
CordovaPreferences preferences) {
         assert this.cordova == null;
         this.cordova = cordova;
         this.webView = webView;
         this.preferences = preferences;
         initialize(cordova, webView);
-        initialize();
+        pluginInitialize();
     }
 
-    @Deprecated // Override initialize() instead.
+    /**
+     * Called after plugin construction and fields have been initialized.
+     * Prefer to use pluginInitialize instead since there is no value in
+     * having parameters on the initialize() function.
+     */
     public void initialize(CordovaInterface cordova, CordovaWebView webView) {
     }
 
     /**
-     * This is where you can do start-up logic with protected fields set.
+     * Called after plugin construction and fields have been initialized.
      */
-    protected void initialize() {
+    protected void pluginInitialize() {
     }
     
     /**


Mime
View raw message