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
|
<TextView
|
||||||
android:id="@+id/title"
|
android:id="@+id/title"
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
android:layout_marginLeft="16dp"
|
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_gravity="center_vertical"
|
android:layout_gravity="center_vertical"
|
||||||
|
android:layout_marginLeft="16dp"
|
||||||
android:layout_weight="1"
|
android:layout_weight="1"
|
||||||
android:textSize="@dimen/default_list_text_size"
|
android:textSize="@dimen/default_list_text_size"
|
||||||
tools:text="Some title text"/>
|
tools:text="Some title text"/>
|
||||||
|
|
||||||
<android.support.v7.widget.AppCompatButton
|
<android.support.v7.widget.AppCompatTextView
|
||||||
android:id="@+id/description"
|
android:id="@+id/description"
|
||||||
style="@style/Widget.AppCompat.Button.Borderless"
|
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:layout_gravity="center_vertical"
|
android:layout_gravity="center_vertical"
|
||||||
android:inputType="textCapWords"
|
android:layout_margin="16dp"
|
||||||
tools:text="topbar"
|
android:gravity="center_vertical"
|
||||||
android:textColor="?colorAccent"
|
android:textColor="?colorAccent"
|
||||||
android:layout_marginLeft="16dp"
|
tools:text="topbar"/>
|
||||||
android:focusable="false"/>
|
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
|
@ -52,6 +52,7 @@ import net.osmand.plus.liveupdates.OsmLiveActivity;
|
||||||
import net.osmand.plus.routing.RouteProvider.GPXRouteParamsBuilder;
|
import net.osmand.plus.routing.RouteProvider.GPXRouteParamsBuilder;
|
||||||
import net.osmand.plus.routing.RoutingHelper;
|
import net.osmand.plus.routing.RoutingHelper;
|
||||||
import net.osmand.plus.views.BaseMapLayer;
|
import net.osmand.plus.views.BaseMapLayer;
|
||||||
|
import net.osmand.plus.views.MapControlsLayer;
|
||||||
import net.osmand.plus.views.MapTileLayer;
|
import net.osmand.plus.views.MapTileLayer;
|
||||||
import net.osmand.plus.views.OsmandMapTileView;
|
import net.osmand.plus.views.OsmandMapTileView;
|
||||||
|
|
||||||
|
@ -90,18 +91,6 @@ public class MapActivityActions implements DialogProvider {
|
||||||
routingHelper = mapActivity.getMyApplication().getRoutingHelper();
|
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) {
|
public void addAsTarget(double latitude, double longitude, PointDescription pd) {
|
||||||
TargetPointsHelper targets = getMyApplication().getTargetPointsHelper();
|
TargetPointsHelper targets = getMyApplication().getTargetPointsHelper();
|
||||||
targets.navigateToPoint(new LatLon(latitude, longitude), true, targets.getIntermediatePoints().size() + 1,
|
targets.navigateToPoint(new LatLon(latitude, longitude), true, targets.getIntermediatePoints().size() + 1,
|
||||||
|
@ -223,6 +212,7 @@ public class MapActivityActions implements DialogProvider {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
String name = edit.getText().toString();
|
String name = edit.getText().toString();
|
||||||
|
//noinspection ResultOfMethodCallIgnored
|
||||||
fileDir.mkdirs();
|
fileDir.mkdirs();
|
||||||
File toSave = fileDir;
|
File toSave = fileDir;
|
||||||
if (name.length() > 0) {
|
if (name.length() > 0) {
|
||||||
|
@ -476,14 +466,6 @@ public class MapActivityActions implements DialogProvider {
|
||||||
public ApplicationMode getRouteMode(LatLon from) {
|
public ApplicationMode getRouteMode(LatLon from) {
|
||||||
ApplicationMode mode = settings.DEFAULT_APPLICATION_MODE.get();
|
ApplicationMode mode = settings.DEFAULT_APPLICATION_MODE.get();
|
||||||
ApplicationMode selected = settings.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) {
|
if (selected != ApplicationMode.DEFAULT) {
|
||||||
mode = selected;
|
mode = selected;
|
||||||
} else if (mode == ApplicationMode.DEFAULT) {
|
} else if (mode == ApplicationMode.DEFAULT) {
|
||||||
|
@ -492,18 +474,6 @@ public class MapActivityActions implements DialogProvider {
|
||||||
settings.LAST_ROUTING_APPLICATION_MODE != ApplicationMode.DEFAULT) {
|
settings.LAST_ROUTING_APPLICATION_MODE != ApplicationMode.DEFAULT) {
|
||||||
mode = settings.LAST_ROUTING_APPLICATION_MODE;
|
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;
|
return mode;
|
||||||
}
|
}
|
||||||
|
@ -637,15 +607,9 @@ public class MapActivityActions implements DialogProvider {
|
||||||
.setListener(new ContextMenuAdapter.ItemClickListener() {
|
.setListener(new ContextMenuAdapter.ItemClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public boolean onContextMenuClick(ArrayAdapter<ContextMenuItem> adapter, int itemId, int pos, boolean isChecked) {
|
public boolean onContextMenuClick(ArrayAdapter<ContextMenuItem> adapter, int itemId, int pos, boolean isChecked) {
|
||||||
MapActivity.clearPrevActivityIntent();
|
MapControlsLayer mapControlsLayer = mapActivity.getMapLayers().getMapControlsLayer();
|
||||||
if (!routingHelper.isFollowingMode() && !routingHelper.isRoutePlanningMode()) {
|
if (mapControlsLayer != null) {
|
||||||
if (settings.USE_MAP_MARKERS.get()) {
|
mapControlsLayer.doRoute(false);
|
||||||
setFirstMapMarkerAsTarget();
|
|
||||||
}
|
|
||||||
enterRoutePlanningMode(null, null);
|
|
||||||
} else {
|
|
||||||
mapActivity.getMapViewTrackingUtilities().switchToRoutePlanningMode();
|
|
||||||
mapActivity.refreshMap();
|
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -791,23 +755,6 @@ public class MapActivityActions implements DialogProvider {
|
||||||
|
|
||||||
//////////// Others
|
//////////// Others
|
||||||
OsmandPlugin.registerOptionsMenu(mapActivity, optionsMenuHelper);
|
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);
|
getMyApplication().getAppCustomization().prepareOptionsMenu(mapActivity, optionsMenuHelper);
|
||||||
return optionsMenuHelper;
|
return optionsMenuHelper;
|
||||||
}
|
}
|
||||||
|
@ -820,10 +767,6 @@ public class MapActivityActions implements DialogProvider {
|
||||||
mapActivity.getDashboard().setDashboardVisibility(true, DashboardType.ROUTE_PREFERENCES);
|
mapActivity.getDashboard().setDashboardVisibility(true, DashboardType.ROUTE_PREFERENCES);
|
||||||
}
|
}
|
||||||
|
|
||||||
private TargetPointsHelper getTargets() {
|
|
||||||
return mapActivity.getMyApplication().getTargetPointsHelper();
|
|
||||||
}
|
|
||||||
|
|
||||||
public void stopNavigationWithoutConfirm() {
|
public void stopNavigationWithoutConfirm() {
|
||||||
if (getMyApplication().getLocationProvider().getLocationSimulation().isRouteAnimating()) {
|
if (getMyApplication().getLocationProvider().getLocationSimulation().isRouteAnimating()) {
|
||||||
getMyApplication().getLocationProvider().getLocationSimulation().startStopRouteAnimation(mapActivity);
|
getMyApplication().getLocationProvider().getLocationSimulation().startStopRouteAnimation(mapActivity);
|
||||||
|
@ -855,7 +798,6 @@ public class MapActivityActions implements DialogProvider {
|
||||||
return builder.show();
|
return builder.show();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public void whereAmIDialog() {
|
public void whereAmIDialog() {
|
||||||
final List<String> items = new ArrayList<>();
|
final List<String> items = new ArrayList<>();
|
||||||
items.add(getString(R.string.show_location));
|
items.add(getString(R.string.show_location));
|
||||||
|
|
|
@ -129,11 +129,13 @@ public class MapWidgetRegistry {
|
||||||
public <T extends TextInfoWidget> T getSideWidget(Class<T> cl) {
|
public <T extends TextInfoWidget> T getSideWidget(Class<T> cl) {
|
||||||
for (MapWidgetRegInfo ri : leftWidgetSet) {
|
for (MapWidgetRegInfo ri : leftWidgetSet) {
|
||||||
if (cl.isInstance(ri)) {
|
if (cl.isInstance(ri)) {
|
||||||
|
//noinspection unchecked
|
||||||
return (T) ri.widget;
|
return (T) ri.widget;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for (MapWidgetRegInfo ri : rightWidgetSet) {
|
for (MapWidgetRegInfo ri : rightWidgetSet) {
|
||||||
if (cl.isInstance(ri)) {
|
if (cl.isInstance(ri)) {
|
||||||
|
//noinspection unchecked
|
||||||
return (T) ri.widget;
|
return (T) ri.widget;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -368,11 +370,13 @@ public class MapWidgetRegistry {
|
||||||
}
|
}
|
||||||
|
|
||||||
final boolean selected = r.visibleCollapsed(mode) || r.visible(mode);
|
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)
|
contextMenuAdapter.addItem(new ContextMenuItem.ItemBuilder().setTitleId(r.messageId, mapActivity)
|
||||||
.setIcon(r.drawableMenu)
|
.setIcon(r.drawableMenu)
|
||||||
.setSelected(selected)
|
.setSelected(selected)
|
||||||
.setColor(selected ? R.color.osmand_orange : defaultColor)
|
.setColor(selected ? R.color.osmand_orange : defaultColor)
|
||||||
.setSecondaryIcon(R.drawable.ic_action_additional_option)
|
.setSecondaryIcon(R.drawable.ic_action_additional_option)
|
||||||
|
.setDescription(r.visibleCollapsed(mode) ? desc : null)
|
||||||
.setListener(new ContextMenuAdapter.OnRowItemClick() {
|
.setListener(new ContextMenuAdapter.OnRowItemClick() {
|
||||||
@Override
|
@Override
|
||||||
public boolean onRowItemClick(final ArrayAdapter<ContextMenuItem> adapter,
|
public boolean onRowItemClick(final ArrayAdapter<ContextMenuItem> adapter,
|
||||||
|
@ -423,7 +427,6 @@ public class MapWidgetRegistry {
|
||||||
ContextMenuItem item = adapter.getItem(position);
|
ContextMenuItem item = adapter.getItem(position);
|
||||||
item.setSelected(visible);
|
item.setSelected(visible);
|
||||||
item.setColorRes(visible ? R.color.osmand_orange : defaultColor);
|
item.setColorRes(visible ? R.color.osmand_orange : defaultColor);
|
||||||
String desc = mapActivity.getString(R.string.shared_string_collapse);
|
|
||||||
item.setDescription(visible && collapsed ? desc : null);
|
item.setDescription(visible && collapsed ? desc : null);
|
||||||
adapter.notifyDataSetChanged();
|
adapter.notifyDataSetChanged();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue