简单调整小地图

This commit is contained in:
董宏宇
2020-12-23 11:48:28 +08:00
parent bf05411d3d
commit e4b574c0e1
3 changed files with 17 additions and 10 deletions

View File

@@ -7,6 +7,7 @@ import android.util.Log;
import android.view.LayoutInflater;
import android.view.animation.LinearInterpolator;
import android.widget.ImageView;
import android.widget.RelativeLayout;
import androidx.annotation.Nullable;
@@ -17,7 +18,6 @@ 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.module.common.view.RoundLayout;
import com.mogo.module.small.map.animation.DirectionRotateAnimation;
import com.mogo.utils.FileUtils;
@@ -30,11 +30,11 @@ import java.io.IOException;
* @author donghongyu
* @date 12/14/20 4:40 PM
*/
public class SmallMapDirectionView extends RoundLayout {
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;
@@ -48,12 +48,14 @@ public class SmallMapDirectionView extends RoundLayout {
public SmallMapDirectionView(Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
initView(context);
try {
initView(context);
} catch (Exception e) {
e.printStackTrace();
}
}
private void initView(Context context) {
String styleFilePath = "/mnt/sdcard/amap/small_map_style.data";
mRotateAnimation = new DirectionRotateAnimation(context, null);
LayoutInflater.from(context).inflate(R.layout.module_small_map_view, this);

View File

@@ -72,8 +72,12 @@ public class SmallMapService extends Service {
*/
private void addSmallMapView() {
Logger.d(TAG, "addSmallMapView");
// 初始化小地图控件
mSmallMapDirectionView = new SmallMapDirectionView(getApplicationContext());
mWindowManagerView = new WindowManagerView.Builder(getApplicationContext())
.contentView(R.layout.module_small_map_direction_view)
.contentView(mSmallMapDirectionView)
.size(
WindowManager.LayoutParams.WRAP_CONTENT,
WindowManager.LayoutParams.WRAP_CONTENT
@@ -85,7 +89,6 @@ public class SmallMapService extends Service {
.gravity(Gravity.TOP | Gravity.LEFT)
.showInWindowManager();
mWindowManagerView.show();
mSmallMapDirectionView = mWindowManagerView.findViewById(R.id.smallMapDirectionView);
}