Merge branch 'master' of ssh://github.com/osmandapp/Osmand into js_voice_routing

This commit is contained in:
PaulStets 2018-08-01 17:05:41 +03:00
commit 34aacfbc45
10 changed files with 222 additions and 116 deletions

View file

@ -99,21 +99,21 @@
android:paddingTop="3dp">
<net.osmand.plus.widgets.TextViewEx
android:layout_gravity="center_vertical"
android:id="@+id/nearby_routes_within_text_view"
style="@style/TextAppearance.ContextMenuSubtitle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_marginEnd="@dimen/context_menu_padding_margin_small"
android:layout_marginRight="@dimen/context_menu_padding_margin_small"
android:textSize="@dimen/default_sub_text_size"
osmand:typeface="@string/font_roboto_medium"/>
<GridView
android:layout_gravity="center_vertical"
android:id="@+id/transport_stop_nearby_routes_grid"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:columnWidth="@dimen/context_menu_transport_grid_item_width"
android:horizontalSpacing="@dimen/context_menu_transport_grid_spacing"
android:numColumns="auto_fit"
@ -133,10 +133,10 @@
android:layout_marginTop="@dimen/context_menu_padding_margin_tiny"
android:gravity="top"
android:orientation="horizontal"
android:paddingTop="3dp"
android:paddingBottom="3dp"
android:paddingLeft="@dimen/context_menu_padding_margin_default"
android:paddingRight="@dimen/context_menu_padding_margin_default">
android:paddingRight="@dimen/context_menu_padding_margin_default"
android:paddingTop="3dp">
<LinearLayout
android:id="@+id/additional_info_row"
@ -161,8 +161,8 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="top"
android:paddingTop="1dp"
android:paddingRight="@dimen/context_menu_padding_margin_small"
android:paddingTop="1dp"
tools:src="@drawable/ic_action_opening_hour_16"/>
<TextView
@ -173,6 +173,17 @@
android:layout_marginRight="@dimen/context_menu_padding_margin_small"
tools:text="Closed till 10:00"/>
<TextView
android:id="@+id/info_compass_separator"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="@dimen/context_menu_padding_margin_small"
android:layout_marginRight="@dimen/context_menu_padding_margin_small"
android:text="•"
android:textColor="@color/icon_color"
android:visibility="gone"
tools:visibility="visible"/>
<LinearLayout
android:id="@+id/compass_layout"
android:layout_width="wrap_content"
@ -723,13 +734,13 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="left"
android:scaleType="center"
android:textColor="@color/abc_primary_text_material_dark"
android:textSize="@dimen/abc_text_size_large_material"
android:ellipsize="end"
android:lines="1"
android:maxLines="1"
android:scaleType="center"
android:singleLine="true"
android:textColor="@color/abc_primary_text_material_dark"
android:textSize="@dimen/abc_text_size_large_material"
tools:text="Toolbar"
tools:visibility="visible"/>

View file

@ -1859,7 +1859,7 @@ Proporcia memoro %4$s MB (limito de Android %5$s MB, Dalvik %6$s MB).</string>
<string name="opening_hours">Malfermaj horoj</string>
<string name="opening_changeset">Malfermado de ŝanĝaro…</string>
<string name="closing_changeset">Fermado de ŝanĝaro…</string>
<string name="commiting_node">Enmetado de nodo…</string>
<string name="commiting_node">Alŝutado de nodo…</string>
<string name="loading_poi_obj">Ŝargado de interesejoj…</string>
<string name="auth_failed">Rajtigo malsukcesis</string>
<string name="failed_op">malsukcesis</string>

View file

