Removed unused code. Moved waypointsdialoghelper to mapactivityactions
This commit is contained in:
parent
d7ca432c32
commit
7fbda80bc5
3 changed files with 8 additions and 52 deletions
|
@ -97,12 +97,15 @@ public class MapActivityActions implements DialogProvider {
|
|||
|
||||
DrawerLayout mDrawerLayout;
|
||||
ListView mDrawerList;
|
||||
private WaypointDialogHelper waypointDialogHelper;
|
||||
|
||||
|
||||
public MapActivityActions(MapActivity mapActivity){
|
||||
this.mapActivity = mapActivity;
|
||||
settings = mapActivity.getMyApplication().getSettings();
|
||||
routingHelper = mapActivity.getMyApplication().getRoutingHelper();
|
||||
waypointDialogHelper = new WaypointDialogHelper(mapActivity);
|
||||
waypointDialogHelper.init();
|
||||
}
|
||||
|
||||
protected void addFavouritePoint(final double latitude, final double longitude){
|
||||
|
@ -902,8 +905,7 @@ public class MapActivityActions implements DialogProvider {
|
|||
if (getMyApplication().getWaypointHelper().isRouteCalculated()) {
|
||||
|
||||
final List<WaypointHelper.LocationPointWrapper> deletedPoints = new ArrayList<WaypointHelper.LocationPointWrapper>();
|
||||
ArrayAdapter<Object> adapter = app.getMapActivity().getMapLayers().
|
||||
getMapControlsLayer().getWaypointDialogHelper().getWaypointsAdapter(app.getMapActivity(), deletedPoints);
|
||||
ArrayAdapter<Object> adapter = waypointDialogHelper.getWaypointsAdapter(app.getMapActivity(), deletedPoints);
|
||||
mDrawerList = (ListView) mapActivity.findViewById(R.id.left_drawer);
|
||||
mDrawerList.setAdapter(adapter);
|
||||
return false;
|
||||
|
|
|
@ -229,10 +229,7 @@ public class WaypointDialogHelper implements OsmAndLocationListener {
|
|||
|
||||
@Override
|
||||
public Dialog onCreateDialog(Bundle savedInstanceState) {
|
||||
if (getArguments() != null && getArguments().getBoolean(FLAT_ARG)) {
|
||||
return createWaypointsDialogFlat(waypointHelper.getAllPoints());
|
||||
}
|
||||
return createWaypointsDialog();
|
||||
return createWaypointsDialogFlat(waypointHelper.getAllPoints());
|
||||
}
|
||||
|
||||
public AlertDialog createWaypointsDialogFlat(final List<LocationPointWrapper> points) {
|
||||
|
@ -288,43 +285,6 @@ public class WaypointDialogHelper implements OsmAndLocationListener {
|
|||
return builder.create();
|
||||
}
|
||||
|
||||
public AlertDialog createWaypointsDialog() {
|
||||
final FragmentActivity ctx = getActivity();
|
||||
final ListView listView = new ListView(ctx);
|
||||
final List<LocationPointWrapper> deletedPoints = new ArrayList<WaypointHelper.LocationPointWrapper>();
|
||||
final ArrayAdapter<Object> listAdapter = dialogHelper.getWaypointsAdapter(ctx, deletedPoints);
|
||||
|
||||
listView.setAdapter(listAdapter);
|
||||
listView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
|
||||
@Override
|
||||
public void onItemClick(AdapterView<?> adapterView, View view, int item, long l) {
|
||||
if (listAdapter.getItem(item) instanceof LocationPointWrapper) {
|
||||
LocationPointWrapper ps = (LocationPointWrapper) listAdapter.getItem(item);
|
||||
showOnMap(app, ctx, ps.getPoint(), WaypointDialogFragment.this);
|
||||
}
|
||||
}
|
||||
});
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(ctx);
|
||||
builder.setView(listView);
|
||||
builder.setNeutralButton(R.string.flat_list_waypoints, new OnClickListener() {
|
||||
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
showWaypointsDialogFlat(getActivity());
|
||||
}
|
||||
|
||||
});
|
||||
builder.setPositiveButton(R.string.default_buttons_ok, new OnClickListener() {
|
||||
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
waypointHelper.removeVisibleLocationPoint(deletedPoints);
|
||||
}
|
||||
});
|
||||
builder.setNegativeButton(ctx.getString(R.string.default_buttons_cancel), null);
|
||||
return builder.create();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -65,12 +65,11 @@ public class MapControlsLayer extends OsmandMapLayer {
|
|||
private LinearLayout transparencyBarLayout;
|
||||
private static CommonPreference<Integer> settingsToTransparency;
|
||||
private OsmandSettings settings;
|
||||
private WaypointDialogHelper waypointDialogHelper;
|
||||
|
||||
|
||||
public MapControlsLayer(MapActivity activity){
|
||||
this.mapActivity = activity;
|
||||
settings = activity.getMyApplication().getSettings();
|
||||
waypointDialogHelper = new WaypointDialogHelper(activity);
|
||||
}
|
||||
|
||||
|
||||
|
@ -122,8 +121,7 @@ public class MapControlsLayer extends OsmandMapLayer {
|
|||
mapCancelNavigationControl.setMargin(mapSmallMenuControls.getWidth());
|
||||
mapInfoNavigationControl.setMargin(mapSmallMenuControls.getWidth() + mapCancelNavigationControl.getWidth());
|
||||
mapAppModeControl.setMargin(mapNavigationControl.getWidth());
|
||||
|
||||
waypointDialogHelper.init();
|
||||
|
||||
initTransparencyBar(view, parent);
|
||||
}
|
||||
|
||||
|
@ -150,7 +148,7 @@ public class MapControlsLayer extends OsmandMapLayer {
|
|||
|
||||
@Override
|
||||
public void destroyLayer() {
|
||||
waypointDialogHelper.removeListener();
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -337,10 +335,6 @@ public class MapControlsLayer extends OsmandMapLayer {
|
|||
mapInfoNavigationControl.setShowDialog();
|
||||
}
|
||||
|
||||
public WaypointDialogHelper getWaypointDialogHelper() {
|
||||
return waypointDialogHelper;
|
||||
}
|
||||
|
||||
private int getScreenOrientation() {
|
||||
int rotation = mapActivity.getWindowManager().getDefaultDisplay().getRotation();
|
||||
DisplayMetrics dm = new DisplayMetrics();
|
||||
|
|
Loading…
Reference in a new issue