Fixes
This commit is contained in:
parent
2690378851
commit
1da1b25cbf
12 changed files with 189 additions and 47 deletions
|
@ -33,13 +33,13 @@
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:baselineAligned="false"
|
android:baselineAligned="false"
|
||||||
|
android:layout_marginBottom="16dp"
|
||||||
android:orientation="horizontal">
|
android:orientation="horizontal">
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:id="@+id/context_menu_icon_layout"
|
android:id="@+id/context_menu_icon_layout"
|
||||||
android:layout_width="42dp"
|
android:layout_width="42dp"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent">
|
||||||
android:orientation="horizontal">
|
|
||||||
|
|
||||||
<ImageView
|
<ImageView
|
||||||
android:id="@+id/context_menu_icon_view"
|
android:id="@+id/context_menu_icon_view"
|
||||||
|
@ -53,35 +53,31 @@
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
|
<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:layout_marginLeft="12dp"
|
||||||
|
android:orientation="horizontal">
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginBottom="16dp"
|
|
||||||
android:layout_marginTop="15dp"
|
android:layout_marginTop="15dp"
|
||||||
android:layout_weight="1"
|
android:layout_weight="1">
|
||||||
android:orientation="vertical">
|
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/context_menu_line1"
|
android:id="@+id/context_menu_line1"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginLeft="12dp"
|
|
||||||
android:layout_marginRight="12dp"
|
|
||||||
android:text="@string/search_address_building"
|
android:text="@string/search_address_building"
|
||||||
android:textColor="?android:textColorPrimary"
|
android:textColor="?android:textColorPrimary"
|
||||||
android:textSize="@dimen/default_list_text_size_large"/>
|
android:textSize="@dimen/default_list_text_size_large"/>
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:id="@+id/context_menu_line2"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_marginLeft="12dp"
|
|
||||||
android:layout_marginRight="12dp"
|
|
||||||
android:layout_marginTop="4dp"
|
|
||||||
android:text="@string/other_location"
|
|
||||||
android:textColor="?android:textColorSecondary"
|
|
||||||
android:textSize="@dimen/default_desc_text_size"/>
|
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
|
@ -107,6 +103,44 @@
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginLeft="12dp"
|
||||||
|
android:layout_marginTop="4dp">
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/direction"
|
||||||
|
android:layout_width="@dimen/dashFavDirectionSize"
|
||||||
|
android:layout_height="@dimen/dashFavDirectionSize"
|
||||||
|
android:layout_gravity="center_vertical" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/distance"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginLeft="2dp"
|
||||||
|
android:layout_marginRight="4dp"
|
||||||
|
android:layout_gravity="center_vertical"
|
||||||
|
android:textColor="?android:textColorSecondary"
|
||||||
|
android:textSize="@dimen/default_desc_text_size"
|
||||||
|
tools:text="100500 km" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/context_menu_line2"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_gravity="center_vertical"
|
||||||
|
android:text="@string/other_location"
|
||||||
|
android:textColor="?android:textColorSecondary"
|
||||||
|
android:textSize="@dimen/default_desc_text_size"/>
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:id="@+id/title_button_container"
|
android:id="@+id/title_button_container"
|
||||||
android:layout_width="fill_parent"
|
android:layout_width="fill_parent"
|
||||||
|
@ -116,7 +150,9 @@
|
||||||
android:layout_marginTop="-16dp"
|
android:layout_marginTop="-16dp"
|
||||||
android:paddingBottom="4dp"
|
android:paddingBottom="4dp"
|
||||||
android:clickable="true"
|
android:clickable="true"
|
||||||
android:orientation="horizontal">
|
android:orientation="horizontal"
|
||||||
|
tools:visibility="visible"
|
||||||
|
android:visibility="gone">
|
||||||
|
|
||||||
<Button
|
<Button
|
||||||
android:id="@+id/title_button"
|
android:id="@+id/title_button"
|
||||||
|
@ -133,7 +169,7 @@
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/title_button_right_text"
|
android:id="@+id/title_button_right_text"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="fill_parent"
|
android:layout_height="wrap_content"
|
||||||
android:gravity="center_vertical"
|
android:gravity="center_vertical"
|
||||||
android:clickable="true"
|
android:clickable="true"
|
||||||
android:layout_marginLeft="-4dp"
|
android:layout_marginLeft="-4dp"
|
||||||
|
|
|
@ -61,6 +61,7 @@
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginLeft="2dp"
|
android:layout_marginLeft="2dp"
|
||||||
|
android:layout_gravity="center_vertical"
|
||||||
android:textColor="?android:textColorSecondary"
|
android:textColor="?android:textColorSecondary"
|
||||||
android:textSize="@dimen/default_sub_text_size"
|
android:textSize="@dimen/default_sub_text_size"
|
||||||
tools:text="100500 km" />
|
tools:text="100500 km" />
|
||||||
|
|
|
@ -399,6 +399,10 @@ public class MapContextMenu extends MenuTitleController {
|
||||||
return menuController == null || menuController.buttonsVisible();
|
return menuController == null || menuController.buttonsVisible();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean displayDistanceDirection() {
|
||||||
|
return menuController != null && menuController.displayDistanceDirection();
|
||||||
|
}
|
||||||
|
|
||||||
public void updateData() {
|
public void updateData() {
|
||||||
if (menuController != null) {
|
if (menuController != null) {
|
||||||
menuController.updateData();
|
menuController.updateData();
|
||||||
|
|
|
@ -29,26 +29,31 @@ import android.widget.LinearLayout;
|
||||||
import android.widget.ProgressBar;
|
import android.widget.ProgressBar;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
|
|
||||||
|
import net.osmand.Location;
|
||||||
import net.osmand.data.LatLon;
|
import net.osmand.data.LatLon;
|
||||||
import net.osmand.data.QuadPoint;
|
import net.osmand.data.QuadPoint;
|
||||||
import net.osmand.data.RotatedTileBox;
|
import net.osmand.data.RotatedTileBox;
|
||||||
import net.osmand.plus.IconsCache;
|
import net.osmand.plus.IconsCache;
|
||||||
|
import net.osmand.plus.OsmAndLocationProvider.OsmAndCompassListener;
|
||||||
|
import net.osmand.plus.OsmAndLocationProvider.OsmAndLocationListener;
|
||||||
import net.osmand.plus.OsmandApplication;
|
import net.osmand.plus.OsmandApplication;
|
||||||
import net.osmand.plus.OsmandSettings;
|
import net.osmand.plus.OsmandSettings;
|
||||||
import net.osmand.plus.R;
|
import net.osmand.plus.R;
|
||||||
import net.osmand.plus.activities.MapActivity;
|
import net.osmand.plus.activities.MapActivity;
|
||||||
|
import net.osmand.plus.dashboard.DashLocationFragment;
|
||||||
import net.osmand.plus.download.DownloadIndexesThread.DownloadEvents;
|
import net.osmand.plus.download.DownloadIndexesThread.DownloadEvents;
|
||||||
import net.osmand.plus.mapcontextmenu.MenuController.TitleButtonController;
|
import net.osmand.plus.mapcontextmenu.MenuController.TitleButtonController;
|
||||||
import net.osmand.plus.mapcontextmenu.MenuController.TitleProgressController;
|
import net.osmand.plus.mapcontextmenu.MenuController.TitleProgressController;
|
||||||
import net.osmand.plus.views.AnimateDraggingMapThread;
|
import net.osmand.plus.views.AnimateDraggingMapThread;
|
||||||
import net.osmand.plus.views.OsmandMapTileView;
|
import net.osmand.plus.views.OsmandMapTileView;
|
||||||
|
import net.osmand.util.MapUtils;
|
||||||
|
|
||||||
import static android.util.TypedValue.COMPLEX_UNIT_DIP;
|
import static android.util.TypedValue.COMPLEX_UNIT_DIP;
|
||||||
import static net.osmand.plus.mapcontextmenu.MenuBuilder.SHADOW_HEIGHT_BOTTOM_DP;
|
import static net.osmand.plus.mapcontextmenu.MenuBuilder.SHADOW_HEIGHT_BOTTOM_DP;
|
||||||
import static net.osmand.plus.mapcontextmenu.MenuBuilder.SHADOW_HEIGHT_TOP_DP;
|
import static net.osmand.plus.mapcontextmenu.MenuBuilder.SHADOW_HEIGHT_TOP_DP;
|
||||||
|
|
||||||
|
|
||||||
public class MapContextMenuFragment extends Fragment implements DownloadEvents {
|
public class MapContextMenuFragment extends Fragment implements DownloadEvents, OsmAndLocationListener, OsmAndCompassListener {
|
||||||
|
|
||||||
public static final String TAG = "MapContextMenuFragment";
|
public static final String TAG = "MapContextMenuFragment";
|
||||||
|
|
||||||
|
@ -84,6 +89,10 @@ public class MapContextMenuFragment extends Fragment implements DownloadEvents {
|
||||||
private int origMarkerY;
|
private int origMarkerY;
|
||||||
private boolean customMapCenter;
|
private boolean customMapCenter;
|
||||||
|
|
||||||
|
private LatLon location;
|
||||||
|
private Float heading;
|
||||||
|
private int screenOrientation;
|
||||||
|
|
||||||
private class SingleTapConfirm implements OnGestureListener {
|
private class SingleTapConfirm implements OnGestureListener {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -550,6 +559,26 @@ public class MapContextMenuFragment extends Fragment implements DownloadEvents {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onResume() {
|
||||||
|
super.onResume();
|
||||||
|
screenOrientation = DashLocationFragment.getScreenOrientation(getActivity());
|
||||||
|
if (menu.displayDistanceDirection()) {
|
||||||
|
if (location == null) {
|
||||||
|
location = getMyApplication().getSettings().getLastKnownMapLocation();
|
||||||
|
}
|
||||||
|
getMyApplication().getLocationProvider().addLocationListener(this);
|
||||||
|
getMyApplication().getLocationProvider().addCompassListener(this);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onPause() {
|
||||||
|
getMyApplication().getLocationProvider().removeLocationListener(this);
|
||||||
|
getMyApplication().getLocationProvider().removeCompassListener(this);
|
||||||
|
super.onPause();
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onDestroyView() {
|
public void onDestroyView() {
|
||||||
super.onDestroyView();
|
super.onDestroyView();
|
||||||
|
@ -641,6 +670,15 @@ public class MapContextMenuFragment extends Fragment implements DownloadEvents {
|
||||||
line1.setText(menu.getTitleStr());
|
line1.setText(menu.getTitleStr());
|
||||||
|
|
||||||
// Text line 2
|
// Text line 2
|
||||||
|
TextView distanceText = (TextView) view.findViewById(R.id.distance);
|
||||||
|
ImageView direction = (ImageView) view.findViewById(R.id.direction);
|
||||||
|
if (menu.displayDistanceDirection()) {
|
||||||
|
updateDistanceDirection();
|
||||||
|
} else {
|
||||||
|
direction.setVisibility(View.GONE);
|
||||||
|
distanceText.setVisibility(View.GONE);
|
||||||
|
}
|
||||||
|
|
||||||
TextView line2 = (TextView) view.findViewById(R.id.context_menu_line2);
|
TextView line2 = (TextView) view.findViewById(R.id.context_menu_line2);
|
||||||
line2.setText(menu.getLocationStr());
|
line2.setText(menu.getLocationStr());
|
||||||
Drawable icon = menu.getSecondLineIcon();
|
Drawable icon = menu.getSecondLineIcon();
|
||||||
|
@ -650,6 +688,14 @@ public class MapContextMenuFragment extends Fragment implements DownloadEvents {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void updateDistanceDirection() {
|
||||||
|
TextView distanceText = (TextView) view.findViewById(R.id.distance);
|
||||||
|
ImageView direction = (ImageView) view.findViewById(R.id.direction);
|
||||||
|
boolean mapLinked = getMapActivity().getMapViewTrackingUtilities().isMapLinkedToLocation() && location != null;
|
||||||
|
DashLocationFragment.updateLocationView(!mapLinked, location, heading, direction, distanceText,
|
||||||
|
menu.getLatLon().getLatitude(), menu.getLatLon().getLongitude(), screenOrientation, getMyApplication(), getActivity());
|
||||||
|
}
|
||||||
|
|
||||||
private int getPosY() {
|
private int getPosY() {
|
||||||
return getPosY(false);
|
return getPosY(false);
|
||||||
}
|
}
|
||||||
|
@ -870,5 +916,26 @@ public class MapContextMenuFragment extends Fragment implements DownloadEvents {
|
||||||
getActivity().getWindowManager().getDefaultDisplay().getMetrics(dm);
|
getActivity().getWindowManager().getDefaultDisplay().getMetrics(dm);
|
||||||
return dm.heightPixels;
|
return dm.heightPixels;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void updateLocation(Location location) {
|
||||||
|
if (location != null) {
|
||||||
|
this.location = new LatLon(location.getLatitude(), location.getLongitude());
|
||||||
|
updateDistanceDirection();
|
||||||
|
}
|
||||||
|
; }
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void updateCompassValue(float value) {
|
||||||
|
// 99 in next line used to one-time initalize arrows (with reference vs. fixed-north direction) on non-compass
|
||||||
|
// devices
|
||||||
|
float lastHeading = heading != null ? heading : 99;
|
||||||
|
heading = value;
|
||||||
|
if (Math.abs(MapUtils.degreesDiff(lastHeading, heading)) > 5) {
|
||||||
|
updateDistanceDirection();
|
||||||
|
} else {
|
||||||
|
heading = lastHeading;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -220,7 +220,11 @@ public abstract class MenuController extends BaseMenuController {
|
||||||
return menuType != MenuType.STANDARD;
|
return menuType != MenuType.STANDARD;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean displayStreetNameinTitle() {
|
public boolean displayStreetNameInTitle() {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean displayDistanceDirection() {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -59,8 +59,8 @@ public abstract class MenuTitleController {
|
||||||
return typeStr;
|
return typeStr;
|
||||||
} else {
|
} else {
|
||||||
if (Algorithms.isEmpty(streetStr)) {
|
if (Algorithms.isEmpty(streetStr)) {
|
||||||
return PointDescription.getLocationName(getMapActivity(),
|
return "";//PointDescription.getLocationName(getMapActivity(),
|
||||||
getLatLon().getLatitude(), getLatLon().getLongitude(), true).replaceAll("\n", "");
|
//getLatLon().getLatitude(), getLatLon().getLongitude(), true).replaceAll("\n", "");
|
||||||
} else {
|
} else {
|
||||||
return streetStr;
|
return streetStr;
|
||||||
}
|
}
|
||||||
|
@ -147,7 +147,7 @@ public abstract class MenuTitleController {
|
||||||
|
|
||||||
if (!Algorithms.isEmpty(streetStr)) {
|
if (!Algorithms.isEmpty(streetStr)) {
|
||||||
MenuController menuController = getMenuController();
|
MenuController menuController = getMenuController();
|
||||||
if (menuController == null || menuController.displayStreetNameinTitle()) {
|
if (menuController == null || menuController.displayStreetNameInTitle()) {
|
||||||
nameStr = streetStr;
|
nameStr = streetStr;
|
||||||
addressUnknown = false;
|
addressUnknown = false;
|
||||||
streetStr = "";
|
streetStr = "";
|
||||||
|
|
|
@ -48,6 +48,11 @@ public class FavouritePointMenuController extends MenuController {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean displayDistanceDirection() {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Drawable getLeftIcon() {
|
public Drawable getLeftIcon() {
|
||||||
return FavoriteImageDrawable.getOrCreate(getMapActivity().getMyApplication(), fav.getColor(), true);
|
return FavoriteImageDrawable.getOrCreate(getMapActivity().getMyApplication(), fav.getColor(), true);
|
||||||
|
|
|
@ -31,6 +31,11 @@ public class HistoryMenuController extends MenuController {
|
||||||
return (typeName != null && !typeName.isEmpty());
|
return (typeName != null && !typeName.isEmpty());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean displayDistanceDirection() {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Drawable getLeftIcon() {
|
public Drawable getLeftIcon() {
|
||||||
return getIcon(SearchHistoryFragment.getItemIcon(entry.getName()));
|
return getIcon(SearchHistoryFragment.getItemIcon(entry.getName()));
|
||||||
|
|
|
@ -51,6 +51,11 @@ public class ParkingPositionMenuController extends MenuController {
|
||||||
return !Algorithms.isEmpty(parkingDescription);
|
return !Algorithms.isEmpty(parkingDescription);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean displayDistanceDirection() {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Drawable getLeftIcon() {
|
public Drawable getLeftIcon() {
|
||||||
return getIcon(R.drawable.ic_action_parking_dark, R.color.map_widget_blue, R.color.osmand_orange);
|
return getIcon(R.drawable.ic_action_parking_dark, R.color.map_widget_blue, R.color.osmand_orange);
|
||||||
|
|
|
@ -29,7 +29,12 @@ public class PointDescriptionMenuController extends MenuController {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean displayStreetNameinTitle() {
|
public boolean displayStreetNameInTitle() {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean displayDistanceDirection() {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -46,6 +46,11 @@ public class TargetPointMenuController extends MenuController {
|
||||||
return !Algorithms.isEmpty(getNameStr());
|
return !Algorithms.isEmpty(getNameStr());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean displayDistanceDirection() {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Drawable getLeftIcon() {
|
public Drawable getLeftIcon() {
|
||||||
if (!targetPoint.intermediate) {
|
if (!targetPoint.intermediate) {
|
||||||
|
|
|
@ -47,6 +47,11 @@ public class WptPtMenuController extends MenuController {
|
||||||
return wpt.category != null;
|
return wpt.category != null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean displayDistanceDirection() {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Drawable getLeftIcon() {
|
public Drawable getLeftIcon() {
|
||||||
return FavoriteImageDrawable.getOrCreate(getMapActivity().getMyApplication(), wpt.getColor(), true);
|
return FavoriteImageDrawable.getOrCreate(getMapActivity().getMyApplication(), wpt.getColor(), true);
|
||||||
|
|
Loading…
Reference in a new issue