Death to tabs while working on CB-1864

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

Branch: refs/heads/master
Commit: 04b9a0b09eca789a0bbd23e1ea140159599530ec
Parents: e1d6084
Author: Joe Bowser <[email protected]>
Authored: Thu Nov 15 13:47:52 2012 -0800
Committer: Joe Bowser <[email protected]>
Committed: Thu Nov 15 13:47:52 2012 -0800

----------------------------------------------------------------------
 .../src/org/apache/cordova/CordovaWebView.java     |  150 +++++++-------
 1 files changed, 75 insertions(+), 75 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-cordova-android/blob/04b9a0b0/framework/src/org/apache/cordova/CordovaWebView.java
----------------------------------------------------------------------
diff --git a/framework/src/org/apache/cordova/CordovaWebView.java 
b/framework/src/org/apache/cordova/CordovaWebView.java
index 1511e30..4777f25 100755
--- a/framework/src/org/apache/cordova/CordovaWebView.java
+++ b/framework/src/org/apache/cordova/CordovaWebView.java
@@ -99,8 +99,8 @@ public class CordovaWebView extends WebView {
     
     private long lastMenuEventTime = 0;
 
-       NativeToJsMessageQueue jsMessageQueue;
-       ExposedJsApi exposedJsApi;
+    NativeToJsMessageQueue jsMessageQueue;
+    ExposedJsApi exposedJsApi;
 
     /** custom view created by the browser (a video player for example) */
     private View mCustomView;
@@ -184,8 +184,8 @@ public class CordovaWebView extends WebView {
      * @param defStyle
      * @param privateBrowsing
      */
-       @TargetApi(11)
-       public CordovaWebView(Context context, AttributeSet attrs, int 
defStyle, boolean privateBrowsing) {
+    @TargetApi(11)
+    public CordovaWebView(Context context, AttributeSet attrs, int defStyle, 
boolean privateBrowsing) {
         super(context, attrs, defStyle, privateBrowsing);
         if (CordovaInterface.class.isInstance(context))
         {
@@ -249,7 +249,7 @@ public class CordovaWebView extends WebView {
         // Jellybean rightfully tried to lock this down. Too bad they didn't 
give us a whitelist
         // while we do this
         if (android.os.Build.VERSION.SDK_INT > 
android.os.Build.VERSION_CODES.ICE_CREAM_SANDWICH_MR1)
-               Level16Apis.enableUniversalAccess(settings);
+            Level16Apis.enableUniversalAccess(settings);
         // Enable database
         settings.setDatabaseEnabled(true);
         String databasePath = 
this.cordova.getActivity().getApplicationContext().getDir("database", 
Context.MODE_PRIVATE).getPath();
@@ -285,7 +285,7 @@ public class CordovaWebView extends WebView {
     }
     
     private void updateUserAgentString() {
-       this.getSettings().getUserAgentString();
+        this.getSettings().getUserAgentString();
     }
 
     private void exposeJsInterface() {
@@ -608,7 +608,7 @@ public class CordovaWebView extends WebView {
         // Check webview first to see if there is a history
         // This is needed to support curPage#diffLink, since they are added to 
appView's history, but not our history url array (JQMobile behavior)
         if (super.canGoBack()) {
-               printBackForwardList();
+            printBackForwardList();
             super.goBack();
             
             return true;
@@ -839,27 +839,27 @@ public class CordovaWebView extends WebView {
         // If back key
         if (keyCode == KeyEvent.KEYCODE_BACK) {
             // A custom view is currently displayed  (e.g. playing a video)
-               if(mCustomView != null) {
-                       this.hideCustomView();
-               } else {
-                   // The webview is currently displayed
-                   // If back key is bound, then send event to JavaScript
-                   if (this.bound) {
-                       
this.loadUrl("javascript:cordova.fireDocumentEvent('backbutton');");
-                       return true;
-                   } else {
-                       // If not bound
-                       // Go to previous page in webview if it is possible to 
go back
-                       if (this.backHistory()) {
-                           return true;
-                       }
-                       // If not, then invoke default behaviour
-                       else {
-                           //this.activityState = ACTIVITY_EXITING;
-                           return false;
-                       }
-                   }
-               }
+            if(mCustomView != null) {
+                this.hideCustomView();
+            } else {
+                // The webview is currently displayed
+                // If back key is bound, then send event to JavaScript
+                if (this.bound) {
+                    
this.loadUrl("javascript:cordova.fireDocumentEvent('backbutton');");
+                    return true;
+                } else {
+                    // If not bound
+                    // Go to previous page in webview if it is possible to go 
back
+                    if (this.backHistory()) {
+                        return true;
+                    }
+                    // If not, then invoke default behaviour
+                    else {
+                        //this.activityState = ACTIVITY_EXITING;
+                        return false;
+                    }
+                }
+            }
         }
         // Legacy
         else if (keyCode == KeyEvent.KEYCODE_MENU) {
@@ -1002,14 +1002,14 @@ public class CordovaWebView extends WebView {
     }
     
     public void printBackForwardList() {
-       WebBackForwardList currentList = this.copyBackForwardList();
-       int currentSize = currentList.getSize();
-       for(int i = 0; i < currentSize; ++i)
-       {
-               WebHistoryItem item = currentList.getItemAtIndex(i);
-               String url = item.getUrl();
-               LOG.d(TAG, "The URL at index: " + Integer.toString(i) + "is " + 
url );
-       }
+        WebBackForwardList currentList = this.copyBackForwardList();
+        int currentSize = currentList.getSize();
+        for(int i = 0; i < currentSize; ++i)
+        {
+            WebHistoryItem item = currentList.getItemAtIndex(i);
+            String url = item.getUrl();
+            LOG.d(TAG, "The URL at index: " + Integer.toString(i) + "is " + 
url );
+        }
     }
     
     
@@ -1026,8 +1026,8 @@ public class CordovaWebView extends WebView {
     }
 
     public void showCustomView(View view, WebChromeClient.CustomViewCallback 
callback) {
-       // This code is adapted from the original Android Browser code, 
licensed under the Apache License, Version 2.0
-       Log.d(TAG, "showing Custom View");
+        // This code is adapted from the original Android Browser code, 
licensed under the Apache License, Version 2.0
+        Log.d(TAG, "showing Custom View");
         // if a view already exists then immediately terminate the new one
         if (mCustomView != null) {
             callback.onCustomViewHidden();
@@ -1035,46 +1035,46 @@ public class CordovaWebView extends WebView {
         }
         
         // Store the view and its callback for later (to kill it properly)
-       mCustomView = view;
-       mCustomViewCallback = callback;
-       
+        mCustomView = view;
+        mCustomViewCallback = callback;
+        
         // Add the custom view to its container.
-       ViewGroup parent = (ViewGroup) this.getParent();
-       parent.addView(view, COVER_SCREEN_GRAVITY_CENTER);
-       
-       // Hide the content view.
-       this.setVisibility(View.GONE);
-       
-       // Finally show the custom view container.
-       parent.setVisibility(View.VISIBLE);
-       parent.bringToFront();
+        ViewGroup parent = (ViewGroup) this.getParent();
+        parent.addView(view, COVER_SCREEN_GRAVITY_CENTER);
+        
+        // Hide the content view.
+        this.setVisibility(View.GONE);
+        
+        // Finally show the custom view container.
+        parent.setVisibility(View.VISIBLE);
+        parent.bringToFront();
     }
 
-       public void hideCustomView() {
-       // This code is adapted from the original Android Browser code, 
licensed under the Apache License, Version 2.0
-       Log.d(TAG, "Hidding Custom View");
-               if (mCustomView == null) return;
-
-               // Hide the custom view.
-               mCustomView.setVisibility(View.GONE);
-               
-               // Remove the custom view from its container.
-               ViewGroup parent = (ViewGroup) this.getParent();
-               parent.removeView(mCustomView);
-               mCustomView = null;
-               mCustomViewCallback.onCustomViewHidden();
-               
+    public void hideCustomView() {
+        // This code is adapted from the original Android Browser code, 
licensed under the Apache License, Version 2.0
+        Log.d(TAG, "Hidding Custom View");
+        if (mCustomView == null) return;
+
+        // Hide the custom view.
+        mCustomView.setVisibility(View.GONE);
+        
+        // Remove the custom view from its container.
+        ViewGroup parent = (ViewGroup) this.getParent();
+        parent.removeView(mCustomView);
+        mCustomView = null;
+        mCustomViewCallback.onCustomViewHidden();
+        
         // Show the content view.
         this.setVisibility(View.VISIBLE);
-       }
-       
-       /**
-        * if the video overlay is showing then we need to know 
-        * as it effects back button handling
-        * 
-        * @return
-        */
-       public boolean isCustomViewShowing() {
-           return mCustomView != null;
-       }
+    }
+    
+    /**
+     * if the video overlay is showing then we need to know 
+     * as it effects back button handling
+     * 
+     * @return
+     */
+    public boolean isCustomViewShowing() {
+        return mCustomView != null;
+    }
 }

Reply via email to