From 465f8b80ff8981d901a5b1868af2e21f3499687f Mon Sep 17 00:00:00 2001 From: Sebastian Kaspari Date: Tue, 11 Aug 2015 10:22:39 +0200 Subject: [PATCH] Bug 1192814 - PanelRecyclerView: Create context menu for header. r=jonalmeida --HG-- extra : commitid : 3ZR71TUm0z9 extra : amend_source : 31aa338f8f9feb89fc3bb1cc53df15787c2b03ad --- mobile/android/base/home/PanelRecyclerView.java | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/mobile/android/base/home/PanelRecyclerView.java b/mobile/android/base/home/PanelRecyclerView.java index b07f8de7e4fc..9145ab1e1ca4 100644 --- a/mobile/android/base/home/PanelRecyclerView.java +++ b/mobile/android/base/home/PanelRecyclerView.java @@ -143,11 +143,26 @@ public class PanelRecyclerView extends RecyclerView @Override public boolean onItemLongClicked(RecyclerView recyclerView, int position, View v) { + if (viewConfig.hasHeaderConfig()) { + if (position == 0) { + final HomeConfig.HeaderConfig headerConfig = viewConfig.getHeaderConfig(); + + final HomeContextMenuInfo info = new HomeContextMenuInfo(v, position, -1); + info.url = headerConfig.getUrl(); + info.title = headerConfig.getUrl(); + + contextMenuInfo = info; + return showContextMenuForChild(this); + } + + position--; + } + Cursor cursor = adapter.getCursor(); cursor.moveToPosition(position); contextMenuInfo = contextMenuInfoFactory.makeInfoForCursor(recyclerView, position, -1, cursor); - return showContextMenuForChild(PanelRecyclerView.this); + return showContextMenuForChild(this); } private class PanelSpanSizeLookup extends GridLayoutManager.SpanSizeLookup {