From ba8dfaaeb9193d36bb566b2ec5b75c14febea8b6 Mon Sep 17 00:00:00 2001 From: Alexey Osminin Date: Tue, 1 Dec 2020 18:03:58 +0300 Subject: [PATCH] [android] fix for lost header label 'key information' on PP --- android/res/layout/place_page_details.xml | 2 ++ .../res/layout/place_page_key_info_header.xml | 22 +++++++++++++++++++ .../maps/bookmarks/data/MapObject.java | 5 +++++ .../maps/bookmarks/data/Metadata.java | 5 +++++ .../maps/widget/placepage/PlacePageView.java | 3 +++ 5 files changed, 37 insertions(+) create mode 100644 android/res/layout/place_page_key_info_header.xml diff --git a/android/res/layout/place_page_details.xml b/android/res/layout/place_page_details.xml index e2c7e1ea78..8fa9d94d82 100644 --- a/android/res/layout/place_page_details.xml +++ b/android/res/layout/place_page_details.xml @@ -53,6 +53,8 @@ + + diff --git a/android/res/layout/place_page_key_info_header.xml b/android/res/layout/place_page_key_info_header.xml new file mode 100644 index 0000000000..b682698583 --- /dev/null +++ b/android/res/layout/place_page_key_info_header.xml @@ -0,0 +1,22 @@ + + + + + diff --git a/android/src/com/mapswithme/maps/bookmarks/data/MapObject.java b/android/src/com/mapswithme/maps/bookmarks/data/MapObject.java index 45c77ffb00..2a3c2a3bb4 100644 --- a/android/src/com/mapswithme/maps/bookmarks/data/MapObject.java +++ b/android/src/com/mapswithme/maps/bookmarks/data/MapObject.java @@ -380,6 +380,11 @@ public class MapObject implements PopularityProvider, ShareableInfoProvider, return res == null ? "" : res; } + public boolean hasMetadata() + { + return !mMetadata.isEmpty(); + } + @MapObjectType public int getMapObjectType() { diff --git a/android/src/com/mapswithme/maps/bookmarks/data/Metadata.java b/android/src/com/mapswithme/maps/bookmarks/data/Metadata.java index d9a849824a..90d3e40a90 100644 --- a/android/src/com/mapswithme/maps/bookmarks/data/Metadata.java +++ b/android/src/com/mapswithme/maps/bookmarks/data/Metadata.java @@ -100,6 +100,11 @@ public class Metadata implements Parcelable return mMetadataMap.get(type); } + boolean isEmpty() + { + return mMetadataMap.isEmpty(); + } + @Override public int describeContents() { diff --git a/android/src/com/mapswithme/maps/widget/placepage/PlacePageView.java b/android/src/com/mapswithme/maps/widget/placepage/PlacePageView.java index 7eff57080e..b123bc78e6 100644 --- a/android/src/com/mapswithme/maps/widget/placepage/PlacePageView.java +++ b/android/src/com/mapswithme/maps/widget/placepage/PlacePageView.java @@ -157,6 +157,7 @@ public class PlacePageView extends NestedScrollViewClickFixed private TextView mTvWebsite; private TextView mTvLatlon; private View mOpeningHours; + private View mKeyInfo; private TextView mFullOpeningHours; private TextView mTodayOpeningHours; private View mWifi; @@ -438,6 +439,7 @@ public class PlacePageView extends NestedScrollViewClickFixed LinearLayout latlon = findViewById(R.id.ll__place_latlon); latlon.setOnClickListener(this); mTvLatlon = findViewById(R.id.tv__place_latlon); + mKeyInfo = findViewById(R.id.place_page_key_info); mOpeningHours = findViewById(R.id.ll__place_schedule); mFullOpeningHours = findViewById(R.id.opening_hours); mTodayOpeningHours = findViewById(R.id.today_opening_hours); @@ -1422,6 +1424,7 @@ public class PlacePageView extends NestedScrollViewClickFixed refreshMetadataOrHide(mapObject.getMetadata(Metadata.MetadataType.FMD_WIKIPEDIA), mWiki, null); refreshMetadataOrHide(mapObject.getMetadata(Metadata.MetadataType.FMD_INTERNET), mWifi, null); refreshMetadataOrHide(mapObject.getMetadata(Metadata.MetadataType.FMD_FLATS), mEntrance, mTvEntrance); + UiUtils.showIf(mapObject.hasMetadata(), mKeyInfo); refreshOpeningHours(mapObject); showTaxiOffer(mapObject);