Bug 957097 - Turn GeckoActionProvider's max history size into a constant (r=wesj)
authorLucas Rocha <lucasr@mozilla.com>
Wed, 08 Jan 2014 12:18:40 +0000
changeset 162546 b524fc6b21b9da837c0ee6f0c91ae3f0b86e37bb
parent 162545 7f48035ecdb486544b4ba672429725a67ee5e1e6
child 162547 2e6f5635d28c38609ddd3797ed6493ef23a57e7d
push idunknown
push userunknown
push dateunknown
reviewerswesj
bugs957097
milestone29.0a1
Bug 957097 - Turn GeckoActionProvider's max history size into a constant (r=wesj)
mobile/android/base/widget/GeckoActionProvider.java
--- a/mobile/android/base/widget/GeckoActionProvider.java
+++ b/mobile/android/base/widget/GeckoActionProvider.java
@@ -15,16 +15,17 @@ import android.graphics.drawable.Drawabl
 import android.view.ActionProvider;
 import android.view.MenuItem;
 import android.view.MenuItem.OnMenuItemClickListener;
 import android.view.SubMenu;
 import android.view.View;
 import android.view.View.OnClickListener;
 
 public class GeckoActionProvider extends ActionProvider {
+    private static int MAX_HISTORY_SIZE = 2;
 
     /**
      * A listener to know when a target was selected.
      * When setting a provider, the activity can listen to this,
      * to close the menu.
      */
     public interface OnTargetSelectedListener {
         public void onTargetSelected();
@@ -50,18 +51,18 @@ public class GeckoActionProvider extends
     public View onCreateActionView() {
         // Create the view and set its data model.
         ActivityChooserModel dataModel = ActivityChooserModel.get(mContext, mHistoryFileName);
         MenuItemActionView view = new MenuItemActionView(mContext, null);
         view.setActionButtonClickListener(mCallbacks);
 
         final PackageManager packageManager = mContext.getPackageManager();
         int historySize = dataModel.getDistinctActivityCountInHistory();
-        if (historySize > 2) {
-            historySize = 2;
+        if (historySize > MAX_HISTORY_SIZE) {
+            historySize = MAX_HISTORY_SIZE;
         }
 
         // Historical data is dependent on past selection of activities.
         // Activity count is determined by the number of activities that can handle
         // the particular intent. When no intent is set, the activity count is 0,
         // while the history count can be a valid number.
         if (historySize > dataModel.getActivityCount()) {
             return view;