Backed out changeset b2828872f3e7 (bug 1220928)
authorCarsten "Tomcat" Book <cbook@mozilla.com>
Wed, 30 Mar 2016 14:37:52 +0200
changeset 290883 9c2817f5c9009571e11f65c208401a58fe280799
parent 290882 3cdaff81f4d58e0e2ba8af736438e63993867a4a
child 290884 0bc1a886196ed0e9a1aa2f9754a11af4adf52936
push id19656
push usergwagner@mozilla.com
push dateMon, 04 Apr 2016 13:43:23 +0000
treeherderb2g-inbound@e99061fde28a [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs1220928
milestone48.0a1
backs outb2828872f3e78911798083fde9b196e7206aaf19
Backed out changeset b2828872f3e7 (bug 1220928)
mobile/android/base/java/org/mozilla/gecko/home/CombinedHistoryAdapter.java
mobile/android/base/java/org/mozilla/gecko/home/CombinedHistoryPanel.java
mobile/android/base/java/org/mozilla/gecko/home/CombinedHistoryRecyclerView.java
--- a/mobile/android/base/java/org/mozilla/gecko/home/CombinedHistoryAdapter.java
+++ b/mobile/android/base/java/org/mozilla/gecko/home/CombinedHistoryAdapter.java
@@ -106,31 +106,16 @@ public class CombinedHistoryAdapter exte
             return position - remoteClients.size();
         } else if (type == ItemType.HISTORY){
             return position - remoteClients.size() - getHeadersBefore(position);
         } else {
             return position;
         }
     }
 
