Show on map favourite group
This commit is contained in:
parent
2cf3c2c254
commit
d74e3da288
1 changed files with 8 additions and 6 deletions
|
@ -2,30 +2,32 @@ package net.osmand.plus.mapmarkers;
|
||||||
|
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
|
|
||||||
|
import net.osmand.plus.FavouritesDbHelper;
|
||||||
import net.osmand.plus.FavouritesDbHelper.FavoriteGroup;
|
import net.osmand.plus.FavouritesDbHelper.FavoriteGroup;
|
||||||
import net.osmand.plus.MapMarkersHelper.MarkersSyncGroup;
|
import net.osmand.plus.MapMarkersHelper.MarkersSyncGroup;
|
||||||
import net.osmand.plus.mapmarkers.adapters.FavouritesGroupsAdapter;
|
import net.osmand.plus.mapmarkers.adapters.FavouritesGroupsAdapter;
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
public class AddFavouritesGroupBottomSheetDialogFragment extends AddGroupBottomSheetDialogFragment {
|
public class AddFavouritesGroupBottomSheetDialogFragment extends AddGroupBottomSheetDialogFragment {
|
||||||
|
|
||||||
private List<FavoriteGroup> favoriteGroups;
|
private FavouritesDbHelper favouritesDbHelper;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onCreate(Bundle savedInstanceState) {
|
public void onCreate(Bundle savedInstanceState) {
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
favoriteGroups = getMyApplication().getFavorites().getFavoriteGroups();
|
favouritesDbHelper = getMyApplication().getFavorites();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public MarkersSyncGroup createMapMarkersSyncGroup(int position) {
|
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);
|
return new MarkersSyncGroup(group.name, group.name, MarkersSyncGroup.FAVORITES_TYPE, group.color);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void createAdapter() {
|
public void createAdapter() {
|
||||||
adapter = new FavouritesGroupsAdapter(getContext(), favoriteGroups);
|
adapter = new FavouritesGroupsAdapter(getContext(), favouritesDbHelper.getFavoriteGroups());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue