Bug 852312: Move the custom views in about:home to widget directory. [r=bnicholson]
authorSriram Ramasubramanian <sriram@mozilla.com>
Mon, 25 Mar 2013 15:44:45 -0700
changeset 126641 9ec706efc6c0dbd49fd7a5404744e15892fb8229
parent 126640 fa9cde226b2aa6d9e67ba641366d426cd3823ac3
child 126642 c3cb49f3953351a698649bcc3f2d25f18643e57e
push id25562
push usersramasubramanian@mozilla.com
push dateThu, 28 Mar 2013 22:28:35 +0000
treeherdermozilla-inbound@c3cb49f39533 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbnicholson
bugs852312
milestone22.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 852312: Move the custom views in about:home to widget directory. [r=bnicholson]
mobile/android/base/AboutHomeContent.java
mobile/android/base/AboutHomePromoBox.java
mobile/android/base/AboutHomeSection.java
mobile/android/base/ActivityHandlerHelper.java
mobile/android/base/AwesomeBar.java
mobile/android/base/BrowserApp.java
mobile/android/base/GeckoAppShell.java
mobile/android/base/GeckoViewsFactory.java
mobile/android/base/LinkTextView.java
mobile/android/base/Makefile.in
mobile/android/base/ThumbnailHelper.java
mobile/android/base/resources/layout/gecko_app.xml
mobile/android/base/widget/AboutHomeContent.java
mobile/android/base/widget/AboutHomePromoBox.java
mobile/android/base/widget/AboutHomeSection.java
mobile/android/base/widget/LinkTextView.java
--- a/mobile/android/base/ActivityHandlerHelper.java
+++ b/mobile/android/base/ActivityHandlerHelper.java
@@ -23,41 +23,41 @@ import android.provider.MediaStore;
 import android.util.Log;
 
 import java.io.File;
 import java.util.ArrayList;
 import java.util.List;
 import java.util.concurrent.SynchronousQueue;
 import java.util.concurrent.TimeUnit;
 