@ -1837,4 +1837,20 @@
<string name="poi_resource_coal">פחם</string>
<string name="poi_resource_copper">נחושת</string>
<string name="poi_resource_diamond">יהלומים</string>
<string name="poi_climbing_deepwater_yes">חתירה יחידנית במים עמוקים: יש</string>
<string name="poi_climbing_deepwater_no">חתירה יחידנית במים עמוקים: אין</string>
<string name="poi_climbing_length">גובה הטיפוס</string>
<string name="poi_climbing_length_min">גובה טיפוס מזערי</string>
<string name="poi_climbing_length_max">גובה טיפוס מרבי</string>
<string name="poi_climbing_rock_limestone">סלע טיפוס: אבן גיר</string>
<string name="poi_climbing_rock_granite">סלע טיפוס: גרניט</string>
<string name="poi_climbing_rock_sandstone">סלע טיפוס: אבן חול</string>
<string name="poi_climbing_rock_quartzite">סלע טיפוס: קוורציט</string>
<string name="poi_climbing_rock_gneiss">סלע טיפוס: גנייס</string>
<string name="poi_climbing_rock_porphyry">סלע טיפוס: פורפיר</string>
<string name="poi_climbing_quality_solid">איכות טיפוס: אחידה</string>
<string name="poi_climbing_quality_fragile">איכות טיפוס: שבירה</string>
<string name="poi_climbing_bolted_yes">ידיות קבועות: יש</string>
<string name="poi_climbing_bolted_no">ידיות קבועות: אין</string>
</resources>

View file

@ -3068,4 +3068,16 @@
<string name="send_search_query">לשלוח את שאילתת החיפוש?</string>
<string name="increase_search_radius_to">הגדלת רדיוס החיפוש ל־%1$s</string>
<string name="commiting_way">הדרך נשלחת…</string>
<string name="release_3_1">• ניווט: תיקון סרגל ההתקדמות, החלפה מהירה בין נקודות ההתחלה והסיום של המסלול
\n
\n • סמני מפה: תיקון כיבוי/הפעלה של קבוצות, אפשרות להסתיר סמנים במפה
\n
\n • עריכת OSM: היכולת לערוך תגיות לפריטים שאינם נקודה, תיקון תגובות חסרות על הערות, גיבוי עריכות
\n
\n • שיפור פענוח של ויקיפדיה ושל ויקימסע, קבצים מעודכנים כבר זמינים
\n
\n • תפריט הקשר: תיקון צבעי סימול כבישים במצב לילה, תיקון גדלי תפריט נוספים
\n
\n • תיקון תקלות נוספות
\n</string>
</resources>

View file

@ -3140,4 +3140,5 @@
\n • 其他錯誤修復
\n</string>
<string name="increase_search_radius_to">將搜尋半徑增加到 %1$s</string>
<string name="commiting_way">正在提交路線…</string>
</resources>

View file

@ -14,9 +14,10 @@
<string name="release_3_1">
• Navigation: Fix progress bar, fast swapping of the start and end point of the route\n\n
• Map markers: fix turn on/off groups, ability to hide markers from the map\n\n
• OSM Edit: Ability to edit tags for non-point objects, fix missing comments on notes, backup of edits\n\n
• OSM Edit: Ability to edit tags for non-point objects and ways, fix missing comments on notes, backup of edits\n\n
• Improve Wikipedia and Wikivoyage parsing, updated files are already available\n\n
• Context menu: fix transport shields color in the night mode, fix additional menu sizes\n\n
• Boat navigation: support for waterway fairway\n\n
• Other bug fixes\n\n
</string>
<string name="commiting_way">Committing way…</string>

View file

