Merge branch 'feature/v2.0.0' of gitlab.zhidaoauto.com:ecos/yycp-service/Launcher into feature/v2.0.0

This commit is contained in:
wangcongtao
2020-05-20 09:46:56 +08:00
31 changed files with 288 additions and 79 deletions

View File

@@ -23,6 +23,7 @@ import com.mogo.service.intent.IMogoIntentManager;
import com.mogo.service.statusmanager.IMogoStatusManager;
import com.mogo.utils.logger.Logger;
import org.json.JSONException;
import org.json.JSONObject;
import java.util.HashMap;
@@ -198,8 +199,19 @@ public class EntrancePresenter extends Presenter< EntranceView > {
if ( mIMogoAuthorizeModuleManager.needAuthorize( AUTHORIZE_TYPE_LAUNCHER_SHARE ) ) {
mIMogoAuthorizeModuleManager.invokeAuthorization( AUTHORIZE_TYPE_LAUNCHER_SHARE );
} else {
uploadRoadCondition();
Log.d( TAG, "mogoIntentListener 分享路况 唤醒 ----> " );
JSONObject jsonObject = null;
try {
jsonObject = new JSONObject( data );
String typeString = jsonObject.get( "obj" ).toString();
Logger.d(TAG, "mogiIntentListener 准备上报拥堵: " + typeString);
if("拥堵".equals(typeString)) {
uploadRoadCondition();
Log.d(TAG, "mogoIntentListener 上报拥堵 唤醒 ----> ");
}
} catch (JSONException e) {
e.printStackTrace();
}
}
} else if ( intentStr.equals( ExtensionsModuleConst.SHARE_DIALOG_CLOSE ) ) { //关闭分享框 唤醒
if ( mIMogoAuthorizeModuleManager.needAuthorize( AUTHORIZE_TYPE_LAUNCHER_SHARE ) ) {

View File

@@ -34,6 +34,7 @@ dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation rootProject.ext.dependencies.kotlinstdlibjdk7
implementation rootProject.ext.dependencies.androidxappcompat
implementation rootProject.ext.dependencies.androidxrecyclerview
implementation rootProject.ext.dependencies.androidxccorektx
implementation rootProject.ext.dependencies.androidxconstraintlayout
implementation rootProject.ext.dependencies.arouter

View File

@@ -4,22 +4,57 @@ import android.content.BroadcastReceiver
import android.content.Context
import android.content.Intent
import com.mogo.module.share.constant.ShareConstants
import com.mogo.module.share.constant.ShareConstants.VOICE_CMD_PUB_TROUBLE_HELP
import com.mogo.module.share.constant.ShareConstants.*
import com.mogo.module.share.manager.UploadHelper
import com.mogo.utils.logger.Logger
import org.json.JSONObject
/**
* 用于接收唤醒词指令,现在只接收 com.zhidao.speech.awake.notify 这一条广播
*/
class ShareVoiceCmdReceiver : BroadcastReceiver() {
private val TAG = "ShareVoiceCmdReceiver"
override fun onReceive(context: Context, intent: Intent) {
// 接收唤醒词指令
val command = intent.getStringExtra("command")
Logger.d("ShareCmdReceiver", "收到唤醒词指令: $command")
if (command == VOICE_CMD_PUB_TROUBLE_HELP) {
// 开启服务,准备上报求助
val seekHelp = Intent(context, VoiceCmdService::class.java)
seekHelp.putExtra(ShareConstants.VOICE_CMD_SERVICE_EVENT_KEY, ShareConstants.VOICE_CMD_SERVICE_SEEK_HELP)
context.startService(seekHelp)
val command = intent.getStringExtra("command")?:""
Logger.d(TAG, "收到唤醒词指令: $command")
when (command) {
VOICE_CMD_PUB_TROUBLE_HELP -> {
// 开启服务,准备上报求助
val seekHelp = Intent(context, VoiceCmdService::class.java)
seekHelp.putExtra(ShareConstants.VOICE_CMD_SERVICE_EVENT_KEY, ShareConstants.VOICE_CMD_SERVICE_SEEK_HELP)
context.startService(seekHelp)
}
VOICE_CMD_GO_TO_SHARE ->{
val ob = JSONObject(intent.getStringExtra("data") ?: "").opt("ob")
Logger.d(TAG, "ob: $ob")
when (ob) {
"积水"->{
UploadHelper.upload(context, TYPE_STAGNANT_WATER)
}
"积冰"->{
UploadHelper.upload(context, TYPE_ROAD_ICY)
}
""->{
UploadHelper.upload(context, TYPE_DENSE_FOG)
}
"交通事故"->{
UploadHelper.upload(context, TYPE_ACCIDENT)
}
"施工"->{
UploadHelper.upload(context, TYPE_ROAD_CONSTRUCTION)
}
}
}
VOICE_CMD_PUB_ROAD_CONDITION->{
val ob = JSONObject(intent.getStringExtra("data") ?: "").opt("obj")
Logger.d(TAG, "ob: $ob")
if(ob == "路况") {
// 上报实时路况
Logger.d(TAG, "分享框准备触发上报实时路况")
UploadHelper.upload(context, TYPE_REAL_TIME_TRAFFIC)
}
}
}
}
}

View File

@@ -19,5 +19,23 @@ public class ShareConstants {
public static final String VOICE_CMD_SERVICE_EVENT_KEY = "type";
public static final int VOICE_CMD_SERVICE_SEEK_HELP = 1;
// 此处只记录了事故、实时路况、道路积水、道路结冰、浓雾,至于拥堵、交通检查和封路是在extention模块里面管理
public static final String VOICE_CMD_PUB_TROUBLE_HELP = "com.zhidao.auxiliaryDriving.pubTroubleHelp";
public static final String VOICE_CMD_GO_TO_SHARE = "com.zhidao.share";
/**
* 这个是实时路况不是拥堵拥堵放在了extention模块里面处理
*/
public static final String VOICE_CMD_PUB_ROAD_CONDITION = "com.zhidao.pathfinder.report" +
".roadCondition";
public static final String TYPE_BLOCK = "1";
public static final String TYPE_TRAFFIC_CHECK = "2";
public static final String TYPE_CLOSURE = "3";
public static final String TYPE_ACCIDENT = "10013";
public static final String TYPE_REAL_TIME_TRAFFIC = "10015";
public static final String TYPE_SEEK_HELP = "6";
public static final String TYPE_STAGNANT_WATER = "10008";
public static final String TYPE_ROAD_ICY = "10011";
public static final String TYPE_DENSE_FOG = "10010";
public static final String TYPE_ROAD_CONSTRUCTION = "10006";
}

View File

@@ -20,6 +20,7 @@ import com.mogo.module.share.ShareControl;
import com.mogo.module.share.constant.ShareConstants;
import com.mogo.module.share.manager.ISeekHelpListener;
import com.mogo.module.share.manager.SeekHelpManager;
import com.mogo.module.share.manager.UploadHelper;
import com.mogo.service.IMogoServiceApis;
import com.mogo.service.MogoServicePaths;
import com.mogo.service.analytics.IMogoAnalytics;
@@ -47,12 +48,19 @@ public class LaucherShareDialog implements View.OnClickListener {
private TextView tvTrafficCheck;
private TextView tvClosure;
private TextView tvNeedHelp;
private TextView tvAccident;
private TextView tvRealTimeTraffic;
private TextView tvStagnantWater;
private TextView tvRoadIcy;
private TextView tvDenseFog;
private TextView tvConstruction;
private Context mContext;
private IMogoAnalytics mAnalytics;
private IMogoStatusManager mStatusManager;
private IMogoServiceApis mApis;
private WindowManager windowManager;
public LaucherShareDialog(@NonNull Context context) {
@@ -72,19 +80,34 @@ public class LaucherShareDialog implements View.OnClickListener {
dismiss();
}
});
tvBlock = body.findViewById(R.id.tvBlock);
tvTrafficCheck = body.findViewById(R.id.tvTrafficCheck);
tvClosure = body.findViewById(R.id.tvClosure);
tvNeedHelp = body.findViewById(R.id.tvNeedHelp);
tvNeedHelp = body.findViewById(R.id.tvSeekHelp);
tvAccident = body.findViewById(R.id.tvAccident);
tvRealTimeTraffic = body.findViewById(R.id.tvRealTimeTraffic);
tvStagnantWater = body.findViewById(R.id.tvStagnantWater);
tvRoadIcy = body.findViewById(R.id.tvRoadIcy);
tvDenseFog = body.findViewById(R.id.tvDenseFog);
tvConstruction = body.findViewById(R.id.tvConstruction);
}
private void initListener() {
tvBlock.setOnClickListener(this);
tvNeedHelp.setOnClickListener(this);
tvTrafficCheck.setOnClickListener(this);
tvClosure.setOnClickListener(this);
tvAccident.setOnClickListener(this);
tvRealTimeTraffic.setOnClickListener(this);
tvStagnantWater.setOnClickListener(this);
tvRoadIcy.setOnClickListener(this);
tvDenseFog.setOnClickListener(this);
tvConstruction.setOnClickListener(this);
}
@Override
@@ -117,9 +140,27 @@ public class LaucherShareDialog implements View.OnClickListener {
sendShareReceiver("3");
traceTypeData("4");
dismiss();
} else if (id == R.id.tvNeedHelp) {
} else if (id == R.id.tvSeekHelp) {
// 故障求助
SeekHelpManager.INSTANCE.seekHelp(mContext,seekListener,true);
} else if (id == R.id.tvAccident) {
// 事故
sendShareReceiver(ShareConstants.TYPE_ACCIDENT);
} else if (id == R.id.tvConstruction) {
// 道路施工
sendShareReceiver(ShareConstants.TYPE_ROAD_CONSTRUCTION);
} else if (id == R.id.tvRealTimeTraffic) {
// 实时路况
sendShareReceiver(ShareConstants.TYPE_REAL_TIME_TRAFFIC);
} else if (id == R.id.tvStagnantWater) {
// 道路积水
sendShareReceiver(ShareConstants.TYPE_STAGNANT_WATER);
} else if (id == R.id.tvRoadIcy) {
// 道路结冰
sendShareReceiver(ShareConstants.TYPE_ROAD_ICY);
} else if (id == R.id.tvDenseFog) {
// 浓雾
sendShareReceiver(ShareConstants.TYPE_DENSE_FOG);
}
}
@@ -144,15 +185,7 @@ public class LaucherShareDialog implements View.OnClickListener {
* 发送广播 1拥堵2交通检查3封路
*/
private void sendShareReceiver(String type) {
mStatusManager.setUploadingStatus("CARD_TYPE_ROAD_CONDITION", true);
Logger.d("LaucherShareDialog", "LaucherShareDialog sendShareReceiver ---->");
Intent intent = new Intent();
intent.setAction("com.zhidao.roadcondition.share");
intent.addFlags(Intent.FLAG_RECEIVER_FOREGROUND);
intent.addFlags(Intent.FLAG_INCLUDE_STOPPED_PACKAGES);
intent.putExtra("type", type);
mContext.sendBroadcast(intent);
UploadHelper.INSTANCE.upload(mContext, type);
}
/**

View File

@@ -0,0 +1,23 @@
package com.mogo.module.share.manager
import android.content.Context
import android.content.Intent
import com.mogo.module.share.ShareControl
import com.mogo.module.share.dialog.LaucherShareDialog
import com.mogo.utils.logger.Logger
/**
* 上报工具类
*/
object UploadHelper {
fun upload(context:Context, type: String) {
ShareControl.getInstance(context).mogoServiceApis.statusManagerApi.setUploadingStatus("CARD_TYPE_ROAD_CONDITION", true)
Logger.d("UploadHelper", "upload ----> $type")
val intent = Intent()
intent.action = "com.zhidao.roadcondition.share"
intent.addFlags(Intent.FLAG_RECEIVER_FOREGROUND)
intent.addFlags(Intent.FLAG_INCLUDE_STOPPED_PACKAGES)
intent.putExtra("type", type)
context.sendBroadcast(intent)
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.8 KiB

After

Width:  |  Height:  |  Size: 4.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.4 KiB

After

Width:  |  Height:  |  Size: 4.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.1 KiB

After

Width:  |  Height:  |  Size: 4.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.0 KiB

After

Width:  |  Height:  |  Size: 4.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 14 KiB

After

Width:  |  Height:  |  Size: 8.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 10 KiB

After

Width:  |  Height:  |  Size: 9.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 14 KiB

After

Width:  |  Height:  |  Size: 8.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 16 KiB

After

Width:  |  Height:  |  Size: 8.6 KiB

View File

@@ -1,5 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<corners android:radius="@dimen/dp_20" />
<solid android:color="@color/color_545362"/>
<corners android:radius="@dimen/dp_30" />
<gradient
android:angle="-45"
android:startColor="#3F4057"
android:endColor="#2A2B38" />
</shape>

View File

@@ -0,0 +1,28 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"
android:orientation="vertical">
<ImageView
android:layout_width="@dimen/dp_160"
android:layout_height="@dimen/dp_160"
android:id="@+id/ivShareIcon"
android:src="@drawable/share_road_closure" />
<Space
android:layout_width="wrap_content"
android:layout_height="@dimen/share_module_tv_margin_top" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/tvShareContent"
android:text="上报拥堵"
android:textColor="@color/white"
android:textSize="@dimen/share_module_item"
android:textStyle="bold" />
</LinearLayout>

View File

@@ -36,77 +36,133 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:drawableTop="@drawable/share_block_up"
android:drawablePadding="@dimen/share_module_tv_margin_top"
android:gravity="center"
android:text="上报拥堵"
android:text="拥堵"
android:textSize="@dimen/dp_32"
android:textColor="#fff"
app:layout_constraintHorizontal_chainStyle="spread_inside"
android:layout_marginStart="@dimen/dp_76"
android:textColor="@color/white"
android:textSize="@dimen/share_module_item"
android:textStyle="bold"
android:layout_marginTop="@dimen/dp_64"
app:layout_constraintLeft_toLeftOf="@+id/vBg"
android:gravity="center"
app:layout_constraintTop_toBottomOf="@+id/btn_share_title"
app:layout_constraintRight_toLeftOf="@+id/tvTrafficCheck"
app:layout_constraintTop_toBottomOf="@+id/btn_share_title" />
app:layout_constraintLeft_toLeftOf="@+id/vBg"
android:layout_marginStart="@dimen/dp_116"
android:layout_marginTop="@dimen/dp_78"
android:drawablePadding="@dimen/dp_30" />
<TextView
android:id="@+id/tvTrafficCheck"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:drawableTop="@drawable/share_traffic_check"
android:drawablePadding="@dimen/share_module_tv_margin_top"
android:text="交通检查"
android:textSize="@dimen/dp_32"
android:textColor="#fff"
android:gravity="center"
android:text="上报交通检查"
android:textColor="@color/white"
android:textSize="@dimen/share_module_item"
android:textStyle="bold"
app:layout_constraintLeft_toRightOf="@+id/tvBlock"
app:layout_constraintTop_toTopOf="@+id/tvBlock"
app:layout_constraintLeft_toRightOf="@id/tvBlock"
app:layout_constraintRight_toLeftOf="@+id/tvClosure"
app:layout_constraintRight_toRightOf="@+id/vBg"
app:layout_constraintTop_toTopOf="@+id/tvBlock" />
android:drawablePadding="@dimen/dp_30" />
<TextView
android:id="@+id/tvClosure"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:drawableTop="@drawable/share_road_closure"
android:drawablePadding="@dimen/share_module_tv_margin_top"
android:gravity="center"
android:text="上报封路"
android:textColor="@color/white"
android:textSize="@dimen/share_module_item"
android:textStyle="bold"
android:text="封路"
android:textSize="@dimen/dp_32"
app:layout_constraintTop_toTopOf="@+id/tvBlock"
app:layout_constraintLeft_toRightOf="@+id/tvTrafficCheck"
app:layout_constraintRight_toLeftOf="@+id/tvNeedHelp"
app:layout_constraintRight_toRightOf="@+id/vBg"
app:layout_constraintTop_toTopOf="@+id/tvTrafficCheck" />
app:layout_constraintRight_toLeftOf="@+id/tvAccident"
android:textColor="#fff"
android:gravity="center"
android:drawablePadding="@dimen/dp_30" />
<TextView
android:id="@+id/tvNeedHelp"
android:id="@+id/tvAccident"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:drawableTop="@drawable/share_accident"
android:text="事故"
android:textSize="@dimen/dp_32"
app:layout_constraintTop_toTopOf="@+id/tvBlock"
app:layout_constraintLeft_toRightOf="@+id/tvClosure"
app:layout_constraintRight_toLeftOf="@+id/tvConstruction"
android:textColor="#fff"
android:gravity="center"
android:drawablePadding="@dimen/dp_30" />
<TextView
android:id="@+id/tvConstruction"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:drawableTop="@drawable/share_road_construction"
android:text="施工"
android:textSize="@dimen/dp_32"
app:layout_constraintTop_toTopOf="@+id/tvBlock"
app:layout_constraintLeft_toRightOf="@+id/tvAccident"
app:layout_constraintRight_toRightOf="@+id/vBg"
android:layout_marginEnd="@dimen/dp_116"
android:textColor="#fff"
android:gravity="center"
android:drawablePadding="@dimen/dp_30" />
<TextView
android:id="@+id/tvRealTimeTraffic"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:drawableTop="@drawable/share_real_time_traffic"
android:text="实时路况"
android:textSize="@dimen/dp_32"
android:textColor="#fff"
android:gravity="center"
app:layout_constraintTop_toBottomOf="@+id/tvBlock"
app:layout_constraintLeft_toLeftOf="@+id/tvBlock"
android:layout_marginTop="@dimen/dp_62"
android:drawablePadding="@dimen/dp_30" />
<TextView
android:id="@+id/tvSeekHelp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:drawableTop="@drawable/share_seek_help"
android:drawablePadding="@dimen/share_module_tv_margin_top"
android:text="故障求助"
android:textSize="@dimen/dp_32"
android:textColor="#fff"
android:gravity="center"
android:text="发起求助"
android:textColor="@color/white"
android:layout_marginEnd="@dimen/dp_76"
android:textSize="@dimen/share_module_item"
android:textStyle="bold"
app:layout_constraintLeft_toRightOf="@+id/tvClosure"
app:layout_constraintRight_toRightOf="@+id/vBg"
app:layout_constraintTop_toTopOf="@+id/tvClosure" />
app:layout_constraintTop_toBottomOf="@+id/tvTrafficCheck"
app:layout_constraintLeft_toLeftOf="@+id/tvTrafficCheck"
android:layout_marginTop="@dimen/dp_62"
android:drawablePadding="@dimen/dp_30" />
<TextView
android:id="@+id/tvStagnantWater"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="可以对小智说:上报拥堵、上报交通检查、上报封路、发起求助"
android:textColor="@color/white_40"
android:textSize="@dimen/share_module_bottom_size"
android:textStyle="bold"
android:layout_marginTop="@dimen/dp_55"
app:layout_constraintEnd_toEndOf="@+id/vBg"
app:layout_constraintStart_toStartOf="@+id/vBg"
app:layout_constraintTop_toBottomOf="@+id/tvBlock" />
android:drawableTop="@drawable/share_stagnant_water"
android:text="道路积水"
android:textSize="@dimen/dp_32"
android:textColor="#fff"
android:gravity="center"
app:layout_constraintTop_toBottomOf="@+id/tvClosure"
app:layout_constraintLeft_toLeftOf="@+id/tvClosure"
android:layout_marginTop="@dimen/dp_62"
android:drawablePadding="@dimen/dp_30" />
<TextView
android:id="@+id/tvRoadIcy"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:drawableTop="@drawable/share_road_icy"
android:text="道路积冰"
android:textSize="@dimen/dp_32"
android:textColor="#fff"
app:layout_constraintTop_toBottomOf="@+id/tvAccident"
app:layout_constraintLeft_toLeftOf="@+id/tvAccident"
android:layout_marginTop="@dimen/dp_62"
android:gravity="center"
android:drawablePadding="@dimen/dp_30" />
<TextView
android:id="@+id/tvDenseFog"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:drawableTop="@drawable/share_dense_fog"
android:text="浓雾"
android:textSize="@dimen/dp_32"
android:textColor="#fff"
app:layout_constraintTop_toBottomOf="@+id/tvConstruction"
app:layout_constraintLeft_toLeftOf="@+id/tvConstruction"
android:layout_marginTop="@dimen/dp_62"
android:gravity="center"
android:drawablePadding="@dimen/dp_30" />
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@@ -1,8 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<dimen name="share_module_width">693px</dimen>
<dimen name="share_module_height">320px</dimen>
<dimen name="share_module_width">776px</dimen>
<dimen name="share_module_height">428px</dimen>
<dimen name="share_module_margin_top">34px</dimen>
<dimen name="share_module_title_margin_top">43px</dimen>
<dimen name="share_module_first_margin_left">100px</dimen>

View File

@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<dimen name="share_module_width">1300px</dimen>
<dimen name="share_module_height">600px</dimen>
<dimen name="share_module_width">1464px</dimen>
<dimen name="share_module_height">808px</dimen>
<dimen name="share_module_margin_top">64px</dimen>
<dimen name="share_module_title_margin_top">80px</dimen>
<dimen name="share_module_first_margin_left">200px</dimen>