From 8350ccb9c25f8f41e9388f975478779339789554 Mon Sep 17 00:00:00 2001 From: Dmitry Yunitsky Date: Wed, 22 Jul 2015 15:26:40 +0300 Subject: [PATCH] [android] Correctly hide PP in landscape on 2.3 devices. --- .../LeftCompatAnimationController.java | 24 +++++++++++++++++++ .../maps/widget/placepage/PlacePageView.java | 12 +++++++--- 2 files changed, 33 insertions(+), 3 deletions(-) create mode 100644 android/src/com/mapswithme/maps/widget/placepage/LeftCompatAnimationController.java diff --git a/android/src/com/mapswithme/maps/widget/placepage/LeftCompatAnimationController.java b/android/src/com/mapswithme/maps/widget/placepage/LeftCompatAnimationController.java new file mode 100644 index 0000000000..0a948a52b9 --- /dev/null +++ b/android/src/com/mapswithme/maps/widget/placepage/LeftCompatAnimationController.java @@ -0,0 +1,24 @@ +package com.mapswithme.maps.widget.placepage; + +import android.support.annotation.NonNull; + +import com.mapswithme.util.UiUtils; +import com.nineoldandroids.view.ViewHelper; + +public class LeftCompatAnimationController extends LeftFullPlacePageAnimationController +{ + public LeftCompatAnimationController(@NonNull PlacePageView placePage) + { + super(placePage); + } + + @Override + protected void hidePlacePage() + { + ViewHelper.setTranslationX(mPlacePage, -mPlacePage.getWidth()); + mPlacePage.clearAnimation(); // need clear animation to correctly hide view on pre-honeycomb devices. + UiUtils.hide(mPlacePage); + mIsPlacePageVisible = mIsPreviewVisible = false; + notifyVisibilityListener(); + } +} diff --git a/android/src/com/mapswithme/maps/widget/placepage/PlacePageView.java b/android/src/com/mapswithme/maps/widget/placepage/PlacePageView.java index 036bb5b87a..e6ffd04d8a 100644 --- a/android/src/com/mapswithme/maps/widget/placepage/PlacePageView.java +++ b/android/src/com/mapswithme/maps/widget/placepage/PlacePageView.java @@ -229,18 +229,24 @@ public class PlacePageView extends RelativeLayout implements View.OnClickListene // switch with values from "animationType" from attrs.xml switch (animationType) { + // TODO remove hacks with api levels after app will have 11+ SDK case 0: - // TODO remove this hack after 11+ SDK if (Build.VERSION.SDK_INT < Build.VERSION_CODES.HONEYCOMB) mAnimationController = new CompatPlacePageAnimationController(this); else mAnimationController = new BottomPlacePageAnimationController(this); break; case 2: - mAnimationController = new LeftFloatPlacePageAnimationController(this); + if (Build.VERSION.SDK_INT < Build.VERSION_CODES.HONEYCOMB) + mAnimationController = new LeftCompatAnimationController(this); + else + mAnimationController = new LeftFloatPlacePageAnimationController(this); break; case 3: - mAnimationController = new LeftFullPlacePageAnimationController(this); + if (Build.VERSION.SDK_INT < Build.VERSION_CODES.HONEYCOMB) + mAnimationController = new LeftCompatAnimationController(this); + else + mAnimationController = new LeftFullPlacePageAnimationController(this); break; } }