Fix "show history" button

This commit is contained in:
Alexander Sytnyk 2018-03-21 11:59:33 +02:00
parent 2199c796a3
commit ee4622a4aa
2 changed files with 6 additions and 5 deletions

View file

@ -378,11 +378,13 @@ public class MapMarkersHelper {
}
public void updateGroup(MapMarkersGroup mapMarkersGroup) {
createHeaderAndHistoryButtonInGroup(mapMarkersGroup);
createHeaderInGroup(mapMarkersGroup);
int historyMarkersCount = mapMarkersGroup.getHistoryMarkers().size();
ShowHideHistoryButton showHideHistoryButton = mapMarkersGroup.getShowHideHistoryButton();
if (showHideHistoryButton != null && historyMarkersCount == 0) {
if (showHideHistoryButton != null) {
if (historyMarkersCount == 0) {
mapMarkersGroup.setShowHideHistoryButton(null);
}
} else if (historyMarkersCount > 0) {
showHideHistoryButton = new ShowHideHistoryButton();
showHideHistoryButton.setShowHistory(false);
@ -418,7 +420,7 @@ public class MapMarkersHelper {
}
}
private void createHeaderAndHistoryButtonInGroup(@NonNull MapMarkersGroup group) {
private void createHeaderInGroup(@NonNull MapMarkersGroup group) {
if (group.getName() != null) {
GroupHeader header = new GroupHeader();
int type = group.getType();

View file

@ -137,7 +137,6 @@ public class MapMarkersGroupsAdapter extends RecyclerView.Adapter<RecyclerView.V
}
} else {
GroupHeader header = group.getGroupHeader();
// TODO fix null-header
items.add(header);
populateAdapterWithGroupMarkers(group, getItemCount());
}