Added previous route card
This commit is contained in:
parent
930b305d5c
commit
4a5f9b8c0d
10 changed files with 324 additions and 9 deletions
|
@ -9,9 +9,15 @@
|
|||
<LinearLayout
|
||||
android:id="@+id/card_divider"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical">
|
||||
|
||||
<View
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="8dp"/>
|
||||
|
||||
<include layout="@layout/card_top_divider"/>
|
||||
|
||||
<include layout="@layout/list_item_divider" />
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
|
@ -145,7 +151,7 @@
|
|||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="@dimen/list_content_padding">
|
||||
android:layout_height="14dp">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/bottom_shadow"
|
||||
|
|
116
OsmAnd/res/layout/prev_route_card.xml
Normal file
116
OsmAnd/res/layout/prev_route_card.xml
Normal file
|
@ -0,0 +1,116 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:id="@+id/prev_route_card"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical">
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/card_divider"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<ImageView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:scaleType="fitXY"
|
||||
android:src="@drawable/bg_shadow_list_top" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/card_content"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="?attr/bg_color"
|
||||
android:baselineAligned="false"
|
||||
android:gravity="center_vertical"
|
||||
android:orientation="vertical"
|
||||
android:paddingBottom="@dimen/route_info_button_go_margin">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="@dimen/route_info_list_item_height"
|
||||
android:gravity="center_vertical">
|
||||
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="@dimen/list_content_padding"
|
||||
android:layout_marginLeft="@dimen/list_content_padding"
|
||||
android:text="@string/previous_route" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/card_button"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="@dimen/route_info_card_item_height"
|
||||
android:background="?attr/selectableItemBackground"
|
||||
android:gravity="center_vertical"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<android.support.v7.widget.AppCompatImageView
|
||||
android:id="@+id/card_img"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="@dimen/list_content_padding"
|
||||
android:layout_marginLeft="@dimen/list_content_padding"
|
||||
android:layout_marginEnd="@dimen/favorites_icon_right_margin"
|
||||
android:layout_marginRight="@dimen/favorites_icon_right_margin"
|
||||
android:src="@drawable/ic_action_previous_route"
|
||||
tools:tint="?attr/route_info_control_icon_color" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginEnd="@dimen/list_content_padding"
|
||||
android:layout_marginRight="@dimen/list_content_padding"
|
||||
android:orientation="vertical">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/start_title"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:ellipsize="end"
|
||||
android:letterSpacing="@dimen/text_button_letter_spacing"
|
||||
android:maxLines="1"
|
||||
android:text="@string/home_button"
|
||||
android:textSize="@dimen/default_sub_text_size"
|
||||
tools:ignore="UnusedAttribute"
|
||||
tools:text="My location - 160 Broadway, New York"
|
||||
tools:textColor="?android:attr/textColorSecondary" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/destination_title"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:ellipsize="end"
|
||||
android:letterSpacing="@dimen/text_button_letter_spacing"
|
||||
android:maxLines="1"
|
||||
android:textSize="@dimen/default_list_text_size"
|
||||
tools:ignore="UnusedAttribute"
|
||||
tools:text="McDonald's, 1560 Broadway, New York"
|
||||
tools:textColor="?android:attr/textColorPrimary" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="14dp">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/bottom_shadow"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:scaleType="fitXY"
|
||||
android:src="@drawable/bg_shadow_list_bottom" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
|
@ -278,6 +278,7 @@
|
|||
<dimen name="route_info_settings_buttons_height">32dp</dimen>
|
||||
<dimen name="route_info_app_modes_padding">40dp</dimen>
|
||||
<dimen name="route_info_card_row_min_height">60dp</dimen>
|
||||
<dimen name="route_info_card_item_height">56dp</dimen>
|
||||
|
||||
<dimen name="multi_selection_header_height">52dp</dimen>
|
||||
|
||||
|
|
|
@ -10,6 +10,7 @@
|
|||
- For wording and consistency, please note https://osmand.net/help-online?id=technical-articles#Creating_a_Consistent_User_Experience
|
||||
Thx - Hardy
|
||||
-->
|
||||
<string name="previous_route">Previous route</string>
|
||||
<string name="add_home">Add home</string>
|
||||
<string name="add_work">Add work</string>
|
||||
<string name="work_button">Work</string>
|
||||
|
|
|
@ -1894,6 +1894,9 @@ public class OsmandSettings {
|
|||
public final static String START_POINT_DESCRIPTION_BACKUP = "start_point_description_backup"; //$NON-NLS-1$
|
||||
public final static String INTERMEDIATE_POINTS_BACKUP = "intermediate_points_backup"; //$NON-NLS-1$
|
||||
public final static String INTERMEDIATE_POINTS_DESCRIPTION_BACKUP = "intermediate_points_description_backup"; //$NON-NLS-1$
|
||||
public final static String MY_LOC_POINT_LAT = "my_loc_point_lat";
|
||||
public final static String MY_LOC_POINT_LON = "my_loc_point_lon";
|
||||
public final static String MY_LOC_POINT_DESCRIPTION = "my_loc_point_description";
|
||||
|
||||
public final static String HOME_POINT_LAT = "home_point_lat";
|
||||
public final static String HOME_POINT_LON = "home_point_lon";
|
||||
|
@ -1988,6 +1991,34 @@ public class OsmandSettings {
|
|||
settingsAPI.getString(globalPreferences, POINT_NAVIGATE_DESCRIPTION, ""), getPointToNavigate());
|
||||
}
|
||||
|
||||
public LatLon getPointToNavigateBackup() {
|
||||
float lat = settingsAPI.getFloat(globalPreferences, POINT_NAVIGATE_LAT_BACKUP, 0);
|
||||
float lon = settingsAPI.getFloat(globalPreferences, POINT_NAVIGATE_LON_BACKUP, 0);
|
||||
if (lat == 0 && lon == 0) {
|
||||
return null;
|
||||
}
|
||||
return new LatLon(lat, lon);
|
||||
}
|
||||
|
||||
public LatLon getPointToStartBackup() {
|
||||
float lat = settingsAPI.getFloat(globalPreferences, START_POINT_LAT_BACKUP, 0);
|
||||
float lon = settingsAPI.getFloat(globalPreferences, START_POINT_LON_BACKUP, 0);
|
||||
if (lat == 0 && lon == 0) {
|
||||
return null;
|
||||
}
|
||||
return new LatLon(lat, lon);
|
||||
}
|
||||
|
||||
public PointDescription getStartPointDescriptionBackup() {
|
||||
return PointDescription.deserializeFromString(
|
||||
settingsAPI.getString(globalPreferences, START_POINT_DESCRIPTION_BACKUP, ""), getPointToStart());
|
||||
}
|
||||
|
||||
public PointDescription getPointNavigateDescriptionBackup() {
|
||||
return PointDescription.deserializeFromString(
|
||||
settingsAPI.getString(globalPreferences, POINT_NAVIGATE_DESCRIPTION_BACKUP, ""), getPointToNavigate());
|
||||
}
|
||||
|
||||
public LatLon getHomePoint() {
|
||||
float lat = settingsAPI.getFloat(globalPreferences, HOME_POINT_LAT, 0);
|
||||
float lon = settingsAPI.getFloat(globalPreferences, HOME_POINT_LON, 0);
|
||||
|
@ -2026,6 +2057,30 @@ public class OsmandSettings {
|
|||
settingsAPI.edit(globalPreferences).putString(WORK_POINT_DESCRIPTION, PointDescription.serializeToString(p)).commit();
|
||||
}
|
||||
|
||||
public LatLon getMyLocationToStart() {
|
||||
float lat = settingsAPI.getFloat(globalPreferences, MY_LOC_POINT_LAT, 0);
|
||||
float lon = settingsAPI.getFloat(globalPreferences, MY_LOC_POINT_LON, 0);
|
||||
if (lat == 0 && lon == 0) {
|
||||
return null;
|
||||
}
|
||||
return new LatLon(lat, lon);
|
||||
}
|
||||
|
||||
public PointDescription getMyLocationToStartDescription() {
|
||||
return PointDescription.deserializeFromString(
|
||||
settingsAPI.getString(globalPreferences, MY_LOC_POINT_DESCRIPTION, ""), getMyLocationToStart());
|
||||
}
|
||||
|
||||
public void setMyLocationToStart(double latitude, double longitude, PointDescription p) {
|
||||
settingsAPI.edit(globalPreferences).putFloat(MY_LOC_POINT_LAT, (float) latitude).putFloat(MY_LOC_POINT_LON, (float) longitude).commit();
|
||||
settingsAPI.edit(globalPreferences).putString(MY_LOC_POINT_DESCRIPTION, PointDescription.serializeToString(p)).commit();
|
||||
}
|
||||
|
||||
public void clearMyLocationToStart() {
|
||||
settingsAPI.edit(globalPreferences).remove(MY_LOC_POINT_LAT).remove(MY_LOC_POINT_LON).
|
||||
remove(MY_LOC_POINT_DESCRIPTION).commit();
|
||||
}
|
||||
|
||||
public int isRouteToPointNavigateAndClear() {
|
||||
int vl = settingsAPI.getInt(globalPreferences, POINT_NAVIGATE_ROUTE, 0);
|
||||
if (vl != 0) {
|
||||
|
|
|
@ -23,6 +23,9 @@ public class TargetPointsHelper {
|
|||
private List<TargetPoint> intermediatePoints = new ArrayList<>();
|
||||
private TargetPoint pointToNavigate = null;
|
||||
private TargetPoint pointToStart = null;
|
||||
private TargetPoint pointToNavigateBackup = null;
|
||||
private TargetPoint pointToStartBackup = null;
|
||||
private TargetPoint myLocationToStart = null;
|
||||
private OsmandSettings settings;
|
||||
private RoutingHelper routingHelper;
|
||||
private List<StateChangedListener<Void>> listeners = new ArrayList<>();
|
||||
|
@ -35,6 +38,7 @@ public class TargetPointsHelper {
|
|||
private AddressLookupRequest targetPointRequest;
|
||||
private AddressLookupRequest homePointRequest;
|
||||
private AddressLookupRequest workPointRequest;
|
||||
private AddressLookupRequest myLocationPointRequest;
|
||||
|
||||
public interface TargetPointChangedListener {
|
||||
void onTargetPointChanged(TargetPoint targetPoint);
|
||||
|
@ -156,11 +160,15 @@ public class TargetPointsHelper {
|
|||
}
|
||||
lookupAddressForHomePoint();
|
||||
lookupAddressForWorkPoint();
|
||||
lookupAddressForMyLocationPoint();
|
||||
}
|
||||
|
||||
private void readFromSettings() {
|
||||
pointToNavigate = TargetPoint.create(settings.getPointToNavigate(), settings.getPointNavigateDescription());
|
||||
pointToStart = TargetPoint.createStartPoint(settings.getPointToStart(), settings.getStartPointDescription());
|
||||
pointToNavigateBackup = TargetPoint.create(settings.getPointToNavigateBackup(), settings.getPointNavigateDescriptionBackup());
|
||||
pointToStartBackup = TargetPoint.createStartPoint(settings.getPointToStartBackup(), settings.getStartPointDescriptionBackup());
|
||||
myLocationToStart = TargetPoint.create(settings.getMyLocationToStart(), settings.getMyLocationToStartDescription());
|
||||
intermediatePoints.clear();
|
||||
List<LatLon> ips = settings.getIntermediatePoints();
|
||||
List<String> desc = settings.getIntermediatePointDescriptions(ips.size());
|
||||
|
@ -188,6 +196,13 @@ public class TargetPointsHelper {
|
|||
}
|
||||
}
|
||||
|
||||
private void readMyLocationPointFromSettings() {
|
||||
myLocationToStart = TargetPoint.create(settings.getMyLocationToStart(), settings.getMyLocationToStartDescription());
|
||||
if (!ctx.isApplicationInitializing()) {
|
||||
lookupAddressForMyLocationPoint();
|
||||
}
|
||||
}
|
||||
|
||||
private void lookupAddressForIntermediatePoint(final TargetPoint targetPoint) {
|
||||
if (targetPoint != null && targetPoint.pointDescription.isSearchingAddress(ctx)) {
|
||||
cancelPointAddressRequests(targetPoint.point);
|
||||
|
@ -294,6 +309,27 @@ public class TargetPointsHelper {
|
|||
}
|
||||
}
|
||||
|
||||
private void lookupAddressForMyLocationPoint() {
|
||||
if (myLocationToStart != null && myLocationToStart.isSearchingAddress(ctx)
|
||||
&& (myLocationPointRequest == null || !myLocationPointRequest.getLatLon().equals(workPoint.point))) {
|
||||
cancelWorkPointAddressRequest();
|
||||
myLocationPointRequest = new AddressLookupRequest(workPoint.point, new GeocodingLookupService.OnAddressLookupResult() {
|
||||
@Override
|
||||
public void geocodingDone(String address) {
|
||||
myLocationPointRequest = null;
|
||||
if (myLocationToStart != null) {
|
||||
myLocationToStart.pointDescription.setName(address);
|
||||
settings.setMyLocationToStart(myLocationToStart.point.getLatitude(), myLocationToStart.point.getLongitude(),
|
||||
myLocationToStart.pointDescription);
|
||||
updateRouteAndRefresh(false);
|
||||
updateTargetPoint(myLocationToStart);
|
||||
}
|
||||
}
|
||||
}, null);
|
||||
ctx.getGeocodingLookupService().lookupAddress(myLocationPointRequest);
|
||||
}
|
||||
}
|
||||
|
||||
public TargetPoint getPointToNavigate() {
|
||||
return pointToNavigate;
|
||||
}
|
||||
|
@ -302,6 +338,18 @@ public class TargetPointsHelper {
|
|||
return pointToStart;
|
||||
}
|
||||
|
||||
public TargetPoint getPointToNavigateBackup() {
|
||||
return pointToNavigateBackup;
|
||||
}
|
||||
|
||||
public TargetPoint getPointToStartBackup() {
|
||||
return pointToStartBackup;
|
||||
}
|
||||
|
||||
public TargetPoint getMyLocationToStart() {
|
||||
return myLocationToStart;
|
||||
}
|
||||
|
||||
public PointDescription getStartPointDescription(){
|
||||
return settings.getStartPointDescription();
|
||||
}
|
||||
|
@ -421,6 +469,7 @@ public class TargetPointsHelper {
|
|||
settings.clearPointToStart();
|
||||
if (clearBackup) {
|
||||
settings.backupTargetPoints();
|
||||
updateMyLocationToStart();
|
||||
}
|
||||
pointToNavigate = null;
|
||||
pointToStart = null;
|
||||
|
@ -481,6 +530,15 @@ public class TargetPointsHelper {
|
|||
updateListeners();
|
||||
}
|
||||
|
||||
public void updateMyLocationToStart() {
|
||||
if (pointToStart == null) {
|
||||
Location lastKnownLocation = ctx.getLocationProvider().getLastKnownLocation();
|
||||
LatLon latLon = lastKnownLocation != null ?
|
||||
new LatLon(lastKnownLocation.getLatitude(), lastKnownLocation.getLongitude()) : null;
|
||||
setMyLocationPoint(latLon, false, null);
|
||||
}
|
||||
}
|
||||
|
||||
private void updateRoutingHelper() {
|
||||
LatLon start = settings.getPointToStart();
|
||||
LatLon finish = settings.getPointToNavigate();
|
||||
|
@ -494,7 +552,6 @@ public class TargetPointsHelper {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
private Location wrap(LatLon l) {
|
||||
if(l == null) {
|
||||
return null;
|
||||
|
@ -669,6 +726,25 @@ public class TargetPointsHelper {
|
|||
updateRouteAndRefresh(updateRoute);
|
||||
}
|
||||
|
||||
public void setMyLocationPoint(final LatLon startPoint, boolean updateRoute, PointDescription name) {
|
||||
if (startPoint != null) {
|
||||
final PointDescription pointDescription;
|
||||
if (name == null) {
|
||||
pointDescription = new PointDescription(PointDescription.POINT_TYPE_LOCATION, "");
|
||||
} else {
|
||||
pointDescription = name;
|
||||
}
|
||||
if (pointDescription.isLocation() && Algorithms.isEmpty(pointDescription.getName())) {
|
||||
pointDescription.setName(PointDescription.getSearchAddressStr(ctx));
|
||||
}
|
||||
settings.setMyLocationToStart(startPoint.getLatitude(), startPoint.getLongitude(), pointDescription);
|
||||
} else {
|
||||
settings.clearMyLocationToStart();
|
||||
}
|
||||
readMyLocationPointFromSettings();
|
||||
updateRouteAndRefresh(updateRoute);
|
||||
}
|
||||
|
||||
public boolean checkPointToNavigateShort(){
|
||||
if (pointToNavigate == null){
|
||||
ctx.showShortToastMessage(R.string.mark_final_location_first);
|
||||
|
|
|
@ -50,6 +50,7 @@ import net.osmand.plus.mapmarkers.MapMarkerSelectionFragment;
|
|||
import net.osmand.plus.poi.PoiUIFilter;
|
||||
import net.osmand.plus.routepreparationmenu.cards.BaseCard;
|
||||
import net.osmand.plus.routepreparationmenu.cards.HomeWorkCard;
|
||||
import net.osmand.plus.routepreparationmenu.cards.PreviousRouteCard;
|
||||
import net.osmand.plus.routepreparationmenu.cards.PublicTransportCard;
|
||||
import net.osmand.plus.routepreparationmenu.cards.SimpleRouteCard;
|
||||
import net.osmand.plus.routing.IRouteInformationListener;
|
||||
|
@ -379,6 +380,17 @@ public class MapRouteInfoMenu implements IRouteInformationListener {
|
|||
} else {
|
||||
HomeWorkCard homeWorkCard = new HomeWorkCard(mapActivity);
|
||||
menuCards.add(homeWorkCard);
|
||||
|
||||
TargetPointsHelper targetPointsHelper = app.getTargetPointsHelper();
|
||||
TargetPoint startBackup = targetPointsHelper.getPointToStartBackup();
|
||||
if (startBackup == null) {
|
||||
startBackup = targetPointsHelper.getMyLocationToStart();
|
||||
}
|
||||
TargetPoint destinationBackup = targetPointsHelper.getPointToNavigateBackup();
|
||||
if (startBackup != null && destinationBackup != null) {
|
||||
PreviousRouteCard previousRouteCard = new PreviousRouteCard(mapActivity);
|
||||
menuCards.add(previousRouteCard);
|
||||
}
|
||||
}
|
||||
setupCards();
|
||||
}
|
||||
|
|
|
@ -33,9 +33,9 @@ public class HomeWorkCard extends BaseCard {
|
|||
|
||||
TextView homeDescr = (TextView) view.findViewById(R.id.home_button_descr);
|
||||
final TextView workDescr = (TextView) view.findViewById(R.id.work_button_descr);
|
||||
homeDescr.setText(homePoint != null ? homePoint.getPointDescription(mapActivity).getName() :
|
||||
homeDescr.setText(homePoint != null ? homePoint.getPointDescription(mapActivity).getSimpleName(mapActivity, false) :
|
||||
mapActivity.getString(R.string.shared_string_add));
|
||||
workDescr.setText(workPoint != null ? workPoint.getPointDescription(mapActivity).getName() :
|
||||
workDescr.setText(workPoint != null ? workPoint.getPointDescription(mapActivity).getSimpleName(mapActivity, false) :
|
||||
mapActivity.getString(R.string.shared_string_add));
|
||||
|
||||
View homeButton = view.findViewById(R.id.home_button);
|
||||
|
|
|
@ -1,6 +1,16 @@
|
|||
package net.osmand.plus.routepreparationmenu.cards;
|
||||
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.support.v7.widget.AppCompatImageView;
|
||||
import android.view.View;
|
||||
import android.widget.TextView;
|
||||
|
||||
import net.osmand.AndroidUtils;
|
||||
import net.osmand.plus.R;
|
||||
import net.osmand.plus.TargetPointsHelper;
|
||||
import net.osmand.plus.TargetPointsHelper.TargetPoint;
|
||||
import net.osmand.plus.activities.MapActivity;
|
||||
import net.osmand.util.Algorithms;
|
||||
|
||||
public class PreviousRouteCard extends BaseCard {
|
||||
|
||||
|
@ -10,16 +20,50 @@ public class PreviousRouteCard extends BaseCard {
|
|||
|
||||
@Override
|
||||
public int getCardLayoutId() {
|
||||
return 0;
|
||||
return R.layout.prev_route_card;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void updateContent() {
|
||||
final TargetPointsHelper targetPointsHelper = mapActivity.getMyApplication().getTargetPointsHelper();
|
||||
TextView startTitle = (TextView) view.findViewById(R.id.start_title);
|
||||
TextView destinationTitle = (TextView) view.findViewById(R.id.destination_title);
|
||||
|
||||
TargetPoint startPoint = targetPointsHelper.getPointToStartBackup();
|
||||
boolean myLocation = false;
|
||||
if (startPoint == null) {
|
||||
myLocation = true;
|
||||
startPoint = targetPointsHelper.getMyLocationToStart();
|
||||
}
|
||||
StringBuilder startText = new StringBuilder(myLocation ? mapActivity.getText(R.string.my_location) : "");
|
||||
if (startPoint != null) {
|
||||
String descr = startPoint.getPointDescription(mapActivity).getSimpleName(mapActivity, false);
|
||||
if (!Algorithms.isEmpty(descr)) {
|
||||
if (startText.length() > 0) {
|
||||
startText.append(" — ");
|
||||
}
|
||||
startText.append(descr);
|
||||
}
|
||||
}
|
||||
startTitle.setText(startText.toString());
|
||||
TargetPoint destinationPoint = targetPointsHelper.getPointToNavigateBackup();
|
||||
destinationTitle.setText(destinationPoint != null ?
|
||||
destinationPoint.getPointDescription(mapActivity).getSimpleName(mapActivity, false) : "");
|
||||
View homeButton = view.findViewById(R.id.card_button);
|
||||
homeButton.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
targetPointsHelper.restoreTargetPoints(true);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void applyDayNightMode() {
|
||||
|
||||
AndroidUtils.setTextSecondaryColor(app, (TextView) view.findViewById(R.id.start_title), nightMode);
|
||||
AndroidUtils.setTextPrimaryColor(app, (TextView) view.findViewById(R.id.destination_title), nightMode);
|
||||
Drawable img = app.getUIUtilities().getIcon(R.drawable.ic_action_previous_route, nightMode ? R.color.route_info_control_icon_color_dark : R.color.route_info_control_icon_color_light);
|
||||
((AppCompatImageView) view.findViewById(R.id.card_img)).setImageDrawable(img);
|
||||
AndroidUtils.setBackground(app, view.findViewById(R.id.card_content), nightMode, R.color.route_info_bg_light, R.color.route_info_bg_dark);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -279,6 +279,10 @@ public class RoutingHelper {
|
|||
}
|
||||
|
||||
public void updateLocation(Location currentLocation) {
|
||||
if (settings.getPointToStart() == null && settings.getMyLocationToStart() == null && currentLocation != null) {
|
||||
app.getTargetPointsHelper().setMyLocationPoint(
|
||||
new LatLon(currentLocation.getLatitude(), currentLocation.getLongitude()), false, null);
|
||||
}
|
||||
if(isFollowingMode() || (settings.getPointToStart() == null && isRoutePlanningMode) ||
|
||||
app.getLocationProvider().getLocationSimulation().isRouteAnimating()) {
|
||||
setCurrentLocation(currentLocation, false);
|
||||
|
|
Loading…
Reference in a new issue