-class ActivityHandlerHelper {
+public class ActivityHandlerHelper {
     private static final String LOGTAG = "GeckoActivityHandlerHelper";
 
     private final SynchronousQueue<String> mFilePickerResult;
 
     private final ActivityResultHandlerMap mActivityResultHandlerMap;
     private final FilePickerResultHandlerSync mFilePickerResultHandlerSync;
     private final AwesomebarResultHandler mAwesomebarResultHandler;
     private final CameraImageResultHandler mCameraImageResultHandler;
     private final CameraVideoResultHandler mCameraVideoResultHandler;
 
-    ActivityHandlerHelper() {
+    public ActivityHandlerHelper() {
         mFilePickerResult = new SynchronousQueue<String>();
         mActivityResultHandlerMap = new ActivityResultHandlerMap();
         mFilePickerResultHandlerSync = new FilePickerResultHandlerSync(mFilePickerResult);
         mAwesomebarResultHandler = new AwesomebarResultHandler();
         mCameraImageResultHandler = new CameraImageResultHandler(mFilePickerResult);
         mCameraVideoResultHandler = new CameraVideoResultHandler(mFilePickerResult);
     }
 
-    int makeRequestCodeForAwesomebar() {
+    public int makeRequestCodeForAwesomebar() {
         return mActivityResultHandlerMap.put(mAwesomebarResultHandler);
     }
 
-    int makeRequestCode(ActivityResultHandler aHandler) {
+    public int makeRequestCode(ActivityResultHandler aHandler) {
         return mActivityResultHandlerMap.put(aHandler);
     }
 
     private int addIntentActivitiesToList(Context context, Intent intent, ArrayList<PromptService.PromptListItem> items, ArrayList<Intent> aIntents) {
         PackageManager pm = context.getPackageManager();
         List<ResolveInfo> lri = pm.queryIntentActivityOptions(GeckoApp.mAppContext.getComponentName(), null, intent, 0);
 
         if (lri == null) {
--- a/mobile/android/base/AwesomeBar.java
+++ b/mobile/android/base/AwesomeBar.java
@@ -51,23 +51,23 @@ import java.util.Collection;
 public class AwesomeBar extends GeckoActivity {
     private static final String LOGTAG = "GeckoAwesomeBar";
 
     private static final Collection<String> sSwypeInputMethods = Arrays.asList(new String[] {
                                                                  InputMethods.METHOD_SWYPE,
                                                                  InputMethods.METHOD_SWYPE_BETA,
                                                                  });
 
-    static final String URL_KEY = "url";
-    static final String CURRENT_URL_KEY = "currenturl";
-    static final String TARGET_KEY = "target";
-    static final String SEARCH_KEY = "search";
-    static final String TITLE_KEY = "title";
-    static final String USER_ENTERED_KEY = "user_entered";
-    static final String READING_LIST_KEY = "reading_list";
+    public static final String URL_KEY = "url";
+    public static final String CURRENT_URL_KEY = "currenturl";
+    public static final String TARGET_KEY = "target";
+    public static final String SEARCH_KEY = "search";
+    public static final String TITLE_KEY = "title";
+    public static final String USER_ENTERED_KEY = "user_entered";
+    public static final String READING_LIST_KEY = "reading_list";
     public static enum Target { NEW_TAB, CURRENT_TAB, PICK_SITE };
 
     private String mTarget;
     private AwesomeBarTabs mAwesomeTabs;
     private CustomEditText mText;
     private ImageButton mGoButton;
     private ContextMenuSubject mContextMenuSubject;
     private boolean mIsUsingSwype;
--- a/mobile/android/base/BrowserApp.java
+++ b/mobile/android/base/BrowserApp.java
@@ -9,16 +9,17 @@ import org.mozilla.gecko.db.BrowserContr
 import org.mozilla.gecko.db.BrowserDB;
 import org.mozilla.gecko.gfx.BitmapUtils;
 import org.mozilla.gecko.gfx.ImmutableViewportMetrics;
 import org.mozilla.gecko.gfx.LayerView;
 import org.mozilla.gecko.util.FloatUtils;
 import org.mozilla.gecko.util.GamepadUtils;
 import org.mozilla.gecko.util.ThreadUtils;
 import org.mozilla.gecko.util.UiAsyncTask;
+import org.mozilla.gecko.widget.AboutHomeContent;
 
 import org.json.JSONArray;
 import org.json.JSONException;
 import org.json.JSONObject;
 
 import android.app.Activity;
 import android.app.AlertDialog;
 import android.content.DialogInterface;
--- a/mobile/android/base/GeckoAppShell.java
+++ b/mobile/android/base/GeckoAppShell.java
@@ -145,17 +145,17 @@ public class GeckoAppShell
     private static Sensor gLinearAccelerometerSensor = null;
     private static Sensor gGyroscopeSensor = null;
     private static Sensor gOrientationSensor = null;
     private static Sensor gProximitySensor = null;
     private static Sensor gLightSensor = null;
 
     private static boolean mLocationHighAccuracy = false;
 
-    static ActivityHandlerHelper sActivityHelper = new ActivityHandlerHelper();
+    public static ActivityHandlerHelper sActivityHelper = new ActivityHandlerHelper();
     static NotificationClient sNotificationClient;
 
     /* The Android-side API: API methods that Android calls */
 
     // Initialization methods
     public static native void nativeInit();
 
     // helper methods
--- a/mobile/android/base/GeckoViewsFactory.java
+++ b/mobile/android/base/GeckoViewsFactory.java
@@ -1,16 +1,20 @@
 /* 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/. */
 
 package org.mozilla.gecko;
 
 import org.mozilla.gecko.gfx.LayerView;
+import org.mozilla.gecko.widget.AboutHomeContent;
+import org.mozilla.gecko.widget.AboutHomePromoBox;
+import org.mozilla.gecko.widget.AboutHomeSection;
 import org.mozilla.gecko.widget.IconTabWidget;
+import org.mozilla.gecko.widget.LinkTextView;
 import org.mozilla.gecko.widget.TabRow;
 import org.mozilla.gecko.widget.ThumbnailView;
 
 import android.content.Context;
 import android.text.TextUtils;
 import android.util.AttributeSet;
 import android.util.Log;
 import android.view.LayoutInflater;
--- a/mobile/android/base/Makefile.in
+++ b/mobile/android/base/Makefile.in
@@ -38,19 +38,16 @@ UTIL_JAVA_FILES := \
   util/INIParser.java \
   util/INISection.java \
   util/StringUtils.java \
   util/ThreadUtils.java \
   util/UiAsyncTask.java \
   $(NULL)
 
 FENNEC_JAVA_FILES = \
-  AboutHomeContent.java \
-  AboutHomePromoBox.java \
-  AboutHomeSection.java \
   ActivityHandlerHelper.java \
   AlertNotification.java \
   AllCapsTextView.java \
   AndroidImport.java \
   AndroidImportPreference.java \
   AnimatorProxy.java \
   AnimatedHeightLayout.java \
   AppNotificationClient.java \
@@ -108,17 +105,16 @@ FENNEC_JAVA_FILES = \
   GlobalHistory.java \
   GeckoViewsFactory.java \
   HeightChangeAnimation.java \
   InputMethods.java \
   JavaAddonManager.java \
   LightweightTheme.java \
   LightweightThemeDrawable.java \
   LinkPreference.java \
-  LinkTextView.java \
   MemoryMonitor.java \
   MenuButton.java \
   MenuItemActionBar.java \
   MenuItemDefault.java \
   MenuPanel.java \
   MenuPopup.java \
   MotionEventInterceptor.java \
   MultiChoicePreference.java \
@@ -196,18 +192,22 @@ FENNEC_JAVA_FILES = \
   gfx/SubdocumentScrollHelper.java \
   gfx/TextLayer.java \
   gfx/TextureGenerator.java \
   gfx/TextureReaper.java \
   gfx/TileLayer.java \
   gfx/TouchEventHandler.java \
   gfx/ViewTransform.java \
   gfx/VirtualLayer.java \
+  widget/AboutHomeContent.java \
+  widget/AboutHomePromoBox.java \
+  widget/AboutHomeSection.java \
   widget/DateTimePicker.java \
   widget/IconTabWidget.java \
+  widget/LinkTextView.java \
   widget/TabRow.java \
   widget/ThumbnailView.java \
   widget/TwoWayView.java \
   GeckoNetworkManager.java \
   GeckoScreenOrientationListener.java \
   UpdateService.java \
   GeckoUpdateReceiver.java \
   ReferrerReceiver.java \
--- a/mobile/android/base/ThumbnailHelper.java
+++ b/mobile/android/base/ThumbnailHelper.java
@@ -21,17 +21,17 @@ import java.util.concurrent.atomic.Atomi
  * Helper class to generate thumbnails for tabs.
  * Internally, a queue of pending thumbnails is maintained in mPendingThumbnails.
  * The head of the queue is the thumbnail that is currently being processed; upon
  * completion of the current thumbnail the next one is automatically processed.
  * Changes to the thumbnail width are stashed in mPendingWidth and the change is
  * applied between thumbnail processing. This allows a single thumbnail buffer to
  * be used for all thumbnails.
  */
-final class ThumbnailHelper {
+public final class ThumbnailHelper {
     private static final String LOGTAG = "GeckoThumbnailHelper";
 
     public static final float THUMBNAIL_ASPECT_RATIO = 0.714f;  // this is a 5:7 ratio (as per UX decision)
 
     // static singleton stuff
 
     private static ThumbnailHelper sInstance;
 
--- a/mobile/android/base/resources/layout/gecko_app.xml
+++ b/mobile/android/base/resources/layout/gecko_app.xml
@@ -22,20 +22,20 @@
         <RelativeLayout android:id="@+id/gecko_layout"
                         android:layout_width="fill_parent"
                         android:layout_height="fill_parent"
                         android:layout_below="@+id/toolbar_spacer"
                         android:layout_above="@+id/find_in_page">
 
             <include layout="@layout/shared_ui_components"/>
 
-            <org.mozilla.gecko.AboutHomeContent android:id="@+id/abouthome_content"
-                                                android:layout_width="fill_parent"
-                                                android:layout_height="fill_parent"
-                                                android:background="@color/background_normal"/>
+            <Gecko.AboutHomeContent android:id="@+id/abouthome_content"
+                                    android:layout_width="fill_parent"
+                                    android:layout_height="fill_parent"
+                                    android:background="@color/background_normal"/>
 
         </RelativeLayout>
 
         <org.mozilla.gecko.FindInPageBar android:id="@+id/find_in_page"
                                          android:layout_width="fill_parent"
                                          android:layout_height="wrap_content"
                                          android:layout_alignParentBottom="true"
                                          style="@style/FindBar"
rename from mobile/android/base/AboutHomeContent.java
rename to mobile/android/base/widget/AboutHomeContent.java
--- a/mobile/android/base/AboutHomeContent.java
+++ b/mobile/android/base/widget/AboutHomeContent.java
@@ -1,15 +1,28 @@
 /* -*- Mode: Java; c-basic-offset: 4; tab-width: 20; indent-tabs-mode: nil; -*-
  * 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/. */
 
-package org.mozilla.gecko;
+package org.mozilla.gecko.widget;
 
+import org.mozilla.gecko.AwesomeBar;
+import org.mozilla.gecko.BrowserApp;
+import org.mozilla.gecko.Favicons;
+import org.mozilla.gecko.GeckoApp;
+import org.mozilla.gecko.GeckoAppShell;
+import org.mozilla.gecko.GeckoLinearLayout;
+import org.mozilla.gecko.LightweightTheme;
+import org.mozilla.gecko.LightweightThemeDrawable;
+import org.mozilla.gecko.R;
+import org.mozilla.gecko.SessionParser;
+import org.mozilla.gecko.Tabs;
+import org.mozilla.gecko.TabsAccessor;
+import org.mozilla.gecko.ThumbnailHelper;
 import org.mozilla.gecko.db.BrowserContract;
 import org.mozilla.gecko.db.BrowserContract.Thumbnails;
 import org.mozilla.gecko.db.BrowserDB;
 import org.mozilla.gecko.db.BrowserDB.URLColumns;
 import org.mozilla.gecko.db.BrowserDB.TopSitesCursorWrapper;
 import org.mozilla.gecko.sync.setup.SyncAccounts;
 import org.mozilla.gecko.util.ActivityResultHandler;
 import org.mozilla.gecko.util.GamepadUtils;
@@ -79,17 +92,17 @@ public class AboutHomeContent extends Sc
     private static int mNumberOfTopSites;
     private static int mNumberOfCols;
 
     public static enum UnpinFlags {
         REMOVE_PIN,
         REMOVE_HISTORY
     }
 
-    static enum UpdateFlags {
+    public static enum UpdateFlags {
         TOP_SITES,
         PREVIOUS_TABS,
         RECOMMENDED_ADDONS,
         REMOTE_TABS;
 
         public static final EnumSet<UpdateFlags> ALL = EnumSet.allOf(UpdateFlags.class);
     }
 
@@ -260,17 +273,17 @@ public class AboutHomeContent extends Sc
         }
 
         if (mTabsContentObserver != null) {
             mActivity.getContentResolver().unregisterContentObserver(mTabsContentObserver);
             mTabsContentObserver = null;
         }
     }
 
-    void setLastTabsVisibility(boolean visible) {
+    public void setLastTabsVisibility(boolean visible) {
         if (visible)
             mLastTabs.show();
         else
             mLastTabs.hide();
     }
 
     private void setTopSitesVisibility(boolean hasTopSites) {
         int visibility = hasTopSites ? View.VISIBLE : View.GONE;
@@ -440,17 +453,17 @@ public class AboutHomeContent extends Sc
 
             @Override
             public void onPostExecute(Cursor c) {
                 updateTopSitesThumbnails(getThumbnailsFromCursor(c));
             }
         }).execute();
     }
 
-    void update(final EnumSet<UpdateFlags> flags) {
+    public void update(final EnumSet<UpdateFlags> flags) {
         ThreadUtils.postToBackgroundThread(new Runnable() {
             @Override
             public void run() {
                 if (flags.contains(UpdateFlags.TOP_SITES))
                     loadTopSites();
 
                 if (flags.contains(UpdateFlags.PREVIOUS_TABS))
                     readLastTabs();
rename from mobile/android/base/AboutHomePromoBox.java
rename to mobile/android/base/widget/AboutHomePromoBox.java
--- a/mobile/android/base/AboutHomePromoBox.java
+++ b/mobile/android/base/widget/AboutHomePromoBox.java
@@ -1,14 +1,16 @@
 /* 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/. */
 
-package org.mozilla.gecko;
+package org.mozilla.gecko.widget;
 
+import org.mozilla.gecko.R;
+import org.mozilla.gecko.Tabs;
 import org.mozilla.gecko.db.BrowserDB;
 import org.mozilla.gecko.sync.setup.activities.SetupSyncActivity;
 import org.mozilla.gecko.sync.setup.SyncAccounts;
 import org.mozilla.gecko.util.ThreadUtils;
 import org.mozilla.gecko.util.UiAsyncTask;
 
 import android.accounts.Account;
 import android.accounts.AccountManager;
rename from mobile/android/base/AboutHomeSection.java
rename to mobile/android/base/widget/AboutHomeSection.java
--- a/mobile/android/base/AboutHomeSection.java
+++ b/mobile/android/base/widget/AboutHomeSection.java
@@ -1,14 +1,16 @@
 /* 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/. */
 
-package org.mozilla.gecko;
+package org.mozilla.gecko.widget;
 
+import org.mozilla.gecko.GeckoLinearLayout;
+import org.mozilla.gecko.R;
 import org.mozilla.gecko.util.GamepadUtils;
 
 import android.content.Context;
 import android.content.res.TypedArray;
 import android.text.TextUtils;
 import android.util.AttributeSet;
 import android.view.LayoutInflater;
 import android.view.View;
rename from mobile/android/base/LinkTextView.java
rename to mobile/android/base/widget/LinkTextView.java
--- a/mobile/android/base/LinkTextView.java
+++ b/mobile/android/base/widget/LinkTextView.java
@@ -1,13 +1,15 @@
 /* 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/. */
 
-package org.mozilla.gecko;
+package org.mozilla.gecko.widget;
+
+import org.mozilla.gecko.R;
 
 import android.content.Context;
 import android.graphics.Rect;
 import android.text.SpannableString;
 import android.text.style.BackgroundColorSpan;
 import android.text.style.UnderlineSpan;
 import android.util.AttributeSet;
 import android.widget.TextView;