修复了bug

增加了新鲜事儿的字段
修改了marker动画
This commit is contained in:
董宏宇
2020-02-17 14:23:31 +08:00
parent 47b730c359
commit 4cb2d4de51
2 changed files with 39 additions and 7 deletions

View File

@@ -9,6 +9,8 @@ import android.view.animation.Interpolator;
import com.amap.api.maps.model.LatLng;
import com.amap.api.maps.model.animation.Animation;
import com.amap.api.maps.model.animation.AnimationSet;
import com.amap.api.maps.model.animation.ScaleAnimation;
import com.amap.api.maps.model.animation.TranslateAnimation;
import com.mogo.map.MogoLatLng;
import com.mogo.map.impl.amap.marker.AMapMarkerWrapper;
@@ -229,9 +231,12 @@ public class MapMarkerManager implements IMogoMarkerClickListener, IMogoOnMessag
point.y -= WindowUtils.dip2px(mContext, 100f);
MogoLatLng targetMogoLatLng = MarkerServiceHandler.getMapUIController().getLocationMogoLatLngInScreen(point);
LatLng target = ObjectUtils.fromMogo2(targetMogoLatLng);
//使用TranslateAnimation,填写一个需要移动的目标点
Animation animation = new TranslateAnimation(target);
animation.setInterpolator(new Interpolator() {
// 使用TranslateAnimation,填写一个需要移动的目标点
AnimationSet animationSet = new AnimationSet(true);
Animation animationTranslate = new TranslateAnimation(target);
Animation animationScale = new ScaleAnimation(0.5f,2.5f,0.5f,2.5f);
animationScale.setInterpolator(new Interpolator() {
@Override
public float getInterpolation(float input) {
if (input <= 0.5) {
@@ -241,11 +246,28 @@ public class MapMarkerManager implements IMogoMarkerClickListener, IMogoOnMessag
}
}
});
//整个移动所需要的时间
animation.setDuration(1000);
//设置动画
animationSet.setInterpolator(new Interpolator() {
@Override
public float getInterpolation(float input) {
if (input <= 0.5) {
return (float) (0.5f - 2.0 * (0.5 - input) * (0.5 - input));
} else {
return (float) (0.5f - Math.sqrt((double) ((input - 0.5f) * (1.5f - input))));
}
}
});
// 整个移动所需要的时间
animationSet.setDuration(1000);
// 添加动画集合
animationSet.addAnimation(animationTranslate);
animationSet.addAnimation(animationScale);
// 设置动画
if (mogoMarker instanceof AMapMarkerWrapper) {
((AMapMarkerWrapper) mogoMarker).getMarker().setAnimation(animation);
((AMapMarkerWrapper) mogoMarker).getMarker().setAnimation(animationSet);
((AMapMarkerWrapper) mogoMarker).getMarker().startAnimation();
}
} catch (Exception e) {