Bug 1117796 - Add zoomed view in a ViewStub and inflate it only with Nightly build. r=mcomella
authordominique vincent <domivinc@toitl.com>
Tue, 06 Jan 2015 14:19:25 +0100
changeset 239441 134bcefd5f7b48c34b38d5dcf832e4685dd23c16
parent 239440 913310f4e14405f7bc3926d59e4a665c65420df6
child 239442 75e4282eb85d78b796030ad2416e8fa9c491ec52
push id497
push usermleibovic@mozilla.com
push dateWed, 28 Jan 2015 16:43:37 +0000
reviewersmcomella
bugs1117796
milestone38.0a1
Bug 1117796 - Add zoomed view in a ViewStub and inflate it only with Nightly build. r=mcomella
mobile/android/base/GeckoApp.java
mobile/android/base/resources/layout/shared_ui_components.xml
--- a/mobile/android/base/GeckoApp.java
+++ b/mobile/android/base/GeckoApp.java
@@ -125,16 +125,18 @@ public abstract class GeckoApp
     LocationListener,
     NativeEventListener,
     SensorEventListener,
     Tabs.OnTabsChangedListener {
 
     private static final String LOGTAG = "GeckoApp";
     private static final int ONE_DAY_MS = 1000*60*60*24;
 
+    private static final boolean ZOOMED_VIEW_ENABLED = AppConstants.NIGHTLY_BUILD;
+
     private static enum StartupAction {
         NORMAL,     /* normal application start */
         URL,        /* launched with a passed URL */
         PREFETCH    /* launched with a passed URL that we prefetch */
     }
 
     public static final String ACTION_ALERT_CALLBACK       = "org.mozilla.gecko.ACTION_ALERT_CALLBACK";
     public static final String ACTION_HOMESCREEN_SHORTCUT  = "org.mozilla.gecko.BOOKMARK";
@@ -168,16 +170,17 @@ public abstract class GeckoApp
     protected MenuPanel mMenuPanel;
     protected Menu mMenu;
     protected GeckoProfile mProfile;
     protected boolean mIsRestoringActivity;
 
     private ContactService mContactService;
     private PromptService mPromptService;
     private TextSelection mTextSelection;
+    private ZoomedView mZoomedView;
 
     protected DoorHangerPopup mDoorHangerPopup;
     protected FormAssistPopup mFormAssistPopup;
     protected ButtonToast mToast;
 
     protected LayerView mLayerView;
     private AbsoluteLayout mPluginContainer;
 
@@ -1573,16 +1576,21 @@ public abstract class GeckoApp
         mContactService = new ContactService(EventDispatcher.getInstance(), this);
 
         mPromptService = new PromptService(this);
 
         mTextSelection = new TextSelection((TextSelectionHandle) findViewById(R.id.anchor_handle),
                                            (TextSelectionHandle) findViewById(R.id.caret_handle),
                                            (TextSelectionHandle) findViewById(R.id.focus_handle));
 
+        if (ZOOMED_VIEW_ENABLED) {
+            ViewStub stub = (ViewStub) findViewById(R.id.zoomed_view_stub);
+            mZoomedView = (ZoomedView) stub.inflate();
+        }
+
         PrefsHelper.getPref("app.update.autodownload", new PrefsHelper.PrefHandlerBase() {
             @Override public void prefValue(String pref, String value) {
                 UpdateServiceHelper.registerForUpdates(GeckoApp.this, value);
             }
         });
 
         // Trigger the completion of the telemetry timer that wraps activity startup,
         // then grab the duration to give to FHR.
@@ -2043,16 +2051,19 @@ public abstract class GeckoApp
         if (mFormAssistPopup != null)
             mFormAssistPopup.destroy();
         if (mContactService != null)
             mContactService.destroy();
         if (mPromptService != null)
             mPromptService.destroy();
         if (mTextSelection != null)
             mTextSelection.destroy();
+        if (mZoomedView != null) {
+            mZoomedView.destroy();
+        }
         NotificationHelper.destroy();
         IntentHelper.destroy();
         GeckoNetworkManager.destroy();
 
         if (SmsManager.isEnabled()) {
             SmsManager.getInstance().stop();
             if (isFinishing()) {
                 SmsManager.getInstance().shutdown();
--- a/mobile/android/base/resources/layout/shared_ui_components.xml
+++ b/mobile/android/base/resources/layout/shared_ui_components.xml
@@ -20,17 +20,22 @@
                     android:layout_height="match_parent"/>
 
     <org.mozilla.gecko.FormAssistPopup android:id="@+id/form_assist_popup"
                                        android:layout_width="match_parent"
                                        android:layout_height="match_parent"
                                        android:visibility="gone"/>
 
     <include layout="@layout/text_selection_handles"/>
-    <include layout="@layout/zoomed_view"/>
+
+    <ViewStub android:id="@+id/zoomed_view_stub"
+               android:inflatedId="@+id/zoomed_view"
+               android:layout="@layout/zoomed_view"
+               android:layout_width="wrap_content"
+               android:layout_height="wrap_content" />
 
     <FrameLayout android:id="@+id/camera_layout"
                  android:layout_height="wrap_content"
                  android:layout_width="wrap_content"
                  android:layout_alignParentRight="true"
                  android:layout_alignParentBottom="true">
     </FrameLayout>