Refactor
This commit is contained in:
parent
50162f229a
commit
9ac96bfb86
2 changed files with 11 additions and 12 deletions
|
@ -11,7 +11,7 @@
|
||||||
Thx - Hardy
|
Thx - Hardy
|
||||||
|
|
||||||
-->
|
-->
|
||||||
<string name="switch_all_points">Reverse all points</string>
|
<string name="reverce_all_points">Reverse all points</string>
|
||||||
<string name="release_3_9">
|
<string name="release_3_9">
|
||||||
• Added option to export and import all data including settings, resources, my places\n\n
|
• Added option to export and import all data including settings, resources, my places\n\n
|
||||||
• Plan Route: graphs for track segments with route, and added the ability to create and edit multiple track segments\n\n
|
• Plan Route: graphs for track segments with route, and added the ability to create and edit multiple track segments\n\n
|
||||||
|
|
|
@ -265,8 +265,8 @@ public class WaypointDialogHelper {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void switchAllPoint(final OsmandApplication app, final Activity ctx,
|
public static void reverseAllPoints(OsmandApplication app, Activity ctx,
|
||||||
final WaypointDialogHelper helper) {
|
WaypointDialogHelper helper) {
|
||||||
TargetPointsHelper targets = app.getTargetPointsHelper();
|
TargetPointsHelper targets = app.getTargetPointsHelper();
|
||||||
List<TargetPoint> points = targets.getAllPoints();
|
List<TargetPoint> points = targets.getAllPoints();
|
||||||
Collections.reverse(points);
|
Collections.reverse(points);
|
||||||
|
@ -457,7 +457,8 @@ public class WaypointDialogHelper {
|
||||||
@Override
|
@Override
|
||||||
public void createMenuItems(Bundle savedInstanceState) {
|
public void createMenuItems(Bundle savedInstanceState) {
|
||||||
items.add(new TitleItem(getString(R.string.shared_string_options)));
|
items.add(new TitleItem(getString(R.string.shared_string_options)));
|
||||||
|
final OsmandApplication app = requiredMyApplication();
|
||||||
|
final TargetPointsHelper targetsHelper = app.getTargetPointsHelper();
|
||||||
BaseBottomSheetItem sortDoorToDoorItem = new SimpleBottomSheetItem.Builder()
|
BaseBottomSheetItem sortDoorToDoorItem = new SimpleBottomSheetItem.Builder()
|
||||||
.setIcon(getContentIcon(R.drawable.ic_action_sort_door_to_door))
|
.setIcon(getContentIcon(R.drawable.ic_action_sort_door_to_door))
|
||||||
.setTitle(getString(R.string.intermediate_items_sort_by_distance))
|
.setTitle(getString(R.string.intermediate_items_sort_by_distance))
|
||||||
|
@ -507,15 +508,15 @@ public class WaypointDialogHelper {
|
||||||
|
|
||||||
BaseBottomSheetItem reorderAllItems = new SimpleBottomSheetItem.Builder()
|
BaseBottomSheetItem reorderAllItems = new SimpleBottomSheetItem.Builder()
|
||||||
.setIcon(getContentIcon(R.drawable.ic_action_sort_reverse_order))
|
.setIcon(getContentIcon(R.drawable.ic_action_sort_reverse_order))
|
||||||
.setTitle(getString(R.string.switch_all_points))
|
.setTitle(getString(R.string.reverce_all_points))
|
||||||
.setLayoutId(R.layout.bottom_sheet_item_simple)
|
.setLayoutId(R.layout.bottom_sheet_item_simple)
|
||||||
.setOnClickListener(new View.OnClickListener() {
|
.setOnClickListener(new View.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
MapActivity mapActivity = getMapActivity();
|
MapActivity mapActivity = getMapActivity();
|
||||||
if (mapActivity != null) {
|
if (mapActivity != null) {
|
||||||
WaypointDialogHelper.switchAllPoint(
|
WaypointDialogHelper.reverseAllPoints(
|
||||||
mapActivity.getMyApplication(),
|
app,
|
||||||
mapActivity,
|
mapActivity,
|
||||||
mapActivity.getDashboard().getWaypointDialogHelper()
|
mapActivity.getDashboard().getWaypointDialogHelper()
|
||||||
);
|
);
|
||||||
|
@ -524,12 +525,10 @@ public class WaypointDialogHelper {
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.create();
|
.create();
|
||||||
if (getMyApplication() != null) {
|
int intermediateSize = targetsHelper.getIntermediatePoints().size();
|
||||||
int intermediateSize = getMyApplication().getTargetPointsHelper().getIntermediatePoints().size();
|
if (intermediateSize > 2 && !targetsHelper.getAllPoints().isEmpty()) {
|
||||||
if (intermediateSize > 2) {
|
|
||||||
items.add(reorderAllItems);
|
items.add(reorderAllItems);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
items.add(new DividerHalfItem(getContext()));
|
items.add(new DividerHalfItem(getContext()));
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue