Remove CategoriesSubHeader

This commit is contained in:
Victor Shcherb 2021-04-19 13:46:14 +02:00
parent d3722d8540
commit beb8058495
4 changed files with 15 additions and 36 deletions

View file

@ -2,23 +2,3 @@ package net.osmand.plus.mapmarkers;
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;
// TODO should be removed from this class:
private GroupHeader header;
private CategoriesSubHeader categoriesSubHeader;
private ShowHideHistoryButton showHideHistoryButton;
public MapMarkersGroup() {
@ -76,10 +75,6 @@ public class MapMarkersGroup {
this.header = header;
}
public void setCategoriesSubHeader(CategoriesSubHeader categoriesSubHeader) {
this.categoriesSubHeader = categoriesSubHeader;
}
public void setShowHideHistoryButton(ShowHideHistoryButton showHideHistoryButton) {
this.showHideHistoryButton = showHideHistoryButton;
}
@ -144,10 +139,6 @@ public class MapMarkersGroup {
return header;
}
public CategoriesSubHeader getCategoriesSubHeader() {
return categoriesSubHeader;
}
public ShowHideHistoryButton getShowHideHistoryButton() {
return showHideHistoryButton;
}

View file

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

View file

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