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 2015/02/25 18:28:46 UTC

android commit: CB-8545 Don't add a layout as a parent of the WebView

Repository: cordova-android
Updated Branches:
  refs/heads/master d6da2ef09 -> 395081803


CB-8545 Don't add a layout as a parent of the WebView

Sanity checked mobilespec with --thirdpartyplugins that this doesn't
break any of them.


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

Branch: refs/heads/master
Commit: 3950818030d6583bc410cc7351b17d405dd56a6c
Parents: d6da2ef
Author: Andrew Grieve <ag...@chromium.org>
Authored: Wed Feb 25 12:27:48 2015 -0500
Committer: Andrew Grieve <ag...@chromium.org>
Committed: Wed Feb 25 12:27:48 2015 -0500

----------------------------------------------------------------------
 .../src/org/apache/cordova/CordovaActivity.java | 26 ++++++--------------
 1 file changed, 7 insertions(+), 19 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-android/blob/39508180/framework/src/org/apache/cordova/CordovaActivity.java
----------------------------------------------------------------------
diff --git a/framework/src/org/apache/cordova/CordovaActivity.java b/framework/src/org/apache/cordova/CordovaActivity.java
index 78af625..7942626 100755
--- a/framework/src/org/apache/cordova/CordovaActivity.java
+++ b/framework/src/org/apache/cordova/CordovaActivity.java
@@ -37,11 +37,10 @@ import android.view.Menu;
 import android.view.MenuItem;
 import android.view.View;
 import android.view.ViewGroup;
-import android.view.ViewParent;
 import android.view.Window;
 import android.view.WindowManager;
 import android.webkit.WebViewClient;
-import android.widget.LinearLayout;
+import android.widget.FrameLayout;
 
 /**
  * This class is the main Android activity that represents the Cordova
@@ -163,31 +162,20 @@ public class CordovaActivity extends Activity {
     //Suppressing warnings in AndroidStudio
     @SuppressWarnings({"deprecation", "ResourceType"})
     protected void createViews() {
-        LinearLayout root = new LinearLayout(this);
-        root.setOrientation(LinearLayout.VERTICAL);
-        root.setLayoutParams(new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,
-                ViewGroup.LayoutParams.MATCH_PARENT, 0.0F));
-
         //Why are we setting a constant as the ID? This should be investigated
         appView.getView().setId(100);
-        appView.getView().setLayoutParams(new LinearLayout.LayoutParams(
-                ViewGroup.LayoutParams.MATCH_PARENT,
+        appView.getView().setLayoutParams(new FrameLayout.LayoutParams(
                 ViewGroup.LayoutParams.MATCH_PARENT,
-                1.0F));
-
-        // need to remove appView from any existing parent before invoking root.addView(appView)
-        ViewParent parent = appView.getView().getParent();
-        if ((parent != null) && (parent != root)) {
-            LOG.d(TAG, "removing appView from existing parent");
-            ViewGroup parentGroup = (ViewGroup) parent;
-            parentGroup.removeView(appView.getView());
+                ViewGroup.LayoutParams.MATCH_PARENT));
+
+        setContentView(appView.getView());
+
         if (preferences.contains("BackgroundColor")) {
             int backgroundColor = preferences.getInteger("BackgroundColor", Color.BLACK);
             // Background of activity:
             appView.getView().setBackgroundColor(backgroundColor);
         }
-        root.addView(appView.getView());
-        setContentView(root);
+
         appView.getView().requestFocusFromTouch();
     }
 


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