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 d2ffb31959..d0e3d7c747 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 @@ -4,8 +4,7 @@ import android.content.Context; import android.graphics.BitmapFactory; import android.util.AttributeSet; import android.util.Log; -import android.view.animation.LinearInterpolator; -import android.widget.ImageView; +import android.view.MotionEvent; import android.widget.RelativeLayout; import androidx.annotation.Nullable; @@ -14,16 +13,13 @@ import com.amap.api.maps.AMap; import com.amap.api.maps.CameraUpdate; import com.amap.api.maps.CameraUpdateFactory; import com.amap.api.maps.UiSettings; -import com.amap.api.maps.model.CameraPosition; import com.amap.api.navi.AMapNaviView; import com.amap.api.navi.AMapNaviViewOptions; import com.mogo.commons.AbsMogoApplication; -import com.mogo.map.uicontroller.EnumMapUI; import com.mogo.module.common.MogoApisHandler; import com.mogo.module.small.map.animation.DirectionRotateAnimation; import com.mogo.utils.FileUtils; -import java.io.File; import java.io.IOException; /** @@ -35,7 +31,6 @@ import java.io.IOException; public class SmallMapDirectionView extends RelativeLayout { private String styleFilePath = "/mnt/sdcard/amap/small_map_style.data"; - private ImageView mIvMapBorder; private AMapNaviView mAMapNaviView; private DirectionRotateAnimation mRotateAnimation; private int lastAngle = 0; @@ -62,7 +57,6 @@ public class SmallMapDirectionView extends RelativeLayout { mRotateAnimation = new DirectionRotateAnimation(context, null); AbsMogoApplication.getLayoutInflaterNoSkin().inflate(R.layout.module_small_map_view, this); - mIvMapBorder = findViewById(R.id.ivMapBorder); mAMapNaviView = findViewById(R.id.aMapNaviView); mAMapNaviView.onCreate(null); @@ -136,7 +130,7 @@ public class SmallMapDirectionView extends RelativeLayout { options.setNaviArrowVisible(false); // 通过路线是否自动置灰,仅支持驾车导航 options.setAfterRouteAutoGray(false); - //options.setZoom(((int) 9)); + options.setZoom(((int) 7)); //options.setPointToCenter(0.7D, 0.5D); // 2D模式 options.setTilt(0); @@ -151,21 +145,6 @@ public class SmallMapDirectionView extends RelativeLayout { CameraUpdate cameraUpdate = CameraUpdateFactory.zoomTo(zoomLevel); aMap.moveCamera(cameraUpdate); - aMap.setOnCameraChangeListener(new AMap.OnCameraChangeListener() { - @Override - public void onCameraChange(CameraPosition cameraPosition) { - if (cameraPosition != null) { - //Log.w("onCameraChange", "cameraPosition=" + cameraPosition.bearing); - changeAngle((int) cameraPosition.bearing); - } - } - - @Override - public void onCameraChangeFinish(CameraPosition cameraPosition) { - - } - }); - aMap.setOnMapLoadedListener(new AMap.OnMapLoadedListener() { @Override @@ -229,46 +208,22 @@ public class SmallMapDirectionView extends RelativeLayout { e.printStackTrace(); } - mIvMapBorder.setOnClickListener( view -> { + setOnClickListener(view -> { MogoApisHandler.getInstance().getApis() .getMapServiceApi() .getMapUIController() .changeMapMode( MogoApisHandler.getInstance() - .getApis() - .getAdasControllerApi() - .getCurrentSkinMode() + .getApis() + .getAdasControllerApi() + .getCurrentSkinMode() ); - } ); + }); } - /** - * 修改角度 - * - * @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; + @Override + public boolean onInterceptTouchEvent(MotionEvent ev) { + return true; } - } 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 dd0630dcfc..693f7da327 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 @@ -2,10 +2,10 @@ + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:padding="@dimen/dp_40" + tools:parentTag="RelativeLayout"> - - \ 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 abea40f5d9..45bdd66ca6 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 @@ -8,8 +8,8 @@ 250px 250px - 1525px - 695px + 1620px + 780px 0px 0px