From 4e486c0b40290fb1c55be34c776e7165ab84b34c Mon Sep 17 00:00:00 2001 From: Grisha Kruglov Date: Mon, 21 Sep 2020 17:41:25 -0700 Subject: [PATCH] [fenix] For https://github.com/mozilla-mobile/fenix/issues/15286: Don't crash when separators are long-touched --- .../mozilla/fenix/library/bookmarks/BookmarkTouchHelper.kt | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/org/mozilla/fenix/library/bookmarks/BookmarkTouchHelper.kt b/app/src/main/java/org/mozilla/fenix/library/bookmarks/BookmarkTouchHelper.kt index 742f2a2387..5edf2c26f2 100644 --- a/app/src/main/java/org/mozilla/fenix/library/bookmarks/BookmarkTouchHelper.kt +++ b/app/src/main/java/org/mozilla/fenix/library/bookmarks/BookmarkTouchHelper.kt @@ -30,8 +30,12 @@ class BookmarkTouchCallback( recyclerView: RecyclerView, viewHolder: RecyclerView.ViewHolder ): Int { + // Swiping separators is currently not supported. + if (viewHolder is BookmarkSeparatorViewHolder) { + return 0 + } val item = (viewHolder as BookmarkNodeViewHolder).item - return if (viewHolder is BookmarkSeparatorViewHolder || item?.inRoots() == true) { + return if (item?.inRoots() == true) { 0 } else { super.getSwipeDirs(recyclerView, viewHolder)