Fix waypoints
This commit is contained in:
parent
f1c576f2a3
commit
135d01b7c7
5 changed files with 120 additions and 70 deletions
|
@ -1,5 +1,5 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
<android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
android:id="@+id/MainLayout"
|
android:id="@+id/MainLayout"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent">
|
android:layout_height="match_parent">
|
||||||
|
@ -25,4 +25,4 @@
|
||||||
|
|
||||||
<include layout="@layout/my_places_fabs"/>
|
<include layout="@layout/my_places_fabs"/>
|
||||||
|
|
||||||
</RelativeLayout>
|
</android.support.design.widget.CoordinatorLayout>
|
|
@ -9,6 +9,8 @@
|
||||||
3. All your modified/created strings are in the top of the file (to make easier find what\'s translated).
|
3. All your modified/created strings are in the top of the file (to make easier find what\'s translated).
|
||||||
PLEASE: Have a look at http://code.google.com/p/osmand/wiki/UIConsistency, it may really improve your and our work :-) Thx - Hardy
|
PLEASE: Have a look at http://code.google.com/p/osmand/wiki/UIConsistency, it may really improve your and our work :-) Thx - Hardy
|
||||||
-->
|
-->
|
||||||
|
<string name="view">View</string>
|
||||||
|
<string name="waypoints_added_to_map_markers">Waypoints added to map markers</string>
|
||||||
<string name="wrong_format">Wrong format</string>
|
<string name="wrong_format">Wrong format</string>
|
||||||
<string name="shared_string_road">Road</string>
|
<string name="shared_string_road">Road</string>
|
||||||
<string name="show_map">Show map</string>
|
<string name="show_map">Show map</string>
|
||||||
|
|
|
@ -144,6 +144,8 @@ public class MapActivity extends OsmandActionBarActivity implements DownloadEven
|
||||||
MapMarkerChangedListener, OnDismissDialogFragmentListener, OnDrawMapListener {
|
MapMarkerChangedListener, OnDismissDialogFragmentListener, OnDrawMapListener {
|
||||||
public static final String INTENT_KEY_PARENT_MAP_ACTIVITY = "intent_parent_map_activity_key";
|
public static final String INTENT_KEY_PARENT_MAP_ACTIVITY = "intent_parent_map_activity_key";
|
||||||
|
|
||||||
|
public static final String OPEN_MAP_MARKERS_GROUPS = "open_map_markers_groups";
|
||||||
|
|
||||||
private static final int SHOW_POSITION_MSG_ID = OsmAndConstants.UI_HANDLER_MAP_VIEW + 1;
|
private static final int SHOW_POSITION_MSG_ID = OsmAndConstants.UI_HANDLER_MAP_VIEW + 1;
|
||||||
private static final int LONG_KEYPRESS_MSG_ID = OsmAndConstants.UI_HANDLER_MAP_VIEW + 2;
|
private static final int LONG_KEYPRESS_MSG_ID = OsmAndConstants.UI_HANDLER_MAP_VIEW + 2;
|
||||||
private static final int LONG_KEYPRESS_DELAY = 500;
|
private static final int LONG_KEYPRESS_DELAY = 500;
|
||||||
|
@ -680,6 +682,9 @@ public class MapActivity extends OsmandActionBarActivity implements DownloadEven
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (intent.hasExtra(OPEN_MAP_MARKERS_GROUPS)) {
|
||||||
|
MapMarkersDialogFragment.showInstance(this, true);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
mapView.refreshMap(true);
|
mapView.refreshMap(true);
|
||||||
if (atlasMapRendererView != null) {
|
if (atlasMapRendererView != null) {
|
||||||
|
@ -1378,7 +1383,7 @@ public class MapActivity extends OsmandActionBarActivity implements DownloadEven
|
||||||
return mapLayers;
|
return mapLayers;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void launchMapActivityMoveToTop(Context activity) {
|
public static void launchMapActivityMoveToTop(Context activity, String openMarkersAction) {
|
||||||
if (activity instanceof MapActivity) {
|
if (activity instanceof MapActivity) {
|
||||||
if (((MapActivity) activity).getDashboard().isVisible()) {
|
if (((MapActivity) activity).getDashboard().isVisible()) {
|
||||||
((MapActivity) activity).getDashboard().hideDashboard();
|
((MapActivity) activity).getDashboard().hideDashboard();
|
||||||
|
@ -1400,10 +1405,17 @@ public class MapActivity extends OsmandActionBarActivity implements DownloadEven
|
||||||
Intent newIntent = new Intent(activity, ((OsmandApplication) activity.getApplicationContext())
|
Intent newIntent = new Intent(activity, ((OsmandApplication) activity.getApplicationContext())
|
||||||
.getAppCustomization().getMapActivity());
|
.getAppCustomization().getMapActivity());
|
||||||
newIntent.addFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT | Intent.FLAG_ACTIVITY_CLEAR_TOP);
|
newIntent.addFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT | Intent.FLAG_ACTIVITY_CLEAR_TOP);
|
||||||
|
if (openMarkersAction != null) {
|
||||||
|
newIntent.putExtra(openMarkersAction, true);
|
||||||
|
}
|
||||||
activity.startActivity(newIntent);
|
activity.startActivity(newIntent);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void launchMapActivityMoveToTop(Context activity) {
|
||||||
|
launchMapActivityMoveToTop(activity, null);
|
||||||
|
}
|
||||||
|
|
||||||
public static void clearPrevActivityIntent() {
|
public static void clearPrevActivityIntent() {
|
||||||
prevActivityIntent = null;
|
prevActivityIntent = null;
|
||||||
}
|
}
|
||||||
|
|
|
@ -64,6 +64,11 @@ public class MapMarkersDialogFragment extends android.support.v4.app.DialogFragm
|
||||||
@Nullable
|
@Nullable
|
||||||
@Override
|
@Override
|
||||||
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, Bundle savedInstanceState) {
|
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, Bundle savedInstanceState) {
|
||||||
|
Bundle args = getArguments();
|
||||||
|
boolean openGroups = false;
|
||||||
|
if (args != null && args.getBoolean(MapActivity.OPEN_MAP_MARKERS_GROUPS)) {
|
||||||
|
openGroups = true;
|
||||||
|
}
|
||||||
List<Fragment> fragments = getChildFragmentManager().getFragments();
|
List<Fragment> fragments = getChildFragmentManager().getFragments();
|
||||||
if (fragments != null) {
|
if (fragments != null) {
|
||||||
for (Fragment fragment : fragments) {
|
for (Fragment fragment : fragments) {
|
||||||
|
@ -144,6 +149,12 @@ public class MapMarkersDialogFragment extends android.support.v4.app.DialogFragm
|
||||||
bottomNav.setItemIconTintList(ContextCompat.getColorStateList(getContext(), R.color.bottom_navigation_color_selector_dark));
|
bottomNav.setItemIconTintList(ContextCompat.getColorStateList(getContext(), R.color.bottom_navigation_color_selector_dark));
|
||||||
bottomNav.setItemTextColor(ContextCompat.getColorStateList(getContext(), R.color.bottom_navigation_color_selector_dark));
|
bottomNav.setItemTextColor(ContextCompat.getColorStateList(getContext(), R.color.bottom_navigation_color_selector_dark));
|
||||||
}
|
}
|
||||||
|
if (openGroups) {
|
||||||
|
activeFragment.stopLocationUpdate();
|
||||||
|
groupsFragment.startLocationUpdate();
|
||||||
|
groupsFragment.updateAdapter();
|
||||||
|
viewPager.setCurrentItem(GROUPS_POSITION, false);
|
||||||
|
}
|
||||||
bottomNav.setOnNavigationItemSelectedListener(new BottomNavigationView.OnNavigationItemSelectedListener() {
|
bottomNav.setOnNavigationItemSelectedListener(new BottomNavigationView.OnNavigationItemSelectedListener() {
|
||||||
@Override
|
@Override
|
||||||
public boolean onNavigationItemSelected(@NonNull MenuItem menuItem) {
|
public boolean onNavigationItemSelected(@NonNull MenuItem menuItem) {
|
||||||
|
@ -350,11 +361,20 @@ public class MapMarkersDialogFragment extends android.support.v4.app.DialogFragm
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean showInstance(@NonNull MapActivity mapActivity) {
|
public static boolean showInstance(@NonNull MapActivity mapActivity) {
|
||||||
|
return showInstance(mapActivity, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static boolean showInstance(@NonNull MapActivity mapActivity, boolean openGroups) {
|
||||||
try {
|
try {
|
||||||
if (mapActivity.isActivityDestroyed()) {
|
if (mapActivity.isActivityDestroyed()) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
MapMarkersDialogFragment fragment = new MapMarkersDialogFragment();
|
MapMarkersDialogFragment fragment = new MapMarkersDialogFragment();
|
||||||
|
if (openGroups) {
|
||||||
|
Bundle args = new Bundle();
|
||||||
|
args.putBoolean(MapActivity.OPEN_MAP_MARKERS_GROUPS, true);
|
||||||
|
fragment.setArguments(args);
|
||||||
|
}
|
||||||
fragment.show(mapActivity.getSupportFragmentManager(), TAG);
|
fragment.show(mapActivity.getSupportFragmentManager(), TAG);
|
||||||
return true;
|
return true;
|
||||||
} catch (RuntimeException e) {
|
} catch (RuntimeException e) {
|
||||||
|
|
|
@ -9,6 +9,7 @@ import android.os.Handler;
|
||||||
import android.support.annotation.NonNull;
|
import android.support.annotation.NonNull;
|
||||||
import android.support.annotation.Nullable;
|
import android.support.annotation.Nullable;
|
||||||
import android.support.design.widget.FloatingActionButton;
|
import android.support.design.widget.FloatingActionButton;
|
||||||
|
import android.support.design.widget.Snackbar;
|
||||||
import android.support.v4.content.ContextCompat;
|
import android.support.v4.content.ContextCompat;
|
||||||
import android.support.v4.view.MenuItemCompat;
|
import android.support.v4.view.MenuItemCompat;
|
||||||
import android.support.v7.app.AlertDialog;
|
import android.support.v7.app.AlertDialog;
|
||||||
|
@ -91,7 +92,6 @@ public class TrackPointFragment extends OsmandExpandableListFragment {
|
||||||
final private PointGPXAdapter adapter = new PointGPXAdapter();
|
final private PointGPXAdapter adapter = new PointGPXAdapter();
|
||||||
private GpxDisplayItemType[] filterTypes = {GpxDisplayItemType.TRACK_POINTS, GpxDisplayItemType.TRACK_ROUTE_POINTS};
|
private GpxDisplayItemType[] filterTypes = {GpxDisplayItemType.TRACK_POINTS, GpxDisplayItemType.TRACK_ROUTE_POINTS};
|
||||||
private boolean selectionMode = false;
|
private boolean selectionMode = false;
|
||||||
private boolean addToMapMarkersMode = false;
|
|
||||||
private LinkedHashMap<GpxDisplayItemType, Set<GpxDisplayItem>> selectedItems = new LinkedHashMap<>();
|
private LinkedHashMap<GpxDisplayItemType, Set<GpxDisplayItem>> selectedItems = new LinkedHashMap<>();
|
||||||
private Set<Integer> selectedGroups = new LinkedHashSet<>();
|
private Set<Integer> selectedGroups = new LinkedHashSet<>();
|
||||||
private ActionMode actionMode;
|
private ActionMode actionMode;
|
||||||
|
@ -105,6 +105,7 @@ public class TrackPointFragment extends OsmandExpandableListFragment {
|
||||||
private FloatingActionButton lineFab;
|
private FloatingActionButton lineFab;
|
||||||
private View lineTextLayout;
|
private View lineTextLayout;
|
||||||
private View overlayView;
|
private View overlayView;
|
||||||
|
private View mainView;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onCreate(@Nullable Bundle savedInstanceState) {
|
public void onCreate(@Nullable Bundle savedInstanceState) {
|
||||||
|
@ -179,29 +180,29 @@ public class TrackPointFragment extends OsmandExpandableListFragment {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
|
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
|
||||||
View view = inflater.inflate(R.layout.track_points_tree, container, false);
|
mainView = inflater.inflate(R.layout.track_points_tree, container, false);
|
||||||
ExpandableListView listView = (ExpandableListView) view.findViewById(android.R.id.list);
|
ExpandableListView listView = (ExpandableListView) mainView.findViewById(android.R.id.list);
|
||||||
setHasOptionsMenu(true);
|
setHasOptionsMenu(true);
|
||||||
|
|
||||||
overlayView = view.findViewById(R.id.overlay_view);
|
overlayView = mainView.findViewById(R.id.overlay_view);
|
||||||
overlayView.setOnClickListener(onFabClickListener);
|
overlayView.setOnClickListener(onFabClickListener);
|
||||||
|
|
||||||
menuFab = (FloatingActionButton) view.findViewById(R.id.menu_fab);
|
menuFab = (FloatingActionButton) mainView.findViewById(R.id.menu_fab);
|
||||||
menuFab.setOnClickListener(onFabClickListener);
|
menuFab.setOnClickListener(onFabClickListener);
|
||||||
|
|
||||||
waypointFab = (FloatingActionButton) view.findViewById(R.id.waypoint_fab);
|
waypointFab = (FloatingActionButton) mainView.findViewById(R.id.waypoint_fab);
|
||||||
waypointFab.setOnClickListener(onFabClickListener);
|
waypointFab.setOnClickListener(onFabClickListener);
|
||||||
waypointTextLayout = view.findViewById(R.id.waypoint_text_layout);
|
waypointTextLayout = mainView.findViewById(R.id.waypoint_text_layout);
|
||||||
waypointTextLayout.setOnClickListener(onFabClickListener);
|
waypointTextLayout.setOnClickListener(onFabClickListener);
|
||||||
|
|
||||||
routePointFab = (FloatingActionButton) view.findViewById(R.id.route_fab);
|
routePointFab = (FloatingActionButton) mainView.findViewById(R.id.route_fab);
|
||||||
routePointFab.setOnClickListener(onFabClickListener);
|
routePointFab.setOnClickListener(onFabClickListener);
|
||||||
routePointTextLayout = view.findViewById(R.id.route_text_layout);
|
routePointTextLayout = mainView.findViewById(R.id.route_text_layout);
|
||||||
routePointTextLayout.setOnClickListener(onFabClickListener);
|
routePointTextLayout.setOnClickListener(onFabClickListener);
|
||||||
|
|
||||||
lineFab = (FloatingActionButton) view.findViewById(R.id.line_fab);
|
lineFab = (FloatingActionButton) mainView.findViewById(R.id.line_fab);
|
||||||
lineFab.setOnClickListener(onFabClickListener);
|
lineFab.setOnClickListener(onFabClickListener);
|
||||||
lineTextLayout = view.findViewById(R.id.line_text_layout);
|
lineTextLayout = mainView.findViewById(R.id.line_text_layout);
|
||||||
lineTextLayout.setOnClickListener(onFabClickListener);
|
lineTextLayout.setOnClickListener(onFabClickListener);
|
||||||
|
|
||||||
TextView tv = new TextView(getActivity());
|
TextView tv = new TextView(getActivity());
|
||||||
|
@ -212,7 +213,7 @@ public class TrackPointFragment extends OsmandExpandableListFragment {
|
||||||
setContent(listView);
|
setContent(listView);
|
||||||
setListView(listView);
|
setListView(listView);
|
||||||
expandAllGroups();
|
expandAllGroups();
|
||||||
return view;
|
return mainView;
|
||||||
}
|
}
|
||||||
|
|
||||||
private int getSelectedItemsCount() {
|
private int getSelectedItemsCount() {
|
||||||
|
@ -469,10 +470,6 @@ public class TrackPointFragment extends OsmandExpandableListFragment {
|
||||||
this.selectionMode = selectionMode;
|
this.selectionMode = selectionMode;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void enableAddToMapMarkersMode(boolean addToMapMarkersMode) {
|
|
||||||
this.addToMapMarkersMode = addToMapMarkersMode;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void enterDeleteMode() {
|
private void enterDeleteMode() {
|
||||||
|
|
||||||
actionMode = getActionBarActivity().startSupportActionMode(new ActionMode.Callback() {
|
actionMode = getActionBarActivity().startSupportActionMode(new ActionMode.Callback() {
|
||||||
|
@ -588,21 +585,17 @@ public class TrackPointFragment extends OsmandExpandableListFragment {
|
||||||
}
|
}
|
||||||
|
|
||||||
private void enterMapMarkersMode() {
|
private void enterMapMarkersMode() {
|
||||||
|
if (getSettings().USE_MAP_MARKERS.get()) {
|
||||||
|
addMapMarkersSyncGroup();
|
||||||
|
} else {
|
||||||
actionMode = getActionBarActivity().startSupportActionMode(new ActionMode.Callback() {
|
actionMode = getActionBarActivity().startSupportActionMode(new ActionMode.Callback() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onCreateActionMode(ActionMode mode, Menu menu) {
|
public boolean onCreateActionMode(ActionMode mode, Menu menu) {
|
||||||
if (getSettings().USE_MAP_MARKERS.get()) {
|
|
||||||
enableAddToMapMarkersMode(true);
|
|
||||||
createMenuItem(menu, SELECT_MAP_MARKERS_ACTION_MODE_ID, R.string.shared_string_add_to_map_markers,
|
|
||||||
R.drawable.ic_action_flag_dark, R.drawable.ic_action_flag_dark,
|
|
||||||
MenuItemCompat.SHOW_AS_ACTION_IF_ROOM);
|
|
||||||
} else {
|
|
||||||
enableSelectionMode(true);
|
enableSelectionMode(true);
|
||||||
createMenuItem(menu, SELECT_MAP_MARKERS_ACTION_MODE_ID, R.string.select_destination_and_intermediate_points,
|
createMenuItem(menu, SELECT_MAP_MARKERS_ACTION_MODE_ID, R.string.select_destination_and_intermediate_points,
|
||||||
R.drawable.ic_action_intermediate, R.drawable.ic_action_intermediate,
|
R.drawable.ic_action_intermediate, R.drawable.ic_action_intermediate,
|
||||||
MenuItemCompat.SHOW_AS_ACTION_IF_ROOM);
|
MenuItemCompat.SHOW_AS_ACTION_IF_ROOM);
|
||||||
}
|
|
||||||
selectedItems.clear();
|
selectedItems.clear();
|
||||||
selectedGroups.clear();
|
selectedGroups.clear();
|
||||||
adapter.notifyDataSetInvalidated();
|
adapter.notifyDataSetInvalidated();
|
||||||
|
@ -618,7 +611,6 @@ public class TrackPointFragment extends OsmandExpandableListFragment {
|
||||||
@Override
|
@Override
|
||||||
public void onDestroyActionMode(ActionMode mode) {
|
public void onDestroyActionMode(ActionMode mode) {
|
||||||
enableSelectionMode(false);
|
enableSelectionMode(false);
|
||||||
enableAddToMapMarkersMode(false);
|
|
||||||
adapter.notifyDataSetInvalidated();
|
adapter.notifyDataSetInvalidated();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -631,17 +623,11 @@ public class TrackPointFragment extends OsmandExpandableListFragment {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void selectMapMarkersImpl() {
|
private void addMapMarkersSyncGroup() {
|
||||||
if (getSelectedItemsCount() > 0) {
|
|
||||||
if (getSettings().USE_MAP_MARKERS.get()) {
|
|
||||||
MapMarkersHelper markersHelper = app.getMapMarkersHelper();
|
MapMarkersHelper markersHelper = app.getMapMarkersHelper();
|
||||||
List<LatLon> points = new LinkedList<>();
|
|
||||||
List<PointDescription> names = new LinkedList<>();
|
|
||||||
for (Map.Entry<GpxDisplayItemType, Set<GpxDisplayItem>> entry : selectedItems.entrySet()) {
|
|
||||||
if (entry.getKey() == GpxDisplayItemType.TRACK_POINTS) {
|
|
||||||
File gpx = getGpxDataItem().getFile();
|
File gpx = getGpxDataItem().getFile();
|
||||||
MarkersSyncGroup syncGroup = new MarkersSyncGroup(gpx.getAbsolutePath(),
|
MarkersSyncGroup syncGroup = new MarkersSyncGroup(gpx.getAbsolutePath(),
|
||||||
AndroidUtils.trimExtension(gpx.getName()), MarkersSyncGroup.GPX_TYPE);
|
AndroidUtils.trimExtension(gpx.getName()), MarkersSyncGroup.GPX_TYPE);
|
||||||
|
@ -651,7 +637,41 @@ public class TrackPointFragment extends OsmandExpandableListFragment {
|
||||||
if (gpxFile != null) {
|
if (gpxFile != null) {
|
||||||
app.getSelectedGpxHelper().selectGpxFile(gpxFile, true, false);
|
app.getSelectedGpxHelper().selectGpxFile(gpxFile, true, false);
|
||||||
}
|
}
|
||||||
} else {
|
hideTransparentOverlay();
|
||||||
|
closeMenu();
|
||||||
|
updateMenuFabVisibility(false);
|
||||||
|
Snackbar snackbar = Snackbar.make(mainView, getResources().getString(R.string.waypoints_added_to_map_markers), Snackbar.LENGTH_LONG)
|
||||||
|
.setAction(getResources().getString(R.string.view), new View.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View v) {
|
||||||
|
MapActivity.launchMapActivityMoveToTop(getTrackActivity(), MapActivity.OPEN_MAP_MARKERS_GROUPS);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
snackbar.addCallback(new Snackbar.Callback() {
|
||||||
|
@Override
|
||||||
|
public void onDismissed(Snackbar transientBottomBar, int event) {
|
||||||
|
updateMenuFabVisibility(true);
|
||||||
|
super.onDismissed(transientBottomBar, event);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
View snackBarView = snackbar.getView();
|
||||||
|
TextView tv = (TextView) snackBarView.findViewById(android.support.design.R.id.snackbar_action);
|
||||||
|
tv.setTextColor(ContextCompat.getColor(getContext(), R.color.color_dialog_buttons_dark));
|
||||||
|
snackbar.show();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void updateMenuFabVisibility(boolean visible) {
|
||||||
|
menuFab.setVisibility(visible ? View.VISIBLE : View.GONE);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void selectMapMarkersImpl() {
|
||||||
|
if (getSelectedItemsCount() > 0) {
|
||||||
|
if (getSettings().USE_MAP_MARKERS.get()) {
|
||||||
|
MapMarkersHelper markersHelper = app.getMapMarkersHelper();
|
||||||
|
List<LatLon> points = new LinkedList<>();
|
||||||
|
List<PointDescription> names = new LinkedList<>();
|
||||||
|
for (Map.Entry<GpxDisplayItemType, Set<GpxDisplayItem>> entry : selectedItems.entrySet()) {
|
||||||
|
if (entry.getKey() != GpxDisplayItemType.TRACK_POINTS) {
|
||||||
for (GpxDisplayItem i : entry.getValue()) {
|
for (GpxDisplayItem i : entry.getValue()) {
|
||||||
if (i.locationStart != null) {
|
if (i.locationStart != null) {
|
||||||
points.add(new LatLon(i.locationStart.lat, i.locationStart.lon));
|
points.add(new LatLon(i.locationStart.lat, i.locationStart.lon));
|
||||||
|
@ -788,7 +808,7 @@ public class TrackPointFragment extends OsmandExpandableListFragment {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
updateSelectionMode(actionMode);
|
updateSelectionMode(actionMode);
|
||||||
} else if (!addToMapMarkersMode) {
|
} else {
|
||||||
final GpxDisplayItem item = adapter.getChild(groupPosition, childPosition);
|
final GpxDisplayItem item = adapter.getChild(groupPosition, childPosition);
|
||||||
if (item != null) {
|
if (item != null) {
|
||||||
if (item.group.getGpx() != null) {
|
if (item.group.getGpx() != null) {
|
||||||
|
@ -897,8 +917,7 @@ public class TrackPointFragment extends OsmandExpandableListFragment {
|
||||||
View row = convertView;
|
View row = convertView;
|
||||||
final GpxDisplayGroup group = getGroup(groupPosition);
|
final GpxDisplayGroup group = getGroup(groupPosition);
|
||||||
boolean checkBox = row != null && row.findViewById(R.id.toggle_item) instanceof CheckBox;
|
boolean checkBox = row != null && row.findViewById(R.id.toggle_item) instanceof CheckBox;
|
||||||
boolean showCheckBox = selectionMode || (addToMapMarkersMode && group.getType() == GpxDisplayItemType.TRACK_POINTS);
|
boolean same = (selectionMode && checkBox) || (!selectionMode && !checkBox);
|
||||||
boolean same = (showCheckBox && checkBox) || (!showCheckBox && !checkBox);
|
|
||||||
if (row == null || !same) {
|
if (row == null || !same) {
|
||||||
LayoutInflater inflater = getActivity().getLayoutInflater();
|
LayoutInflater inflater = getActivity().getLayoutInflater();
|
||||||
row = inflater.inflate(R.layout.wpt_list_item_category, parent, false);
|
row = inflater.inflate(R.layout.wpt_list_item_category, parent, false);
|
||||||
|
@ -915,7 +934,7 @@ public class TrackPointFragment extends OsmandExpandableListFragment {
|
||||||
description.setText(getString(R.string.route_points_category_name));
|
description.setText(getString(R.string.route_points_category_name));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (showCheckBox) {
|
if (selectionMode) {
|
||||||
final CheckBox ch = (CheckBox) row.findViewById(R.id.toggle_item);
|
final CheckBox ch = (CheckBox) row.findViewById(R.id.toggle_item);
|
||||||
ch.setVisibility(View.VISIBLE);
|
ch.setVisibility(View.VISIBLE);
|
||||||
ch.setChecked(selectedGroups.contains(groupPosition));
|
ch.setChecked(selectedGroups.contains(groupPosition));
|
||||||
|
@ -1061,9 +1080,6 @@ public class TrackPointFragment extends OsmandExpandableListFragment {
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
row.findViewById(R.id.icon).setVisibility(View.VISIBLE);
|
row.findViewById(R.id.icon).setVisibility(View.VISIBLE);
|
||||||
if (addToMapMarkersMode) {
|
|
||||||
ch.setVisibility(View.GONE);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return row;
|
return row;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue