Merge remote-tracking branch 'origin/master'
This commit is contained in:
commit
7e3e8293d2
3 changed files with 14 additions and 71 deletions
|
@ -10,23 +10,21 @@
|
|||
<TextView
|
||||
android:id="@+id/title"
|
||||
android:layout_width="0dp"
|
||||
android:layout_marginLeft="16dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:layout_marginLeft="16dp"
|
||||
android:layout_weight="1"
|
||||
android:textSize="@dimen/default_list_text_size"
|
||||
tools:text="Some title text"/>
|
||||
|
||||
<android.support.v7.widget.AppCompatButton
|
||||
<android.support.v7.widget.AppCompatTextView
|
||||
android:id="@+id/description"
|
||||
style="@style/Widget.AppCompat.Button.Borderless"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:inputType="textCapWords"
|
||||
tools:text="topbar"
|
||||
android:layout_margin="16dp"
|
||||
android:gravity="center_vertical"
|
||||
android:textColor="?colorAccent"
|
||||
android:layout_marginLeft="16dp"
|
||||
android:focusable="false"/>
|
||||
tools:text="topbar"/>
|
||||
|
||||
</LinearLayout>
|
|
@ -52,6 +52,7 @@ import net.osmand.plus.liveupdates.OsmLiveActivity;
|
|||
import net.osmand.plus.routing.RouteProvider.GPXRouteParamsBuilder;
|
||||
import net.osmand.plus.routing.RoutingHelper;
|
||||
import net.osmand.plus.views.BaseMapLayer;
|
||||
import net.osmand.plus.views.MapControlsLayer;
|
||||
import net.osmand.plus.views.MapTileLayer;
|
||||
import net.osmand.plus.views.OsmandMapTileView;
|
||||
|
||||
|
@ -90,18 +91,6 @@ public class MapActivityActions implements DialogProvider {
|
|||
routingHelper = mapActivity.getMyApplication().getRoutingHelper();
|
||||
}
|
||||
|
||||
/*
|
||||
public void addAsWaypoint(double latitude, double longitude, PointDescription pd) {
|
||||
TargetPointsHelper targets = getMyApplication().getTargetPointsHelper();
|
||||
boolean destination = (targets.getPointToNavigate() == null);
|
||||
|
||||
targets.navigateToPoint(new LatLon(latitude, longitude), true,
|
||||
destination ? -1 : targets.getIntermediatePoints().size(),
|
||||
pd);
|
||||
|
||||
openIntermediateEditPointsDialog();
|
||||
}
|
||||
*/
|
||||
public void addAsTarget(double latitude, double longitude, PointDescription pd) {
|
||||
TargetPointsHelper targets = getMyApplication().getTargetPointsHelper();
|
||||
targets.navigateToPoint(new LatLon(latitude, longitude), true, targets.getIntermediatePoints().size() + 1,
|
||||
|
@ -223,6 +212,7 @@ public class MapActivityActions implements DialogProvider {
|
|||
@Override
|
||||
public void onClick(View v) {
|
||||
String name = edit.getText().toString();
|
||||
//noinspection ResultOfMethodCallIgnored
|
||||
fileDir.mkdirs();
|
||||
File toSave = fileDir;
|
||||
if (name.length() > 0) {
|
||||
|
@ -476,14 +466,6 @@ public class MapActivityActions implements DialogProvider {
|
|||
public ApplicationMode getRouteMode(LatLon from) {
|
||||
ApplicationMode mode = settings.DEFAULT_APPLICATION_MODE.get();
|
||||
ApplicationMode selected = settings.APPLICATION_MODE.get();
|
||||
OsmandApplication app = mapActivity.getMyApplication();
|
||||
TargetPointsHelper targets = app.getTargetPointsHelper();
|
||||
if (from == null) {
|
||||
Location ll = app.getLocationProvider().getLastKnownLocation();
|
||||
if (ll != null) {
|
||||
from = new LatLon(ll.getLatitude(), ll.getLongitude());
|
||||
}
|
||||
}
|
||||
if (selected != ApplicationMode.DEFAULT) {
|
||||
mode = selected;
|
||||
} else if (mode == ApplicationMode.DEFAULT) {
|
||||
|
@ -492,18 +474,6 @@ public class MapActivityActions implements DialogProvider {
|
|||
settings.LAST_ROUTING_APPLICATION_MODE != ApplicationMode.DEFAULT) {
|
||||
mode = settings.LAST_ROUTING_APPLICATION_MODE;
|
||||
}
|
||||
// didn't provide good results
|
||||
// if (from != null && targets.getPointToNavigate() != null) {
|
||||
// double dist = MapUtils.getDistance(from, targets.getPointToNavigate().getLatitude(),
|
||||
// targets.getPointToNavigate().getLongitude());
|
||||
// if (dist >= 50000 && mode.isDerivedRoutingFrom(ApplicationMode.PEDESTRIAN)) {
|
||||
// mode = ApplicationMode.CAR;
|
||||
// } else if (dist >= 300000 && mode.isDerivedRoutingFrom(ApplicationMode.BICYCLE)) {
|
||||
// mode = ApplicationMode.CAR;
|
||||
// } else if (dist < 2000 && mode.isDerivedRoutingFrom(ApplicationMode.CAR)) {
|
||||
// mode = ApplicationMode.PEDESTRIAN;
|
||||
// }
|
||||
// }
|
||||
}
|
||||
return mode;
|
||||
}
|
||||
|
@ -637,15 +607,9 @@ public class MapActivityActions implements DialogProvider {
|
|||
.setListener(new ContextMenuAdapter.ItemClickListener() {
|
||||
@Override
|
||||
public boolean onContextMenuClick(ArrayAdapter<ContextMenuItem> adapter, int itemId, int pos, boolean isChecked) {
|
||||
MapActivity.clearPrevActivityIntent();
|
||||
if (!routingHelper.isFollowingMode() && !routingHelper.isRoutePlanningMode()) {
|
||||
if (settings.USE_MAP_MARKERS.get()) {
|
||||
setFirstMapMarkerAsTarget();
|
||||
}
|
||||
enterRoutePlanningMode(null, null);
|
||||
} else {
|
||||
mapActivity.getMapViewTrackingUtilities().switchToRoutePlanningMode();
|
||||
mapActivity.refreshMap();
|
||||
MapControlsLayer mapControlsLayer = mapActivity.getMapLayers().getMapControlsLayer();
|
||||
if (mapControlsLayer != null) {
|
||||
mapControlsLayer.doRoute(false);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
@ -791,23 +755,6 @@ public class MapActivityActions implements DialogProvider {
|
|||
|
||||
//////////// Others
|
||||
OsmandPlugin.registerOptionsMenu(mapActivity, optionsMenuHelper);
|
||||
|
||||
// optionsMenuHelper.item(R.string.shared_string_exit).colorIcon(R.drawable.ic_action_quit_dark )
|
||||
// .listen(new OnContextMenuClick() {
|
||||
// @Override
|
||||
// public boolean onContextMenuClick(ArrayAdapter<ContextMenuItem> adapter, int itemId, int pos, boolean isChecked) {
|
||||
// // 1. Work for almost all cases when user open apps from main menu
|
||||
//// Intent newIntent = new Intent(mapActivity, mapActivity.getMyApplication().getAppCustomization().getMapActivity());
|
||||
//// newIntent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
|
||||
//// // not exit
|
||||
//// newIntent.putExtra(AppInitializer.APP_EXIT_KEY, AppInitializer.APP_EXIT_CODE);
|
||||
//// mapActivity.startActivity(newIntent);
|
||||
// // In future when map will be main screen this should change
|
||||
// app.closeApplication(mapActivity);
|
||||
// return true;
|
||||
// }
|
||||
// }).reg();
|
||||
|
||||
getMyApplication().getAppCustomization().prepareOptionsMenu(mapActivity, optionsMenuHelper);
|
||||
return optionsMenuHelper;
|
||||
}
|
||||
|
@ -820,10 +767,6 @@ public class MapActivityActions implements DialogProvider {
|
|||
mapActivity.getDashboard().setDashboardVisibility(true, DashboardType.ROUTE_PREFERENCES);
|
||||
}
|
||||
|
||||
private TargetPointsHelper getTargets() {
|
||||
return mapActivity.getMyApplication().getTargetPointsHelper();
|
||||
}
|
||||
|
||||
public void stopNavigationWithoutConfirm() {
|
||||
if (getMyApplication().getLocationProvider().getLocationSimulation().isRouteAnimating()) {
|
||||
getMyApplication().getLocationProvider().getLocationSimulation().startStopRouteAnimation(mapActivity);
|
||||
|
@ -855,7 +798,6 @@ public class MapActivityActions implements DialogProvider {
|
|||
return builder.show();
|
||||
}
|
||||
|
||||
|
||||
public void whereAmIDialog() {
|
||||
final List<String> items = new ArrayList<>();
|
||||
items.add(getString(R.string.show_location));
|
||||
|
|
|
@ -129,11 +129,13 @@ public class MapWidgetRegistry {
|
|||
public <T extends TextInfoWidget> T getSideWidget(Class<T> cl) {
|
||||
for (MapWidgetRegInfo ri : leftWidgetSet) {
|
||||
if (cl.isInstance(ri)) {
|
||||
//noinspection unchecked
|
||||
return (T) ri.widget;
|
||||
}
|
||||
}
|
||||
for (MapWidgetRegInfo ri : rightWidgetSet) {
|
||||
if (cl.isInstance(ri)) {
|
||||
//noinspection unchecked
|
||||
return (T) ri.widget;
|
||||
}
|
||||
}
|
||||
|
@ -368,11 +370,13 @@ public class MapWidgetRegistry {
|
|||
}
|
||||
|
||||
final boolean selected = r.visibleCollapsed(mode) || r.visible(mode);
|
||||
final String desc = mapActivity.getString(R.string.shared_string_collapse);
|
||||
contextMenuAdapter.addItem(new ContextMenuItem.ItemBuilder().setTitleId(r.messageId, mapActivity)
|
||||
.setIcon(r.drawableMenu)
|
||||
.setSelected(selected)
|
||||
.setColor(selected ? R.color.osmand_orange : defaultColor)
|
||||
.setSecondaryIcon(R.drawable.ic_action_additional_option)
|
||||
.setDescription(r.visibleCollapsed(mode) ? desc : null)
|
||||
.setListener(new ContextMenuAdapter.OnRowItemClick() {
|
||||
@Override
|
||||
public boolean onRowItemClick(final ArrayAdapter<ContextMenuItem> adapter,
|
||||
|
@ -423,7 +427,6 @@ public class MapWidgetRegistry {
|
|||
ContextMenuItem item = adapter.getItem(position);
|
||||
item.setSelected(visible);
|
||||
item.setColorRes(visible ? R.color.osmand_orange : defaultColor);
|
||||
String desc = mapActivity.getString(R.string.shared_string_collapse);
|
||||
item.setDescription(visible && collapsed ? desc : null);
|
||||
adapter.notifyDataSetChanged();
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue