forked from organicmaps/organicmaps-tmp
[android] place description webview is added + related ui changes
This commit is contained in:
parent
71204d5bd2
commit
ad5bab2df4
9 changed files with 229 additions and 132 deletions
|
@ -78,7 +78,8 @@ jobject CreateMapObject(JNIEnv * env, std::string const & mwmName, int64_t mwmVe
|
|||
bool shouldShowUGC, bool canBeRated, bool canBeReviewed,
|
||||
jobjectArray jratings, jobject const & hotelType, int priceRate,
|
||||
jobject const & popularity, std::string const & description,
|
||||
RoadWarningMarkType roadWarningMarkType, jobjectArray jrawTypes)
|
||||
RoadWarningMarkType roadWarningMarkType, bool isTopChoice,
|
||||
jobjectArray jrawTypes)
|
||||
{
|
||||
// public MapObject(@NonNull FeatureId featureId, @MapObjectType int mapObjectType, String title,
|
||||
// @Nullable String secondaryTitle, String subtitle, String address,
|
||||
|
@ -88,7 +89,8 @@ jobject CreateMapObject(JNIEnv * env, std::string const & mwmName, int64_t mwmVe
|
|||
// @OpeningMode int openingMode, boolean shouldShowUGC, boolean canBeRated,
|
||||
// boolean canBeReviewed, @Nullable UGC.Rating[] ratings,
|
||||
// @Nullable HotelsFilter.HotelType hotelType,
|
||||
// @PriceFilterView.PriceDef int priceRate)
|
||||
// @PriceFilterView.PriceDef int priceRate
|
||||
// boolean isTopChoice)
|
||||
static jmethodID const ctorId = jni::GetConstructorID(
|
||||
env, g_mapObjectClazz,
|
||||
"(Lcom/mapswithme/maps/bookmarks/data/FeatureId;ILjava/lang/String;Ljava/lang/"
|
||||
|
@ -97,7 +99,7 @@ jobject CreateMapObject(JNIEnv * env, std::string const & mwmName, int64_t mwmVe
|
|||
"Lcom/mapswithme/maps/ads/LocalAdInfo;"
|
||||
"Lcom/mapswithme/maps/routing/RoutePointInfo;IZZZ[Lcom/mapswithme/maps/ugc/UGC$Rating;"
|
||||
"Lcom/mapswithme/maps/search/HotelsFilter$HotelType;ILcom/mapswithme/maps/search/Popularity;"
|
||||
"Ljava/lang/String;I[Ljava/lang/String;)V");
|
||||
"Ljava/lang/String;IZ[Ljava/lang/String;)V");
|
||||
|
||||
//public FeatureId(@NonNull String mwmName, long mwmVersion, int featureIndex)
|
||||
static jmethodID const featureCtorId =
|
||||
|
@ -121,7 +123,8 @@ jobject CreateMapObject(JNIEnv * env, std::string const & mwmName, int64_t mwmVe
|
|||
static_cast<jint>(openingMode), static_cast<jboolean>(shouldShowUGC),
|
||||
static_cast<jboolean>(canBeRated), static_cast<jboolean>(canBeReviewed),
|
||||
jratings, hotelType, priceRate, popularity, jDescription.get(),
|
||||
static_cast<jint>(roadWarningMarkType), jrawTypes);
|
||||
static_cast<jint>(roadWarningMarkType), static_cast<jboolean>(isTopChoice),
|
||||
jrawTypes);
|
||||
|
||||
InjectMetadata(env, g_mapObjectClazz, mapObject, metadata);
|
||||
return mapObject;
|
||||
|
@ -147,7 +150,8 @@ jobject CreateBookmark(JNIEnv *env, const place_page::Info &info,
|
|||
// @Nullable HotelsFilter.HotelType hotelType,
|
||||
// @PriceFilterView.PriceDef int priceRate,
|
||||
// @NotNull com.mapswithme.maps.search.Popularity entity
|
||||
// @NotNull String description)
|
||||
// @NotNull String description
|
||||
// boolean isTopChoice)
|
||||
static jmethodID const ctorId =
|
||||
jni::GetConstructorID(env, g_bookmarkClazz,
|
||||
"(Lcom/mapswithme/maps/bookmarks/data/FeatureId;JJLjava/lang/String;"
|
||||
|
@ -158,7 +162,7 @@ jobject CreateBookmark(JNIEnv *env, const place_page::Info &info,
|
|||
"IZZZ[Lcom/mapswithme/maps/ugc/UGC$Rating;"
|
||||
"Lcom/mapswithme/maps/search/HotelsFilter$HotelType;"
|
||||
"ILcom/mapswithme/maps/search/Popularity;Ljava/lang/String;"
|
||||
"[Ljava/lang/String;)V");
|
||||
"Z[Ljava/lang/String;)V");
|
||||
// public FeatureId(@NonNull String mwmName, long mwmVersion, int featureIndex)
|
||||
static jmethodID const featureCtorId =
|
||||
jni::GetConstructorID(env, g_featureIdClazz, "(Ljava/lang/String;JI)V");
|
||||
|
@ -181,7 +185,7 @@ jobject CreateBookmark(JNIEnv *env, const place_page::Info &info,
|
|||
jAddress.get(), jbanners.get(), jTaxiTypes.get(), jBookingSearchUrl.get(),
|
||||
localAdInfo.get(), routingPointInfo.get(), info.GetOpeningMode(), info.ShouldShowUGC(),
|
||||
info.CanBeRated(), info.CanBeReviewed(), jratings.get(), hotelType.get(), priceRate,
|
||||
popularity.get(), jDescription.get(), jrawTypes.get());
|
||||
popularity.get(), jDescription.get(), info.IsTopChoise(), jrawTypes.get());
|
||||
|
||||
if (info.IsFeature())
|
||||
InjectMetadata(env, g_mapObjectClazz, mapObject, info.GetMetadata());
|
||||
|
@ -276,7 +280,7 @@ jobject CreateMapObject(JNIEnv * env, place_page::Info const & info)
|
|||
info.GetOpeningMode(), info.ShouldShowUGC(), info.CanBeRated(),
|
||||
info.CanBeReviewed(), jratings.get(), hotelType.get(), priceRate,
|
||||
popularity.get(), info.GetDescription(), info.GetRoadType(),
|
||||
jrawTypes.get());
|
||||
info.IsTopChoise(), jrawTypes.get());
|
||||
}
|
||||
|
||||
if (info.HasApiUrl())
|
||||
|
@ -288,7 +292,7 @@ jobject CreateMapObject(JNIEnv * env, place_page::Info const & info)
|
|||
info.GetBookingSearchUrl(), localAdInfo.get(), routingPointInfo.get(), info.GetOpeningMode(),
|
||||
info.ShouldShowUGC(), info.CanBeRated(), info.CanBeReviewed(), jratings.get(),
|
||||
hotelType.get(), priceRate, popularity.get(), info.GetDescription(), info.GetRoadType(),
|
||||
jrawTypes.get());
|
||||
info.IsTopChoise(), jrawTypes.get());
|
||||
}
|
||||
|
||||
return CreateMapObject(
|
||||
|
@ -298,7 +302,7 @@ jobject CreateMapObject(JNIEnv * env, place_page::Info const & info)
|
|||
jTaxiTypes.get(), info.GetBookingSearchUrl(), localAdInfo.get(), routingPointInfo.get(),
|
||||
info.GetOpeningMode(), info.ShouldShowUGC(), info.CanBeRated(), info.CanBeReviewed(),
|
||||
jratings.get(), hotelType.get(), priceRate, popularity.get(),
|
||||
info.GetDescription(), info.GetRoadType(), jrawTypes.get());
|
||||
info.GetDescription(), info.GetRoadType(), info.IsTopChoise(), jrawTypes.get());
|
||||
}
|
||||
|
||||
jobjectArray ToBannersArray(JNIEnv * env, std::vector<ads::Banner> const & banners)
|
||||
|
|
34
android/res/layout/place_page_description_header.xml
Normal file
34
android/res/layout/place_page_description_header.xml
Normal file
|
@ -0,0 +1,34 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<RelativeLayout
|
||||
android:id="@+id/pp_description_header_container"
|
||||
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"
|
||||
android:paddingBottom="@dimen/margin_half_plus_eight"
|
||||
android:background="?windowBackgroundForced">
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="@dimen/margin_base"
|
||||
android:ellipsize="end"
|
||||
android:singleLine="true"
|
||||
android:paddingTop="@dimen/margin_quarter_plus"
|
||||
android:paddingBottom="@dimen/margin_quarter"
|
||||
android:text="@string/placepage_place_description"
|
||||
android:layout_toStartOf="@+id/poi_description_logo"
|
||||
android:textAppearance="@style/TextAppearance.MdcTypographyStyles.Subtitle2"
|
||||
android:layout_alignParentStart="true" />
|
||||
<ImageView
|
||||
android:id="@+id/poi_description_logo"
|
||||
android:layout_width="@dimen/content_by_logo_width"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingTop="@dimen/margin_eighth"
|
||||
android:layout_alignParentEnd="true"
|
||||
android:tint="?tintLonelyPlanetLogo"
|
||||
android:layout_marginEnd="@dimen/margin_base"
|
||||
android:scaleType="fitCenter"
|
||||
tools:visibility="visible"
|
||||
android:visibility="invisible"
|
||||
tools:src="@drawable/ic_lp_logo" />
|
||||
</RelativeLayout>
|
|
@ -1,111 +1,113 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<FrameLayout
|
||||
<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">
|
||||
android:layout_height="wrap_content"
|
||||
android:background="?windowBackgroundForced"
|
||||
android:orientation="vertical">
|
||||
|
||||
<include layout="@layout/place_page_fat_shadow"/>
|
||||
|
||||
<include layout="@layout/catalog_promo_container"
|
||||
tools:visibility="gone"/>
|
||||
|
||||
<include
|
||||
android:id="@+id/place_page_promo_divider"
|
||||
layout="@layout/divider_horizontal"/>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="?windowBackgroundForced"
|
||||
android:background="?ppBackground"
|
||||
android:orientation="vertical">
|
||||
|
||||
<include layout="@layout/place_page_fat_shadow"/>
|
||||
|
||||
<include layout="@layout/catalog_promo_container"/>
|
||||
|
||||
<include
|
||||
layout="@layout/divider_horizontal"/>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="?ppBackground"
|
||||
android:orientation="vertical">
|
||||
|
||||
<include
|
||||
layout="@layout/place_page_bookmark_details"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="@dimen/margin_half"
|
||||
tools:visibility="gone"/>
|
||||
|
||||
<include
|
||||
layout="@layout/place_page_description_layout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="@dimen/margin_half"
|
||||
tools:visibility="gone"/>
|
||||
|
||||
<include layout="@layout/place_page_hotel_gallery"/>
|
||||
|
||||
<include layout="@layout/place_page_hotel_description"/>
|
||||
|
||||
<include layout="@layout/place_page_hotel_facilities"/>
|
||||
|
||||
<include layout="@layout/place_page_hotel_nearby"/>
|
||||
|
||||
<include layout="@layout/place_page_hotel_rating"/>
|
||||
|
||||
<include layout="@layout/place_page_placename"/>
|
||||
|
||||
<include layout="@layout/place_page_opening_hours"/>
|
||||
|
||||
<include layout="@layout/place_page_entrance"/>
|
||||
|
||||
<include layout="@layout/place_page_phone"/>
|
||||
|
||||
<include layout="@layout/place_page_website"/>
|
||||
|
||||
<include layout="@layout/place_page_wiki"/>
|
||||
|
||||
<include layout="@layout/place_page_email"/>
|
||||
|
||||
<include layout="@layout/place_page_wifi"/>
|
||||
|
||||
<include layout="@layout/place_page_operator"/>
|
||||
|
||||
<include layout="@layout/place_page_cuisine"/>
|
||||
|
||||
<include layout="@layout/place_page_latlon"/>
|
||||
|
||||
<include layout="@layout/place_page_more"/>
|
||||
|
||||
<include layout="@layout/place_page_local_ad"/>
|
||||
</LinearLayout>
|
||||
|
||||
<include
|
||||
android:id="@+id/place_page_taxi_shadow"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
layout="@layout/place_page_fat_shadow"/>
|
||||
|
||||
<include
|
||||
android:id="@+id/place_page_taxi_divider"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="@dimen/divider_height"
|
||||
layout="@layout/divider_horizontal"/>
|
||||
|
||||
<include layout="@layout/place_page_taxi"/>
|
||||
|
||||
<include layout="@layout/place_page_ugc"/>
|
||||
|
||||
<include
|
||||
layout="@layout/place_page_fat_shadow"
|
||||
android:id="@+id/edit_top_space"
|
||||
layout="@layout/place_page_description_header"
|
||||
android:layout_width="match_parent"
|
||||
android:visibility="gone"
|
||||
android:layout_height="wrap_content"/>
|
||||
|
||||
<include layout="@layout/place_page_editor"/>
|
||||
|
||||
<include layout="@layout/place_page_add_business"/>
|
||||
|
||||
<include layout="@layout/place_page_add"/>
|
||||
|
||||
<androidx.legacy.widget.Space
|
||||
<include
|
||||
layout="@layout/place_page_bookmark_details"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="@dimen/place_page_buttons_height"/>
|
||||
android:layout_height="wrap_content"
|
||||
tools:visibility="visible"/>
|
||||
|
||||
<include
|
||||
layout="@layout/place_page_description_layout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="@dimen/margin_half"
|
||||
tools:visibility="visible"/>
|
||||
|
||||
<include layout="@layout/place_page_hotel_gallery"/>
|
||||
|
||||
<include layout="@layout/place_page_hotel_description"/>
|
||||
|
||||
<include layout="@layout/place_page_hotel_facilities"/>
|
||||
|
||||
<include layout="@layout/place_page_hotel_nearby"/>
|
||||
|
||||
<include layout="@layout/place_page_hotel_rating"/>
|
||||
|
||||
<include layout="@layout/place_page_placename"/>
|
||||
|
||||
<include layout="@layout/place_page_opening_hours"/>
|
||||
|
||||
<include layout="@layout/place_page_entrance"/>
|
||||
|
||||
<include layout="@layout/place_page_phone"/>
|
||||
|
||||
<include layout="@layout/place_page_website"/>
|
||||
|
||||
<include layout="@layout/place_page_wiki"/>
|
||||
|
||||
<include layout="@layout/place_page_email"/>
|
||||
|
||||
<include layout="@layout/place_page_wifi"/>
|
||||
|
||||
<include layout="@layout/place_page_operator"/>
|
||||
|
||||
<include layout="@layout/place_page_cuisine"/>
|
||||
|
||||
<include layout="@layout/place_page_latlon"/>
|
||||
|
||||
<include layout="@layout/place_page_more"/>
|
||||
|
||||
<include layout="@layout/place_page_local_ad"/>
|
||||
</LinearLayout>
|
||||
</FrameLayout>
|
||||
|
||||
<include
|
||||
android:id="@+id/place_page_taxi_shadow"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
layout="@layout/place_page_fat_shadow"/>
|
||||
|
||||
<include
|
||||
android:id="@+id/place_page_taxi_divider"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="@dimen/divider_height"
|
||||
layout="@layout/divider_horizontal"/>
|
||||
|
||||
<include layout="@layout/place_page_taxi"/>
|
||||
|
||||
<include layout="@layout/place_page_ugc"/>
|
||||
|
||||
<include
|
||||
layout="@layout/place_page_fat_shadow"
|
||||
android:id="@+id/edit_top_space"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"/>
|
||||
|
||||
<include layout="@layout/place_page_editor"/>
|
||||
|
||||
<include layout="@layout/place_page_add_business"/>
|
||||
|
||||
<include layout="@layout/place_page_add"/>
|
||||
|
||||
<androidx.legacy.widget.Space
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="@dimen/place_page_buttons_height"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
|
|
@ -2,9 +2,9 @@
|
|||
<RelativeLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:gravity="center_vertical"
|
||||
android:background="?cardBackground"
|
||||
android:paddingTop="@dimen/margin_base"
|
||||
|
@ -82,7 +82,7 @@
|
|||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="@dimen/margin_quarter"
|
||||
android:lines="1"
|
||||
android:maxLines="2"
|
||||
android:textAppearance="@style/MwmTextAppearance.Body3"
|
||||
android:ellipsize="end"
|
||||
tools:background="#300000F0"
|
||||
|
@ -121,6 +121,7 @@
|
|||
android:text="@string/popular_place"
|
||||
android:visibility="gone"
|
||||
app:drawSmile="false"
|
||||
tools:visibility="visible"
|
||||
app:rating="popular"/>
|
||||
|
||||
<LinearLayout
|
||||
|
@ -171,6 +172,7 @@
|
|||
android:layout_marginLeft="@dimen/margin_half_double_plus"
|
||||
tools:background="#8000FFFF"
|
||||
tools:showIn="@layout/place_page_preview"
|
||||
tools:visibility="gone"
|
||||
layout="@layout/place_page_preview_rating"/>
|
||||
|
||||
<TextView
|
||||
|
@ -207,13 +209,13 @@
|
|||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignWithParentIfMissing="true"
|
||||
android:layout_marginLeft="@dimen/margin_quarter"
|
||||
android:layout_marginStart="@dimen/margin_quarter"
|
||||
android:layout_marginRight="@dimen/margin_quarter"
|
||||
android:layout_marginEnd="@dimen/margin_quarter"
|
||||
android:layout_below="@id/tv__address"
|
||||
android:layout_marginStart="@dimen/margin_quarter"
|
||||
android:layout_marginLeft="@dimen/margin_quarter"
|
||||
android:layout_marginTop="@dimen/margin_half_plus"
|
||||
android:layout_marginEnd="@dimen/margin_quarter"
|
||||
android:layout_marginRight="@dimen/margin_quarter"
|
||||
android:visibility="gone"
|
||||
tools:visibility="visible"/>
|
||||
tools:visibility="visible" />
|
||||
</RelativeLayout>
|
||||
|
||||
|
|
|
@ -48,6 +48,8 @@
|
|||
|
||||
<dimen name="place_page_width">320dp</dimen>
|
||||
<dimen name="place_page_buttons_height">56dp</dimen>
|
||||
<dimen name="place_page_category_logo_height">30dp</dimen>
|
||||
<dimen name="place_page_category_logo_width">60dp</dimen>
|
||||
|
||||
<dimen name="downloader_status_size">40dp</dimen>
|
||||
<dimen name="downloader_ad_icon_size">@dimen/downloader_status_size</dimen>
|
||||
|
|
|
@ -19,7 +19,7 @@ import com.mapswithme.util.UiUtils;
|
|||
public class BookmarkHeaderView extends LinearLayout
|
||||
{
|
||||
|
||||
private static final String AUTHOR_LONELY_PLANET_ID = "28035594-6457-466d-8f6f-8499607df570";
|
||||
public static final String AUTHOR_LONELY_PLANET_ID = "28035594-6457-466d-8f6f-8499607df570";
|
||||
|
||||
@NonNull
|
||||
private ImageView mImageView;
|
||||
|
|
|
@ -35,12 +35,12 @@ public class Bookmark extends MapObject
|
|||
boolean canBeReviewed, @Nullable UGC.Rating[] ratings,
|
||||
@Nullable HotelsFilter.HotelType hotelType, @PriceFilterView.PriceDef int priceRate,
|
||||
@NonNull Popularity popularity, @NonNull String description,
|
||||
@Nullable String[] rawTypes)
|
||||
boolean isTopChoice, @Nullable String[] rawTypes)
|
||||
{
|
||||
super(featureId, BOOKMARK, title, secondaryTitle, subtitle, address, 0, 0, "",
|
||||
banners, reachableByTaxiTypes, bookingSearchUrl, localAdInfo, routePointInfo,
|
||||
openingMode, shouldShowUGC, canBeRated, canBeReviewed, ratings, hotelType, priceRate,
|
||||
popularity, description, RoadWarningMarkType.UNKNOWN.ordinal(), rawTypes);
|
||||
popularity, description, RoadWarningMarkType.UNKNOWN.ordinal(), isTopChoice, rawTypes);
|
||||
|
||||
mCategoryId = categoryId;
|
||||
mBookmarkId = bookmarkId;
|
||||
|
@ -161,4 +161,12 @@ public class Bookmark extends MapObject
|
|||
{
|
||||
return getGe0Url(addName).replaceFirst(Constants.Url.GE0_PREFIX, Constants.Url.HTTP_GE0_PREFIX);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public String getRelatedAuthorId()
|
||||
{
|
||||
BookmarkCategory.Author author = BookmarkManager.INSTANCE.getCategoryById(mCategoryId)
|
||||
.getAuthor();
|
||||
return author != null ? author.getId() : null;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -112,6 +112,7 @@ public class MapObject implements PopularityProvider, ShareableInfoProvider,
|
|||
private final int mPriceRate;
|
||||
@Nullable
|
||||
private List<String> mRawTypes;
|
||||
private boolean mIsTopChoice;
|
||||
|
||||
public MapObject(@NonNull FeatureId featureId, @MapObjectType int mapObjectType, String title,
|
||||
@Nullable String secondaryTitle, String subtitle, String address,
|
||||
|
@ -122,13 +123,13 @@ public class MapObject implements PopularityProvider, ShareableInfoProvider,
|
|||
boolean canBeReviewed, @Nullable UGC.Rating[] ratings,
|
||||
@Nullable HotelsFilter.HotelType hotelType, @PriceFilterView.PriceDef int priceRate,
|
||||
@NonNull Popularity popularity, @NonNull String description, int roadWarningType,
|
||||
@Nullable String[] rawTypes)
|
||||
boolean isTopChoice, @Nullable String[] rawTypes)
|
||||
{
|
||||
this(featureId, mapObjectType, title, secondaryTitle,
|
||||
subtitle, address, lat, lon, new Metadata(), apiId, banners,
|
||||
types, bookingSearchUrl, localAdInfo, routePointInfo, openingMode, shouldShowUGC,
|
||||
canBeRated, canBeReviewed, ratings, hotelType, priceRate, popularity, description,
|
||||
roadWarningType, rawTypes);
|
||||
roadWarningType, isTopChoice, rawTypes);
|
||||
}
|
||||
|
||||
public MapObject(@NonNull FeatureId featureId, @MapObjectType int mapObjectType,
|
||||
|
@ -140,7 +141,8 @@ public class MapObject implements PopularityProvider, ShareableInfoProvider,
|
|||
boolean shouldShowUGC, boolean canBeRated, boolean canBeReviewed,
|
||||
@Nullable UGC.Rating[] ratings, @Nullable HotelsFilter.HotelType hotelType,
|
||||
@PriceFilterView.PriceDef int priceRate, @NonNull Popularity popularity,
|
||||
@NonNull String description, int roadWarningType, @Nullable String[] rawTypes)
|
||||
@NonNull String description, int roadWarningType, boolean isTopChoice,
|
||||
@Nullable String[] rawTypes)
|
||||
{
|
||||
mFeatureId = featureId;
|
||||
mMapObjectType = mapObjectType;
|
||||
|
@ -176,6 +178,7 @@ public class MapObject implements PopularityProvider, ShareableInfoProvider,
|
|||
mRoadWarningMarkType = RoadWarningMarkType.values()[roadWarningType];
|
||||
if (rawTypes != null)
|
||||
mRawTypes = new ArrayList<>(Arrays.asList(rawTypes));
|
||||
mIsTopChoice = isTopChoice;
|
||||
}
|
||||
|
||||
protected MapObject(@MapObjectType int type, Parcel source)
|
||||
|
@ -207,6 +210,7 @@ public class MapObject implements PopularityProvider, ShareableInfoProvider,
|
|||
source.readParcelable(Popularity.class.getClassLoader()),
|
||||
source.readString(),
|
||||
source.readInt(),
|
||||
source.readInt() == 1, //mIsTopChoice
|
||||
null // mRawTypes
|
||||
);
|
||||
|
||||
|
@ -226,7 +230,7 @@ public class MapObject implements PopularityProvider, ShareableInfoProvider,
|
|||
false /* shouldShowUGC */, false /* canBeRated */, false /* canBeReviewed */,
|
||||
null /* ratings */, null /* mHotelType */,
|
||||
PriceFilterView.UNDEFINED, Popularity.defaultInstance(), "",
|
||||
RoadWarningMarkType.UNKNOWN.ordinal(), new String[0]);
|
||||
RoadWarningMarkType.UNKNOWN.ordinal(), false, new String[0]);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
|
@ -416,6 +420,11 @@ public class MapObject implements PopularityProvider, ShareableInfoProvider,
|
|||
return types;
|
||||
}
|
||||
|
||||
public boolean isTopChoice()
|
||||
{
|
||||
return mIsTopChoice;
|
||||
}
|
||||
|
||||
public void setLat(double lat)
|
||||
{
|
||||
mLat = lat;
|
||||
|
@ -556,6 +565,7 @@ public class MapObject implements PopularityProvider, ShareableInfoProvider,
|
|||
dest.writeParcelable(mPopularity, 0);
|
||||
dest.writeString(mDescription);
|
||||
dest.writeInt(getRoadWarningMarkType().ordinal());
|
||||
dest.writeInt(mIsTopChoice ? 1 : 0);
|
||||
// All collections are deserialized AFTER non-collection and primitive type objects,
|
||||
// so collections must be always serialized at the end.
|
||||
dest.writeTypedList(mBanners);
|
||||
|
|
|
@ -39,6 +39,7 @@ import androidx.fragment.app.Fragment;
|
|||
import androidx.recyclerview.widget.GridLayoutManager;
|
||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
import com.bumptech.glide.Glide;
|
||||
import com.mapswithme.maps.Framework;
|
||||
import com.mapswithme.maps.MwmActivity;
|
||||
import com.mapswithme.maps.MwmApplication;
|
||||
|
@ -104,6 +105,7 @@ import java.util.List;
|
|||
import java.util.Locale;
|
||||
import java.util.Objects;
|
||||
|
||||
import static com.mapswithme.maps.bookmarks.BookmarkHeaderView.AUTHOR_LONELY_PLANET_ID;
|
||||
import static com.mapswithme.maps.widget.placepage.PlacePageButtons.Item.BOOKING;
|
||||
import static com.mapswithme.util.statistics.Statistics.EventName.PP_HOTEL_DESCRIPTION_LAND;
|
||||
import static com.mapswithme.util.statistics.Statistics.EventName.PP_HOTEL_FACILITIES;
|
||||
|
@ -130,6 +132,7 @@ public class PlacePageView extends NestedScrollViewClickFixed
|
|||
private static final String PREF_USE_DMS = "use_dms";
|
||||
private static final String DISCOUNT_PREFIX = "-";
|
||||
private static final String DISCOUNT_SUFFIX = "%";
|
||||
private static final String DELIMITER_DOT = " • ";
|
||||
|
||||
private boolean mIsDocked;
|
||||
private boolean mIsFloating;
|
||||
|
@ -204,6 +207,18 @@ public class PlacePageView extends NestedScrollViewClickFixed
|
|||
@NonNull
|
||||
private View mPlaceDescriptionContainer;
|
||||
|
||||
@SuppressWarnings("NotNullFieldNotInitialized")
|
||||
@NonNull
|
||||
private View mPlaceDescriptionHeaderContainer;
|
||||
|
||||
@SuppressWarnings("NotNullFieldNotInitialized")
|
||||
@NonNull
|
||||
private View mPromoDivider;
|
||||
|
||||
@SuppressWarnings("NotNullFieldNotInitialized")
|
||||
@NonNull
|
||||
private ImageView mPlaceDescriptionImage;
|
||||
|
||||
@SuppressWarnings("NullableProblems")
|
||||
@NonNull
|
||||
private TextView mPlaceDescriptionView;
|
||||
|
@ -760,6 +775,9 @@ public class PlacePageView extends NestedScrollViewClickFixed
|
|||
{
|
||||
mPlaceDescriptionContainer = findViewById(R.id.poi_description_container);
|
||||
mPlaceDescriptionView = findViewById(R.id.poi_description);
|
||||
mPlaceDescriptionImage = findViewById(R.id.poi_description_logo);
|
||||
mPromoDivider = findViewById(R.id.place_page_promo_divider);
|
||||
mPlaceDescriptionHeaderContainer = findViewById(R.id.pp_description_header_container);
|
||||
mPlaceDescriptionMoreBtn = findViewById(R.id.more_btn);
|
||||
mPlaceDescriptionMoreBtn.setOnClickListener(v -> showDescriptionScreen());
|
||||
}
|
||||
|
@ -1260,37 +1278,55 @@ public class PlacePageView extends NestedScrollViewClickFixed
|
|||
{
|
||||
if (TextUtils.isEmpty(mapObject.getDescription()))
|
||||
{
|
||||
UiUtils.hide(mPlaceDescriptionContainer);
|
||||
UiUtils.hide(mPlaceDescriptionContainer, mPlaceDescriptionHeaderContainer);
|
||||
return;
|
||||
}
|
||||
|
||||
String authorId = null;
|
||||
if (MapObject.isOfType(MapObject.BOOKMARK, mapObject))
|
||||
{
|
||||
Bookmark bmk = (Bookmark) mapObject;
|
||||
if (!TextUtils.isEmpty(bmk.getBookmarkDescription()))
|
||||
{
|
||||
UiUtils.hide(mPlaceDescriptionContainer);
|
||||
UiUtils.hide(mPlaceDescriptionContainer, mPlaceDescriptionHeaderContainer);
|
||||
return;
|
||||
}
|
||||
authorId = bmk.getRelatedAuthorId();
|
||||
}
|
||||
|
||||
UiUtils.show(mPlaceDescriptionContainer);
|
||||
UiUtils.show(mPlaceDescriptionContainer, mPlaceDescriptionHeaderContainer);
|
||||
UiUtils.hide(mPromoDivider);
|
||||
mPlaceDescriptionView.setText(Html.fromHtml(mapObject.getDescription()));
|
||||
|
||||
if (authorId != null && authorId.equals(AUTHOR_LONELY_PLANET_ID))
|
||||
{
|
||||
UiUtils.show(mPlaceDescriptionImage);
|
||||
mPlaceDescriptionImage.setImageDrawable(getContext().getDrawable(R.drawable.ic_lp_logo));
|
||||
}
|
||||
}
|
||||
|
||||
private void colorizeSubtitle()
|
||||
private void setTextAndColorizeSubtitle(@NonNull MapObject mapObject)
|
||||
{
|
||||
String text = mTvSubtitle.getText().toString();
|
||||
if (TextUtils.isEmpty(text))
|
||||
return;
|
||||
|
||||
int start = text.indexOf("★");
|
||||
if (start > -1)
|
||||
String text = mapObject.getSubtitle();
|
||||
UiUtils.setTextAndHideIfEmpty(mTvSubtitle, text);
|
||||
if (!TextUtils.isEmpty(text))
|
||||
{
|
||||
SpannableStringBuilder sb = new SpannableStringBuilder(text);
|
||||
sb.setSpan(new ForegroundColorSpan(getResources().getColor(R.color.base_yellow)),
|
||||
start, sb.length(), Spanned.SPAN_INCLUSIVE_EXCLUSIVE);
|
||||
if (mapObject.isTopChoice()) {
|
||||
String mustSee = getContext().getResources().getString(R.string.mustsee_title);
|
||||
StringBuilder stringBuilder = new StringBuilder();
|
||||
text = stringBuilder.append(mustSee).append(DELIMITER_DOT).append(text).toString();
|
||||
sb = new SpannableStringBuilder(text);
|
||||
sb.setSpan(new ForegroundColorSpan(getResources().getColor(R.color.base_accent)),
|
||||
0, mustSee.length(), Spanned.SPAN_INCLUSIVE_EXCLUSIVE);
|
||||
}
|
||||
int start = text.indexOf("★");
|
||||
if (start > -1)
|
||||
{
|
||||
sb.setSpan(new ForegroundColorSpan(getResources().getColor(R.color.base_yellow)),
|
||||
start, sb.length(), Spanned.SPAN_INCLUSIVE_EXCLUSIVE);
|
||||
|
||||
}
|
||||
mTvSubtitle.setText(sb);
|
||||
}
|
||||
}
|
||||
|
@ -1303,8 +1339,7 @@ public class PlacePageView extends NestedScrollViewClickFixed
|
|||
UiUtils.showIf(isPopular, mPopularityView);
|
||||
if (mToolbar != null)
|
||||
mToolbar.setTitle(mapObject.getTitle());
|
||||
UiUtils.setTextAndHideIfEmpty(mTvSubtitle, mapObject.getSubtitle());
|
||||
colorizeSubtitle();
|
||||
setTextAndColorizeSubtitle(mapObject);
|
||||
UiUtils.hide(mAvDirection);
|
||||
UiUtils.setTextAndHideIfEmpty(mTvAddress, mapObject.getAddress());
|
||||
boolean sponsored = isSponsored();
|
||||
|
|
Loading…
Add table
Reference in a new issue