bug 880259 - Firefox should use GeckoView r=mfinkle
authorBrad Lassey <blassey@mozilla.com>
Fri, 02 Aug 2013 16:46:07 -0400
changeset 142786 25a567f1e260704db2d20892b3dee816042e2248
parent 142785 f25d46b4f39fb704bbb8c4185cb14f2379d77e08
child 142787 000bb98adba6b7a70e86d422f18320de34abeeed
push id1
push userroot
push dateMon, 20 Oct 2014 17:29:22 +0000
reviewersmfinkle
bugs880259
milestone26.0a1
bug 880259 - Firefox should use GeckoView r=mfinkle
mobile/android/base/GeckoView.java
mobile/android/base/resources/layout/shared_ui_components.xml
mobile/android/base/resources/values/attrs.xml
--- a/mobile/android/base/GeckoView.java
+++ b/mobile/android/base/GeckoView.java
@@ -26,52 +26,49 @@ import android.view.SurfaceHolder;
 import android.view.SurfaceView;
 import android.os.Handler;
 
 public class GeckoView extends LayerView
     implements GeckoEventListener, ContextGetter {
 
     public GeckoView(Context context, AttributeSet attrs) {
         super(context, attrs);
-
         TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.GeckoView);
         String url = a.getString(R.styleable.GeckoView_url);
+        boolean doInit = a.getBoolean(R.styleable.GeckoView_doinit, true);
         a.recycle();
 
+        if (!doInit)
+            return;
+
         if (url != null) {
             GeckoThread.setUri(url);
             GeckoThread.setAction(Intent.ACTION_VIEW);
             GeckoAppShell.sendEventToGecko(GeckoEvent.createURILoadEvent(url));
         }
         GeckoAppShell.setContextGetter(this);
         if (context instanceof Activity) {
             Tabs tabs = Tabs.getInstance();
             tabs.attachToContext(context);
         }
-        GeckoProfile profile = GeckoProfile.get(context);
-        BrowserDB.initialize(profile.getName());
         GeckoAppShell.registerEventListener("Gecko:Ready", this);
 
         ThreadUtils.setUiThread(Thread.currentThread(), new Handler());
         initializeView(GeckoAppShell.getEventDispatcher());
+
+
+        GeckoProfile profile = GeckoProfile.get(context);
+        BrowserDB.initialize(profile.getName());
+
         if (GeckoThread.checkAndSetLaunchState(GeckoThread.LaunchState.Launching, GeckoThread.LaunchState.Launched)) {
             GeckoAppShell.setLayerView(this);
             GeckoThread.createAndStart();
         }
     }
 
-    @Override
-    public void onWindowFocusChanged(boolean hasFocus) {
-        super.onWindowFocusChanged(hasFocus);
-
-        if (hasFocus) {
-            setBackgroundDrawable(null);
-        }
-    }
-
     public void loadUrl(String uri) {
         Tabs.getInstance().loadUrl(uri);
     }
 
     public void loadUrlInNewTab(String uri) {
         Tabs.getInstance().loadUrl(uri, Tabs.LOADURL_NEW_TAB);
      }
 
--- a/mobile/android/base/resources/layout/shared_ui_components.xml
+++ b/mobile/android/base/resources/layout/shared_ui_components.xml
@@ -1,21 +1,23 @@
 <?xml version="1.0" encoding="utf-8"?>
 <!-- This Source Code Form is subject to the terms of the Mozilla Public
    - License, v. 2.0. If a copy of the MPL was not distributed with this
    - file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
 
 <!-- This file is used to include shared UI components in different gecko app
      layouts, such as gecko_app.xml and web_app.xml -->
 
-<merge xmlns:android="http://schemas.android.com/apk/res/android">
+<merge xmlns:android="http://schemas.android.com/apk/res/android"
+       xmlns:gecko="http://schemas.android.com/apk/res-auto">
 
-    <org.mozilla.gecko.gfx.LayerView android:id="@+id/layer_view"
-                                     android:layout_width="fill_parent"
-                                     android:layout_height="fill_parent"/>
+    <org.mozilla.gecko.GeckoView android:id="@+id/layer_view"
+                                 gecko:doinit="false"
+                                 android:layout_width="fill_parent"
+                                 android:layout_height="fill_parent"/>
 
     <AbsoluteLayout android:id="@+id/plugin_container"
                     android:background="@android:color/transparent"
                     android:layout_width="fill_parent"
                     android:layout_height="fill_parent"/>
 
     <org.mozilla.gecko.FormAssistPopup android:id="@+id/form_assist_popup"
                                        android:layout_width="fill_parent"
--- a/mobile/android/base/resources/values/attrs.xml
+++ b/mobile/android/base/resources/values/attrs.xml
@@ -168,12 +168,13 @@
         <!-- Imported from AbsListView -->
         <attr name="android:choiceMode"/>
         <attr name="android:drawSelectorOnTop"/>
         <attr name="android:listSelector"/>
     </declare-styleable>
 
     <declare-styleable name="GeckoView">
         <attr name="url" format="string"/>
+        <attr name="doinit" format="boolean"/>
     </declare-styleable>
 
 </resources>