Travel - vehicle mode
This commit is contained in:
parent
1b30f1f428
commit
4aa877f7f6
6 changed files with 113 additions and 27 deletions
|
@ -179,6 +179,26 @@ public class Amenity extends MapObject {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void addProfileTag(Entry<String, String> e) {
|
||||||
|
if (getAdditionalInfo("profile") == null) {
|
||||||
|
if (e.getKey().startsWith("tag_")) {
|
||||||
|
switch (e.getValue().trim()) {
|
||||||
|
case "bicycle":
|
||||||
|
case "cycling":
|
||||||
|
case "mtb":
|
||||||
|
setAdditionalInfo("profile", "bicycle");
|
||||||
|
break;
|
||||||
|
case "hiking":
|
||||||
|
case "hike":
|
||||||
|
case "walking":
|
||||||
|
case "walk":
|
||||||
|
setAdditionalInfo("profile", "pedestrian");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toStringEn() {
|
public String toStringEn() {
|
||||||
return super.toStringEn() + ": " + type.getKeyName() + ":" + subType;
|
return super.toStringEn() + ": " + type.getKeyName() + ":" + subType;
|
||||||
|
|
|
@ -915,14 +915,18 @@ public class MapPoiTypes {
|
||||||
if (!otag.equals(tag) && !otag.equals("name")) {
|
if (!otag.equals(tag) && !otag.equals("name")) {
|
||||||
PoiType pat = poiTypesByTag.get(otag + "/" + e.getValue());
|
PoiType pat = poiTypesByTag.get(otag + "/" + e.getValue());
|
||||||
if (pat == null) {
|
if (pat == null) {
|
||||||
for(String splValue : e.getValue().split(";")) {
|
for (String splValue : e.getValue().split(";")) {
|
||||||
PoiType ps = poiTypesByTag.get(otag + "/" + splValue.trim());
|
PoiType ps = poiTypesByTag.get(otag + "/" + splValue.trim());
|
||||||
if(ps != null) {
|
if (ps != null) {
|
||||||
a.setAdditionalInfo(ps.getKeyName(), splValue.trim());
|
a.setAdditionalInfo(ps.getKeyName(), splValue.trim());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
pat = poiTypesByTag.get(otag);
|
pat = poiTypesByTag.get(otag);
|
||||||
|
if (pat == null && otag.startsWith("tag_")) {
|
||||||
|
a.addProfileTag(e);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pat != null && pat.isAdditional()) {
|
if (pat != null && pat.isAdditional()) {
|
||||||
a.setAdditionalInfo(pat.getKeyName(), e.getValue());
|
a.setAdditionalInfo(pat.getKeyName(), e.getValue());
|
||||||
}
|
}
|
||||||
|
|
|
@ -139,31 +139,82 @@
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:orientation="vertical"
|
|
||||||
android:paddingTop="@dimen/content_padding_half"
|
android:paddingTop="@dimen/content_padding_half"
|
||||||
android:paddingBottom="@dimen/content_padding_small">
|
android:paddingBottom="@dimen/content_padding_small">
|
||||||
|
|
||||||
<net.osmand.plus.widgets.TextViewEx
|
<LinearLayout
|
||||||
android:id="@+id/user_name"
|
android:id="@+id/user_label"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:background="@drawable/btn_border_bg_light"
|
android:background="?attr/btn_border_bg"
|
||||||
android:gravity="center_vertical"
|
android:layout_marginLeft="@dimen/content_padding_half"
|
||||||
android:ellipsize="end"
|
android:layout_marginStart="@dimen/content_padding_half">
|
||||||
android:maxLines="1"
|
|
||||||
android:paddingTop="@dimen/subHeaderPadding"
|
<androidx.appcompat.widget.AppCompatImageView
|
||||||
android:paddingBottom="@dimen/subHeaderPadding"
|
android:id="@+id/user_icon"
|
||||||
android:paddingLeft="@dimen/bottom_sheet_content_padding_small"
|
android:layout_width="@dimen/poi_icon_size"
|
||||||
android:paddingRight="@dimen/bottom_sheet_content_padding_small"
|
android:layout_height="@dimen/poi_icon_size"
|
||||||
android:textAppearance="@style/TextAppearance.ContextMenuSubtitle"
|
android:layout_gravity="center_vertical"
|
||||||
android:textColor="?attr/active_color_basic"
|
android:layout_marginLeft="@dimen/content_padding_small_half"
|
||||||
android:textSize="@dimen/default_desc_text_size"
|
android:layout_marginStart="@dimen/content_padding_small_half"
|
||||||
osmand:typeface="@string/font_roboto_medium"
|
android:contentDescription="@string/shared_string_icon"
|
||||||
android:drawablePadding="@dimen/content_padding_small_half"
|
tools:src="@drawable/ic_action_user_account_16" />
|
||||||
android:drawableStart="@drawable/ic_action_user_account_16"
|
|
||||||
android:drawableLeft="@drawable/ic_action_user_account_16"
|
<net.osmand.plus.widgets.TextViewEx
|
||||||
tools:drawableTint="?attr/wikivoyage_active_color"
|
android:id="@+id/user_name"
|
||||||
tools:text="Lorem Ipsum" />
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:gravity="center_vertical"
|
||||||
|
android:ellipsize="end"
|
||||||
|
android:maxLines="1"
|
||||||
|
android:paddingTop="@dimen/subHeaderPadding"
|
||||||
|
android:paddingBottom="@dimen/subHeaderPadding"
|
||||||
|
android:paddingLeft="@dimen/content_padding_small_half"
|
||||||
|
android:paddingRight="@dimen/content_padding_small_half"
|
||||||
|
android:textAppearance="@style/TextAppearance.ContextMenuSubtitle"
|
||||||
|
android:textColor="?attr/active_color_basic"
|
||||||
|
android:textSize="@dimen/default_desc_text_size"
|
||||||
|
osmand:typeface="@string/font_roboto_medium"
|
||||||
|
tools:drawableTint="?attr/wikivoyage_active_color"
|
||||||
|
tools:text="@string/mapillary_menu_title_username" />
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:id="@+id/profile_label"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:background="?attr/btn_border_bg"
|
||||||
|
android:layout_marginLeft="@dimen/content_padding_half"
|
||||||
|
android:layout_marginStart="@dimen/content_padding_half">
|
||||||
|
|
||||||
|
<androidx.appcompat.widget.AppCompatImageView
|
||||||
|
android:id="@+id/profile_icon"
|
||||||
|
android:layout_width="@dimen/poi_icon_size"
|
||||||
|
android:layout_height="@dimen/poi_icon_size"
|
||||||
|
android:layout_gravity="center_vertical"
|
||||||
|
android:layout_marginLeft="@dimen/content_padding_small_half"
|
||||||
|
android:layout_marginStart="@dimen/content_padding_small_half"
|
||||||
|
android:contentDescription="@string/shared_string_icon"
|
||||||
|
tools:src="@drawable/ic_action_bicycle_dark" />
|
||||||
|
|
||||||
|
<net.osmand.plus.widgets.TextViewEx
|
||||||
|
android:id="@+id/profile"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:gravity="center_vertical"
|
||||||
|
android:ellipsize="end"
|
||||||
|
android:maxLines="1"
|
||||||
|
android:paddingTop="@dimen/subHeaderPadding"
|
||||||
|
android:paddingBottom="@dimen/subHeaderPadding"
|
||||||
|
android:paddingLeft="@dimen/content_padding_small_half"
|
||||||
|
android:paddingRight="@dimen/content_padding_small_half"
|
||||||
|
android:textAppearance="@style/TextAppearance.ContextMenuSubtitle"
|
||||||
|
android:textColor="?attr/active_color_basic"
|
||||||
|
android:textSize="@dimen/default_desc_text_size"
|
||||||
|
osmand:typeface="@string/font_roboto_medium"
|
||||||
|
tools:drawableTint="?attr/wikivoyage_active_color"
|
||||||
|
tools:text="@string/shared_string_profiles" />
|
||||||
|
</LinearLayout>
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
@ -172,7 +223,6 @@
|
||||||
|
|
||||||
<View
|
<View
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:visibility="invisible"
|
|
||||||
android:layout_height="1dp"
|
android:layout_height="1dp"
|
||||||
android:background="?attr/wikivoyage_card_divider_color" />
|
android:background="?attr/wikivoyage_card_divider_color" />
|
||||||
|
|
||||||
|
|
|
@ -6,8 +6,10 @@ public class TravelGpx extends TravelArticle {
|
||||||
public static final String DIFF_ELE_UP = "diff_ele_up";
|
public static final String DIFF_ELE_UP = "diff_ele_up";
|
||||||
public static final String DIFF_ELE_DOWN = "diff_ele_down";
|
public static final String DIFF_ELE_DOWN = "diff_ele_down";
|
||||||
public static final String USER = "user";
|
public static final String USER = "user";
|
||||||
|
public static final String PROFILE = "profile";
|
||||||
|
|
||||||
public String user;
|
public String user;
|
||||||
|
public String profile;
|
||||||
public float totalDistance = 0;
|
public float totalDistance = 0;
|
||||||
public double diffElevationUp = 0;
|
public double diffElevationUp = 0;
|
||||||
public double diffElevationDown = 0;
|
public double diffElevationDown = 0;
|
||||||
|
|
|
@ -58,6 +58,7 @@ import static net.osmand.plus.helpers.GpxUiHelper.getGpxTitle;
|
||||||
import static net.osmand.plus.wikivoyage.data.TravelGpx.DIFF_ELE_DOWN;
|
import static net.osmand.plus.wikivoyage.data.TravelGpx.DIFF_ELE_DOWN;
|
||||||
import static net.osmand.plus.wikivoyage.data.TravelGpx.DIFF_ELE_UP;
|
import static net.osmand.plus.wikivoyage.data.TravelGpx.DIFF_ELE_UP;
|
||||||
import static net.osmand.plus.wikivoyage.data.TravelGpx.DISTANCE;
|
import static net.osmand.plus.wikivoyage.data.TravelGpx.DISTANCE;
|
||||||
|
import static net.osmand.plus.wikivoyage.data.TravelGpx.PROFILE;
|
||||||
import static net.osmand.plus.wikivoyage.data.TravelGpx.USER;
|
import static net.osmand.plus.wikivoyage.data.TravelGpx.USER;
|
||||||
import static net.osmand.util.Algorithms.capitalizeFirstLetter;
|
import static net.osmand.util.Algorithms.capitalizeFirstLetter;
|
||||||
|
|
||||||
|
@ -203,6 +204,7 @@ public class TravelObfHelper implements TravelHelper {
|
||||||
LOG.debug(e.getMessage(), e);
|
LOG.debug(e.getMessage(), e);
|
||||||
}
|
}
|
||||||
res.user = Algorithms.emptyIfNull(amenity.getTagContent(USER));
|
res.user = Algorithms.emptyIfNull(amenity.getTagContent(USER));
|
||||||
|
res.profile = Algorithms.emptyIfNull(amenity.getTagContent(PROFILE));
|
||||||
articles.put("en", res);
|
articles.put("en", res);
|
||||||
return articles;
|
return articles;
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,16 +2,17 @@ package net.osmand.plus.wikivoyage.explore.travelcards;
|
||||||
|
|
||||||
import android.graphics.drawable.Drawable;
|
import android.graphics.drawable.Drawable;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
|
import android.widget.ImageView;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
|
|
||||||
import androidx.annotation.NonNull;
|
import androidx.annotation.NonNull;
|
||||||
import androidx.fragment.app.FragmentActivity;
|
import androidx.fragment.app.FragmentActivity;
|
||||||
import androidx.recyclerview.widget.RecyclerView;
|
import androidx.recyclerview.widget.RecyclerView;
|
||||||
|
|
||||||
import net.osmand.AndroidUtils;
|
|
||||||
import net.osmand.plus.OsmAndFormatter;
|
import net.osmand.plus.OsmAndFormatter;
|
||||||
import net.osmand.plus.OsmandApplication;
|
import net.osmand.plus.OsmandApplication;
|
||||||
import net.osmand.plus.R;
|
import net.osmand.plus.R;
|
||||||
|
import net.osmand.plus.profiles.ProfileIcons;
|
||||||
import net.osmand.plus.track.TrackMenuFragment;
|
import net.osmand.plus.track.TrackMenuFragment;
|
||||||
import net.osmand.plus.wikivoyage.data.TravelGpx;
|
import net.osmand.plus.wikivoyage.data.TravelGpx;
|
||||||
import net.osmand.plus.wikivoyage.data.TravelLocalDataHelper;
|
import net.osmand.plus.wikivoyage.data.TravelLocalDataHelper;
|
||||||
|
@ -40,10 +41,11 @@ public class TravelGpxCard extends BaseTravelCard {
|
||||||
if (viewHolder instanceof TravelGpxVH) {
|
if (viewHolder instanceof TravelGpxVH) {
|
||||||
final TravelGpxVH holder = (TravelGpxVH) viewHolder;
|
final TravelGpxVH holder = (TravelGpxVH) viewHolder;
|
||||||
holder.title.setText(article.getTitle());
|
holder.title.setText(article.getTitle());
|
||||||
Drawable icon = getActiveIcon(R.drawable.ic_action_user_account_16);
|
holder.userIcon.setImageDrawable(getActiveIcon(R.drawable.ic_action_user_account_16));
|
||||||
holder.user.setCompoundDrawablesWithIntrinsicBounds(icon, null, null, null);
|
|
||||||
holder.user.setText(article.user);
|
holder.user.setText(article.user);
|
||||||
AndroidUtils.setBackground(app, holder.user, nightMode, R.drawable.btn_border_bg_light, R.drawable.btn_border_bg_dark);
|
ProfileIcons profileRes = ProfileIcons.valueOf(article.profile.toUpperCase());
|
||||||
|
holder.profileIcon.setImageDrawable(getActiveIcon(profileRes.getResId()));
|
||||||
|
holder.profile.setText(profileRes.getTitleId());
|
||||||
holder.distance.setText(OsmAndFormatter.getFormattedDistance(article.totalDistance, app));
|
holder.distance.setText(OsmAndFormatter.getFormattedDistance(article.totalDistance, app));
|
||||||
holder.diffElevationUp.setText(OsmAndFormatter.getFormattedAlt(article.diffElevationUp, app));
|
holder.diffElevationUp.setText(OsmAndFormatter.getFormattedAlt(article.diffElevationUp, app));
|
||||||
holder.diffElevationDown.setText(OsmAndFormatter.getFormattedAlt(article.diffElevationDown, app));
|
holder.diffElevationDown.setText(OsmAndFormatter.getFormattedAlt(article.diffElevationDown, app));
|
||||||
|
@ -92,6 +94,9 @@ public class TravelGpxCard extends BaseTravelCard {
|
||||||
|
|
||||||
public final TextView title;
|
public final TextView title;
|
||||||
public final TextView user;
|
public final TextView user;
|
||||||
|
public final ImageView userIcon;
|
||||||
|
public final TextView profile;
|
||||||
|
public final ImageView profileIcon;
|
||||||
public final TextView distance;
|
public final TextView distance;
|
||||||
public final TextView diffElevationUp;
|
public final TextView diffElevationUp;
|
||||||
public final TextView diffElevationDown;
|
public final TextView diffElevationDown;
|
||||||
|
@ -104,6 +109,9 @@ public class TravelGpxCard extends BaseTravelCard {
|
||||||
super(itemView);
|
super(itemView);
|
||||||
title = itemView.findViewById(R.id.title);
|
title = itemView.findViewById(R.id.title);
|
||||||
user = itemView.findViewById(R.id.user_name);
|
user = itemView.findViewById(R.id.user_name);
|
||||||
|
userIcon = itemView.findViewById(R.id.user_icon);
|
||||||
|
profile = itemView.findViewById(R.id.profile);
|
||||||
|
profileIcon = itemView.findViewById(R.id.profile_icon);
|
||||||
distance = itemView.findViewById(R.id.distance);
|
distance = itemView.findViewById(R.id.distance);
|
||||||
diffElevationUp = itemView.findViewById(R.id.diff_ele_up);
|
diffElevationUp = itemView.findViewById(R.id.diff_ele_up);
|
||||||
diffElevationDown = itemView.findViewById(R.id.diff_ele_down);
|
diffElevationDown = itemView.findViewById(R.id.diff_ele_down);
|
||||||
|
|
Loading…
Reference in a new issue