Merge pull request #5044 from osmandapp/AssignLineItemsContextMenu

Assign line items context menu
This commit is contained in:
Alexey 2018-02-21 13:20:50 +03:00 committed by GitHub
commit 38325afaf4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 38 additions and 16 deletions

View file

@ -192,9 +192,17 @@ public class FavoritesTreeFragment extends OsmandExpandableListFragment {
});
String groupNameToShow = ((FavoritesActivity) getActivity()).getGroupNameToShow();
if (groupNameToShow != null) {
int position = favouritesAdapter.getGroupPosition(groupNameToShow);
if (position != -1) {
listView.setSelectedGroup(position);
int groupPos = favouritesAdapter.getGroupPosition(groupNameToShow);
if (groupPos != -1) {
listView.expandGroup(groupPos);
int selection = listView.getHeaderViewsCount();
for (int i = 0; i < groupPos; i++) {
selection++; // because of group header
if (getGroupExpandedPreference(favouritesAdapter.getGroup(i).name).get()) {
selection += favouritesAdapter.getChildrenCount(i);
}
}
listView.setSelection(selection);
}
}
return view;

View file

@ -301,20 +301,10 @@ public class MenuBuilder {
public void build(View view) {
firstRow = true;
hidden = false;
buildTopInternal(view);
if (showTitleIfTruncated) {
buildTitleRow(view);
}
if (showTransportRoutes()) {
buildRow(view, 0, null, app.getString(R.string.transport_Routes), 0, true, getCollapsableTransportStopRoutesView(view.getContext(), false, false),
false, 0, false, null, true);
CollapsableView collapsableView = getCollapsableTransportStopRoutesView(view.getContext(), false, true);
if (collapsableView != null) {
String routesWithingDistance = app.getString(R.string.transport_nearby_routes_within) + " " + OsmAndFormatter.getFormattedDistance(TransportStopController.SHOW_STOPS_RADIUS_METERS,app);
buildRow(view, 0, null, routesWithingDistance, 0, true, collapsableView,
false, 0, false, null, true);
}
}
buildNearestWikiRow(view);
if (needBuildPlainMenuItems()) {
buildPlainMenuItems(view);
@ -448,6 +438,20 @@ public class MenuBuilder {
protected void buildInternal(View view) {
}
protected void buildTopInternal(View view) {
if (showTransportRoutes()) {
buildRow(view, 0, null, app.getString(R.string.transport_Routes), 0, true, getCollapsableTransportStopRoutesView(view.getContext(), false, false),
false, 0, false, null, true);
CollapsableView collapsableView = getCollapsableTransportStopRoutesView(view.getContext(), false, true);
if (collapsableView != null) {
String routesWithingDistance = app.getString(R.string.transport_nearby_routes_within) + " " + OsmAndFormatter.getFormattedDistance(TransportStopController.SHOW_STOPS_RADIUS_METERS, app);
buildRow(view, 0, null, routesWithingDistance, 0, true, collapsableView,
false, 0, false, null, true);
}
}
}
protected void buildAfter(View view) {
buildRowDivider(view);
}

View file

@ -62,6 +62,12 @@ public class FavouritePointMenuBuilder extends MenuBuilder {
}
}
@Override
protected void buildTopInternal(View view) {
super.buildTopInternal(view);
buildGroupFavouritesView(view);
}
@Override
public void buildInternal(View view) {
if (originObject != null && originObject instanceof Amenity) {
@ -70,7 +76,6 @@ public class FavouritePointMenuBuilder extends MenuBuilder {
builder.setLight(light);
builder.buildInternal(view);
}
buildGroupFavouritesView(view);
}
private void buildGroupFavouritesView(View view) {

View file

@ -45,6 +45,12 @@ public class WptPtMenuBuilder extends MenuBuilder {
return false;
}
@Override
protected void buildTopInternal(View view) {
super.buildTopInternal(view);
buildWaypointsView(view);
}
@Override
public void buildInternal(View view) {
if (wpt.time > 0) {
@ -89,7 +95,6 @@ public class WptPtMenuBuilder extends MenuBuilder {
});
}
buildWaypointsView(view);
buildPlainMenuItems(view);
}