Fix #6493
This commit is contained in:
parent
ffe7d35142
commit
22029106c6
2 changed files with 12 additions and 12 deletions
|
@ -45,23 +45,23 @@ public class WaypointDialogHelper {
|
||||||
private MapActivity mapActivity;
|
private MapActivity mapActivity;
|
||||||
private OsmandApplication app;
|
private OsmandApplication app;
|
||||||
private WaypointHelper waypointHelper;
|
private WaypointHelper waypointHelper;
|
||||||
private List<WaypointDialogHelperCallbacks> helperCallbacks= new ArrayList<>();
|
private List<WaypointDialogHelperCallback> helperCallbacks= new ArrayList<>();
|
||||||
|
|
||||||
private boolean flat;
|
private boolean flat;
|
||||||
private List<LocationPointWrapper> deletedPoints;
|
private List<LocationPointWrapper> deletedPoints;
|
||||||
|
|
||||||
public interface WaypointDialogHelperCallbacks {
|
public interface WaypointDialogHelperCallback {
|
||||||
void reloadAdapter();
|
void reloadAdapter();
|
||||||
|
|
||||||
void deleteWaypoint(int position);
|
void deleteWaypoint(int position);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addHelperCallbacks(WaypointDialogHelperCallbacks callbacks) {
|
public void addHelperCallback(WaypointDialogHelperCallback callback) {
|
||||||
helperCallbacks.add(callbacks);
|
helperCallbacks.add(callback);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void removeHelperCallbacks(WaypointDialogHelperCallbacks callbacks) {
|
public void removeHelperCallback(WaypointDialogHelperCallback callback) {
|
||||||
helperCallbacks.add(callbacks);
|
helperCallbacks.remove(callback);
|
||||||
}
|
}
|
||||||
|
|
||||||
public WaypointDialogHelper(MapActivity mapActivity) {
|
public WaypointDialogHelper(MapActivity mapActivity) {
|
||||||
|
@ -263,7 +263,7 @@ public class WaypointDialogHelper {
|
||||||
|
|
||||||
public static void updateControls(Activity ctx, WaypointDialogHelper helper) {
|
public static void updateControls(Activity ctx, WaypointDialogHelper helper) {
|
||||||
if (helper != null && helper.helperCallbacks != null) {
|
if (helper != null && helper.helperCallbacks != null) {
|
||||||
for (WaypointDialogHelperCallbacks callback : helper.helperCallbacks) {
|
for (WaypointDialogHelperCallback callback : helper.helperCallbacks) {
|
||||||
callback.reloadAdapter();
|
callback.reloadAdapter();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -298,7 +298,7 @@ public class WaypointDialogHelper {
|
||||||
if (point.type == WaypointHelper.TARGETS && adapter instanceof StableArrayAdapter) {
|
if (point.type == WaypointHelper.TARGETS && adapter instanceof StableArrayAdapter) {
|
||||||
StableArrayAdapter stableAdapter = (StableArrayAdapter) adapter;
|
StableArrayAdapter stableAdapter = (StableArrayAdapter) adapter;
|
||||||
if (helper != null && !helper.helperCallbacks.isEmpty() && needCallback) {
|
if (helper != null && !helper.helperCallbacks.isEmpty() && needCallback) {
|
||||||
for (WaypointDialogHelperCallbacks callback : helper.helperCallbacks) {
|
for (WaypointDialogHelperCallback callback : helper.helperCallbacks) {
|
||||||
callback.deleteWaypoint(stableAdapter.getPosition(item));
|
callback.deleteWaypoint(stableAdapter.getPosition(item));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -414,7 +414,7 @@ public class WaypointDialogHelper {
|
||||||
targets.reorderAllTargetPoints(intermediates, true);
|
targets.reorderAllTargetPoints(intermediates, true);
|
||||||
}
|
}
|
||||||
if (!helper.helperCallbacks.isEmpty()) {
|
if (!helper.helperCallbacks.isEmpty()) {
|
||||||
for (WaypointDialogHelperCallbacks callback : helper.helperCallbacks) {
|
for (WaypointDialogHelperCallback callback : helper.helperCallbacks) {
|
||||||
callback.reloadAdapter();
|
callback.reloadAdapter();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -60,7 +60,7 @@ import java.util.List;
|
||||||
import static net.osmand.plus.helpers.WaypointDialogHelper.showOnMap;
|
import static net.osmand.plus.helpers.WaypointDialogHelper.showOnMap;
|
||||||
|
|
||||||
public class WaypointsFragment extends BaseOsmAndFragment implements ObservableScrollViewCallbacks,
|
public class WaypointsFragment extends BaseOsmAndFragment implements ObservableScrollViewCallbacks,
|
||||||
DynamicListViewCallbacks, WaypointDialogHelper.WaypointDialogHelperCallbacks {
|
DynamicListViewCallbacks, WaypointDialogHelper.WaypointDialogHelperCallback {
|
||||||
|
|
||||||
public static final String TAG = "WaypointsFragment";
|
public static final String TAG = "WaypointsFragment";
|
||||||
|
|
||||||
|
@ -329,7 +329,7 @@ public class WaypointsFragment extends BaseOsmAndFragment implements ObservableS
|
||||||
public void onResume() {
|
public void onResume() {
|
||||||
super.onResume();
|
super.onResume();
|
||||||
wasDrawerDisabled = mapActivity.isDrawerDisabled();
|
wasDrawerDisabled = mapActivity.isDrawerDisabled();
|
||||||
waypointDialogHelper.addHelperCallbacks(this);
|
waypointDialogHelper.addHelperCallback(this);
|
||||||
app.getTargetPointsHelper().addListener(onStateChangedListener);
|
app.getTargetPointsHelper().addListener(onStateChangedListener);
|
||||||
if (!wasDrawerDisabled) {
|
if (!wasDrawerDisabled) {
|
||||||
mapActivity.disableDrawer();
|
mapActivity.disableDrawer();
|
||||||
|
@ -341,7 +341,7 @@ public class WaypointsFragment extends BaseOsmAndFragment implements ObservableS
|
||||||
public void onPause() {
|
public void onPause() {
|
||||||
super.onPause();
|
super.onPause();
|
||||||
cancelTimer();
|
cancelTimer();
|
||||||
waypointDialogHelper.removeHelperCallbacks(this);
|
waypointDialogHelper.removeHelperCallback(this);
|
||||||
app.getTargetPointsHelper().removeListener(onStateChangedListener);
|
app.getTargetPointsHelper().removeListener(onStateChangedListener);
|
||||||
if (!wasDrawerDisabled) {
|
if (!wasDrawerDisabled) {
|
||||||
mapActivity.enableDrawer();
|
mapActivity.enableDrawer();
|
||||||
|
|
Loading…
Reference in a new issue