This commit is contained in:
Denis 2014-08-08 15:46:14 +03:00
parent c2f83ab85e
commit 7feb2252ea

View file

@ -33,7 +33,7 @@ public class WaypointDialogHelper {
private MapActivity mapActivity; private MapActivity mapActivity;
private OsmandApplication app; private OsmandApplication app;
private FrameLayout mainLayout; private FrameLayout mainLayout;
private OsmAndLocationProvider locationProvider; private WaypointHelper waypointHelper;
public static boolean OVERLAP_LAYOUT = true; public static boolean OVERLAP_LAYOUT = true;
private long uiModified; private long uiModified;
@ -41,14 +41,14 @@ public class WaypointDialogHelper {
public WaypointDialogHelper(MapActivity mapActivity) { public WaypointDialogHelper(MapActivity mapActivity) {
this.app = mapActivity.getMyApplication(); this.app = mapActivity.getMyApplication();
locationProvider = this.app.getLocationProvider(); waypointHelper = this.app.getWaypointHelper();
this.mapActivity = mapActivity; this.mapActivity = mapActivity;
this.mainLayout = (FrameLayout) ((FrameLayout) mapActivity.getLayout()).getChildAt(0); this.mainLayout = (FrameLayout) ((FrameLayout) mapActivity.getLayout()).getChildAt(0);
} }
public void updateDialog() { public void updateDialog() {
List<LocationPoint> vlp = locationProvider.getVisibleLocationPoints(); List<LocationPoint> vlp = waypointHelper.getVisibleLocationPoints();
long locationPointsModified = locationProvider.getLocationPointsModified(); long locationPointsModified = waypointHelper.getLocationPointsModified();
if (locationPointsModified != uiModified) { if (locationPointsModified != uiModified) {
uiModified = locationPointsModified; uiModified = locationPointsModified;
if (vlp.isEmpty()) { if (vlp.isEmpty()) {
@ -78,7 +78,7 @@ public class WaypointDialogHelper {
btnN.setOnClickListener(new View.OnClickListener() { btnN.setOnClickListener(new View.OnClickListener() {
@Override @Override
public void onClick(View view) { public void onClick(View view) {
locationProvider.removeVisibleLocationPoint(point); waypointHelper.removeVisibleLocationPoint(point);
updateDialog(); updateDialog();
} }
}); });
@ -186,7 +186,7 @@ public class WaypointDialogHelper {
} }
public void showAllDialog(){ public void showAllDialog(){
final List<LocationPoint> visibleLocationPoints = locationProvider.getVisibleLocationPoints(); final List<LocationPoint> visibleLocationPoints = waypointHelper.getVisibleLocationPoints();
final ArrayAdapter<LocationPoint> listAdapter = new ArrayAdapter<LocationPoint>(mapActivity, R.layout.waypoint_reached, R.id.title, final ArrayAdapter<LocationPoint> listAdapter = new ArrayAdapter<LocationPoint>(mapActivity, R.layout.waypoint_reached, R.id.title,
visibleLocationPoints) { visibleLocationPoints) {
@Override @Override
@ -217,9 +217,9 @@ public class WaypointDialogHelper {
remove.setOnClickListener(new View.OnClickListener() { remove.setOnClickListener(new View.OnClickListener() {
@Override @Override
public void onClick(View view) { public void onClick(View view) {
LocationPoint point = locationProvider.getVisibleLocationPoints().get(position); LocationPoint point = waypointHelper.getVisibleLocationPoints().get(position);
remove(point); remove(point);
locationProvider.removeVisibleLocationPoint(point); waypointHelper.removeVisibleLocationPoint(point);
notifyDataSetChanged(); notifyDataSetChanged();
} }
}); });
@ -246,7 +246,7 @@ public class WaypointDialogHelper {
builder.setNegativeButton(mapActivity.getString(R.string.hide_all_waypoints), new DialogInterface.OnClickListener() { builder.setNegativeButton(mapActivity.getString(R.string.hide_all_waypoints), new DialogInterface.OnClickListener() {
@Override @Override
public void onClick(DialogInterface dialogInterface, int i) { public void onClick(DialogInterface dialogInterface, int i) {
locationProvider.clearAllVisiblePoints(); waypointHelper.clearAllVisiblePoints();
updateDialog(); updateDialog();
} }
}); });