Merge remote-tracking branch 'origin/feature/v1.0.0' into feature/v1.0.0
@@ -1,20 +1,14 @@
|
||||
package com.mogo.module.service.marker;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.Point;
|
||||
import android.os.Handler;
|
||||
import android.os.Looper;
|
||||
import android.text.TextUtils;
|
||||
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;
|
||||
import com.mogo.map.impl.amap.utils.ObjectUtils;
|
||||
import com.mogo.map.marker.IMogoMarker;
|
||||
import com.mogo.map.marker.IMogoMarkerClickListener;
|
||||
import com.mogo.map.marker.MogoMarkerOptions;
|
||||
@@ -35,7 +29,6 @@ import com.mogo.module.service.Utils;
|
||||
import com.mogo.module.service.datamanager.MogoDataHandler;
|
||||
import com.mogo.service.cardmanager.IMogoCardChangedListener;
|
||||
import com.mogo.service.connection.IMogoOnMessageListener;
|
||||
import com.mogo.utils.WindowUtils;
|
||||
import com.mogo.utils.logger.Logger;
|
||||
|
||||
import org.json.JSONArray;
|
||||
@@ -227,47 +220,29 @@ public class MapMarkerManager implements IMogoMarkerClickListener, IMogoOnMessag
|
||||
|
||||
if (alpha == 1) {
|
||||
try {
|
||||
Point point = MarkerServiceHandler.getMapUIController().getLocationPointInScreen(mogoMarker.getPosition());
|
||||
point.y -= WindowUtils.dip2px(mContext, 100f);
|
||||
MogoLatLng targetMogoLatLng = MarkerServiceHandler.getMapUIController().getLocationMogoLatLngInScreen(point);
|
||||
LatLng target = ObjectUtils.fromMogo2(targetMogoLatLng);
|
||||
// 使用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) {
|
||||
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.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);
|
||||
ScaleAnimation animationScale = new ScaleAnimation(0.5f, 1.2f, 0.5f, 1.2f);
|
||||
animationScale.setDuration(500);
|
||||
animationScale.setFillMode(Animation.FILL_MODE_FORWARDS);
|
||||
|
||||
// 设置动画
|
||||
if (mogoMarker instanceof AMapMarkerWrapper) {
|
||||
((AMapMarkerWrapper) mogoMarker).getMarker().setAnimation(animationSet);
|
||||
((AMapMarkerWrapper) mogoMarker).getMarker().setAnimation(animationScale);
|
||||
((AMapMarkerWrapper) mogoMarker).getMarker().startAnimation();
|
||||
}
|
||||
} catch (Exception e) {
|
||||
Logger.e(TAG, e, "error.");
|
||||
}
|
||||
}else{
|
||||
try {
|
||||
// 使用TranslateAnimation,填写一个需要移动的目标点
|
||||
ScaleAnimation animationScale = new ScaleAnimation(1.2f, 1f, 1.2f, 1f);
|
||||
animationScale.setDuration(500);
|
||||
animationScale.setFillMode(Animation.FILL_MODE_FORWARDS);
|
||||
|
||||
// 设置动画
|
||||
if (mogoMarker instanceof AMapMarkerWrapper) {
|
||||
((AMapMarkerWrapper) mogoMarker).getMarker().setAnimation(animationScale);
|
||||
((AMapMarkerWrapper) mogoMarker).getMarker().startAnimation();
|
||||
}
|
||||
} catch (Exception e) {
|
||||
|
||||
|
Before Width: | Height: | Size: 4.4 KiB After Width: | Height: | Size: 4.5 KiB |
|
Before Width: | Height: | Size: 4.1 KiB After Width: | Height: | Size: 4.2 KiB |
|
Before Width: | Height: | Size: 6.6 KiB After Width: | Height: | Size: 6.7 KiB |
|
Before Width: | Height: | Size: 8.3 KiB After Width: | Height: | Size: 8.6 KiB |
|
Before Width: | Height: | Size: 6.5 KiB After Width: | Height: | Size: 6.6 KiB |
|
Before Width: | Height: | Size: 4.4 KiB After Width: | Height: | Size: 4.5 KiB |
|
Before Width: | Height: | Size: 8.4 KiB After Width: | Height: | Size: 8.6 KiB |
@@ -16,8 +16,8 @@
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/ivBg"
|
||||
android:layout_width="@dimen/dp_88"
|
||||
android:layout_height="@dimen/dp_105"
|
||||
android:layout_width="@dimen/dp_90"
|
||||
android:layout_height="@dimen/dp_107"
|
||||
android:layout_gravity="center"
|
||||
android:src="@drawable/bg_map_marker_blue"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
|
||||