From f9c92a23f65d8787a4d84bf100b0eb4224a95b3d Mon Sep 17 00:00:00 2001 From: Manuel Martin Date: Tue, 21 Jan 2020 18:41:45 +0100 Subject: [PATCH] Avoid double removing items when deleting (#2658) --- .../org/mozilla/vrbrowser/ui/views/BookmarksView.java | 7 ------- .../org/mozilla/vrbrowser/ui/views/HistoryView.java | 8 -------- 2 files changed, 15 deletions(-) diff --git a/app/src/common/shared/org/mozilla/vrbrowser/ui/views/BookmarksView.java b/app/src/common/shared/org/mozilla/vrbrowser/ui/views/BookmarksView.java index 4b00f6a4a..cd82489b6 100644 --- a/app/src/common/shared/org/mozilla/vrbrowser/ui/views/BookmarksView.java +++ b/app/src/common/shared/org/mozilla/vrbrowser/ui/views/BookmarksView.java @@ -164,13 +164,6 @@ public void onClick(@NonNull View view, @NonNull Bookmark item) { public void onDelete(@NonNull View view, @NonNull Bookmark item) { mBinding.bookmarksList.requestFocusFromTouch(); - mBookmarkAdapter.removeItem(item); - if (mBookmarkAdapter.itemCount() == 0) { - mBinding.setIsEmpty(true); - mBinding.setIsLoading(false); - mBinding.executePendingBindings(); - } - SessionStore.get().getBookmarkStore().deleteBookmarkById(item.getGuid()); } diff --git a/app/src/common/shared/org/mozilla/vrbrowser/ui/views/HistoryView.java b/app/src/common/shared/org/mozilla/vrbrowser/ui/views/HistoryView.java index 7113cc5a3..c94ce2445 100644 --- a/app/src/common/shared/org/mozilla/vrbrowser/ui/views/HistoryView.java +++ b/app/src/common/shared/org/mozilla/vrbrowser/ui/views/HistoryView.java @@ -167,13 +167,6 @@ public void onClick(View view, VisitInfo item) { public void onDelete(View view, VisitInfo item) { mBinding.historyList.requestFocusFromTouch(); - mHistoryAdapter.removeItem(item); - if (mHistoryAdapter.itemCount() == 0) { - mBinding.setIsEmpty(true); - mBinding.setIsLoading(false); - mBinding.executePendingBindings(); - } - SessionStore.get().getHistoryStore().deleteVisitsFor(item.getUrl()); } @@ -381,7 +374,6 @@ private void showHistory(List historyItems) { mBinding.setIsEmpty(false); mBinding.setIsLoading(false); mHistoryAdapter.setHistoryList(historyItems); - mBinding.historyList.post(() -> mBinding.historyList.smoothScrollToPosition(0)); } }