cordova-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From agri...@apache.org
Subject [7/9] cordova-app-harness git commit: Fix AppHarnessUI.java to work with latest cordova-android changes & to forward lifecycle events (minus onActivityResult)
Date Wed, 13 May 2015 02:42:52 GMT
Fix AppHarnessUI.java to work with latest cordova-android changes & to forward lifecycle
events (minus onActivityResult)


Project: http://git-wip-us.apache.org/repos/asf/cordova-app-harness/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-app-harness/commit/e724e18b
Tree: http://git-wip-us.apache.org/repos/asf/cordova-app-harness/tree/e724e18b
Diff: http://git-wip-us.apache.org/repos/asf/cordova-app-harness/diff/e724e18b

Branch: refs/heads/master
Commit: e724e18bb99e66f36d6ddb013783aeab4a13538b
Parents: 55066a3
Author: Andrew Grieve <agrieve@chromium.org>
Authored: Wed Apr 29 16:28:48 2015 -0400
Committer: Andrew Grieve <agrieve@chromium.org>
Committed: Tue May 12 22:21:04 2015 -0400

----------------------------------------------------------------------
 AppHarnessUI/android/AppHarnessUI.java | 58 ++++++++++++++++++++++++++++-
 1 file changed, 57 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-app-harness/blob/e724e18b/AppHarnessUI/android/AppHarnessUI.java
----------------------------------------------------------------------
diff --git a/AppHarnessUI/android/AppHarnessUI.java b/AppHarnessUI/android/AppHarnessUI.java
index b19ecf2..8244638 100644
--- a/AppHarnessUI/android/AppHarnessUI.java
+++ b/AppHarnessUI/android/AppHarnessUI.java
@@ -43,6 +43,8 @@ import org.xmlpull.v1.XmlPullParserException;
 import org.xmlpull.v1.XmlPullParserFactory;
 
 import android.annotation.TargetApi;
+import android.content.Intent;
+import android.content.res.Configuration;
 import android.content.res.XmlResourceParser;
 import android.net.Uri;
 import android.os.Build;
@@ -66,6 +68,60 @@ public class AppHarnessUI extends CordovaPlugin {
         contentView = (ViewGroup)cordova.getActivity().findViewById(android.R.id.content);
     }
 
+    @Override
+    public void onPause(boolean multitasking) {
+        if (slaveWebView != null) {
+            slaveWebView.handlePause(multitasking);
+        }
+    }
+
+    @Override
+    public void onResume(boolean multitasking) {
+        if (slaveWebView != null) {
+            slaveWebView.handleResume(multitasking);
+        }
+    }
+
+    @Override
+    public void onStart() {
+        if (slaveWebView != null) {
+            slaveWebView.handleStart();
+        }
+    }
+
+    @Override
+    public void onStop() {
+        if (slaveWebView != null) {
+            slaveWebView.handleStop();
+        }
+    }
+
+    @Override
+    public void onDestroy() {
+        if (slaveWebView != null) {
+            slaveWebView.handleDestroy();
+        }
+    }
+
+    @Override
+    public void onNewIntent(Intent intent) {
+        if (slaveWebView != null) {
+            slaveWebView.onNewIntent(intent);
+        }
+    }
+
+    @Override
+    public void onActivityResult(int requestCode, int resultCode, Intent intent) {
+        // TODO: implement me by passing a custom CordovaInterface to slaveWebView
+    }
+
+    @Override
+    public void onConfigurationChanged(Configuration newConfig) {
+        if (slaveWebView != null) {
+            slaveWebView.getPluginManager().onConfigurationChanged(newConfig);
+        }
+    }
+
     public boolean isSlaveVisible() {
         return slaveVisible;
     }
@@ -155,7 +211,7 @@ public class AppHarnessUI extends CordovaPlugin {
             Log.w(LOG_TAG, "create: already exists");
         } else {
             slaveWebViewEngine = new CustomAndroidWebView(this, activity);
-            slaveWebView = new CordovaWebViewImpl(webView.getContext(), (CordovaWebViewEngine)slaveWebViewEngine);
+            slaveWebView = new CordovaWebViewImpl((CordovaWebViewEngine)slaveWebViewEngine);
             // A consistent view ID is needed for plugins that utilize the background-activity
plugin.
             slaveWebView.getView().setId(200);
             // We'll set the plugin entries in initWebView.


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org


Mime
View raw message