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
|
||||
|
||||
-->
|
||||
<string name="switch_all_points">Reverse all points</string>
|
||||
<string name="reverce_all_points">Reverse all points</string>
|
||||
<string name="release_3_9">
|
||||
• 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
|
||||
|
|
|
@ -265,8 +265,8 @@ public class WaypointDialogHelper {
|
|||
}
|
||||
}
|
||||
|
||||
public static void switchAllPoint(final OsmandApplication app, final Activity ctx,
|
||||
final WaypointDialogHelper helper) {
|
||||
public static void reverseAllPoints(OsmandApplication app, Activity ctx,
|
||||
WaypointDialogHelper helper) {
|
||||
TargetPointsHelper targets = app.getTargetPointsHelper();
|
||||
List<TargetPoint> points = targets.getAllPoints();
|
||||
Collections.reverse(points);
|
||||
|
@ -457,7 +457,8 @@ public class WaypointDialogHelper {
|
|||
@Override
|
||||
public void createMenuItems(Bundle savedInstanceState) {
|
||||
items.add(new TitleItem(getString(R.string.shared_string_options)));
|
||||
|
||||
final OsmandApplication app = requiredMyApplication();
|
||||
final TargetPointsHelper targetsHelper = app.getTargetPointsHelper();
|
||||
BaseBottomSheetItem sortDoorToDoorItem = new SimpleBottomSheetItem.Builder()
|
||||
.setIcon(getContentIcon(R.drawable.ic_action_sort_door_to_door))
|
||||
.setTitle(getString(R.string.intermediate_items_sort_by_distance))
|
||||
|
@ -507,15 +508,15 @@ public class WaypointDialogHelper {
|
|||
|
||||
BaseBottomSheetItem reorderAllItems = new SimpleBottomSheetItem.Builder()
|
||||
.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)
|
||||
.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
MapActivity mapActivity = getMapActivity();
|
||||
if (mapActivity != null) {
|
||||
WaypointDialogHelper.switchAllPoint(
|
||||
mapActivity.getMyApplication(),
|
||||
WaypointDialogHelper.reverseAllPoints(
|
||||
app,
|
||||
mapActivity,
|
||||
mapActivity.getDashboard().getWaypointDialogHelper()
|
||||
);
|
||||
|
@ -524,12 +525,10 @@ public class WaypointDialogHelper {
|
|||
}
|
||||
})
|
||||
.create();
|
||||
if (getMyApplication() != null) {
|
||||
int intermediateSize = getMyApplication().getTargetPointsHelper().getIntermediatePoints().size();
|
||||
if (intermediateSize > 2) {
|
||||
int intermediateSize = targetsHelper.getIntermediatePoints().size();
|
||||
if (intermediateSize > 2 && !targetsHelper.getAllPoints().isEmpty()) {
|
||||
items.add(reorderAllItems);
|
||||
}
|
||||
}
|
||||
|
||||
items.add(new DividerHalfItem(getContext()));
|
||||
|
||||
|
|
Loading…
Reference in a new issue