Skip to content

Commit

Permalink
Avoid double removing items when deleting (#2658)
Browse files Browse the repository at this point in the history
  • Loading branch information
keianhzo authored and MortimerGoro committed Jan 21, 2020
1 parent 2868a7e commit f9c92a2
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 15 deletions.
Expand Up @@ -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());
}

Expand Down
Expand Up @@ -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());
}

Expand Down Expand Up @@ -381,7 +374,6 @@ private void showHistory(List<VisitInfo> historyItems) {
mBinding.setIsEmpty(false);
mBinding.setIsLoading(false);
mHistoryAdapter.setHistoryList(historyItems);
mBinding.historyList.post(() -> mBinding.historyList.smoothScrollToPosition(0));
}
}

Expand Down

0 comments on commit f9c92a2

Please sign in to comment.