Remove CategoriesSubHeader

This commit is contained in:
Victor Shcherb 2021-04-19 13:46:14 +02:00 committed by Vitaliy
parent 7f795a4e43
commit c40eb96bd7
4 changed files with 15 additions and 36 deletions

View file

@ -2,23 +2,3 @@ package net.osmand.plus.mapmarkers;
import androidx.annotation.DrawableRes; import androidx.annotation.DrawableRes;
public class CategoriesSubHeader {
@DrawableRes
private int iconRes;
private MapMarkersGroup group;
public CategoriesSubHeader(int iconRes, MapMarkersGroup group) {
this.iconRes = iconRes;
this.group = group;
}
@DrawableRes
public int getIconRes() {
return iconRes;
}
public MapMarkersGroup getGroup() {
return group;
}
}

View file

@ -31,7 +31,6 @@ public class MapMarkersGroup {
private TravelArticle wikivoyageArticle; private TravelArticle wikivoyageArticle;
// TODO should be removed from this class: // TODO should be removed from this class:
private GroupHeader header; private GroupHeader header;
private CategoriesSubHeader categoriesSubHeader;
private ShowHideHistoryButton showHideHistoryButton; private ShowHideHistoryButton showHideHistoryButton;
public MapMarkersGroup() { public MapMarkersGroup() {
@ -76,10 +75,6 @@ public class MapMarkersGroup {
this.header = header; this.header = header;
} }
public void setCategoriesSubHeader(CategoriesSubHeader categoriesSubHeader) {
this.categoriesSubHeader = categoriesSubHeader;
}
public void setShowHideHistoryButton(ShowHideHistoryButton showHideHistoryButton) { public void setShowHideHistoryButton(ShowHideHistoryButton showHideHistoryButton) {
this.showHideHistoryButton = showHideHistoryButton; this.showHideHistoryButton = showHideHistoryButton;
} }
@ -144,10 +139,6 @@ public class MapMarkersGroup {
return header; return header;
} }
public CategoriesSubHeader getCategoriesSubHeader() {
return categoriesSubHeader;
}
public ShowHideHistoryButton getShowHideHistoryButton() { public ShowHideHistoryButton getShowHideHistoryButton() {
return showHideHistoryButton; return showHideHistoryButton;
} }

View file

@ -481,17 +481,12 @@ public class MapMarkersHelper {
private void createHeadersInGroup(@NonNull MapMarkersGroup group) { private void createHeadersInGroup(@NonNull MapMarkersGroup group) {
int type = group.getType(); int type = group.getType();
int headerIconId = 0; int headerIconId = 0;
int subHeaderIconId = 0;
if (type != -1) { if (type != -1) {
headerIconId = type == MapMarkersGroup.FAVORITES_TYPE headerIconId = type == MapMarkersGroup.FAVORITES_TYPE
? R.drawable.ic_action_favorite : R.drawable.ic_action_polygom_dark; ? R.drawable.ic_action_favorite : R.drawable.ic_action_polygom_dark;
subHeaderIconId = R.drawable.ic_action_filter;
} }
GroupHeader header = new GroupHeader(headerIconId, group); GroupHeader header = new GroupHeader(headerIconId, group);
CategoriesSubHeader categoriesSubHeader = new CategoriesSubHeader(subHeaderIconId, group);
group.setHeader(header); group.setHeader(header);
group.setCategoriesSubHeader(categoriesSubHeader);
} }
private void removeMarkerFromGroup(MapMarker marker) { private void removeMarkerFromGroup(MapMarker marker) {

View file

@ -21,7 +21,6 @@ import net.osmand.IndexConstants;
import net.osmand.data.LatLon; import net.osmand.data.LatLon;
import net.osmand.plus.GpxSelectionHelper; import net.osmand.plus.GpxSelectionHelper;
import net.osmand.plus.GpxSelectionHelper.SelectedGpxFile; import net.osmand.plus.GpxSelectionHelper.SelectedGpxFile;
import net.osmand.plus.mapmarkers.CategoriesSubHeader;
import net.osmand.plus.mapmarkers.MapMarkersHelper; import net.osmand.plus.mapmarkers.MapMarkersHelper;
import net.osmand.plus.mapmarkers.GroupHeader; import net.osmand.plus.mapmarkers.GroupHeader;
import net.osmand.plus.mapmarkers.MapMarker; import net.osmand.plus.mapmarkers.MapMarker;
@ -160,7 +159,7 @@ public class MapMarkersGroupsAdapter extends RecyclerView.Adapter<RecyclerView.V
items.add(header); items.add(header);
if (!group.isDisabled()) { if (!group.isDisabled()) {
if (group.getWptCategories() != null && !group.getWptCategories().isEmpty()) { if (group.getWptCategories() != null && !group.getWptCategories().isEmpty()) {
CategoriesSubHeader categoriesSubHeader = group.getCategoriesSubHeader(); CategoriesSubHeader categoriesSubHeader = new CategoriesSubHeader(group);
items.add(categoriesSubHeader); items.add(categoriesSubHeader);
} }
TravelHelper travelHelper = mapActivity.getMyApplication().getTravelHelper(); TravelHelper travelHelper = mapActivity.getMyApplication().getTravelHelper();
@ -627,6 +626,20 @@ public class MapMarkersGroupsAdapter extends RecyclerView.Adapter<RecyclerView.V
return monthStr; return monthStr;
} }
public class CategoriesSubHeader {
private MapMarkersGroup group;
public CategoriesSubHeader(MapMarkersGroup group) {
this.group = group;
}
public MapMarkersGroup getGroup() {
return group;
}
}
public interface MapMarkersGroupsAdapterListener { public interface MapMarkersGroupsAdapterListener {
void onItemClick(View view); void onItemClick(View view);