Save markers on rotate
This commit is contained in:
parent
f121ae1e47
commit
7670f6667a
2 changed files with 9 additions and 3 deletions
|
@ -37,6 +37,8 @@ import net.osmand.Location;
|
|||
import net.osmand.data.LatLon;
|
||||
import net.osmand.data.PointDescription;
|
||||
import net.osmand.plus.IconsCache;
|
||||
import net.osmand.plus.MapMarkersHelper;
|
||||
import net.osmand.plus.MapMarkersHelper.MapMarker;
|
||||
import net.osmand.plus.OsmAndLocationProvider.OsmAndCompassListener;
|
||||
import net.osmand.plus.OsmAndLocationProvider.OsmAndLocationListener;
|
||||
import net.osmand.plus.OsmandApplication;
|
||||
|
@ -76,6 +78,7 @@ public class CoordinateInputDialogFragment extends DialogFragment implements Osm
|
|||
private static final String LONGITUDE_LABEL = "longitude";
|
||||
private static final String NAME_LABEL = "name";
|
||||
|
||||
private List<MapMarker> mapMarkers = new ArrayList<>();
|
||||
private CoordinateInputAdapter adapter;
|
||||
private boolean lightTheme;
|
||||
private boolean useOsmandKeyboard = true;
|
||||
|
@ -88,6 +91,7 @@ public class CoordinateInputDialogFragment extends DialogFragment implements Osm
|
|||
private Float heading;
|
||||
private boolean locationUpdateStarted;
|
||||
private boolean compassUpdateAllowed = true;
|
||||
private MapMarkersHelper mapMarkersHelper;
|
||||
|
||||
@Override
|
||||
public void onCreate(Bundle savedInstanceState) {
|
||||
|
@ -108,6 +112,7 @@ public class CoordinateInputDialogFragment extends DialogFragment implements Osm
|
|||
mainView = inflater.inflate(R.layout.fragment_coordinate_input_dialog, container);
|
||||
final MapActivity mapActivity = getMapActivity();
|
||||
iconsCache = getMyApplication().getIconsCache();
|
||||
mapMarkersHelper = getMyApplication().getMapMarkersHelper();
|
||||
|
||||
Fragment coordinateInputBottomSheetDialogFragment = mapActivity.getSupportFragmentManager().findFragmentByTag(CoordinateInputBottomSheetDialogFragment.TAG);
|
||||
if (coordinateInputBottomSheetDialogFragment != null) {
|
||||
|
@ -179,7 +184,7 @@ public class CoordinateInputDialogFragment extends DialogFragment implements Osm
|
|||
|
||||
RecyclerView recyclerView = (RecyclerView) mainView.findViewById(R.id.markers_recycler_view);
|
||||
recyclerView.setLayoutManager(new LinearLayoutManager(getContext()));
|
||||
adapter = new CoordinateInputAdapter(mapActivity);
|
||||
adapter = new CoordinateInputAdapter(mapActivity, mapMarkers);
|
||||
recyclerView.setAdapter(adapter);
|
||||
recyclerView.addOnScrollListener(new RecyclerView.OnScrollListener() {
|
||||
@Override
|
||||
|
|
|
@ -25,16 +25,17 @@ public class CoordinateInputAdapter extends RecyclerView.Adapter<MapMarkerItemVi
|
|||
private MapActivity mapActivity;
|
||||
private boolean nightTheme;
|
||||
private IconsCache iconsCache;
|
||||
private List<MapMarker> mapMarkers = new ArrayList<>();
|
||||
private List<MapMarker> mapMarkers;
|
||||
private LatLon location;
|
||||
private Float heading;
|
||||
private boolean useCenter;
|
||||
private int screenOrientation;
|
||||
|
||||
public CoordinateInputAdapter (MapActivity mapActivity) {
|
||||
public CoordinateInputAdapter (MapActivity mapActivity, List<MapMarker> mapMarkers) {
|
||||
this.mapActivity = mapActivity;
|
||||
nightTheme = !mapActivity.getMyApplication().getSettings().isLightContent();
|
||||
iconsCache = mapActivity.getMyApplication().getIconsCache();
|
||||
this.mapMarkers = mapMarkers;
|
||||
}
|
||||
|
||||
public void setLocation(LatLon location) {
|
||||
|
|
Loading…
Reference in a new issue