Show on map favourite group

This commit is contained in:
PavelRatushny 2017-11-13 13:33:40 +02:00
parent 2cf3c2c254
commit d74e3da288

View file

@ -2,30 +2,32 @@ package net.osmand.plus.mapmarkers;
import android.os.Bundle;
import net.osmand.plus.FavouritesDbHelper;
import net.osmand.plus.FavouritesDbHelper.FavoriteGroup;
import net.osmand.plus.MapMarkersHelper.MarkersSyncGroup;
import net.osmand.plus.mapmarkers.adapters.FavouritesGroupsAdapter;
import java.util.List;
public class AddFavouritesGroupBottomSheetDialogFragment extends AddGroupBottomSheetDialogFragment {
private List<FavoriteGroup> favoriteGroups;
private FavouritesDbHelper favouritesDbHelper;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
favoriteGroups = getMyApplication().getFavorites().getFavoriteGroups();
favouritesDbHelper = getMyApplication().getFavorites();
}
@Override
public MarkersSyncGroup createMapMarkersSyncGroup(int position) {
FavoriteGroup group = favoriteGroups.get(position - 1);
FavoriteGroup group = favouritesDbHelper.getFavoriteGroups().get(position - 1);
if (!group.visible) {
favouritesDbHelper.editFavouriteGroup(group, group.name, group.color, true);
}
return new MarkersSyncGroup(group.name, group.name, MarkersSyncGroup.FAVORITES_TYPE, group.color);
}
@Override
public void createAdapter() {
adapter = new FavouritesGroupsAdapter(getContext(), favoriteGroups);
adapter = new FavouritesGroupsAdapter(getContext(), favouritesDbHelper.getFavoriteGroups());
}
}