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/05/06 21:29:33 UTC

[19/34] git commit: Use webView.loadUrlIntoView() for reload instead of window.location

Use webView.loadUrlIntoView() for reload instead of window.location


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/cdd39e24
Tree: http://git-wip-us.apache.org/repos/asf/cordova-app-harness/tree/cdd39e24
Diff: http://git-wip-us.apache.org/repos/asf/cordova-app-harness/diff/cdd39e24

Branch: refs/heads/master
Commit: cdd39e246894371a7a45b802dd238c6cf225a11d
Parents: 7454e2f
Author: Andrew Grieve <ag...@chromium.org>
Authored: Tue Mar 18 16:28:11 2014 -0700
Committer: Andrew Grieve <ag...@chromium.org>
Committed: Thu Mar 20 14:22:03 2014 -0700

----------------------------------------------------------------------
 harness-push/src/android/Push.java | 15 +--------------
 1 file changed, 1 insertion(+), 14 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-app-harness/blob/cdd39e24/harness-push/src/android/Push.java
----------------------------------------------------------------------
diff --git a/harness-push/src/android/Push.java b/harness-push/src/android/Push.java
index b216a14..1ac04b1 100644
--- a/harness-push/src/android/Push.java
+++ b/harness-push/src/android/Push.java
@@ -51,11 +51,6 @@ public class Push extends CordovaPlugin {
         return false;
     }
 
-    public void onReset() {
-        Log.w(LOG_TAG, "onReset");
-
-    }
-
     private void listen(CallbackContext callbackContext) {
         // First, check that we're not already listening.
         if (listening) {
@@ -89,15 +84,10 @@ public class Push extends CordovaPlugin {
     }
     
     private void injectJS(final String toInject) {
-    	injectJS(toInject, false);
-    }
-
-    private void injectJS(final String toInject, final boolean clearCache) {
         this.cordova.getActivity().runOnUiThread(new Runnable() {
             @SuppressLint("NewApi")
             @Override
             public void run() {
-                if (clearCache) webView.clearCache(true);
             	if (Build.VERSION.SDK_INT < Build.VERSION_CODES.KITKAT) {
                     webView.loadUrl("javascript:" + toInject);
                 } else {
@@ -108,10 +98,7 @@ public class Push extends CordovaPlugin {
     }
 
     private void restartAppHarness() {
-    	// Clearing the cache is necessary to prevent it loading cached files when the app is restarted.
-    	// This is a bit heavy-handed, since it's destroying everything in the cache, but on the other hand
-    	// we're already loading from the local disk, so the cache is superfluous.
-    	injectJS("window.location = '" + Config.getStartUrl() + "'", true /* clearCache */);
+        webView.loadUrlIntoView(Config.getStartUrl(), false);
     }
 
     private class PushServer extends NanoHTTPD {