add map angle of view ui
This commit is contained in:
@@ -1,6 +1,10 @@
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="com.zhidao.mogo.module.main.launcher">
|
||||
|
||||
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
|
||||
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
|
||||
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
|
||||
|
||||
<application>
|
||||
<activity
|
||||
android:name=".MainLauncherActivity"
|
||||
|
||||
@@ -1,15 +1,24 @@
|
||||
package com.zhidao.mogo.module.main.launcher;
|
||||
|
||||
import android.Manifest;
|
||||
import android.app.AlertDialog;
|
||||
import android.content.DialogInterface;
|
||||
import android.content.Intent;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.net.Uri;
|
||||
import android.os.Bundle;
|
||||
import android.os.Handler;
|
||||
import android.os.Process;
|
||||
import android.provider.Settings;
|
||||
import android.text.TextUtils;
|
||||
import android.util.Log;
|
||||
import android.view.View;
|
||||
import android.widget.ImageView;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.core.app.ActivityCompat;
|
||||
import androidx.core.content.ContextCompat;
|
||||
|
||||
import com.alibaba.android.arouter.launcher.ARouter;
|
||||
import com.mogo.commons.debug.DebugConfig;
|
||||
@@ -29,6 +38,7 @@ import static com.mogo.module.common.entity.V2XMessageEntity.V2XTypeEnum.ALERT_T
|
||||
import static com.mogo.module.common.entity.V2XMessageEntity.V2XTypeEnum.ALERT_THE_FRONT_CRASH_WARNING_LEFT;
|
||||
import static com.mogo.module.common.entity.V2XMessageEntity.V2XTypeEnum.ALERT_THE_FRONT_CRASH_WARNING_RIGHT;
|
||||
import static com.mogo.module.common.entity.V2XMessageEntity.V2XTypeEnum.ALERT_THE_FRONT_CRASH_WARNING_TOP;
|
||||
import static com.mogo.utils.ProcessUtils.getPackageName;
|
||||
|
||||
/**
|
||||
* 针对作为Launcher的情况,做个性化操作
|
||||
@@ -50,6 +60,7 @@ public class MainLauncherActivity extends MainActivity implements IMogoIntentLis
|
||||
DebugConfig.setNeedRequestUserInfo(true);
|
||||
Log.d(TAG, "onCreate");
|
||||
mServiceApis.getV2XListenerManager().registerIntentListener(MogoReceiver.ACTION_V2X_FRONT_WARNING, this);
|
||||
checkPermission();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -248,4 +259,101 @@ public class MainLauncherActivity extends MainActivity implements IMogoIntentLis
|
||||
mApps.setVisibility(View.VISIBLE);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private boolean isFirst = false;
|
||||
private static final int MY_PERMISSION_REQUEST_CODE = 10000;
|
||||
|
||||
/**
|
||||
* 检查是否有相应的权限
|
||||
*/
|
||||
private void checkPermission() {
|
||||
boolean isAllGranted = checkPermissionAllGranted(
|
||||
new String[]{
|
||||
Manifest.permission.READ_EXTERNAL_STORAGE,
|
||||
Manifest.permission.WRITE_EXTERNAL_STORAGE,
|
||||
Manifest.permission.ACCESS_FINE_LOCATION
|
||||
}
|
||||
);
|
||||
|
||||
if (isAllGranted) {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* 请求权限
|
||||
*/
|
||||
ActivityCompat.requestPermissions(
|
||||
this,
|
||||
new String[]{
|
||||
Manifest.permission.READ_EXTERNAL_STORAGE,
|
||||
Manifest.permission.WRITE_EXTERNAL_STORAGE,
|
||||
Manifest.permission.ACCESS_FINE_LOCATION
|
||||
}, MY_PERMISSION_REQUEST_CODE);
|
||||
}
|
||||
|
||||
/**
|
||||
* 检查是否拥有指定的所有权限
|
||||
*/
|
||||
private boolean checkPermissionAllGranted(String[] permissions) {
|
||||
for (String permission : permissions) {
|
||||
if (ContextCompat.checkSelfPermission(getContext(), permission) != PackageManager.PERMISSION_GRANTED) {
|
||||
// 只要有一个权限没有被授予, 则直接返回 false
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* 申请权限结果返回处理
|
||||
*/
|
||||
@Override
|
||||
public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) {
|
||||
super.onRequestPermissionsResult(requestCode, permissions, grantResults);
|
||||
if (requestCode == MY_PERMISSION_REQUEST_CODE) {
|
||||
boolean isAllGranted = true;
|
||||
// 判断是否所有的权限都已经授予了
|
||||
for (int grant : grantResults) {
|
||||
if (grant != PackageManager.PERMISSION_GRANTED) {
|
||||
isAllGranted = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
Log.d("liyz", "onRequestPermissionsResult isAllGranted = " + isAllGranted);
|
||||
if (isAllGranted) {
|
||||
isFirst = false;
|
||||
} else {
|
||||
// 弹出对话框告诉用户需要权限的原因, 并引导用户去应用权限管理中手动打开权限按钮
|
||||
if (!isFirst) {
|
||||
openAppDetails();
|
||||
isFirst = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 打开APP的详情设置
|
||||
*/
|
||||
private void openAppDetails() {
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(this);
|
||||
builder.setMessage("请在 “应用信息 -> 权限” 中授予权限");
|
||||
builder.setPositiveButton("手动授权", new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
Intent intent = new Intent();
|
||||
intent.setAction(Settings.ACTION_APPLICATION_DETAILS_SETTINGS);
|
||||
intent.addCategory(Intent.CATEGORY_DEFAULT);
|
||||
intent.setData(Uri.parse("package:" + getPackageName()));
|
||||
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||
intent.addFlags(Intent.FLAG_ACTIVITY_NO_HISTORY);
|
||||
intent.addFlags(Intent.FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS);
|
||||
startActivity(intent);
|
||||
}
|
||||
});
|
||||
builder.setNegativeButton("取消", null);
|
||||
builder.show();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -18,6 +18,7 @@ import android.widget.EditText;
|
||||
import android.widget.FrameLayout;
|
||||
import android.widget.ImageButton;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.RadioButton;
|
||||
import android.widget.TextView;
|
||||
|
||||
@@ -184,6 +185,7 @@ public class EntranceFragment extends MvpFragment<EntranceView, EntrancePresente
|
||||
//远景和中景的切换
|
||||
private ImageView mSwitchMapModeImage;
|
||||
private FrameLayout mSwitchMapModeLayout;
|
||||
private TextView mSwitchText;
|
||||
|
||||
/**
|
||||
* 搜索莫模块
|
||||
@@ -376,9 +378,9 @@ public class EntranceFragment extends MvpFragment<EntranceView, EntrancePresente
|
||||
|
||||
mSwitchMapModeLayout = (FrameLayout) findViewById(R.id.module_switch_model_layout);
|
||||
mSwitchMapModeImage = (ImageView) findViewById(R.id.module_switch_model_icon);
|
||||
mSwitchMapModeImage.setOnClickListener(clickListener);
|
||||
mSwitchMapModeLayout.setOnClickListener(clickListener);
|
||||
mSwitchText = (TextView) findViewById(R.id.module_switch_model_text);
|
||||
|
||||
//TODO
|
||||
if (DebugConfig.getCarMachineType() == DebugConfig.CAR_MACHINE_TYPE_LENOVO ) {
|
||||
enterVrMode();
|
||||
}
|
||||
@@ -1367,15 +1369,17 @@ public class EntranceFragment extends MvpFragment<EntranceView, EntrancePresente
|
||||
// show panel
|
||||
debugPanelGroup.setVisibility(View.VISIBLE);
|
||||
}
|
||||
} else if (v.getId() == R.id.module_switch_model_icon) { //切换地图的远近视图
|
||||
} else if (v.getId() == R.id.module_switch_model_layout) { //切换地图的远近视图
|
||||
if (MogoApisHandler.getInstance().getApis().getMapServiceApi().getMapUIController().getCurrentMapVisualAngle().isLongSight()) {
|
||||
MogoApisHandler.getInstance().getApis().getMapServiceApi().getMarkerManager(AbsMogoApplication.getApp()).visibleAllMarkers();
|
||||
MogoApisHandler.getInstance().getApis().getMapServiceApi()
|
||||
.getMapUIController().changeMapVisualAngle(VisualAngleMode.MODE_MEDIUM_SIGHT);
|
||||
mSwitchText.setText(R.string.module_map_model_normal);
|
||||
} else if (MogoApisHandler.getInstance().getApis().getMapServiceApi().getMapUIController().getCurrentMapVisualAngle().isMediumSight()) {
|
||||
MogoApisHandler.getInstance().getApis().getMapServiceApi().getMarkerManager(AbsMogoApplication.getApp()).inVisibleAllMarkers();
|
||||
MogoApisHandler.getInstance().getApis().getMapServiceApi()
|
||||
.getMapUIController().changeMapVisualAngle(VisualAngleMode.MODE_LONG_SIGHT);
|
||||
mSwitchText.setText(R.string.module_map_model_faster);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:shape="rectangle">
|
||||
|
||||
<corners android:radius="26px" />
|
||||
<corners android:radius="60px" />
|
||||
|
||||
<solid android:color="@color/module_switch_map_bg" />
|
||||
|
||||
|
||||
@@ -45,26 +45,45 @@
|
||||
|
||||
</FrameLayout>
|
||||
|
||||
<!--切换地图远近事件-->
|
||||
<!--切换地图远近事件 @dimen/module_switch_map -->
|
||||
<FrameLayout
|
||||
android:id="@+id/module_switch_model_layout"
|
||||
android:layout_width="@dimen/module_switch_map"
|
||||
android:layout_height="@dimen/module_switch_map"
|
||||
android:layout_height="@dimen/module_switch_map_height"
|
||||
android:layout_marginLeft="@dimen/dp_20"
|
||||
android:layout_marginBottom="26px"
|
||||
android:background="@drawable/module_switch_map_bg"
|
||||
android:elevation="@dimen/dp_10"
|
||||
android:padding="@dimen/dp_20"
|
||||
android:visibility="gone"
|
||||
android:background="@drawable/module_switch_map_bg"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintBottom_toBottomOf="parent">
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintLeft_toLeftOf="parent">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/module_switch_model_icon"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:src="@drawable/module_switch_map_angle" />
|
||||
<LinearLayout
|
||||
android:id="@+id/module_switch_layout"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/module_switch_model_icon"
|
||||
android:layout_width="@dimen/module_switch_image"
|
||||
android:layout_height="@dimen/module_switch_image"
|
||||
android:paddingLeft="@dimen/module_switch_margin_left"
|
||||
android:layout_gravity="left|center_vertical"
|
||||
android:src="@drawable/module_switch_map_angle" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/module_switch_model_text"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingLeft="@dimen/module_switch_margin_left"
|
||||
android:textSize="@dimen/module_switch_text_size"
|
||||
android:gravity="right|center"
|
||||
android:text="@string/module_map_model_normal"
|
||||
android:textColor="@color/module_ext_color_voice_text" />
|
||||
</LinearLayout>
|
||||
</FrameLayout>
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
|
||||
@@ -163,6 +163,5 @@
|
||||
<dimen name="module_event_live_error_text_size">36px</dimen>
|
||||
<dimen name="module_video_window_height_content">393px</dimen>
|
||||
<dimen name="module_video_window_width_content">700px</dimen>
|
||||
<dimen name="module_switch_map">108px</dimen>
|
||||
|
||||
</resources>
|
||||
@@ -8,5 +8,9 @@
|
||||
<dimen name="module_ext_arcView_stroke_with">15px</dimen>
|
||||
<dimen name="module_ext_arcView_center_text_size">110px</dimen>
|
||||
<dimen name="module_ext_arcView_des_text_size">40px</dimen>
|
||||
<dimen name="module_switch_map">145px</dimen>
|
||||
<dimen name="module_switch_map">279px</dimen>
|
||||
<dimen name="module_switch_map_height">119px</dimen>
|
||||
<dimen name="module_switch_margin_left">22px</dimen>
|
||||
<dimen name="module_switch_text_size">36px</dimen>
|
||||
<dimen name="module_switch_image">50px</dimen>
|
||||
</resources>
|
||||
@@ -14,5 +14,5 @@
|
||||
|
||||
<color name="arc_speeding">#DB3137</color>
|
||||
<color name="arc_speed">#3E77F6</color>
|
||||
<color name="module_switch_map_bg">#3B4577</color>
|
||||
<color name="module_switch_map_bg">#323C6F</color>
|
||||
</resources>
|
||||
@@ -243,6 +243,9 @@
|
||||
<dimen name="module_ext_navi_in_vr_traffic_light_no_time_margin_top">11px</dimen>
|
||||
<dimen name="module_video_window_width_content">400px</dimen>
|
||||
<dimen name="module_video_window_height_content">300px</dimen>
|
||||
|
||||
<dimen name="module_switch_map">108px</dimen>
|
||||
<dimen name="module_switch_map">279px</dimen>
|
||||
<dimen name="module_switch_map_height">119px</dimen>
|
||||
<dimen name="module_switch_margin_left">23px</dimen>
|
||||
<dimen name="module_switch_text_size">35px</dimen>
|
||||
<dimen name="module_switch_image">50px</dimen>
|
||||
</resources>
|
||||
@@ -69,4 +69,7 @@
|
||||
<item>提前看看出行路况,试试唤醒小智说,“中关村路况怎么样”</item>
|
||||
</string-array>
|
||||
|
||||
<string name="module_map_model_normal">默认视角</string>
|
||||
<string name="module_map_model_faster">远距视角</string>
|
||||
|
||||
</resources>
|
||||
|
||||
Reference in New Issue
Block a user