@ -12,6 +12,8 @@ import java.util.Map;
public class AMapPoint implements Parcelable {
public static final String POINT_IMAGE_URI_PARAM = "point_image_uri_param";
public static final String POINT_SPEED_PARAM = "point_speed_param";
public static final String POINT_TYPE_ICON_NAME_PARAM = "point_type_icon_name_param";
private String id;
private String shortName;

View file

@ -1,36 +1,5 @@
package net.osmand.plus.mapcontextmenu;
import static android.util.TypedValue.COMPLEX_UNIT_DIP;
import static net.osmand.plus.mapcontextmenu.MenuBuilder.SHADOW_HEIGHT_TOP_DP;
import java.util.List;
import net.osmand.AndroidUtils;
import net.osmand.data.LatLon;
import net.osmand.data.PointDescription;
import net.osmand.data.QuadPoint;
import net.osmand.data.RotatedTileBox;
import net.osmand.plus.LockableScrollView;
import net.osmand.plus.OsmAndFormatter;
import net.osmand.plus.OsmandApplication;
import net.osmand.plus.OsmandSettings;
import net.osmand.plus.R;
import net.osmand.plus.UiUtilities.UpdateLocationViewCache;
import net.osmand.plus.activities.MapActivity;
import net.osmand.plus.base.BaseOsmAndFragment;
import net.osmand.plus.download.DownloadIndexesThread.DownloadEvents;
import net.osmand.plus.mapcontextmenu.MenuController.MenuState;
import net.osmand.plus.mapcontextmenu.MenuController.TitleButtonController;
import net.osmand.plus.mapcontextmenu.MenuController.TitleProgressController;
import net.osmand.plus.mapcontextmenu.controllers.TransportStopController;
import net.osmand.plus.mapcontextmenu.other.MapRouteInfoMenu;
import net.osmand.plus.transport.TransportStopRoute;
import net.osmand.plus.views.AnimateDraggingMapThread;
import net.osmand.plus.views.OsmandMapTileView;
import net.osmand.plus.views.TransportStopsLayer;
import net.osmand.plus.views.controls.HorizontalSwipeConfirm;
import net.osmand.plus.views.controls.SingleTapConfirm;
import net.osmand.util.Algorithms;
import android.animation.Animator;
import android.animation.AnimatorListenerAdapter;
import android.annotation.TargetApi;
@ -66,6 +35,38 @@ import android.widget.OverScroller;
import android.widget.ProgressBar;
import android.widget.TextView;
import net.osmand.AndroidUtils;
import net.osmand.data.LatLon;
import net.osmand.data.PointDescription;
import net.osmand.data.QuadPoint;
import net.osmand.data.RotatedTileBox;
import net.osmand.plus.LockableScrollView;
import net.osmand.plus.OsmAndFormatter;
import net.osmand.plus.OsmandApplication;
import net.osmand.plus.OsmandSettings;
import net.osmand.plus.R;
import net.osmand.plus.UiUtilities.UpdateLocationViewCache;
import net.osmand.plus.activities.MapActivity;
import net.osmand.plus.base.BaseOsmAndFragment;
import net.osmand.plus.download.DownloadIndexesThread.DownloadEvents;
import net.osmand.plus.mapcontextmenu.MenuController.MenuState;
import net.osmand.plus.mapcontextmenu.MenuController.TitleButtonController;
import net.osmand.plus.mapcontextmenu.MenuController.TitleProgressController;
import net.osmand.plus.mapcontextmenu.controllers.TransportStopController;
import net.osmand.plus.mapcontextmenu.other.MapRouteInfoMenu;
import net.osmand.plus.transport.TransportStopRoute;
import net.osmand.plus.views.AnimateDraggingMapThread;
import net.osmand.plus.views.OsmandMapTileView;
import net.osmand.plus.views.TransportStopsLayer;
import net.osmand.plus.views.controls.HorizontalSwipeConfirm;
import net.osmand.plus.views.controls.SingleTapConfirm;
import net.osmand.util.Algorithms;
import java.util.List;
import static android.util.TypedValue.COMPLEX_UNIT_DIP;
import static net.osmand.plus.mapcontextmenu.MenuBuilder.SHADOW_HEIGHT_TOP_DP;
public class MapContextMenuFragment extends BaseOsmAndFragment implements DownloadEvents {
public static final String TAG = "MapContextMenuFragment";
@ -1478,7 +1479,8 @@ public class MapContextMenuFragment extends BaseOsmAndFragment implements Downlo
TextView additionalInfoTextView = (TextView) view.findViewById(R.id.additional_info_text_view);
CharSequence additionalInfoStr = menu.getAdditionalInfo();
boolean showAdditionalImage = false;
if (!TextUtils.isEmpty(additionalInfoStr)) {
boolean showAdditionalInfo = !TextUtils.isEmpty(additionalInfoStr);
if (showAdditionalInfo) {
int colorId = menu.getAdditionalInfoColor();
int additionalInfoIconRes = menu.getAdditionalInfoIconRes();
if (colorId != 0) {
@ -1495,6 +1497,10 @@ public class MapContextMenuFragment extends BaseOsmAndFragment implements Downlo
additionalInfoTextView.setVisibility(View.GONE);
}
additionalInfoImageView.setVisibility(showAdditionalImage ? View.VISIBLE : View.GONE);
boolean showSeparator = showAdditionalInfo && menu.displayDistanceDirection();
view.findViewById(R.id.info_compass_separator)
.setVisibility(showSeparator ? View.VISIBLE : View.GONE);
}
updateCompassVisibility();
updateAdditionalInfoVisibility();

View file

@ -12,6 +12,8 @@ import android.text.TextUtils;
import net.osmand.aidl.maplayer.point.AMapPoint;
import net.osmand.data.LatLon;
import net.osmand.data.PointDescription;
import net.osmand.plus.OsmAndFormatter;
import net.osmand.plus.OsmandApplication;
import net.osmand.plus.R;
import net.osmand.plus.activities.MapActivity;
import net.osmand.plus.mapcontextmenu.MenuBuilder;
@ -24,6 +26,9 @@ import java.io.InputStream;
public class AMapPointMenuController extends MenuController {
private static final float NO_SPEED = -1;
private static final int NO_ICON = 0;
private AMapPoint point;
private Drawable pointDrawable;
@ -74,11 +79,11 @@ public class AMapPointMenuController extends MenuController {
@Override
public Drawable getSecondLineTypeIcon() {
if (!Algorithms.isEmpty(point.getShortName())) {
return getIcon(R.drawable.ic_small_group);
} else {
return null;
int id = getPointTypeIconId();
if (id != NO_ICON) {
return getIcon(id);
}
return null;
}
@NonNull
@ -102,11 +107,64 @@ public class AMapPointMenuController extends MenuController {
}
}
@Override
public int getAdditionalInfoColorId() {
return R.color.icon_color;
}
@Override
public CharSequence getAdditionalInfoStr() {
MapActivity activity = getMapActivity();
if (activity != null) {
float speed = getPointSpeed();
if (speed != NO_SPEED) {
String formatted = OsmAndFormatter.getFormattedSpeed(speed, activity.getMyApplication());
return activity.getString(R.string.map_widget_speed) + ": " + formatted;
}
}
return super.getAdditionalInfoStr();
}
@Override
public int getAdditionalInfoIconRes() {
if (getPointSpeed() != NO_SPEED) {
return R.drawable.ic_action_speed_16;
}
return super.getAdditionalInfoIconRes();
}
@Override
public boolean needStreetName() {
return false;
}
private int getPointTypeIconId() {
MapActivity activity = getMapActivity();
if (activity != null) {
String iconName = point.getParams().get(AMapPoint.POINT_TYPE_ICON_NAME_PARAM);
if (!TextUtils.isEmpty(iconName)) {
OsmandApplication app = activity.getMyApplication();
return app.getResources().getIdentifier(iconName, "drawable", app.getPackageName());
}
}
if (!TextUtils.isEmpty(point.getShortName())) {
return R.drawable.ic_small_group;
}
return NO_ICON;
}
private float getPointSpeed() {
String speed = point.getParams().get(AMapPoint.POINT_SPEED_PARAM);
if (!TextUtils.isEmpty(speed)) {
try {
return Float.parseFloat(speed);
} catch (NumberFormatException e) {
return NO_SPEED;
}
}
return NO_SPEED;
}
@Nullable
private Drawable getPointDrawable() {
MapActivity mapActivity = getMapActivity();

View file

@ -173,8 +173,7 @@ public class AidlMapLayer extends OsmandMapLayer implements IContextMenuProvider
canvas.drawBitmap(image, null, getDstRect(x, y, smallIconSize / 2), bitmapPaint);
} else if (pointsType == PointsType.BIG_ICON) {
bitmapPaint.setColorFilter(null);
// FIXME: vertical offset
float vOffset = bigIconBg.getHeight() * 0.9f;
float vOffset = bigIconBg.getHeight() * 0.91f;
int imageCenterY = (int) (y - vOffset + bigIconBg.getHeight() / 2);
canvas.drawBitmap(bigIconBg, x - bigIconBg.getWidth() / 2, y - vOffset, bitmapPaint);
canvas.drawBitmap(image, null, getDstRect(x, imageCenterY, bigIconSize / 2), bitmapPaint);