Skip to content
This repository was archived by the owner on Jul 22, 2024. It is now read-only.

Commit a31d333

Browse files
keianhzobluemarvin
authored andcommitted
Show empty history when the last item is manually removed (#1788)
1 parent 94e847e commit a31d333

1 file changed

Lines changed: 9 additions & 1 deletion

File tree

app/src/common/shared/org/mozilla/vrbrowser/ui/adapters/HistoryAdapter.java

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
import java.util.Objects;
2626

2727
import mozilla.components.concept.storage.VisitInfo;
28+
import mozilla.components.concept.storage.VisitType;
2829

2930
public class HistoryAdapter extends RecyclerView.Adapter<HistoryAdapter.HistoryItemViewHolder> {
3031

@@ -100,7 +101,14 @@ public void removeItem(VisitInfo historyItem) {
100101
}
101102

102103
public int itemCount() {
103-
return mHistoryList != null ? mHistoryList.size() : 0;
104+
if (mHistoryList != null) {
105+
return mHistoryList.stream().allMatch(item ->
106+
item.getVisitType() == VisitType.NOT_A_VISIT) ?
107+
0 :
108+
mHistoryList.size();
109+
}
110+
111+
return 0;
104112
}
105113

106114
public int getItemPosition(long id) {

0 commit comments

Comments
 (0)