You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by ag...@apache.org on 2014/07/10 21:06:19 UTC

[1/3] android commit: Tweak CordovaPlugin.initialize method to be less deprecated.

Repository: cordova-android
Updated Branches:
  refs/heads/4.0.x b52fcb8aa -> 1d4aa44d3
  refs/heads/master a14c79425 -> 3792f7528


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/4.0.x
Commit: 3792f752815fd5aa5a23198a56e6d12bee01217b
Parents: a14c794
Author: Andrew Grieve <ag...@chromium.org>
Authored: Thu Jul 10 15:03:53 2014 -0400
Committer: Andrew Grieve <ag...@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() {
     }
     
     /**


[3/3] android commit: Merge branch 'master' into 4.0.x (CordovaPlugin.pluginInitialize tweak)

Posted by ag...@apache.org.
Merge branch 'master' into 4.0.x (CordovaPlugin.pluginInitialize tweak)

Conflicts:
	framework/src/org/apache/cordova/CordovaPlugin.java


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

Branch: refs/heads/4.0.x
Commit: 1d4aa44d3d9eef574100f4e3c2fd2a92a0e1d9c8
Parents: b52fcb8 3792f75
Author: Andrew Grieve <ag...@chromium.org>
Authored: Thu Jul 10 15:05:40 2014 -0400
Committer: Andrew Grieve <ag...@chromium.org>
Committed: Thu Jul 10 15:05:40 2014 -0400

----------------------------------------------------------------------
 .../src/org/apache/cordova/CordovaPlugin.java     | 18 +++++++++++++-----
 1 file changed, 13 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-android/blob/1d4aa44d/framework/src/org/apache/cordova/CordovaPlugin.java
----------------------------------------------------------------------


[2/3] android commit: Tweak CordovaPlugin.initialize method to be less deprecated.

Posted by ag...@apache.org.
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 <ag...@chromium.org>
Authored: Thu Jul 10 15:03:53 2014 -0400
Committer: Andrew Grieve <ag...@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() {
     }
     
     /**