Fix issues
This commit is contained in:
parent
c4b91b2333
commit
b5b8af3db6
14 changed files with 162 additions and 105 deletions
|
@ -2,27 +2,51 @@
|
||||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:orientation="vertical">
|
android:orientation="vertical" >
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:id="@+id/TopBar"
|
android:id="@+id/TopBar"
|
||||||
android:layout_width="fill_parent"
|
android:layout_width="fill_parent"
|
||||||
android:orientation="horizontal"
|
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:gravity="center_horizontal" />
|
android:gravity="center_horizontal"
|
||||||
|
android:orientation="horizontal" />
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_gravity="center_horizontal"
|
||||||
|
android:orientation="horizontal" >
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/avoid_roads"
|
||||||
|
android:layout_width="@dimen/dashListItemHeight"
|
||||||
|
android:layout_height="@dimen/dashListItemHeight"
|
||||||
|
android:background="@drawable/dashboard_button_light"
|
||||||
|
android:scaleType="center"
|
||||||
|
android:src="@drawable/ic_action_road_works_dark" />
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/mute"
|
||||||
|
android:layout_width="@dimen/dashListItemHeight"
|
||||||
|
android:layout_height="@dimen/dashListItemHeight"
|
||||||
|
android:background="@drawable/dashboard_button_light"
|
||||||
|
android:scaleType="center"
|
||||||
|
android:src="@drawable/a_10_device_access_volume_muted_dark" />
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:layout_width="fill_parent"
|
android:layout_width="fill_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginTop="5dp"
|
android:layout_marginLeft="10dp"
|
||||||
android:layout_marginLeft="10dp">
|
android:layout_marginTop="5dp" >
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginLeft="3dp"
|
android:layout_marginLeft="3dp"
|
||||||
android:text="@string/gpx_navigation"
|
android:text="@string/gpx_navigation"
|
||||||
android:textSize="18sp"></TextView>
|
android:textSize="18sp" >
|
||||||
|
</TextView>
|
||||||
|
|
||||||
<Spinner
|
<Spinner
|
||||||
android:id="@+id/GPXRouteSpinner"
|
android:id="@+id/GPXRouteSpinner"
|
||||||
|
@ -30,13 +54,15 @@
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginLeft="5dp"
|
android:layout_marginLeft="5dp"
|
||||||
android:layout_marginRight="5dp"
|
android:layout_marginRight="5dp"
|
||||||
android:textSize="18sp"></Spinner>
|
android:textSize="18sp" >
|
||||||
|
</Spinner>
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
<ListView
|
<ListView
|
||||||
android:id="@android:id/list"
|
android:id="@android:id/list"
|
||||||
android:layout_marginTop="5dp"
|
|
||||||
android:layout_width="fill_parent"
|
android:layout_width="fill_parent"
|
||||||
android:layout_height="fill_parent"></ListView>
|
android:layout_height="fill_parent"
|
||||||
|
android:layout_marginTop="5dp" >
|
||||||
|
</ListView>
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
|
@ -13,6 +13,8 @@
|
||||||
|
|
||||||
<ImageButton
|
<ImageButton
|
||||||
android:id="@+id/start_navigation"
|
android:id="@+id/start_navigation"
|
||||||
|
android:layout_marginLeft="5dp"
|
||||||
|
android:layout_marginRight="5dp"
|
||||||
android:layout_width="@dimen/list_item_height"
|
android:layout_width="@dimen/list_item_height"
|
||||||
android:layout_height="@dimen/list_item_height"
|
android:layout_height="@dimen/list_item_height"
|
||||||
android:background="?attr/options_button_background"
|
android:background="?attr/options_button_background"
|
||||||
|
|
|
@ -64,6 +64,8 @@
|
||||||
android:id="@+id/description"
|
android:id="@+id/description"
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginRight="5dp"
|
||||||
|
android:layout_gravity="center_vertical"
|
||||||
android:layout_weight="1"
|
android:layout_weight="1"
|
||||||
tools:text="@string/lorem_ipsum"
|
tools:text="@string/lorem_ipsum"
|
||||||
android:text=""/>
|
android:text=""/>
|
||||||
|
|
|
@ -34,10 +34,7 @@ import net.osmand.plus.activities.actions.OsmAndDialogs;
|
||||||
import net.osmand.plus.activities.actions.ShareLocation;
|
import net.osmand.plus.activities.actions.ShareLocation;
|
||||||
import net.osmand.plus.activities.search.SearchActivity;
|
import net.osmand.plus.activities.search.SearchActivity;
|
||||||
import net.osmand.plus.dashboard.DashboardOnMap.DashboardType;
|
import net.osmand.plus.dashboard.DashboardOnMap.DashboardType;
|
||||||
import net.osmand.plus.dialogs.ConfigureMapMenu;
|
|
||||||
import net.osmand.plus.dialogs.FavoriteDialogs;
|
import net.osmand.plus.dialogs.FavoriteDialogs;
|
||||||
import net.osmand.plus.helpers.WaypointDialogHelper;
|
|
||||||
import net.osmand.plus.osmo.OsMoPositionLayer;
|
|
||||||
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;
|
||||||
|
@ -56,7 +53,6 @@ import android.view.View;
|
||||||
import android.view.View.OnClickListener;
|
import android.view.View.OnClickListener;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
import android.view.WindowManager;
|
import android.view.WindowManager;
|
||||||
import android.widget.AdapterView.OnItemClickListener;
|
|
||||||
import android.widget.ArrayAdapter;
|
import android.widget.ArrayAdapter;
|
||||||
import android.widget.Button;
|
import android.widget.Button;
|
||||||
import android.widget.EditText;
|
import android.widget.EditText;
|
||||||
|
@ -547,40 +543,23 @@ public class MapActivityActions implements DialogProvider {
|
||||||
final OsmandMapTileView mapView = mapActivity.getMapView();
|
final OsmandMapTileView mapView = mapActivity.getMapView();
|
||||||
final OsmandApplication app = mapActivity.getMyApplication();
|
final OsmandApplication app = mapActivity.getMyApplication();
|
||||||
ContextMenuAdapter optionsMenuHelper = new ContextMenuAdapter(app);
|
ContextMenuAdapter optionsMenuHelper = new ContextMenuAdapter(app);
|
||||||
|
|
||||||
// 2-4. Navigation related (directions, mute, cancel navigation)
|
optionsMenuHelper.item(R.string.get_directions).iconColor(R.drawable.ic_action_gdirections_dark)
|
||||||
boolean muteVisible = routingHelper.getFinalLocation() != null && routingHelper.isFollowingMode();
|
|
||||||
// TODO delete
|
|
||||||
if (muteVisible) {
|
|
||||||
boolean mute = routingHelper.getVoiceRouter().isMute();
|
|
||||||
int t = mute ? R.string.menu_mute_on : R.string.menu_mute_off;
|
|
||||||
int icon;
|
|
||||||
if(mute) {
|
|
||||||
icon = R.drawable.a_10_device_access_volume_muted_dark;
|
|
||||||
} else{
|
|
||||||
icon = R.drawable.a_10_device_access_volume_on_dark;
|
|
||||||
}
|
|
||||||
optionsMenuHelper.item(t).iconColor(icon)
|
|
||||||
.listen(new OnContextMenuClick() {
|
|
||||||
@Override
|
|
||||||
public boolean onContextMenuClick(ArrayAdapter<?> adapter, int itemId, int pos, boolean isChecked) {
|
|
||||||
routingHelper.getVoiceRouter().setMute(!routingHelper.getVoiceRouter().isMute());
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}).reg();
|
|
||||||
}
|
|
||||||
// TODO delete
|
|
||||||
if(!routingHelper.isFollowingMode() && !routingHelper.isRoutePlanningMode()) {
|
|
||||||
optionsMenuHelper.item(R.string.get_directions)
|
|
||||||
.iconColor(R.drawable.ic_action_gdirections_dark)
|
|
||||||
.listen(new OnContextMenuClick() {
|
.listen(new OnContextMenuClick() {
|
||||||
@Override
|
@Override
|
||||||
public boolean onContextMenuClick(ArrayAdapter<?> adapter, int itemId, int pos, boolean isChecked) {
|
public boolean onContextMenuClick(ArrayAdapter<?> adapter, int itemId, int pos, boolean isChecked) {
|
||||||
|
if (!routingHelper.isFollowingMode() && !routingHelper.isRoutePlanningMode()) {
|
||||||
enterRoutePlanningMode(null, null, false);
|
enterRoutePlanningMode(null, null, false);
|
||||||
return true;
|
} else {
|
||||||
|
mapActivity.getMapViewTrackingUtilities().switchToRoutePlanningMode();
|
||||||
|
mapActivity.refreshMap();
|
||||||
}
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
}).reg();
|
}).reg();
|
||||||
} else if(routingHelper.isRouteCalculated()) {
|
|
||||||
|
// TODO Pause/continue
|
||||||
|
if(routingHelper.isRouteCalculated()) {
|
||||||
optionsMenuHelper.item(
|
optionsMenuHelper.item(
|
||||||
routingHelper.isRoutePlanningMode() ? R.string.continue_navigation :
|
routingHelper.isRoutePlanningMode() ? R.string.continue_navigation :
|
||||||
R.string.pause_navigation)
|
R.string.pause_navigation)
|
||||||
|
@ -602,6 +581,7 @@ public class MapActivityActions implements DialogProvider {
|
||||||
}
|
}
|
||||||
}).reg();
|
}).reg();
|
||||||
}
|
}
|
||||||
|
// TODO stop navigation / delete point
|
||||||
if (mapActivity.getPointToNavigate() != null) {
|
if (mapActivity.getPointToNavigate() != null) {
|
||||||
int nav;
|
int nav;
|
||||||
if(routingHelper.isFollowingMode()) {
|
if(routingHelper.isFollowingMode()) {
|
||||||
|
@ -616,14 +596,12 @@ public class MapActivityActions implements DialogProvider {
|
||||||
@Override
|
@Override
|
||||||
public boolean onContextMenuClick(ArrayAdapter<?> adapter, int itemId, int pos, boolean isChecked) {
|
public boolean onContextMenuClick(ArrayAdapter<?> adapter, int itemId, int pos, boolean isChecked) {
|
||||||
stopNavigationActionConfirm(mapView);
|
stopNavigationActionConfirm(mapView);
|
||||||
OsMoPositionLayer osMoPositionLayer = mapActivity.getMapView().getLayerByClass(OsMoPositionLayer.class);
|
|
||||||
if (osMoPositionLayer != null) {
|
|
||||||
OsMoPositionLayer.setFollowDestination(null);
|
|
||||||
}
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}).reg();
|
}).reg();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
optionsMenuHelper.item(R.string.target_points).iconColor(R.drawable.ic_action_flage_dark)
|
optionsMenuHelper.item(R.string.target_points).iconColor(R.drawable.ic_action_flage_dark)
|
||||||
.listen(new OnContextMenuClick() {
|
.listen(new OnContextMenuClick() {
|
||||||
@Override
|
@Override
|
||||||
|
@ -632,19 +610,6 @@ public class MapActivityActions implements DialogProvider {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}).reg();
|
}).reg();
|
||||||
// TODO delete
|
|
||||||
if(routingHelper.isRouteCalculated()) {
|
|
||||||
optionsMenuHelper.item(R.string.impassable_road)
|
|
||||||
.iconColor(R.drawable.ic_action_road_works_dark)
|
|
||||||
.listen(new OnContextMenuClick() {
|
|
||||||
@Override
|
|
||||||
public boolean onContextMenuClick(ArrayAdapter<?> adapter, int itemId, int pos, boolean isChecked) {
|
|
||||||
app.getAvoidSpecificRoads().showDialog(mapActivity);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}).reg();
|
|
||||||
}
|
|
||||||
|
|
||||||
// Default actions (Layers, Configure Map screen, Settings, Search, Favorites)
|
// Default actions (Layers, Configure Map screen, Settings, Search, Favorites)
|
||||||
optionsMenuHelper.item(R.string.search_button)
|
optionsMenuHelper.item(R.string.search_button)
|
||||||
.iconColor(R.drawable.ic_action_search_dark)
|
.iconColor(R.drawable.ic_action_search_dark)
|
||||||
|
|
|
@ -67,6 +67,9 @@ public class ShowRouteInfoActivity extends OsmandListActivity {
|
||||||
View headerView = getLayoutInflater().inflate(R.layout.route_details_header, null);
|
View headerView = getLayoutInflater().inflate(R.layout.route_details_header, null);
|
||||||
header = (TextView) headerView.findViewById(R.id.header);
|
header = (TextView) headerView.findViewById(R.id.header);
|
||||||
helper = ((OsmandApplication)getApplication()).getRoutingHelper();
|
helper = ((OsmandApplication)getApplication()).getRoutingHelper();
|
||||||
|
((ImageView)
|
||||||
|
headerView.findViewById(R.id.start_navigation)).setImageDrawable(
|
||||||
|
getMyApplication().getIconsCache().getIcon(R.drawable.ic_action_start_navigation, R.color.color_myloc_distance));
|
||||||
headerView.findViewById(R.id.start_navigation).setOnClickListener(new View.OnClickListener() {
|
headerView.findViewById(R.id.start_navigation).setOnClickListener(new View.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
|
|
|
@ -160,11 +160,12 @@ public class DashboardOnMap implements ObservableScrollViewCallbacks {
|
||||||
|
|
||||||
|
|
||||||
private void updateListBackgroundHeight() {
|
private void updateListBackgroundHeight() {
|
||||||
|
if (listBackgroundView == null || listBackgroundView.getHeight() > 0) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
final View contentView = mapActivity.getWindow().getDecorView().findViewById(android.R.id.content);
|
final View contentView = mapActivity.getWindow().getDecorView().findViewById(android.R.id.content);
|
||||||
if(contentView.getHeight() > 0) {
|
if (contentView.getHeight() > 0) {
|
||||||
if(listBackgroundView != null) {
|
listBackgroundView.getLayoutParams().height = contentView.getHeight();
|
||||||
listBackgroundView.getLayoutParams().height = contentView.getHeight();
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
contentView.post(new Runnable() {
|
contentView.post(new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
|
@ -172,9 +173,7 @@ public class DashboardOnMap implements ObservableScrollViewCallbacks {
|
||||||
// mListBackgroundView's should fill its parent vertically
|
// mListBackgroundView's should fill its parent vertically
|
||||||
// but the height of the content view is 0 on 'onCreate'.
|
// but the height of the content view is 0 on 'onCreate'.
|
||||||
// So we should get it with post().
|
// So we should get it with post().
|
||||||
if (listBackgroundView != null) {
|
listBackgroundView.getLayoutParams().height = contentView.getHeight();
|
||||||
listBackgroundView.getLayoutParams().height = contentView.getHeight();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -215,7 +214,7 @@ public class DashboardOnMap implements ObservableScrollViewCallbacks {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
if (waypointsVisible) {
|
if (waypointsVisible && getMyApplication().getWaypointHelper().getAllPoints().size() > 0) {
|
||||||
edit.setVisibility(View.VISIBLE);
|
edit.setVisibility(View.VISIBLE);
|
||||||
edit.setOnClickListener(new View.OnClickListener() {
|
edit.setOnClickListener(new View.OnClickListener() {
|
||||||
|
|
||||||
|
@ -224,19 +223,20 @@ public class DashboardOnMap implements ObservableScrollViewCallbacks {
|
||||||
setDashboardVisibility(true, DashboardType.WAYPOINTS_EDIT);
|
setDashboardVisibility(true, DashboardType.WAYPOINTS_EDIT);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
// TODO conditional
|
if (getMyApplication().getWaypointHelper().isRouteCalculated()) {
|
||||||
flat.setVisibility(View.VISIBLE);
|
flat.setVisibility(View.VISIBLE);
|
||||||
final boolean flatNow = visibleType == DashboardType.WAYPOINTS_FLAT;
|
final boolean flatNow = visibleType == DashboardType.WAYPOINTS_FLAT;
|
||||||
flat.setImageDrawable(iconsCache.getActionBarIcon(flatNow ?
|
flat.setImageDrawable(iconsCache.getActionBarIcon(flatNow ? R.drawable.ic_tree_list_dark
|
||||||
R.drawable.ic_tree_list_dark : R.drawable.ic_flat_list_dark));
|
: R.drawable.ic_flat_list_dark));
|
||||||
flat.setOnClickListener(new View.OnClickListener() {
|
flat.setOnClickListener(new View.OnClickListener() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
setDashboardVisibility(true, flatNow ? DashboardType.WAYPOINTS :
|
setDashboardVisibility(true, flatNow ? DashboardType.WAYPOINTS : DashboardType.WAYPOINTS_FLAT,
|
||||||
DashboardType.WAYPOINTS_FLAT);
|
previousVisibleType);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if(waypointsEdit) {
|
if(waypointsEdit) {
|
||||||
ok.setVisibility(View.VISIBLE);
|
ok.setVisibility(View.VISIBLE);
|
||||||
|
@ -282,9 +282,9 @@ public class DashboardOnMap implements ObservableScrollViewCallbacks {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
if (visibleType == DashboardType.DASHBOARD) {
|
if (visibleType == DashboardType.DASHBOARD) {
|
||||||
setDashboardVisibility(true, DashboardType.LIST_MENU);
|
setDashboardVisibility(true, DashboardType.LIST_MENU, null);
|
||||||
} else {
|
} else {
|
||||||
setDashboardVisibility(true, DashboardType.DASHBOARD);
|
setDashboardVisibility(true, DashboardType.DASHBOARD, null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -360,10 +360,13 @@ public class DashboardOnMap implements ObservableScrollViewCallbacks {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setDashboardVisibility(boolean visible, DashboardType type) {
|
public void setDashboardVisibility(boolean visible, DashboardType type) {
|
||||||
|
setDashboardVisibility(visible, type, this.visible ? visibleType : null);
|
||||||
|
}
|
||||||
|
public void setDashboardVisibility(boolean visible, DashboardType type, DashboardType prevItem) {
|
||||||
if(visible == this.visible && type == visibleType) {
|
if(visible == this.visible && type == visibleType) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
this.previousVisibleType = this.visible ? visibleType : null;
|
this.previousVisibleType = prevItem;
|
||||||
this.visible = visible;
|
this.visible = visible;
|
||||||
boolean refresh = this.visibleType == type;
|
boolean refresh = this.visibleType == type;
|
||||||
this.visibleType = type;
|
this.visibleType = type;
|
||||||
|
|
|
@ -36,13 +36,20 @@ public class AvoidSpecificRoads {
|
||||||
this.app = app;
|
this.app = app;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public List<RouteDataObject> getMissingRoads() {
|
||||||
|
if(missingRoads == null) {
|
||||||
|
missingRoads = app.getDefaultRoutingConfig().getImpassableRoads();
|
||||||
|
}
|
||||||
|
return missingRoads;
|
||||||
|
}
|
||||||
|
|
||||||
protected net.osmand.router.RoutingConfiguration.Builder getBuilder() {
|
protected net.osmand.router.RoutingConfiguration.Builder getBuilder() {
|
||||||
return RoutingConfiguration.getDefault();
|
return RoutingConfiguration.getDefault();
|
||||||
}
|
}
|
||||||
|
|
||||||
public ArrayAdapter<RouteDataObject> createAdapter(final MapActivity ctx) {
|
public ArrayAdapter<RouteDataObject> createAdapter(final MapActivity ctx) {
|
||||||
final ArrayList<RouteDataObject> points = new ArrayList<RouteDataObject>();
|
final ArrayList<RouteDataObject> points = new ArrayList<RouteDataObject>();
|
||||||
points.addAll(missingRoads);
|
points.addAll(getMissingRoads());
|
||||||
final LatLon mapLocation = ctx.getMapLocation();
|
final LatLon mapLocation = ctx.getMapLocation();
|
||||||
return new ArrayAdapter<RouteDataObject>(ctx,
|
return new ArrayAdapter<RouteDataObject>(ctx,
|
||||||
R.layout.waypoint_reached, R.id.title, points) {
|
R.layout.waypoint_reached, R.id.title, points) {
|
||||||
|
@ -95,7 +102,7 @@ public class AvoidSpecificRoads {
|
||||||
public void showDialog(final MapActivity mapActivity) {
|
public void showDialog(final MapActivity mapActivity) {
|
||||||
Builder bld = new AlertDialog.Builder(mapActivity);
|
Builder bld = new AlertDialog.Builder(mapActivity);
|
||||||
bld.setTitle(R.string.impassable_road);
|
bld.setTitle(R.string.impassable_road);
|
||||||
if (missingRoads.size() == 0){
|
if (getMissingRoads().size() == 0){
|
||||||
bld.setMessage(R.string.avoid_roads_msg);
|
bld.setMessage(R.string.avoid_roads_msg);
|
||||||
} else {
|
} else {
|
||||||
final ArrayAdapter<?> listAdapter = createAdapter(mapActivity);
|
final ArrayAdapter<?> listAdapter = createAdapter(mapActivity);
|
||||||
|
@ -182,11 +189,4 @@ public class AvoidSpecificRoads {
|
||||||
dialog.dismiss();
|
dialog.dismiss();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public List<RouteDataObject> getMissingRoads() {
|
|
||||||
if(missingRoads == null) {
|
|
||||||
missingRoads = app.getDefaultRoutingConfig().getImpassableRoads();
|
|
||||||
}
|
|
||||||
return missingRoads;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -60,7 +60,6 @@ import android.widget.ScrollView;
|
||||||
import android.widget.Spinner;
|
import android.widget.Spinner;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
import android.widget.Toast;
|
import android.widget.Toast;
|
||||||
|
|
||||||
import net.osmand.AndroidUtils;
|
import net.osmand.AndroidUtils;
|
||||||
import net.osmand.Location;
|
import net.osmand.Location;
|
||||||
import net.osmand.access.AccessibleToast;
|
import net.osmand.access.AccessibleToast;
|
||||||
|
@ -69,6 +68,7 @@ import net.osmand.data.PointDescription;
|
||||||
import net.osmand.plus.NavigationService;
|
import net.osmand.plus.NavigationService;
|
||||||
import net.osmand.plus.OsmAndConstants;
|
import net.osmand.plus.OsmAndConstants;
|
||||||
import net.osmand.plus.OsmAndFormatter;
|
import net.osmand.plus.OsmAndFormatter;
|
||||||
|
import net.osmand.plus.TargetPointsHelper;
|
||||||
import net.osmand.plus.OsmAndLocationProvider.OsmAndCompassListener;
|
import net.osmand.plus.OsmAndLocationProvider.OsmAndCompassListener;
|
||||||
import net.osmand.plus.OsmAndLocationProvider.OsmAndLocationListener;
|
import net.osmand.plus.OsmAndLocationProvider.OsmAndLocationListener;
|
||||||
import net.osmand.plus.OsmandApplication;
|
import net.osmand.plus.OsmandApplication;
|
||||||
|
@ -516,7 +516,10 @@ public class OsMoGroupsActivity extends OsmandExpandableListActivity implements
|
||||||
@Override
|
@Override
|
||||||
public boolean onActionItemClicked(ActionMode mode, MenuItem item) {
|
public boolean onActionItemClicked(ActionMode mode, MenuItem item) {
|
||||||
if (item.getItemId() == TRACK_DEV_ID) {
|
if (item.getItemId() == TRACK_DEV_ID) {
|
||||||
if (device != null) {
|
if (device != null && device.getLastLocation() != null) {
|
||||||
|
TargetPointsHelper targets = getMyApplication().getTargetPointsHelper();
|
||||||
|
targets.navigateToPoint(new LatLon(device.getLastLocation().getLatitude(), device
|
||||||
|
.getLastLocation().getLongitude()), true, -1);
|
||||||
OsMoPositionLayer.setFollowDestination(device);
|
OsMoPositionLayer.setFollowDestination(device);
|
||||||
MapActivity.launchMapActivityMoveToTop(OsMoGroupsActivity.this);
|
MapActivity.launchMapActivityMoveToTop(OsMoGroupsActivity.this);
|
||||||
}
|
}
|
||||||
|
|
|
@ -240,7 +240,9 @@ public class MapControlsLayer extends OsmandMapLayer {
|
||||||
});
|
});
|
||||||
|
|
||||||
TextView routeGoButton = (TextView) mapActivity.findViewById(R.id.map_go_route_button);
|
TextView routeGoButton = (TextView) mapActivity.findViewById(R.id.map_go_route_button);
|
||||||
routeGoControl = createHudButton(routeGoButton, R.drawable.ic_destination_arrow_white).setBg(
|
|
||||||
|
routeGoControl = createHudButton(routeGoButton,
|
||||||
|
R.drawable.ic_action_start_navigation).setIconColorId(R.color.color_myloc_distance) .setBg(
|
||||||
R.drawable.btn_flat, R.drawable.btn_flat_night);
|
R.drawable.btn_flat, R.drawable.btn_flat_night);
|
||||||
controls.add(routeGoControl);
|
controls.add(routeGoControl);
|
||||||
routeGoButton.setText(mapActivity.getString(R.string.shared_string_go).toUpperCase());
|
routeGoButton.setText(mapActivity.getString(R.string.shared_string_go).toUpperCase());
|
||||||
|
|
|
@ -182,7 +182,7 @@ public class MapInfoLayer extends OsmandMapLayer {
|
||||||
for (MapWidgetRegInfo reg : mapInfoControls.getRight()) {
|
for (MapWidgetRegInfo reg : mapInfoControls.getRight()) {
|
||||||
updateReg(ts, reg);
|
updateReg(ts, reg);
|
||||||
}
|
}
|
||||||
updateStreetName(ts);
|
updateStreetName(nightMode, ts);
|
||||||
lanesControl.updateTextSize(nightMode, ts.textColor, ts.textShadowColor, ts.textBold, ts.textShadowRadius);
|
lanesControl.updateTextSize(nightMode, ts.textColor, ts.textShadowColor, ts.textBold, ts.textShadowRadius);
|
||||||
rulerControl.updateTextSize(nightMode, ts.textColor, ts.textShadowColor, ts.textShadowRadius);
|
rulerControl.updateTextSize(nightMode, ts.textColor, ts.textShadowColor, ts.textShadowRadius);
|
||||||
this.expand.setBackgroundResource(ts.expand);
|
this.expand.setBackgroundResource(ts.expand);
|
||||||
|
@ -191,10 +191,10 @@ public class MapInfoLayer extends OsmandMapLayer {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void updateStreetName(TextState ts) {
|
private void updateStreetName(boolean nightMode, TextState ts) {
|
||||||
streetNameView.setBackgroundResource(ScreenOrientationHelper.isOrientationPortrait(map) ? ts.boxTop
|
streetNameView.setBackgroundResource(ScreenOrientationHelper.isOrientationPortrait(map) ? ts.boxTop
|
||||||
: ts.boxFree);
|
: ts.boxFree);
|
||||||
streetNameView.updateTextColor(ts.textColor, ts.textShadowColor, ts.textBold, ts.textShadowRadius);
|
streetNameView.updateTextColor(nightMode, ts.textColor, ts.textShadowColor, ts.textBold, ts.textShadowRadius);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void updateReg(TextState ts, MapWidgetRegInfo reg) {
|
private void updateReg(TextState ts, MapWidgetRegInfo reg) {
|
||||||
|
|
|
@ -11,6 +11,7 @@ import net.osmand.Location;
|
||||||
import net.osmand.data.LatLon;
|
import net.osmand.data.LatLon;
|
||||||
import net.osmand.plus.ApplicationMode;
|
import net.osmand.plus.ApplicationMode;
|
||||||
import net.osmand.plus.GPXUtilities;
|
import net.osmand.plus.GPXUtilities;
|
||||||
|
import net.osmand.plus.ContextMenuAdapter.OnContextMenuClick;
|
||||||
import net.osmand.plus.GPXUtilities.GPXFile;
|
import net.osmand.plus.GPXUtilities.GPXFile;
|
||||||
import net.osmand.plus.OsmandSettings;
|
import net.osmand.plus.OsmandSettings;
|
||||||
import net.osmand.plus.OsmandSettings.CommonPreference;
|
import net.osmand.plus.OsmandSettings.CommonPreference;
|
||||||
|
@ -24,6 +25,7 @@ import net.osmand.plus.activities.actions.AppModeDialog;
|
||||||
import net.osmand.plus.helpers.GpxUiHelper;
|
import net.osmand.plus.helpers.GpxUiHelper;
|
||||||
import net.osmand.plus.routing.RouteProvider.GPXRouteParamsBuilder;
|
import net.osmand.plus.routing.RouteProvider.GPXRouteParamsBuilder;
|
||||||
import net.osmand.plus.routing.RouteProvider.RouteService;
|
import net.osmand.plus.routing.RouteProvider.RouteService;
|
||||||
|
import net.osmand.plus.routing.RoutingHelper;
|
||||||
import net.osmand.router.GeneralRouter;
|
import net.osmand.router.GeneralRouter;
|
||||||
import net.osmand.router.GeneralRouter.RoutingParameter;
|
import net.osmand.router.GeneralRouter.RoutingParameter;
|
||||||
import net.osmand.router.GeneralRouter.RoutingParameterType;
|
import net.osmand.router.GeneralRouter.RoutingParameterType;
|
||||||
|
@ -42,6 +44,7 @@ import android.widget.AdapterView;
|
||||||
import android.widget.ArrayAdapter;
|
import android.widget.ArrayAdapter;
|
||||||
import android.widget.CheckBox;
|
import android.widget.CheckBox;
|
||||||
import android.widget.CompoundButton;
|
import android.widget.CompoundButton;
|
||||||
|
import android.widget.ImageView;
|
||||||
import android.widget.CompoundButton.OnCheckedChangeListener;
|
import android.widget.CompoundButton.OnCheckedChangeListener;
|
||||||
import android.widget.ListView;
|
import android.widget.ListView;
|
||||||
import android.widget.Spinner;
|
import android.widget.Spinner;
|
||||||
|
@ -258,6 +261,14 @@ public class MapRoutePreferencesControl {
|
||||||
final ListView lv = (ListView) settingsDlg.findViewById(android.R.id.list);
|
final ListView lv = (ListView) settingsDlg.findViewById(android.R.id.list);
|
||||||
final Set<ApplicationMode> selected = new HashSet<ApplicationMode>();
|
final Set<ApplicationMode> selected = new HashSet<ApplicationMode>();
|
||||||
selected.add(am);
|
selected.add(am);
|
||||||
|
|
||||||
|
ImageView muteBtn = (ImageView) settingsDlg.findViewById(R.id.mute);
|
||||||
|
setMuteBtn(muteBtn);
|
||||||
|
|
||||||
|
ImageView avoidRoads = (ImageView) settingsDlg.findViewById(R.id.avoid_roads);
|
||||||
|
setAvoidRoads(avoidRoads);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
setupSpinner(settingsDlg);
|
setupSpinner(settingsDlg);
|
||||||
final float scaleCoefficient = mapActivity.getMapView().getScaleCoefficient();
|
final float scaleCoefficient = mapActivity.getMapView().getScaleCoefficient();
|
||||||
|
@ -315,6 +326,41 @@ public class MapRoutePreferencesControl {
|
||||||
return settingsDlg;
|
return settingsDlg;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void setAvoidRoads(ImageView avoidRoads) {
|
||||||
|
avoidRoads.setContentDescription(mapActivity.getString(R.string.impassable_road));
|
||||||
|
avoidRoads.setImageDrawable(mapActivity.getMyApplication().getIconsCache().getIcon(R.drawable.ic_action_road_works_dark
|
||||||
|
, R.color.icon_color_light));
|
||||||
|
avoidRoads.setOnClickListener(new View.OnClickListener() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onClick(View v) {
|
||||||
|
mapActivity.getMyApplication().getAvoidSpecificRoads().showDialog(mapActivity);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
private void setMuteBtn(final ImageView muteBtn) {
|
||||||
|
final RoutingHelper routingHelper = mapActivity.getMyApplication().getRoutingHelper();
|
||||||
|
boolean mute = routingHelper.getVoiceRouter().isMute();
|
||||||
|
int t = mute ? R.string.menu_mute_on : R.string.menu_mute_off;
|
||||||
|
int icon;
|
||||||
|
if(mute) {
|
||||||
|
icon = R.drawable.a_10_device_access_volume_muted_dark;
|
||||||
|
} else{
|
||||||
|
icon = R.drawable.a_10_device_access_volume_on_dark;
|
||||||
|
}
|
||||||
|
muteBtn.setContentDescription(mapActivity.getString(t));
|
||||||
|
muteBtn.setImageDrawable(mapActivity.getMyApplication().getIconsCache().getIcon(icon, R.color.icon_color_light));
|
||||||
|
muteBtn.setOnClickListener(new View.OnClickListener() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onClick(View v) {
|
||||||
|
routingHelper.getVoiceRouter().setMute(!routingHelper.getVoiceRouter().isMute());
|
||||||
|
setMuteBtn(muteBtn);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
private void updateParameters() {
|
private void updateParameters() {
|
||||||
ApplicationMode am = settings.APPLICATION_MODE.get();
|
ApplicationMode am = settings.APPLICATION_MODE.get();
|
||||||
listAdapter.setNotifyOnChange(false);
|
listAdapter.setNotifyOnChange(false);
|
||||||
|
|
|
@ -312,10 +312,16 @@ public class MapInfoWidgetsFactory {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void updateTextColor(int textColor, int textShadowColor, boolean bold, int rad) {
|
public void updateTextColor(boolean nightMode, int textColor, int textShadowColor, boolean bold, int rad) {
|
||||||
updateTextColor(addressText, textColor, textShadowColor, bold, rad);
|
updateTextColor(addressText, textColor, textShadowColor, bold, rad);
|
||||||
updateTextColor((TextView) waypointInfoBar.findViewById(R.id.waypoint_text),
|
updateTextColor((TextView) waypointInfoBar.findViewById(R.id.waypoint_text), textColor, textShadowColor,
|
||||||
textColor, textShadowColor, bold, rad);
|
bold, rad);
|
||||||
|
ImageView all = (ImageView) waypointInfoBar.findViewById(R.id.waypoint_more);
|
||||||
|
ImageView remove = (ImageView) waypointInfoBar.findViewById(R.id.waypoint_close);
|
||||||
|
all.setImageDrawable(map.getMyApplication().getIconsCache()
|
||||||
|
.getActionBarIcon(R.drawable.ic_overflow_menu_dark, !nightMode));
|
||||||
|
remove.setImageDrawable(map.getMyApplication().getIconsCache()
|
||||||
|
.getActionBarIcon(R.drawable.ic_action_remove_dark, !nightMode));
|
||||||
}
|
}
|
||||||
|
|
||||||
private void updateTextColor(TextView tv, int textColor, int textShadowColor, boolean textBold, int rad) {
|
private void updateTextColor(TextView tv, int textColor, int textShadowColor, boolean textBold, int rad) {
|
||||||
|
@ -402,16 +408,14 @@ public class MapInfoWidgetsFactory {
|
||||||
lastPoint, null);
|
lastPoint, null);
|
||||||
if (updated) {
|
if (updated) {
|
||||||
ImageView all = (ImageView) waypointInfoBar.findViewById(R.id.waypoint_more);
|
ImageView all = (ImageView) waypointInfoBar.findViewById(R.id.waypoint_more);
|
||||||
View btnN = waypointInfoBar.findViewById(R.id.waypoint_close);
|
ImageView remove = (ImageView) waypointInfoBar.findViewById(R.id.waypoint_close);
|
||||||
all.setImageDrawable(map.getMyApplication().getIconsCache().
|
|
||||||
getContentIcon(R.drawable.ic_overflow_menu_light));
|
|
||||||
all.setOnClickListener(new View.OnClickListener() {
|
all.setOnClickListener(new View.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View view) {
|
public void onClick(View view) {
|
||||||
map.getDashboard().setDashboardVisibility(true, DashboardType.WAYPOINTS);
|
map.getDashboard().setDashboardVisibility(true, DashboardType.WAYPOINTS);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
btnN.setOnClickListener(new View.OnClickListener() {
|
remove.setOnClickListener(new View.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View view) {
|
public void onClick(View view) {
|
||||||
waypointHelper.removeVisibleLocationPoint(lastPoint);
|
waypointHelper.removeVisibleLocationPoint(lastPoint);
|
||||||
|
|
|
@ -55,7 +55,7 @@ public class NextTurnInfoWidget extends TextInfoWidget {
|
||||||
if(horisontalMini) {
|
if(horisontalMini) {
|
||||||
setImageDrawable(turnDrawable, false);
|
setImageDrawable(turnDrawable, false);
|
||||||
} else {
|
} else {
|
||||||
setTopImageDrawable(turnDrawable, turnType.getExitOut() == 0 ? "" :
|
setTopImageDrawable(turnDrawable, turnType == null || turnType.getExitOut() == 0 ? "" :
|
||||||
turnType.getExitOut() + "");
|
turnType.getExitOut() + "");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -65,6 +65,7 @@ public class TextInfoWidget {
|
||||||
if(imageDrawable != null) {
|
if(imageDrawable != null) {
|
||||||
topImageView.setImageDrawable(imageDrawable);
|
topImageView.setImageDrawable(imageDrawable);
|
||||||
topImageView.setVisibility(View.VISIBLE);
|
topImageView.setVisibility(View.VISIBLE);
|
||||||
|
topTextView.setVisibility(View.VISIBLE);
|
||||||
topTextView.setText(topText == null ? "" : topText);
|
topTextView.setText(topText == null ? "" : topText);
|
||||||
} else {
|
} else {
|
||||||
topImageView.setVisibility(View.GONE );
|
topImageView.setVisibility(View.GONE );
|
||||||
|
|
Loading…
Reference in a new issue