diff --git a/modules/mogo-module-smp/src/main/java/com/mogo/module/small/map/SmallMapDirectionView.java b/modules/mogo-module-smp/src/main/java/com/mogo/module/small/map/SmallMapDirectionView.java
index 4732079e66..e30a9f5bb7 100644
--- a/modules/mogo-module-smp/src/main/java/com/mogo/module/small/map/SmallMapDirectionView.java
+++ b/modules/mogo-module-smp/src/main/java/com/mogo/module/small/map/SmallMapDirectionView.java
@@ -6,7 +6,8 @@ import android.location.Location;
import android.util.AttributeSet;
import android.view.LayoutInflater;
import android.view.MotionEvent;
-import android.view.View;
+import android.view.animation.LinearInterpolator;
+import android.widget.ImageView;
import android.widget.RelativeLayout;
import androidx.annotation.Nullable;
@@ -26,6 +27,7 @@ import com.mogo.map.MogoLatLng;
import com.mogo.map.navi.IMogoCarLocationChangedListener2;
import com.mogo.module.common.MogoApisHandler;
import com.mogo.module.common.view.RoundLayout;
+import com.mogo.module.small.map.animation.DirectionRotateAnimation;
import com.mogo.module.small.map.utils.MapAssetStyleUtils;
import com.mogo.module.small.map.view.ISmallMapDirectionView;
import com.mogo.utils.logger.Logger;
@@ -46,6 +48,10 @@ public class SmallMapDirectionView
public static final String MODULE_NAME = "SmallMap";
private RoundLayout rlSmallMapBorder;
+ private ImageView mIvMapBorder;
+ private DirectionRotateAnimation mRotateAnimation;
+ private int lastAngle = 0;
+
private AMapNaviView mAMapNaviView;
private AMap mAMap;
private AMapNavi mAMapNavi;
@@ -69,11 +75,15 @@ public class SmallMapDirectionView
}
private void initView(Context context) {
+ mRotateAnimation = new DirectionRotateAnimation(context, null);
+
LayoutInflater.from(context).inflate(R.layout.module_small_map_view, this);
mAMapNaviView = AbsMogoApplication.getMapNaviView();
rlSmallMapBorder = findViewById(R.id.rlSmallMapBorder);
rlSmallMapBorder.addView(mAMapNaviView);
+ mIvMapBorder = findViewById(R.id.ivMapBorder);
+
initAMapView();
@@ -122,7 +132,7 @@ public class SmallMapDirectionView
public void onCameraChange(CameraPosition cameraPosition) {
if (cameraPosition != null) {
//Log.w("onCameraChange", "cameraPosition=" + cameraPosition.bearing);
- //changeAngle((int) cameraPosition.bearing);
+ changeAngle((int) cameraPosition.bearing);
}
}
@@ -257,4 +267,32 @@ public class SmallMapDirectionView
public void clearPolyline() {
}
+
+ /**
+ * 修改角度
+ *
+ * @param angle 角度 0 - 359度旋转,相对于自身中心位置
+ */
+ public void changeAngle(int angle) {
+ int tempAngle = 360 - angle;
+
+// if (tempAngle <= 180) {
+// tempAngle = tempAngle;
+// } else {
+// tempAngle = -(360 - tempAngle);
+// }
+
+ mRotateAnimation.setFromDegrees(lastAngle);
+ mRotateAnimation.setToDegrees(tempAngle);
+
+ //设置线性插值,可以解决旋转一圈后卡顿问题
+ mRotateAnimation.setInterpolator(new LinearInterpolator());
+ //设置旋转一圈时间
+ mRotateAnimation.setDuration(300);
+ //控件动画结束时是否保持动画最后的状态
+ mRotateAnimation.setFillAfter(true);
+ mIvMapBorder.startAnimation(mRotateAnimation);
+ // 刷新最后一次角度
+ lastAngle = tempAngle;
+ }
}
diff --git a/modules/mogo-module-smp/src/main/res/layout/module_small_map_view.xml b/modules/mogo-module-smp/src/main/res/layout/module_small_map_view.xml
index a01b5d6828..e243671e27 100644
--- a/modules/mogo-module-smp/src/main/res/layout/module_small_map_view.xml
+++ b/modules/mogo-module-smp/src/main/res/layout/module_small_map_view.xml
@@ -10,7 +10,6 @@
android:layout_width="@dimen/module_small_map_view_border_width"
android:layout_height="@dimen/module_small_map_view_border_width"
android:layout_centerInParent="true"
- android:layout_margin="@dimen/module_small_map_padding"
android:background="@drawable/module_small_map_view_border" />
-->
+
+
\ No newline at end of file
diff --git a/modules/mogo-module-smp/src/main/res/values-xhdpi-2560x1440/dimens.xml b/modules/mogo-module-smp/src/main/res/values-xhdpi-2560x1440/dimens.xml
index c25d84eb9d..3c55bfcc33 100644
--- a/modules/mogo-module-smp/src/main/res/values-xhdpi-2560x1440/dimens.xml
+++ b/modules/mogo-module-smp/src/main/res/values-xhdpi-2560x1440/dimens.xml
@@ -2,6 +2,7 @@
40px
400px
+ 550px
360px
\ No newline at end of file
diff --git a/modules/mogo-module-smp/src/main/res/values-xhdpi/dimens.xml b/modules/mogo-module-smp/src/main/res/values-xhdpi/dimens.xml
index 69b891aa2c..1bab67cb10 100644
--- a/modules/mogo-module-smp/src/main/res/values-xhdpi/dimens.xml
+++ b/modules/mogo-module-smp/src/main/res/values-xhdpi/dimens.xml
@@ -2,6 +2,7 @@
30px
288px
+ 450px
260px
\ No newline at end of file