-    public HomeContextMenuInfo makeContextMenuInfoFromPosition(View view, int position) {
-        final ItemType itemType = ItemType.viewTypeToItemType(getItemViewType(position));
-        HomeContextMenuInfo info;
-        switch (itemType) {
-            case CHILD:
-                info = new HomeContextMenuInfo(view, position, -1);
-                return CombinedHistoryPanel.populateChildInfoFromTab(info, clientChildren.get(position));
-            case HISTORY:
-                info = new HomeContextMenuInfo(view, position, -1);
-                historyCursor.moveToPosition(transformPosition(ItemType.HISTORY, position));
-                return CombinedHistoryPanel.populateHistoryInfoFromCursor(info, historyCursor);
-        }
-        return null;
-    }
-
     @Override
     public CombinedHistoryItem onCreateViewHolder(ViewGroup viewGroup, int viewType) {
         final LayoutInflater inflater = LayoutInflater.from(viewGroup.getContext());
         final View view;
 
         final ItemType itemType = ItemType.viewTypeToItemType(viewType);
 
         switch (itemType) {
--- a/mobile/android/base/java/org/mozilla/gecko/home/CombinedHistoryPanel.java
+++ b/mobile/android/base/java/org/mozilla/gecko/home/CombinedHistoryPanel.java
@@ -32,20 +32,18 @@ import org.json.JSONArray;
 import org.mozilla.gecko.EventDispatcher;
 import org.mozilla.gecko.GeckoAppShell;
 import org.mozilla.gecko.GeckoEvent;
 import org.mozilla.gecko.GeckoProfile;
 import org.mozilla.gecko.R;
 import org.mozilla.gecko.Restrictions;
 import org.mozilla.gecko.Telemetry;
 import org.mozilla.gecko.TelemetryContract;
-import org.mozilla.gecko.db.BrowserContract;
 import org.mozilla.gecko.db.BrowserDB;
 import org.mozilla.gecko.db.RemoteClient;
-import org.mozilla.gecko.db.RemoteTab;
 import org.mozilla.gecko.home.HistorySectionsHelper.SectionDateRange;
 import org.mozilla.gecko.restrictions.Restrictable;
 import org.mozilla.gecko.widget.DividerItemDecoration;
 
 import java.util.List;
 
 public class CombinedHistoryPanel extends HomeFragment {
     private static final String LOGTAG = "GeckoCombinedHistoryPnl";
@@ -101,18 +99,16 @@ public class CombinedHistoryPanel extend
 
         mRecyclerView = (CombinedHistoryRecyclerView) view.findViewById(R.id.combined_recycler_view);
         mAdapter = new CombinedHistoryAdapter(getContext());
         mRecyclerView.setAdapter(mAdapter);
         mRecyclerView.setItemAnimator(new DefaultItemAnimator());
         mRecyclerView.addItemDecoration(new DividerItemDecoration(getContext()));
         mRecyclerView.setOnHistoryClickedListener(mUrlOpenListener);
         mRecyclerView.setOnPanelLevelChangeListener(new OnLevelChangeListener());
-        registerForContextMenu(mRecyclerView);
-
         mPanelFooterButton = (Button) view.findViewById(R.id.clear_history_button);
         mPanelFooterButton.setOnClickListener(new OnFooterButtonClickListener());
     }
 
     @Override
     public void onActivityCreated(Bundle savedInstanceState) {
         super.onActivityCreated(savedInstanceState);
         mCursorLoaderCallbacks = new CursorLoaderCallbacks();
@@ -372,31 +368,9 @@ public class CombinedHistoryPanel extend
         // Add underlining for "Private Browsing".
         ssb.setSpan(new UnderlineSpan(), underlineStart, underlineEnd, 0);
 
         ssb.delete(underlineEnd, underlineEnd + FORMAT_S2.length());
         ssb.delete(underlineStart, underlineStart + FORMAT_S1.length());
 
         return ssb;
     }
-
-    protected static HomeContextMenuInfo populateHistoryInfoFromCursor(HomeContextMenuInfo info, Cursor cursor) {
-        info.url = cursor.getString(cursor.getColumnIndexOrThrow(BrowserContract.Combined.URL));
-        info.title = cursor.getString(cursor.getColumnIndexOrThrow(BrowserContract.Combined.TITLE));
-        info.historyId = cursor.getInt(cursor.getColumnIndexOrThrow(BrowserContract.Combined.HISTORY_ID));
-        info.itemType = HomeContextMenuInfo.RemoveItemType.HISTORY;
-        final int bookmarkIdCol = cursor.getColumnIndexOrThrow(BrowserContract.Combined.BOOKMARK_ID);
-        if (cursor.isNull(bookmarkIdCol)) {
-            // If this is a combined cursor, we may get a history item without a
-            // bookmark, in which case the bookmarks ID column value will be null.
-            info.bookmarkId =  -1;
-        } else {
-            info.bookmarkId = cursor.getInt(bookmarkIdCol);
-        }
-        return info;
-    }
-
-    protected static HomeContextMenuInfo populateChildInfoFromTab(HomeContextMenuInfo info, RemoteTab tab) {
-        info.url = tab.url;
-        info.title = tab.title;
-        return info;
-    }
 }
--- a/mobile/android/base/java/org/mozilla/gecko/home/CombinedHistoryRecyclerView.java
+++ b/mobile/android/base/java/org/mozilla/gecko/home/CombinedHistoryRecyclerView.java
@@ -18,17 +18,16 @@ import org.mozilla.gecko.widget.Recycler
 
 import java.util.EnumSet;
 
 public class CombinedHistoryRecyclerView extends RecyclerView
         implements RecyclerViewClickSupport.OnItemClickListener, RecyclerViewClickSupport.OnItemLongClickListener {
 
     protected HomePager.OnUrlOpenListener mOnUrlOpenListener;
     protected OnPanelLevelChangeListener mOnPanelLevelChangeListener;
-    protected HomeContextMenuInfo mContextMenuInfo;
 
     public CombinedHistoryRecyclerView(Context context) {
         super(context);
         init(context);
     }
 
     public CombinedHistoryRecyclerView(Context context, AttributeSet attributeSet) {
         super(context, attributeSet);
@@ -80,18 +79,12 @@ public class CombinedHistoryRecyclerView
                     mOnUrlOpenListener.onUrlOpen(historyItem.getUrl(), EnumSet.of(HomePager.OnUrlOpenListener.Flags.ALLOW_SWITCH_TO_TAB));
                 }
                 break;
         }
     }
 
     @Override
     public boolean onItemLongClicked(RecyclerView recyclerView, int position, View v) {
-        mContextMenuInfo = ((CombinedHistoryAdapter) getAdapter()).makeContextMenuInfoFromPosition(v, position);
+        // TODO: open context menu if not a date title
         return showContextMenuForChild(this);
     }
-
-    @Override
-    public HomeContextMenuInfo getContextMenuInfo() {
-        return mContextMenuInfo;
-    }
-
 }