This commit is contained in:
crimean 2019-02-23 12:45:36 +03:00
parent ffe7d35142
commit 22029106c6
2 changed files with 12 additions and 12 deletions

View file

@ -45,23 +45,23 @@ public class WaypointDialogHelper {
private MapActivity mapActivity;
private OsmandApplication app;
private WaypointHelper waypointHelper;
private List<WaypointDialogHelperCallbacks> helperCallbacks= new ArrayList<>();
private List<WaypointDialogHelperCallback> helperCallbacks= new ArrayList<>();
private boolean flat;
private List<LocationPointWrapper> deletedPoints;
public interface WaypointDialogHelperCallbacks {
public interface WaypointDialogHelperCallback {
void reloadAdapter();
void deleteWaypoint(int position);
}
public void addHelperCallbacks(WaypointDialogHelperCallbacks callbacks) {
helperCallbacks.add(callbacks);
public void addHelperCallback(WaypointDialogHelperCallback callback) {
helperCallbacks.add(callback);
}
public void removeHelperCallbacks(WaypointDialogHelperCallbacks callbacks) {
helperCallbacks.add(callbacks);
public void removeHelperCallback(WaypointDialogHelperCallback callback) {
helperCallbacks.remove(callback);
}
public WaypointDialogHelper(MapActivity mapActivity) {
@ -263,7 +263,7 @@ public class WaypointDialogHelper {
public static void updateControls(Activity ctx, WaypointDialogHelper helper) {
if (helper != null && helper.helperCallbacks != null) {
for (WaypointDialogHelperCallbacks callback : helper.helperCallbacks) {
for (WaypointDialogHelperCallback callback : helper.helperCallbacks) {
callback.reloadAdapter();
}
}
@ -298,7 +298,7 @@ public class WaypointDialogHelper {
if (point.type == WaypointHelper.TARGETS && adapter instanceof StableArrayAdapter) {
StableArrayAdapter stableAdapter = (StableArrayAdapter) adapter;
if (helper != null && !helper.helperCallbacks.isEmpty() && needCallback) {
for (WaypointDialogHelperCallbacks callback : helper.helperCallbacks) {
for (WaypointDialogHelperCallback callback : helper.helperCallbacks) {
callback.deleteWaypoint(stableAdapter.getPosition(item));
}
}
@ -414,7 +414,7 @@ public class WaypointDialogHelper {
targets.reorderAllTargetPoints(intermediates, true);
}
if (!helper.helperCallbacks.isEmpty()) {
for (WaypointDialogHelperCallbacks callback : helper.helperCallbacks) {
for (WaypointDialogHelperCallback callback : helper.helperCallbacks) {
callback.reloadAdapter();
}
}

View file

@ -60,7 +60,7 @@ import java.util.List;
import static net.osmand.plus.helpers.WaypointDialogHelper.showOnMap;
public class WaypointsFragment extends BaseOsmAndFragment implements ObservableScrollViewCallbacks,
DynamicListViewCallbacks, WaypointDialogHelper.WaypointDialogHelperCallbacks {
DynamicListViewCallbacks, WaypointDialogHelper.WaypointDialogHelperCallback {
public static final String TAG = "WaypointsFragment";
@ -329,7 +329,7 @@ public class WaypointsFragment extends BaseOsmAndFragment implements ObservableS
public void onResume() {
super.onResume();
wasDrawerDisabled = mapActivity.isDrawerDisabled();
waypointDialogHelper.addHelperCallbacks(this);
waypointDialogHelper.addHelperCallback(this);
app.getTargetPointsHelper().addListener(onStateChangedListener);
if (!wasDrawerDisabled) {
mapActivity.disableDrawer();
@ -341,7 +341,7 @@ public class WaypointsFragment extends BaseOsmAndFragment implements ObservableS
public void onPause() {
super.onPause();
cancelTimer();
waypointDialogHelper.removeHelperCallbacks(this);
waypointDialogHelper.removeHelperCallback(this);
app.getTargetPointsHelper().removeListener(onStateChangedListener);
if (!wasDrawerDisabled) {
mapActivity.enableDrawer();