[android] Correctly hide PP in landscape on 2.3 devices.

This commit is contained in:
Dmitry Yunitsky 2015-07-22 15:26:40 +03:00 committed by Alex Zolotarev
parent 19d2a67ec2
commit 8350ccb9c2
2 changed files with 33 additions and 3 deletions

View file

@ -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();
}
}

View file

@ -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;
}
}