From f8bd0b218a448cdfbbfaebe19473ecd94dc338aa Mon Sep 17 00:00:00 2001 From: Roman Romanov Date: Thu, 15 Dec 2016 09:56:04 +0400 Subject: [PATCH 1/2] [android] Added place page height compensation view. --- android/res/layout/place_page.xml | 6 ++++++ .../maps/widget/placepage/BannerController.java | 6 ++++-- .../BottomPlacePageAnimationController.java | 1 - .../maps/widget/placepage/PlacePageView.java | 15 ++++++++++++++- 4 files changed, 24 insertions(+), 4 deletions(-) diff --git a/android/res/layout/place_page.xml b/android/res/layout/place_page.xml index f8a6159e3c..76fa88dda7 100644 --- a/android/res/layout/place_page.xml +++ b/android/res/layout/place_page.xml @@ -25,6 +25,12 @@ android:layout_width="match_parent" android:layout_height="wrap_content" android:background="?panel"/> + + diff --git a/android/src/com/mapswithme/maps/widget/placepage/BannerController.java b/android/src/com/mapswithme/maps/widget/placepage/BannerController.java index a7b3298bcf..483b6b2918 100644 --- a/android/src/com/mapswithme/maps/widget/placepage/BannerController.java +++ b/android/src/com/mapswithme/maps/widget/placepage/BannerController.java @@ -128,10 +128,10 @@ final class BannerController implements View.OnClickListener mFrame.setOnClickListener(this); } - void close() + int close() { if (!isShowing() || mBanner == null || !mIsOpened) - return; + return 0; mIsOpened = false; setFrameHeight((int) mCloseFrameHeight); @@ -147,6 +147,8 @@ final class BannerController implements View.OnClickListener if (mTitle != null) mTitle.setMaxLines(1); mFrame.setOnClickListener(null); + + return mFrame.getHeight(); } private void setFrameHeight(int height) diff --git a/android/src/com/mapswithme/maps/widget/placepage/BottomPlacePageAnimationController.java b/android/src/com/mapswithme/maps/widget/placepage/BottomPlacePageAnimationController.java index 3a589511a2..65d98991af 100644 --- a/android/src/com/mapswithme/maps/widget/placepage/BottomPlacePageAnimationController.java +++ b/android/src/com/mapswithme/maps/widget/placepage/BottomPlacePageAnimationController.java @@ -8,7 +8,6 @@ import android.support.annotation.Nullable; import android.support.v4.view.GestureDetectorCompat; import android.support.v7.widget.Toolbar; import android.util.DisplayMetrics; -import android.util.Log; import android.view.GestureDetector; import android.view.MotionEvent; import android.view.View; diff --git a/android/src/com/mapswithme/maps/widget/placepage/PlacePageView.java b/android/src/com/mapswithme/maps/widget/placepage/PlacePageView.java index d3ec0dd98d..ad24fc3644 100644 --- a/android/src/com/mapswithme/maps/widget/placepage/PlacePageView.java +++ b/android/src/com/mapswithme/maps/widget/placepage/PlacePageView.java @@ -168,6 +168,9 @@ public class PlacePageView extends RelativeLayout @Nullable BannerController mBannerController; + @Nullable + View mHeightCompensationView; + // Animations private BaseShadowController mShadowController; private BasePlacePageAnimationController mAnimationController; @@ -332,6 +335,8 @@ public class PlacePageView extends RelativeLayout ViewGroup ppButtons = (ViewGroup) findViewById(R.id.pp__buttons); + mHeightCompensationView = findViewById(R.id.pp__height_compensation); + // TODO: remove this after booking_api.cpp will be done mHotelMore = findViewById(R.id.ll__more); mHotelMore.setOnClickListener(this); @@ -797,14 +802,22 @@ public class PlacePageView extends RelativeLayout if (state == State.HIDDEN) clearBookmarkWebView(); + int heightCompensation = 0; if (mBannerController != null) { if ((state == State.HIDDEN || state == State.PREVIEW) && !UiUtils.isLandscape(getContext())) - mBannerController.close(); + heightCompensation = mBannerController.close(); else mBannerController.open(); } + if (mHeightCompensationView != null) + { + ViewGroup.LayoutParams lp = mHeightCompensationView.getLayoutParams(); + lp.height = heightCompensation; + mHeightCompensationView.setLayoutParams(lp); + } + if (mMapObject != null) mAnimationController.setState(state, mMapObject.getMapObjectType()); From 3f1df0d91985e4a210c16c00ac6e1dc143596c86 Mon Sep 17 00:00:00 2001 From: Roman Romanov Date: Mon, 19 Dec 2016 08:19:14 +0400 Subject: [PATCH 2/2] [android] Review fixes. --- .../maps/widget/placepage/BannerController.java | 9 +++++++-- .../mapswithme/maps/widget/placepage/PlacePageView.java | 7 ++++++- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/android/src/com/mapswithme/maps/widget/placepage/BannerController.java b/android/src/com/mapswithme/maps/widget/placepage/BannerController.java index 483b6b2918..5f70a08e35 100644 --- a/android/src/com/mapswithme/maps/widget/placepage/BannerController.java +++ b/android/src/com/mapswithme/maps/widget/placepage/BannerController.java @@ -128,10 +128,10 @@ final class BannerController implements View.OnClickListener mFrame.setOnClickListener(this); } - int close() + boolean close() { if (!isShowing() || mBanner == null || !mIsOpened) - return 0; + return false; mIsOpened = false; setFrameHeight((int) mCloseFrameHeight); @@ -148,6 +148,11 @@ final class BannerController implements View.OnClickListener mTitle.setMaxLines(1); mFrame.setOnClickListener(null); + return true; + } + + int getLastBannerHeight() + { return mFrame.getHeight(); } diff --git a/android/src/com/mapswithme/maps/widget/placepage/PlacePageView.java b/android/src/com/mapswithme/maps/widget/placepage/PlacePageView.java index ad24fc3644..c91d9fdc10 100644 --- a/android/src/com/mapswithme/maps/widget/placepage/PlacePageView.java +++ b/android/src/com/mapswithme/maps/widget/placepage/PlacePageView.java @@ -806,9 +806,14 @@ public class PlacePageView extends RelativeLayout if (mBannerController != null) { if ((state == State.HIDDEN || state == State.PREVIEW) && !UiUtils.isLandscape(getContext())) - heightCompensation = mBannerController.close(); + { + if (mBannerController.close()) + heightCompensation = mBannerController.getLastBannerHeight(); + } else + { mBannerController.open(); + } } if (mHeightCompensationView != null)