diff --git a/android/res/layout/place_page_preview.xml b/android/res/layout/place_page_preview.xml index fae716242f..88998c9767 100644 --- a/android/res/layout/place_page_preview.xml +++ b/android/res/layout/place_page_preview.xml @@ -87,20 +87,22 @@ android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginEnd="@dimen/margin_base" + android:paddingEnd="@dimen/margin_quarter" + android:paddingStart="@dimen/margin_quarter" android:layout_alignParentEnd="true" android:layout_alignWithParentIfMissing="true" android:layout_alignBottom="@id/title_container" android:background="?selectableItemBackground" android:layout_below="@id/pull_icon_container" - android:gravity="bottom" - android:orientation="horizontal" + android:gravity="center" + android:orientation="vertical" tools:background="#111111F0"> @@ -109,6 +111,7 @@ android:id="@+id/tv__straight_distance" android:layout_width="wrap_content" android:layout_height="wrap_content" + android:layout_gravity="center" android:textAppearance="@style/MwmTextAppearance.PlacePage.Accent" android:textSize="@dimen/text_size_body_3" tools:text="2000 km"/> diff --git a/android/src/app/organicmaps/widget/placepage/PlacePageView.java b/android/src/app/organicmaps/widget/placepage/PlacePageView.java index 63a79d429f..c5059facab 100644 --- a/android/src/app/organicmaps/widget/placepage/PlacePageView.java +++ b/android/src/app/organicmaps/widget/placepage/PlacePageView.java @@ -32,7 +32,6 @@ import androidx.annotation.NonNull; import androidx.annotation.Nullable; import androidx.appcompat.widget.Toolbar; import androidx.core.widget.NestedScrollViewClickFixed; -import androidx.fragment.app.Fragment; import androidx.fragment.app.FragmentManager; import androidx.recyclerview.widget.RecyclerView; import app.organicmaps.Framework; @@ -320,6 +319,12 @@ public class PlacePageView extends NestedScrollViewClickFixed { super.onFinishInflate(); mPreview = findViewById(R.id.pp__preview); + mPreview.addOnLayoutChangeListener((v, left, top, right, bottom, oldLeft, oldTop, oldRight, oldBottom) -> { + final int oldHeight = oldBottom - oldTop; + final int newHeight = bottom - top; + if (oldHeight != newHeight) + mPreview.post(() -> mOnPlacePageContentChangeListener.OnPlacePageContentChange()); + }); mTvTitle = mPreview.findViewById(R.id.tv__title); mTvTitle.setOnLongClickListener(this); mTvTitle.setOnClickListener(this); @@ -332,6 +337,8 @@ public class PlacePageView extends NestedScrollViewClickFixed View directionFrame = mPreview.findViewById(R.id.direction_frame); mTvDistance = mPreview.findViewById(R.id.tv__straight_distance); mAvDirection = mPreview.findViewById(R.id.av__direction); + UiUtils.hide(mTvDistance); + UiUtils.hide(mAvDirection); directionFrame.setOnClickListener(this); mTvAddress = mPreview.findViewById(R.id.tv__address); @@ -875,7 +882,6 @@ public class PlacePageView extends NestedScrollViewClickFixed if (mToolbar != null) mToolbar.setTitle(mapObject.getTitle()); setTextAndColorizeSubtitle(mapObject); - UiUtils.hide(mAvDirection); UiUtils.setTextAndHideIfEmpty(mTvAddress, mapObject.getAddress()); } @@ -1241,6 +1247,7 @@ public class PlacePageView extends NestedScrollViewClickFixed private void refreshMyPosition(@NonNull MapObject mapObject, Location l) { UiUtils.hide(mTvDistance); + UiUtils.hide(mAvDirection); if (l == null) return; @@ -1268,7 +1275,6 @@ public class PlacePageView extends NestedScrollViewClickFixed if (l == null) return; - mTvDistance.setVisibility(View.VISIBLE); double lat = mapObject.getLat(); double lon = mapObject.getLon(); DistanceAndAzimut distanceAndAzimuth = @@ -1303,16 +1309,19 @@ public class PlacePageView extends NestedScrollViewClickFixed final Location location = LocationHelper.INSTANCE.getSavedLocation(); if (location == null) + { + UiUtils.hide(mAvDirection); return; + } final double azimuth = Framework.nativeGetDistanceAndAzimuthFromLatLon(mMapObject.getLat(), mMapObject.getLon(), location.getLatitude(), location.getLongitude(), northAzimuth).getAzimuth(); + UiUtils.showIf(azimuth >= 0, mAvDirection); if (azimuth >= 0) { - UiUtils.show(mAvDirection); mAvDirection.setAzimuth(azimuth); } } diff --git a/android/src/app/organicmaps/widget/placepage/RichPlacePageController.java b/android/src/app/organicmaps/widget/placepage/RichPlacePageController.java index a3bcf73f61..89c618381d 100644 --- a/android/src/app/organicmaps/widget/placepage/RichPlacePageController.java +++ b/android/src/app/organicmaps/widget/placepage/RichPlacePageController.java @@ -251,8 +251,7 @@ public class RichPlacePageController implements PlacePageController, LocationLis { @BottomSheetBehavior.State int currentState = mPlacePageBehavior.getState(); - if (PlacePageUtils.isHiddenState(currentState) || PlacePageUtils.isDraggingState(currentState) - || PlacePageUtils.isSettlingState(currentState)) + if (PlacePageUtils.isHiddenState(currentState)) return; mPlacePage.refreshAzimuth(north);