Merge remote-tracking branch 'origin/master'

This commit is contained in:
Weblate 2018-03-07 11:39:40 +01:00
commit 204b582f77
18 changed files with 378 additions and 517 deletions

View file

@ -1,11 +1,11 @@
package net.osmand; package net.osmand;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Random;
import net.osmand.data.LatLon; import net.osmand.data.LatLon;
import net.osmand.util.MapUtils; import net.osmand.util.MapUtils;
import java.util.ArrayList;
import java.util.List;
import java.util.Random;
/* /*
* === Implementation of ant swarm TSP solver. === * === Implementation of ant swarm TSP solver. ===
* *
@ -106,10 +106,13 @@ public class TspAnt {
// Allocates all memory. // Allocates all memory.
// Adds 1 to edge lengths to ensure no zero length edges. // Adds 1 to edge lengths to ensure no zero length edges.
public TspAnt readGraph(List<LatLon> intermediates, LatLon start, LatLon end) { public TspAnt readGraph(List<LatLon> intermediates, LatLon start, LatLon end) {
boolean keepEndPoint = end != null;
List<LatLon> l = new ArrayList<LatLon>(); List<LatLon> l = new ArrayList<LatLon>();
l.add(start); l.add(start);
l.addAll(intermediates); l.addAll(intermediates);
if (keepEndPoint) {
l.add(end); l.add(end);
}
n = l.size() ; n = l.size() ;
// System.out.println("Cost"); // System.out.println("Cost");
graph = new double[n][n]; graph = new double[n][n];
@ -125,7 +128,7 @@ public class TspAnt {
} }
maxSum = Math.rint(maxSum) + 1; maxSum = Math.rint(maxSum) + 1;
for (int i = 0; i < n; i++) { for (int i = 0; i < n; i++) {
if (i == n - 1) { if (keepEndPoint && i == n - 1) {
graph[i][0] = 0.1; graph[i][0] = 0.1;
} else { } else {
graph[i][0] = maxSum; graph[i][0] = maxSum;

View file

@ -15,7 +15,7 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent"> android:layout_height="match_parent">
<ListView <com.github.ksoichiro.android.observablescrollview.ObservableListView
android:clipToPadding="false" android:clipToPadding="false"
android:paddingBottom="@dimen/bottom_sheet_content_padding_small" android:paddingBottom="@dimen/bottom_sheet_content_padding_small"
android:id="@+id/list" android:id="@+id/list"

View file

@ -0,0 +1,39 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/change_color_view"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?attr/selectableItemBackground"
android:gravity="center_vertical"
android:minHeight="@dimen/list_item_height"
android:orientation="horizontal"
android:paddingLeft="@dimen/list_content_padding"
android:paddingRight="@dimen/list_content_padding">
<ImageView
android:id="@+id/change_color_icon"
android:layout_width="@dimen/standard_icon_size"
android:layout_height="@dimen/standard_icon_size"
android:layout_gravity="center_vertical"
android:layout_marginEnd="@dimen/bottom_sheet_icon_margin"
android:layout_marginRight="@dimen/bottom_sheet_icon_margin"
android:src="@drawable/ic_action_appearance" />
<TextView
android:id="@+id/title"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_weight="1"
android:ellipsize="end"
android:maxLines="1"
android:text="@string/change_color"
android:textAppearance="@style/TextAppearance.ListItemTitle" />
<android.support.v7.widget.AppCompatImageView
android:id="@+id/colorImage"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/ic_action_circle" />
</LinearLayout>

View file

@ -1,249 +0,0 @@
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content"
xmlns:osmand="http://schemas.android.com/apk/res-auto"
android:layout_gravity="bottom"
android:background="?attr/bottom_menu_view_bg"
android:orientation="vertical"
tools:context="net.osmand.plus.download.ui.DataStoragePlaceDialogFragment">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:minHeight="@dimen/list_item_height"
android:paddingLeft="@dimen/list_content_padding"
android:paddingRight="@dimen/list_content_padding"
android:gravity="center_vertical">
<net.osmand.plus.widgets.TextViewEx
android:id="@+id/title"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingTop="6dp"
android:paddingBottom="6dp"
android:textColor="?android:attr/textColorPrimary"
android:textSize="@dimen/default_list_text_size"
osmand:typeface="@string/font_roboto_medium"
tools:text="Category"/>
</LinearLayout>
<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<LinearLayout
android:id="@+id/edit_name_view"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:minHeight="@dimen/list_item_height"
android:background="?attr/selectableItemBackground"
android:paddingLeft="@dimen/list_content_padding"
android:paddingRight="@dimen/list_content_padding"
android:orientation="horizontal"
android:gravity="center_vertical">
<ImageView
android:id="@+id/edit_name_icon"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/ic_action_edit_dark"/>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingLeft="@dimen/list_content_padding"
android:paddingTop="6dp"
android:paddingBottom="6dp"
android:textColor="?android:attr/textColorPrimary"
android:textSize="@dimen/default_list_text_size"
android:text="@string/edit_name"/>
</LinearLayout>
<LinearLayout
android:id="@+id/change_color_view"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:minHeight="@dimen/list_item_height"
android:background="?attr/selectableItemBackground"
android:paddingLeft="@dimen/list_content_padding"
android:paddingRight="@dimen/list_content_padding"
android:orientation="horizontal"
android:gravity="center_vertical">
<ImageView
android:id="@+id/change_color_icon"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/ic_action_appearance"/>
<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:paddingLeft="@dimen/list_content_padding"
android:paddingTop="6dp"
android:paddingBottom="6dp"
android:textColor="?android:attr/textColorPrimary"
android:textSize="@dimen/default_list_text_size"
android:text="@string/change_color"/>
<android.support.v7.widget.AppCompatImageView
android:id="@+id/colorImage"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/ic_action_circle"/>
</LinearLayout>
<LinearLayout
android:id="@+id/show_on_map_view"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:minHeight="@dimen/list_item_height"
android:background="?attr/selectableItemBackground"
android:paddingLeft="@dimen/list_content_padding"
android:paddingRight="@dimen/list_content_padding"
android:orientation="horizontal"
android:gravity="center_vertical">
<ImageView
android:id="@+id/show_on_map_icon"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/ic_map"/>
<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:paddingLeft="@dimen/list_content_padding"
android:paddingTop="6dp"
android:paddingBottom="6dp"
android:paddingRight="8dp"
android:textColor="?android:attr/textColorPrimary"
android:textSize="@dimen/default_list_text_size"
android:text="@string/shared_string_show_on_map"/>
<android.support.v7.widget.SwitchCompat
android:id="@+id/show_on_map_switch"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:clickable="false"/>
</LinearLayout>
<View
android:id="@+id/divider"
android:layout_width="match_parent"
android:layout_height="1dp"
android:background="?attr/dashboard_divider"/>
<LinearLayout
android:id="@+id/add_to_markers_view"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:minHeight="@dimen/list_item_height"
android:background="?attr/selectableItemBackground"
android:paddingLeft="@dimen/list_content_padding"
android:paddingRight="@dimen/list_content_padding"
android:orientation="horizontal"
android:gravity="center_vertical">
<ImageView
android:id="@+id/add_to_markers_icon"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/ic_action_flag_dark"/>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingLeft="@dimen/list_content_padding"
android:paddingTop="6dp"
android:paddingBottom="6dp"
android:textColor="?android:attr/textColorPrimary"
android:textSize="@dimen/default_list_text_size"
android:text="@string/shared_string_add_to_map_markers"/>
</LinearLayout>
<LinearLayout
android:id="@+id/remove_from_markers_view"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?attr/selectableItemBackground"
android:gravity="center_vertical"
android:minHeight="@dimen/list_item_height"
android:paddingLeft="@dimen/list_content_padding"
android:paddingRight="@dimen/list_content_padding"
android:visibility="gone"
tools:visibility="visible">
<ImageView
android:id="@+id/remove_from_markers_icon"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
tools:src="@drawable/ic_action_delete_dark"/>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingBottom="6dp"
android:paddingLeft="@dimen/list_content_padding"
android:paddingTop="6dp"
android:text="@string/remove_from_map_markers"
android:textColor="?android:attr/textColorPrimary"
android:textSize="@dimen/default_list_text_size"/>
</LinearLayout>
<LinearLayout
android:id="@+id/share_view"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:minHeight="@dimen/list_item_height"
android:background="?attr/selectableItemBackground"
android:paddingLeft="@dimen/list_content_padding"
android:paddingRight="@dimen/list_content_padding"
android:orientation="horizontal"
android:gravity="center_vertical">
<ImageView
android:id="@+id/share_icon"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/ic_action_gshare_dark"/>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingLeft="@dimen/list_content_padding"
android:paddingTop="6dp"
android:paddingBottom="6dp"
android:textColor="?android:attr/textColorPrimary"
android:textSize="@dimen/default_list_text_size"
android:text="@string/shared_string_share"/>
</LinearLayout>
</LinearLayout>
</ScrollView>
</LinearLayout>
</LinearLayout>

View file

@ -26,8 +26,12 @@
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:focusable="false" android:focusable="false"
android:layout_marginRight="@dimen/list_content_padding" android:visibility="gone"
android:visibility="gone"/> android:paddingTop="4dp"
android:paddingBottom="4dp"
android:paddingRight="@dimen/dialog_content_margin"
android:clickable="false"
android:focusableInTouchMode="false"/>
<ImageView <ImageView
android:id="@+id/icon" android:id="@+id/icon"

View file

@ -15,9 +15,8 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content"> android:layout_height="wrap_content">
<ListView <com.github.ksoichiro.android.observablescrollview.ObservableListView
android:clipToPadding="false" android:clipToPadding="false"
android:paddingBottom="@dimen/bottom_sheet_content_padding_small"
android:id="@+id/list" android:id="@+id/list"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="0dp" android:layout_height="0dp"
@ -35,7 +34,7 @@
android:id="@+id/cancel_row" android:id="@+id/cancel_row"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="@dimen/bottom_sheet_cancel_button_height" android:layout_height="@dimen/bottom_sheet_cancel_button_height"
android:background="?attr/selectableItemBackground"> android:foreground="?attr/selectableItemBackground">
<TextView <TextView
android:id="@+id/cancel_row_text" android:id="@+id/cancel_row_text"

View file

@ -3739,4 +3739,6 @@
<string name="poi_flooring">Напольные покрытия</string> <string name="poi_flooring">Напольные покрытия</string>
<string name="poi_pottery">Глиняная посуда</string> <string name="poi_pottery">Глиняная посуда</string>
<string name="poi_whitewater_rapid_name">Название речного порога</string>
</resources> </resources>

View file

@ -3759,4 +3759,6 @@
<string name="poi_flooring">Flooring store</string> <string name="poi_flooring">Flooring store</string>
<string name="poi_pottery">Pottery</string> <string name="poi_pottery">Pottery</string>
<string name="poi_whitewater_rapid_name">Name of the river rapids</string>
</resources> </resources>

View file

@ -1438,7 +1438,8 @@ public class MapMarkersHelper {
} }
public List<MapMarker> getActiveMarkers() { public List<MapMarker> getActiveMarkers() {
List<MapMarker> activeMarkers = new ArrayList<>(); List<MapMarker> markers = new ArrayList<>(this.markers);
List<MapMarker> activeMarkers = new ArrayList<>(markers.size());
for (MapMarker marker : markers) { for (MapMarker marker : markers) {
if (!marker.history) { if (!marker.history) {
activeMarkers.add(marker); activeMarkers.add(marker);

View file

@ -1,6 +1,5 @@
package net.osmand.plus.activities; package net.osmand.plus.activities;
import android.app.Activity;
import android.content.Context; import android.content.Context;
import android.content.DialogInterface; import android.content.DialogInterface;
import android.os.Bundle; import android.os.Bundle;
@ -9,13 +8,11 @@ import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager; import android.support.v4.app.FragmentManager;
import android.support.v7.app.AlertDialog; import android.support.v7.app.AlertDialog;
import android.support.v7.widget.ListPopupWindow; import android.support.v7.widget.ListPopupWindow;
import android.support.v7.widget.SwitchCompat; import android.view.ContextThemeWrapper;
import android.view.Gravity; import android.view.Gravity;
import android.view.LayoutInflater; import android.view.LayoutInflater;
import android.view.View; import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;
import android.view.Window;
import android.view.WindowManager;
import android.widget.AdapterView; import android.widget.AdapterView;
import android.widget.ArrayAdapter; import android.widget.ArrayAdapter;
import android.widget.EditText; import android.widget.EditText;
@ -25,80 +22,54 @@ import android.widget.TextView;
import net.osmand.AndroidUtils; import net.osmand.AndroidUtils;
import net.osmand.plus.FavouritesDbHelper; import net.osmand.plus.FavouritesDbHelper;
import net.osmand.plus.FavouritesDbHelper.FavoriteGroup; import net.osmand.plus.FavouritesDbHelper.FavoriteGroup;
import net.osmand.plus.IconsCache;
import net.osmand.plus.MapMarkersHelper; import net.osmand.plus.MapMarkersHelper;
import net.osmand.plus.MapMarkersHelper.MarkersSyncGroup; import net.osmand.plus.MapMarkersHelper.MarkersSyncGroup;
import net.osmand.plus.OsmandApplication; import net.osmand.plus.OsmandApplication;
import net.osmand.plus.R; import net.osmand.plus.R;
import net.osmand.plus.base.BottomSheetDialogFragment; import net.osmand.plus.base.MenuBottomSheetDialogFragment;
import net.osmand.plus.base.bottomsheetmenu.BaseBottomSheetItem;
import net.osmand.plus.base.bottomsheetmenu.BottomSheetItemWithCompoundButton;
import net.osmand.plus.base.bottomsheetmenu.SimpleBottomSheetItem;
import net.osmand.plus.base.bottomsheetmenu.simpleitems.DividerHalfItem;
import net.osmand.plus.base.bottomsheetmenu.simpleitems.TitleItem;
import net.osmand.plus.helpers.ColorDialogs; import net.osmand.plus.helpers.ColorDialogs;
import net.osmand.util.Algorithms; import net.osmand.util.Algorithms;
public class EditFavoriteGroupDialogFragment extends BottomSheetDialogFragment { public class EditFavoriteGroupDialogFragment extends MenuBottomSheetDialogFragment {
public static final String TAG = "EditFavoriteGroupDialogFragment"; public static final String TAG = "EditFavoriteGroupDialogFragment";
private static final String GROUP_NAME_KEY = "group_name_key"; private static final String GROUP_NAME_KEY = "group_name_key";
private OsmandApplication app;
private FavoriteGroup group; private FavoriteGroup group;
private FavouritesDbHelper helper;
@Override @Override
public void onStart() { public void createMenuItems(Bundle savedInstanceState) {
super.onStart(); final OsmandApplication app = getMyApplication();
FavouritesDbHelper helper = app.getFavorites();
final Window window = getDialog().getWindow(); Bundle args = getArguments();
WindowManager.LayoutParams params = window.getAttributes();
params.height = ViewGroup.LayoutParams.WRAP_CONTENT;
params.gravity = Gravity.BOTTOM;
params.width = ViewGroup.LayoutParams.MATCH_PARENT;
window.setAttributes(params);
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
final Activity activity = getActivity();
app = (OsmandApplication) activity.getApplicationContext();
helper = app.getFavorites();
Bundle args = null;
if (savedInstanceState != null) {
args = savedInstanceState;
} else if (getArguments() != null) {
args = getArguments();
}
if (args != null) { if (args != null) {
String groupName = args.getString(GROUP_NAME_KEY); String groupName = args.getString(GROUP_NAME_KEY);
if (groupName != null) { if (groupName != null) {
group = helper.getGroup(groupName); group = helper.getGroup(groupName);
} }
} }
final View view = inflater.inflate(R.layout.edit_fav_fragment, container,
false);
if (group == null) { if (group == null) {
return view; return;
} }
items.add(new TitleItem(Algorithms.isEmpty(group.name) ? app.getString(R.string.shared_string_favorites) : group.name));
IconsCache ic = app.getIconsCache(); BaseBottomSheetItem editNameItem = new SimpleBottomSheetItem.Builder()
.setIcon(getContentIcon(R.drawable.ic_action_edit_dark))
final TextView title = (TextView) view.findViewById(R.id.title); .setTitle(getString(R.string.edit_name))
title.setText(Algorithms.isEmpty(group.name) ? app.getString(R.string.shared_string_favorites) : group.name); .setLayoutId(R.layout.bottom_sheet_item_simple)
View editNameView = view.findViewById(R.id.edit_name_view); .setOnClickListener(new View.OnClickListener() {
((ImageView) view.findViewById(R.id.edit_name_icon))
.setImageDrawable(ic.getThemedIcon(R.drawable.ic_action_edit_dark));
editNameView.setOnClickListener(new View.OnClickListener() {
@Override @Override
public void onClick(View v) { public void onClick(View v) {
AlertDialog.Builder b = new AlertDialog.Builder(activity); AlertDialog.Builder b = new AlertDialog.Builder(getContext());
b.setTitle(R.string.favorite_group_name); b.setTitle(R.string.favorite_group_name);
final EditText nameEditText = new EditText(activity); final EditText nameEditText = new EditText(getContext());
nameEditText.setText(group.name); nameEditText.setText(group.name);
int leftPadding = AndroidUtils.dpToPx(activity, 24f); b.setView(nameEditText);
int topPadding = AndroidUtils.dpToPx(activity, 4f);
b.setView(nameEditText, leftPadding, topPadding, leftPadding, topPadding);
b.setNegativeButton(R.string.shared_string_cancel, null); b.setNegativeButton(R.string.shared_string_cancel, null);
b.setPositiveButton(R.string.shared_string_save, new DialogInterface.OnClickListener() { b.setPositiveButton(R.string.shared_string_save, new DialogInterface.OnClickListener() {
@Override @Override
@ -106,7 +77,7 @@ public class EditFavoriteGroupDialogFragment extends BottomSheetDialogFragment {
String name = nameEditText.getText().toString(); String name = nameEditText.getText().toString();
boolean nameChanged = !Algorithms.objectEquals(group.name, name); boolean nameChanged = !Algorithms.objectEquals(group.name, name);
if (nameChanged) { if (nameChanged) {
getMyApplication().getFavorites() app.getFavorites()
.editFavouriteGroup(group, name, group.color, group.visible); .editFavouriteGroup(group, name, group.color, group.visible);
updateParentFragment(); updateParentFragment();
} }
@ -115,32 +86,37 @@ public class EditFavoriteGroupDialogFragment extends BottomSheetDialogFragment {
}); });
b.show(); b.show();
} }
}); })
.create();
items.add(editNameItem);
final View changeColorView = view.findViewById(R.id.change_color_view); final int themeRes = nightMode ? R.style.OsmandDarkTheme : R.style.OsmandLightTheme;
((ImageView) view.findViewById(R.id.change_color_icon)) final View changeColorView = View.inflate(new ContextThemeWrapper(getContext(), themeRes),
.setImageDrawable(ic.getThemedIcon(R.drawable.ic_action_appearance)); R.layout.change_fav_color, null);
updateColorView(changeColorView); ((ImageView) changeColorView.findViewById(R.id.change_color_icon))
changeColorView.setOnClickListener(new View.OnClickListener() { .setImageDrawable(getContentIcon(R.drawable.ic_action_appearance));
updateColorView((ImageView) changeColorView.findViewById(R.id.colorImage));
BaseBottomSheetItem changeColorItem = new BaseBottomSheetItem.Builder()
.setCustomView(changeColorView)
.setOnClickListener(new View.OnClickListener() {
@Override @Override
public void onClick(View v) { public void onClick(View v) {
final ListPopupWindow popup = new ListPopupWindow(getActivity()); final ListPopupWindow popup = new ListPopupWindow(getActivity());
popup.setAnchorView(changeColorView); popup.setAnchorView(changeColorView);
popup.setContentWidth(AndroidUtils.dpToPx(app, 200f)); popup.setContentWidth(AndroidUtils.dpToPx(app, 200f));
popup.setModal(true); popup.setModal(true);
popup.setDropDownGravity(Gravity.RIGHT | Gravity.TOP); popup.setDropDownGravity(Gravity.END | Gravity.TOP);
popup.setVerticalOffset(AndroidUtils.dpToPx(app, -48f)); popup.setVerticalOffset(AndroidUtils.dpToPx(app, -48f));
popup.setHorizontalOffset(AndroidUtils.dpToPx(app, -6f)); popup.setHorizontalOffset(AndroidUtils.dpToPx(app, -6f));
final FavoriteColorAdapter colorAdapter = new FavoriteColorAdapter(getActivity()); final FavoriteColorAdapter colorAdapter = new FavoriteColorAdapter(getActivity());
popup.setAdapter(colorAdapter); popup.setAdapter(colorAdapter);
popup.setOnItemClickListener(new AdapterView.OnItemClickListener() { popup.setOnItemClickListener(new AdapterView.OnItemClickListener() {
@Override @Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) { public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
Integer color = colorAdapter.getItem(position); Integer color = colorAdapter.getItem(position);
if (color != null) { if (color != null) {
if (color != group.color) { if (color != group.color) {
getMyApplication().getFavorites() app.getFavorites()
.editFavouriteGroup(group, group.name, color, group.visible); .editFavouriteGroup(group, group.name, color, group.visible);
updateParentFragment(); updateParentFragment();
} }
@ -151,34 +127,43 @@ public class EditFavoriteGroupDialogFragment extends BottomSheetDialogFragment {
}); });
popup.show(); popup.show();
} }
}); })
.create();
items.add(changeColorItem);
View showOnMapView = view.findViewById(R.id.show_on_map_view); BaseBottomSheetItem showOnMapItem = new BottomSheetItemWithCompoundButton.Builder()
((ImageView) view.findViewById(R.id.show_on_map_icon)) .setChecked(group.visible)
.setImageDrawable(ic.getThemedIcon(R.drawable.ic_map)); .setIcon(getContentIcon(R.drawable.ic_map))
final SwitchCompat checkbox = (SwitchCompat) view.findViewById(R.id.show_on_map_switch); .setTitle(getString(R.string.shared_string_show_on_map))
checkbox.setChecked(group.visible); .setLayoutId(R.layout.bottom_sheet_item_with_switch)
showOnMapView.setOnClickListener(new View.OnClickListener() { .setOnClickListener(new View.OnClickListener() {
@Override @Override
public void onClick(View v) { public void onClick(View v) {
boolean visible = !group.visible; boolean visible = !group.visible;
checkbox.setChecked(visible); app.getFavorites()
getMyApplication().getFavorites()
.editFavouriteGroup(group, group.name, group.color, visible); .editFavouriteGroup(group, group.name, group.color, visible);
updateParentFragment(); updateParentFragment();
dismiss();
} }
}); })
.create();
items.add(showOnMapItem);
final MapMarkersHelper markersHelper = getMyApplication().getMapMarkersHelper(); if (group.points.size() > 0) {
items.add(new DividerHalfItem(getContext()));
}
final MapMarkersHelper markersHelper = app.getMapMarkersHelper();
final MarkersSyncGroup syncGroup = final MarkersSyncGroup syncGroup =
new MarkersSyncGroup(group.name, group.name, MarkersSyncGroup.FAVORITES_TYPE, group.color); new MarkersSyncGroup(group.name, group.name, MarkersSyncGroup.FAVORITES_TYPE, group.color);
boolean groupSyncedWithMarkers = markersHelper.isGroupSynced(syncGroup.getId()); boolean groupSyncedWithMarkers = markersHelper.isGroupSynced(syncGroup.getId());
View addToMarkersView = view.findViewById(R.id.add_to_markers_view);
if (app.getSettings().USE_MAP_MARKERS.get() && group.points.size() > 0 && !groupSyncedWithMarkers) { if (app.getSettings().USE_MAP_MARKERS.get() && group.points.size() > 0 && !groupSyncedWithMarkers) {
((ImageView) view.findViewById(R.id.add_to_markers_icon)) BaseBottomSheetItem addToMarkersItem = new SimpleBottomSheetItem.Builder()
.setImageDrawable(ic.getThemedIcon(R.drawable.ic_action_flag_dark)); .setIcon(getContentIcon(R.drawable.ic_action_flag_dark))
addToMarkersView.setOnClickListener(new View.OnClickListener() { .setTitle(getString(R.string.shared_string_add_to_map_markers))
.setLayoutId(R.layout.bottom_sheet_item_simple)
.setOnClickListener(new View.OnClickListener() {
@Override @Override
public void onClick(View v) { public void onClick(View v) {
markersHelper.addMarkersSyncGroup(syncGroup); markersHelper.addMarkersSyncGroup(syncGroup);
@ -186,48 +171,46 @@ public class EditFavoriteGroupDialogFragment extends BottomSheetDialogFragment {
dismiss(); dismiss();
MapActivity.launchMapActivityMoveToTop(getActivity()); MapActivity.launchMapActivityMoveToTop(getActivity());
} }
}); })
} else { .create();
addToMarkersView.setVisibility(View.GONE); items.add(addToMarkersItem);
} }
View removeFromMarkersView = view.findViewById(R.id.remove_from_markers_view);
if (app.getSettings().USE_MAP_MARKERS.get() && groupSyncedWithMarkers) { if (app.getSettings().USE_MAP_MARKERS.get() && groupSyncedWithMarkers) {
removeFromMarkersView.setVisibility(View.VISIBLE); BaseBottomSheetItem removeFromMarkersItem = new SimpleBottomSheetItem.Builder()
((ImageView) view.findViewById(R.id.remove_from_markers_icon)) .setIcon(getContentIcon(R.drawable.ic_action_delete_dark))
.setImageDrawable(ic.getThemedIcon(R.drawable.ic_action_delete_dark)); .setTitle(getString(R.string.remove_from_map_markers))
removeFromMarkersView.setOnClickListener(new View.OnClickListener() { .setLayoutId(R.layout.bottom_sheet_item_simple)
.setOnClickListener(new View.OnClickListener() {
@Override @Override
public void onClick(View view) { public void onClick(View view) {
markersHelper.removeMarkersSyncGroup(syncGroup.getId(), true); markersHelper.removeMarkersSyncGroup(syncGroup.getId(), true);
dismiss(); dismiss();
MapActivity.launchMapActivityMoveToTop(getActivity()); MapActivity.launchMapActivityMoveToTop(getActivity());
} }
}); })
.create();
items.add(removeFromMarkersItem);
} }
View shareView = view.findViewById(R.id.share_view);
if (group.points.size() > 0) { if (group.points.size() > 0) {
((ImageView) view.findViewById(R.id.share_icon)) BaseBottomSheetItem shareItem = new SimpleBottomSheetItem.Builder()
.setImageDrawable(ic.getThemedIcon(R.drawable.ic_action_gshare_dark)); .setIcon(getContentIcon(R.drawable.ic_action_gshare_dark))
shareView.setOnClickListener(new View.OnClickListener() { .setTitle(getString(R.string.shared_string_share))
.setLayoutId(R.layout.bottom_sheet_item_simple)
.setOnClickListener(new View.OnClickListener() {
@Override @Override
public void onClick(View v) { public void onClick(View view) {
FavoritesTreeFragment fragment = getFavoritesTreeFragment(); FavoritesTreeFragment fragment = getFavoritesTreeFragment();
if (fragment != null) { if (fragment != null) {
fragment.shareFavorites(group); fragment.shareFavorites(group);
} }
dismiss(); dismiss();
} }
}); })
} else { .create();
shareView.setVisibility(View.GONE); items.add(shareItem);
} }
if (group.points.size() == 0) {
view.findViewById(R.id.divider).setVisibility(View.GONE);
}
return view;
} }
@Override @Override
@ -253,13 +236,12 @@ public class EditFavoriteGroupDialogFragment extends BottomSheetDialogFragment {
} }
} }
private void updateColorView(View colorView) { private void updateColorView(ImageView colorImageView) {
ImageView colorImageView = (ImageView) colorView.findViewById(R.id.colorImage);
int color = group.color == 0 ? getResources().getColor(R.color.color_favorite) : group.color; int color = group.color == 0 ? getResources().getColor(R.color.color_favorite) : group.color;
if (color == 0) { if (color == 0) {
colorImageView.setImageDrawable(app.getIconsCache().getThemedIcon(R.drawable.ic_action_circle)); colorImageView.setImageDrawable(getContentIcon(R.drawable.ic_action_circle));
} else { } else {
colorImageView.setImageDrawable(app.getIconsCache().getPaintedIcon(R.drawable.ic_action_circle, color)); colorImageView.setImageDrawable(getMyApplication().getIconsCache().getPaintedIcon(R.drawable.ic_action_circle, color));
} }
} }
@ -273,9 +255,9 @@ public class EditFavoriteGroupDialogFragment extends BottomSheetDialogFragment {
public static class FavoriteColorAdapter extends ArrayAdapter<Integer> { public static class FavoriteColorAdapter extends ArrayAdapter<Integer> {
private OsmandApplication app; private final OsmandApplication app;
public FavoriteColorAdapter(Context context) { FavoriteColorAdapter(Context context) {
super(context, R.layout.rendering_prop_menu_item); super(context, R.layout.rendering_prop_menu_item);
this.app = (OsmandApplication) getContext().getApplicationContext(); this.app = (OsmandApplication) getContext().getApplicationContext();
init(); init();
@ -293,7 +275,7 @@ public class EditFavoriteGroupDialogFragment extends BottomSheetDialogFragment {
Integer color = getItem(position); Integer color = getItem(position);
View v = convertView; View v = convertView;
if (v == null) { if (v == null) {
v = LayoutInflater.from(getContext()).inflate(R.layout.rendering_prop_menu_item, null); v = LayoutInflater.from(getContext()).inflate(R.layout.rendering_prop_menu_item, parent, false);
} }
if (color != null) { if (color != null) {
TextView textView = (TextView) v.findViewById(R.id.text1); TextView textView = (TextView) v.findViewById(R.id.text1);

View file

@ -30,6 +30,7 @@ import android.widget.AdapterView;
import android.widget.AdapterView.OnItemClickListener; import android.widget.AdapterView.OnItemClickListener;
import android.widget.ArrayAdapter; import android.widget.ArrayAdapter;
import android.widget.Button; import android.widget.Button;
import android.widget.CheckBox;
import android.widget.CompoundButton; import android.widget.CompoundButton;
import android.widget.CompoundButton.OnCheckedChangeListener; import android.widget.CompoundButton.OnCheckedChangeListener;
import android.widget.ImageView; import android.widget.ImageView;
@ -471,9 +472,10 @@ public class GpxUiHelper {
if (item.getSelected() == null) { if (item.getSelected() == null) {
v.findViewById(R.id.check_item).setVisibility(View.GONE); v.findViewById(R.id.check_item).setVisibility(View.GONE);
v.findViewById(R.id.check_local_index).setVisibility(View.GONE);
} else { } else {
if (checkLayout) { if (checkLayout) {
final AppCompatCheckBox ch = ((AppCompatCheckBox) v.findViewById(R.id.toggle_checkbox_item)); final CheckBox ch = ((CheckBox) v.findViewById(R.id.check_local_index));
ch.setVisibility(View.VISIBLE); ch.setVisibility(View.VISIBLE);
v.findViewById(R.id.toggle_item).setVisibility(View.GONE); v.findViewById(R.id.toggle_item).setVisibility(View.GONE);
ch.setOnCheckedChangeListener(null); ch.setOnCheckedChangeListener(null);

View file

@ -832,12 +832,10 @@ public class MapContextMenu extends MenuTitleController implements StateChangedL
} }
public void buttonWaypointPressed() { public void buttonWaypointPressed() {
if (object != null && object instanceof MapMarker) { MapMarker marker = getMapMarker();
if (marker != null) {
RenameMarkerBottomSheetDialogFragment RenameMarkerBottomSheetDialogFragment
.showInstance(mapActivity.getSupportFragmentManager(), (MapMarker) object); .showInstance(mapActivity.getSupportFragmentManager(), marker);
} else {
if (pointDescription.isDestination()) {
mapActivity.getMapActions().editWaypoints();
} else if (settings.USE_MAP_MARKERS.get()) { } else if (settings.USE_MAP_MARKERS.get()) {
if (pointDescription.isMapMarker()) { if (pointDescription.isMapMarker()) {
hide(); hide();
@ -856,10 +854,21 @@ public class MapContextMenu extends MenuTitleController implements StateChangedL
mapActivity.getMapActions().addAsTarget(latLon.getLatitude(), latLon.getLongitude(), mapActivity.getMapActions().addAsTarget(latLon.getLatitude(), latLon.getLongitude(),
getPointDescriptionForTarget()); getPointDescriptionForTarget());
} }
}
close(); close();
} }
@Nullable
private MapMarker getMapMarker() {
Object correspondingObj = menuController.getCorrespondingMapObject();
if (correspondingObj != null && correspondingObj instanceof MapMarker) {
return (MapMarker) correspondingObj;
}
if (object != null && object instanceof MapMarker) {
return (MapMarker) object;
}
return null;
}
public void buttonFavoritePressed() { public void buttonFavoritePressed() {
if (object != null && object instanceof FavouritePoint) { if (object != null && object instanceof FavouritePoint) {

View file

@ -239,6 +239,10 @@ public abstract class MenuController extends BaseMenuController implements Colla
protected abstract Object getObject(); protected abstract Object getObject();
protected Object getCorrespondingMapObject() {
return null;
}
public boolean isActive() { public boolean isActive() {
return active; return active;
} }

View file

@ -93,8 +93,8 @@ public class AmenityMenuController extends MenuController {
} }
@Override @Override
public boolean isWaypointButtonEnabled() { protected Object getCorrespondingMapObject() {
return marker == null; return marker;
} }
@Override @Override

View file

@ -1,17 +1,27 @@
package net.osmand.plus.mapcontextmenu.other; package net.osmand.plus.mapcontextmenu.other;
import android.app.Activity;
import android.content.Context;
import android.os.Build; import android.os.Build;
import android.os.Bundle; import android.os.Bundle;
import android.support.annotation.Nullable; import android.support.annotation.Nullable;
import android.support.v4.app.Fragment; import android.support.v4.app.Fragment;
import android.support.v4.content.ContextCompat; import android.support.v4.content.ContextCompat;
import android.view.Gravity;
import android.view.LayoutInflater; import android.view.LayoutInflater;
import android.view.View; import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;
import android.view.ViewTreeObserver; import android.view.ViewTreeObserver;
import android.widget.AbsListView;
import android.widget.FrameLayout;
import android.widget.ImageView;
import android.widget.ListView; import android.widget.ListView;
import android.widget.TextView; import android.widget.TextView;
import com.github.ksoichiro.android.observablescrollview.ObservableListView;
import com.github.ksoichiro.android.observablescrollview.ObservableScrollViewCallbacks;
import com.github.ksoichiro.android.observablescrollview.ScrollState;
import net.osmand.AndroidUtils; import net.osmand.AndroidUtils;
import net.osmand.plus.R; import net.osmand.plus.R;
import net.osmand.plus.activities.MapActivity; import net.osmand.plus.activities.MapActivity;
@ -41,22 +51,103 @@ public class MapMultiSelectionMenuFragment extends Fragment implements MultiSele
AndroidUtils.setBackground(view.getContext(), view, !menu.isLight(), AndroidUtils.setBackground(view.getContext(), view, !menu.isLight(),
R.drawable.multi_selection_menu_bg_light_land, R.drawable.multi_selection_menu_bg_dark_land); R.drawable.multi_selection_menu_bg_light_land, R.drawable.multi_selection_menu_bg_dark_land);
} else { } else {
AndroidUtils.setBackground(view.getContext(), view, !menu.isLight(), AndroidUtils.setBackground(view.getContext(), view.findViewById(R.id.cancel_row), !menu.isLight(),
R.drawable.multi_selection_menu_bg_light, R.drawable.multi_selection_menu_bg_dark); R.color.ctx_menu_bg_light, R.color.ctx_menu_bg_dark);
} }
ListView listView = (ListView) view.findViewById(R.id.list); final ListView listView = (ListView) view.findViewById(R.id.list);
if (menu.isLandscapeLayout() && Build.VERSION.SDK_INT >= 21) { if (menu.isLandscapeLayout() && Build.VERSION.SDK_INT >= 21) {
AndroidUtils.addStatusBarPadding21v(getActivity(), listView); AndroidUtils.addStatusBarPadding21v(getActivity(), listView);
} }
View headerView = inflater.inflate(R.layout.menu_obj_selection_header, listView, false);
headerView.setOnClickListener(null);
listView.addHeaderView(headerView);
listAdapter = createAdapter(); listAdapter = createAdapter();
listAdapter.setListener(this); listAdapter.setListener(this);
listView.setAdapter(listAdapter); listView.setAdapter(listAdapter);
runLayoutListener(); if (!menu.isLandscapeLayout()) {
final Context context = getContext();
FrameLayout paddingView = new FrameLayout(context);
paddingView.setLayoutParams(new AbsListView.LayoutParams(
AbsListView.LayoutParams.MATCH_PARENT, getPaddingViewHeight())
);
paddingView.setClickable(true);
paddingView.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
dismissMenu();
}
});
FrameLayout shadowContainer = new FrameLayout(context);
shadowContainer.setLayoutParams(new FrameLayout.LayoutParams(
FrameLayout.LayoutParams.MATCH_PARENT, FrameLayout.LayoutParams.MATCH_PARENT, Gravity.BOTTOM
));
ImageView shadow = new ImageView(context);
shadow.setImageDrawable(ContextCompat.getDrawable(context, R.drawable.bg_shadow_onmap));
shadow.setLayoutParams(new FrameLayout.LayoutParams(
FrameLayout.LayoutParams.MATCH_PARENT, FrameLayout.LayoutParams.WRAP_CONTENT, Gravity.BOTTOM
));
shadow.setScaleType(ImageView.ScaleType.FIT_XY);
shadowContainer.addView(shadow);
paddingView.addView(shadowContainer);
listView.addHeaderView(paddingView);
view.getViewTreeObserver().addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() {
@Override
public void onGlobalLayout() {
float titleHeight = getResources().getDimension(R.dimen.multi_selection_header_height);
int maxHeight = (int) (titleHeight);
for (int i = 0; i < 3 && i < listAdapter.getCount(); i++) {
View childView = listAdapter.getView(0, null, (ListView) view.findViewById(R.id.list));
childView.measure(View.MeasureSpec.makeMeasureSpec(0, View.MeasureSpec.UNSPECIFIED),
View.MeasureSpec.makeMeasureSpec(0, View.MeasureSpec.UNSPECIFIED));
maxHeight += childView.getMeasuredHeight();
}
listView.setSelectionFromTop(0, -maxHeight);
ViewTreeObserver obs = view.getViewTreeObserver();
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {
obs.removeOnGlobalLayoutListener(this);
} else {
obs.removeGlobalOnLayoutListener(this);
}
}
});
((ObservableListView) listView).setScrollViewCallbacks(new ObservableScrollViewCallbacks() {
boolean initialScroll = true;
int minHeight = getResources().getDimensionPixelSize(R.dimen.multi_selection_header_height)
+ getResources().getDimensionPixelSize(R.dimen.list_item_height);
@Override
public void onScrollChanged(int scrollY, boolean firstScroll, boolean dragging) {
if (scrollY <= minHeight && !initialScroll) {
dismissMenu();
}
}
@Override
public void onDownMotionEvent() {
initialScroll = false;
}
@Override
public void onUpOrCancelMotionEvent(ScrollState scrollState) {
}
});
}
View headerView = inflater.inflate(R.layout.menu_obj_selection_header, listView, false);
if (!menu.isLandscapeLayout()) {
AndroidUtils.setBackground(getContext(), headerView, !menu.isLight(), R.color.ctx_menu_bg_light, R.color.ctx_menu_bg_dark);
}
headerView.setOnClickListener(null);
listView.addHeaderView(headerView);
view.findViewById(R.id.divider).setBackgroundColor(ContextCompat.getColor(getContext(), menu.isLight() view.findViewById(R.id.divider).setBackgroundColor(ContextCompat.getColor(getContext(), menu.isLight()
? R.color.multi_selection_menu_divider_light : R.color.multi_selection_menu_divider_dark)); ? R.color.multi_selection_menu_divider_light : R.color.multi_selection_menu_divider_dark));
@ -111,6 +202,12 @@ public class MapMultiSelectionMenuFragment extends Fragment implements MultiSele
menu.getMapActivity().getMapLayers().getMapControlsLayer().setControlsClickable(true); menu.getMapActivity().getMapLayers().getMapControlsLayer().setControlsClickable(true);
} }
private int getPaddingViewHeight() {
Activity activity = getActivity();
return AndroidUtils.getScreenHeight(activity)
- activity.getResources().getDimensionPixelSize(R.dimen.bottom_sheet_cancel_button_height);
}
public static void showInstance(final MapActivity mapActivity) { public static void showInstance(final MapActivity mapActivity) {
if (mapActivity.isActivityDestroyed()) { if (mapActivity.isActivityDestroyed()) {
@ -137,45 +234,6 @@ public class MapMultiSelectionMenuFragment extends Fragment implements MultiSele
.addToBackStack(TAG).commitAllowingStateLoss(); .addToBackStack(TAG).commitAllowingStateLoss();
} }
private void runLayoutListener() {
ViewTreeObserver vto = view.getViewTreeObserver();
vto.addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() {
@Override
public void onGlobalLayout() {
if (!menu.isLandscapeLayout() && listAdapter.getCount() > 3) {
View contentView = view.findViewById(R.id.content);
float headerHeight = contentView.getResources().getDimension(R.dimen.multi_selection_header_height);
float cancelRowHeight = contentView.getResources().getDimension(R.dimen.bottom_sheet_cancel_button_height);
int maxHeight = (int) (headerHeight + cancelRowHeight);
for (int i = 0; i < 3; i++) {
View childView = listAdapter.getView(0, null, (ListView) contentView.findViewById(R.id.list));
childView.measure(View.MeasureSpec.makeMeasureSpec(0, View.MeasureSpec.UNSPECIFIED),
View.MeasureSpec.makeMeasureSpec(0, View.MeasureSpec.UNSPECIFIED));
maxHeight += childView.getMeasuredHeight();
}
int height = contentView.getHeight();
if (height > maxHeight) {
ViewGroup.LayoutParams lp = contentView.getLayoutParams();
lp.height = maxHeight;
contentView.setLayoutParams(lp);
contentView.requestLayout();
}
}
ViewTreeObserver obs = view.getViewTreeObserver();
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {
obs.removeOnGlobalLayoutListener(this);
} else {
obs.removeGlobalOnLayoutListener(this);
}
}
});
}
private MultiSelectionArrayAdapter createAdapter() { private MultiSelectionArrayAdapter createAdapter() {
final List<MenuObject> items = new LinkedList<>(menu.getObjects()); final List<MenuObject> items = new LinkedList<>(menu.getObjects());
return new MultiSelectionArrayAdapter(menu, R.layout.menu_obj_list_item, items); return new MultiSelectionArrayAdapter(menu, R.layout.menu_obj_list_item, items);

View file

@ -38,6 +38,10 @@ public class MultiSelectionArrayAdapter extends ArrayAdapter<MapMultiSelectionMe
} }
final MapMultiSelectionMenu.MenuObject item = getItem(position); final MapMultiSelectionMenu.MenuObject item = getItem(position);
if (item != null) { if (item != null) {
if (!menu.isLandscapeLayout()) {
AndroidUtils.setBackground(convertView.getContext(), convertView, !menu.isLight(),
R.color.ctx_menu_bg_light, R.color.ctx_menu_bg_dark);
}
convertView.setOnClickListener(new View.OnClickListener() { convertView.setOnClickListener(new View.OnClickListener() {
@Override @Override
public void onClick(View view) { public void onClick(View view) {

View file

@ -364,10 +364,16 @@ public class GPXLayer extends OsmandMapLayer implements ContextMenuLayer.IContex
List<WptPt> fullObjects = new ArrayList<>(); List<WptPt> fullObjects = new ArrayList<>();
@ColorInt @ColorInt
int fileColor = getFileColor(g); int fileColor = getFileColor(g);
boolean synced = isSynced(g);
for (WptPt o : pts) { for (WptPt o : pts) {
if (o.lat >= latLonBounds.bottom && o.lat <= latLonBounds.top if (o.lat >= latLonBounds.bottom && o.lat <= latLonBounds.top
&& o.lon >= latLonBounds.left && o.lon <= latLonBounds.right && o.lon >= latLonBounds.left && o.lon <= latLonBounds.right
&& o != contextMenuLayer.getMoveableObject()) { && o != contextMenuLayer.getMoveableObject()) {
if (synced) {
if (mapMarkersHelper.getMapMarker(o) == null) {
continue;
}
}
cache.add(o); cache.add(o);
float x = tileBox.getPixXFromLatLon(o.lat, o.lon); float x = tileBox.getPixXFromLatLon(o.lat, o.lon);
float y = tileBox.getPixYFromLatLon(o.lat, o.lon); float y = tileBox.getPixYFromLatLon(o.lat, o.lon);
@ -385,7 +391,6 @@ public class GPXLayer extends OsmandMapLayer implements ContextMenuLayer.IContex
} }
pointFileMap.put(o, g); pointFileMap.put(o, g);
} }
boolean synced = isSynced(g);
for (WptPt o : fullObjects) { for (WptPt o : fullObjects) {
float x = tileBox.getPixXFromLatLon(o.lat, o.lon); float x = tileBox.getPixXFromLatLon(o.lat, o.lon);
float y = tileBox.getPixYFromLatLon(o.lat, o.lon); float y = tileBox.getPixYFromLatLon(o.lat, o.lon);

View file

@ -215,11 +215,7 @@ public class MapMarkersWidgetsFactory {
return; return;
} }
boolean mapLinkedToLoc = map.getMapViewTrackingUtilities().isMapLinkedToLocation(); Float heading = map.getMapViewTrackingUtilities().getHeading();
Float heading = 0f;
if (mapLinkedToLoc) {
heading = map.getMapViewTrackingUtilities().getHeading();
}
MapMarker marker = markers.get(0); MapMarker marker = markers.get(0);
updateUI(loc, heading, marker, arrowImg, distText, okButton, addressText, true, customLocation != null); updateUI(loc, heading, marker, arrowImg, distText, okButton, addressText, true, customLocation != null);