[mini bus] merge 司机端二维码冲突

This commit is contained in:
wangmingjun
2023-03-29 18:16:29 +08:00
parent 4a15d67afd
commit 1755396f72
17 changed files with 865 additions and 30 deletions

View File

@@ -1,12 +0,0 @@
package com.mogo.och.bus.constant
import com.mogo.commons.debug.DebugConfig
/**
* Created on 2021/12/6
*/
class URLConst {
companion object {
}
}

View File

@@ -57,6 +57,8 @@ dependencies {
implementation rootProject.ext.dependencies.arouter
kapt rootProject.ext.dependencies.aroutercompiler
implementation rootProject.ext.dependencies.litezxing
if (Boolean.valueOf(USE_MAVEN_PACKAGE)) {
api rootProject.ext.dependencies.mogoutils
api rootProject.ext.dependencies.mogocommons

View File

@@ -0,0 +1,117 @@
package com.mogo.och.common.module.utils
import android.graphics.Bitmap
import android.graphics.Canvas
import com.google.zxing.BarcodeFormat
import com.google.zxing.EncodeHintType
import com.google.zxing.common.BitMatrix
import com.google.zxing.qrcode.QRCodeWriter
import com.google.zxing.qrcode.decoder.ErrorCorrectionLevel
import java.util.*
/**
* isDeleteWhite 是否删除白边
*/
fun createQRCode(address: String, width: Int, height: Int,isDeleteWhite: Boolean): Bitmap? {
val hints = Hashtable<EncodeHintType, Any>()
hints[EncodeHintType.CHARACTER_SET] = "utf-8"
hints[EncodeHintType.ERROR_CORRECTION] = ErrorCorrectionLevel.H
hints[EncodeHintType.MARGIN] = if (isDeleteWhite) 1 else 0
var bitMatrix = QRCodeWriter().encode(
address,
BarcodeFormat.QR_CODE, width, height, hints
)
if (isDeleteWhite) {
//删除白边
bitMatrix = deleteWhite(bitMatrix)
}
val widthNew = bitMatrix.width
val heightNew = bitMatrix.height
val pixels = IntArray(widthNew * heightNew)
//下面这里按照二维码的算法,逐个生成二维码的图片,
//两个for循环是图片横列扫描的结果
for (y in 0 until heightNew) {
for (x in 0 until widthNew) {
if (bitMatrix.get(x, y)) {
pixels[y * widthNew + x] = -0x1000000
} else {
pixels[y * widthNew + x] = -0x1
}
}
}
//生成二维码图片的格式使用ARGB_8888
var bitmap = Bitmap.createBitmap(widthNew, heightNew, Bitmap.Config.ARGB_8888)
bitmap.setPixels(pixels, 0, widthNew, 0, 0, widthNew, heightNew)
return bitmap
}
/**
* 删除白色边框
*
* @param matrix matrix
* @return BitMatrix
*/
private fun deleteWhite(matrix: BitMatrix): BitMatrix? {
val rec = matrix.enclosingRectangle
val resWidth = rec[2] + 1
val resHeight = rec[3] + 1
val resMatrix = BitMatrix(resWidth, resHeight)
resMatrix.clear()
for (i in 0 until resWidth) {
for (j in 0 until resHeight) {
if (matrix[i + rec[0], j + rec[1]]) resMatrix[i] = j
}
}
return resMatrix
}
fun createQRCodeWithPicture(bmCenter: Bitmap,address: String, width: Int, height: Int,isDeleteWhite: Boolean): Bitmap?{
var qrCode = createQRCode(address,width,height,isDeleteWhite)
//8创建一个bitmap对象用于作为其图标
qrCode?.let {
val resultBitmap = addLogo(it,bmCenter)
if (resultBitmap != null){
return resultBitmap
}
}
return null
}
/**
* 用于向创建的二维码中添加一个logo
* @param bmQr
* @param bmCenter
* @return
*/
fun addLogo(bmQr: Bitmap, bmCenter:Bitmap) :Bitmap?{
if (bmQr == null) {
return null
}
if (bmCenter == null) {
return bmQr
}
//获取图片的宽高
val bmQrWidth = bmQr.width
val bmQrHeight = bmQr.height
val bmCenterWidth = bmCenter.width
val bmCenterHeight = bmCenter.height
var bitmap = Bitmap.createBitmap(bmQrWidth, bmQrHeight, Bitmap.Config.ARGB_8888)
try {
var canvas = Canvas(bitmap)
canvas.drawBitmap(bmQr, 0f, 0f, null)
canvas.drawBitmap(bmCenter, ((bmQrWidth-bmCenterWidth)/2-bmCenterWidth/2).toFloat(),
((bmQrHeight-bmCenterHeight)/2-bmCenterHeight/2).toFloat(), null)
canvas.save()
canvas.restore()
} catch (e: Exception) {
bitmap = null
e.stackTrace
}
return bitmap
}

View File

@@ -0,0 +1,76 @@
package com.mogo.och.common.module.wigets
import android.content.Context
import android.graphics.Bitmap
import androidx.appcompat.widget.AppCompatImageView
import androidx.appcompat.widget.AppCompatTextView
import androidx.lifecycle.LifecycleObserver
import com.mogo.eagle.core.function.hmi.dialog.BaseFloatDialog
import com.mogo.och.common.module.R
/**
* 带有title, tip,confirm,cancel的dialog
*/
class BindQRCodeDialog: BaseFloatDialog, LifecycleObserver {
private var qrBm : AppCompatImageView? = null
private var qrCancel: AppCompatTextView? = null
private var qrTitle: AppCompatTextView? = null
private var clickListener: ClickListener? = null
constructor(builder: Builder,context: Context) : super(context) {
qrTitle?.text = builder.titleStr
qrCancel?.text = builder.cancelStr
qrBm?.setImageBitmap(builder.qrBm)
}
init{
setContentView(R.layout.bind_driver_qr_view)
setCanceledOnTouchOutside(true)
qrTitle = findViewById(R.id.qr_title)
qrBm = findViewById(R.id.qr_bm)
qrCancel = findViewById(R.id.bind_qr_cancel)
qrCancel?.setOnClickListener {
clickListener?.cancel()
dismiss()
}
}
fun setClickListener(clickListener: ClickListener) {
this.clickListener = clickListener
}
interface ClickListener{
fun cancel()
}
class Builder{
var titleStr:String = ""
var cancelStr:String = ""
var qrBm: Bitmap? = null
fun title(title: String) : Builder{
this.titleStr = title
return this
}
fun cancelStr(cancel: String) : Builder{
this.cancelStr = cancel
return this
}
fun qrBm(bm: Bitmap) : Builder{
this.qrBm = bm
return this
}
fun build(context: Context): BindQRCodeDialog? {
return BindQRCodeDialog(this,context)
}
}
}

View File

@@ -49,13 +49,6 @@ class OCHCommitDialog: BaseFloatDialog, LifecycleObserver {
this.clickListener = clickListener
}
fun showUpgradeDialog(){
if(isShowing){
return
}
show()
}
interface ClickListener{
fun confirm()
fun cancel()

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

View File

@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<corners android:radius="@dimen/dp_32"/>
<solid android:color="@color/qr_bg_color"/>
</shape>

View File

@@ -0,0 +1,55 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="@dimen/dp_890"
android:layout_height="@dimen/dp_780"
xmlns:app="http://schemas.android.com/apk/res-auto"
tools:ignore="MissingDefaultResource"
android:background="@drawable/bind_driver_qr_bg">
<androidx.appcompat.widget.AppCompatTextView
android:id="@+id/qr_title"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/bind_driver_qr_title"
android:gravity="center"
android:textSize="@dimen/dp_56"
android:layout_marginTop="@dimen/dp_48"
android:textColor="@android:color/white"
android:textStyle="bold"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent"/>
<androidx.appcompat.widget.AppCompatImageView
android:id="@+id/qr_bm"
android:layout_width="@dimen/dp_357"
android:layout_height="@dimen/dp_357"
android:padding="8dp"
android:background="@android:color/white"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toBottomOf="@+id/qr_title"
app:layout_constraintBottom_toTopOf="@+id/line"/>
<View
android:id="@+id/line"
android:layout_width="match_parent"
android:layout_height="2px"
android:background="@color/qr_line_bg_color"
app:layout_constraintBottom_toTopOf="@+id/bind_qr_cancel"
app:layout_constraintLeft_toLeftOf="parent"/>
<androidx.appcompat.widget.AppCompatTextView
android:id="@+id/bind_qr_cancel"
android:layout_width="match_parent"
android:layout_height="@dimen/dp_162"
android:gravity="center"
android:text="@string/qr_cancel"
android:textSize="@dimen/dp_52"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
android:textColor="@android:color/white" />
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@@ -11,4 +11,7 @@
<color name="taxi_4D000000">#4D000000</color>
<color name="och_dialog_bg_color">#3B4577</color>
<color name="qr_line_bg_color">#66B8BFE8</color>
<color name="qr_bg_color">#3B4577</color>
</resources>

View File

@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<resources xmlns:tools="http://schemas.android.com/tools">
<string name="module_och_taxi_login_title">欢迎您登录</string>
<string name="module_och_taxi_login_btn">登录</string>
@@ -30,4 +30,7 @@
<string name="end_order_zh">感谢您体验\'蘑菇车联\'自动驾驶小巴车,本次旅程已结束,我们下次乘车再见</string>
<string name="end_order_en">Thank you for experiencing the self-driving minibus. See you next time</string>
<string name="end_order_ko">자율주행 버스를 체험해 주셔서 감사합니다. 다음에 또 뵙겠습니다</string>
<string name="qr_cancel">取消</string>
<string name="bind_driver_qr_title">扫描二维码完成车辆绑定</string>
</resources>

View File

@@ -0,0 +1,557 @@
package com.mogo.och.bus.fragment;
import static com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.M_BUS;
import android.content.Intent;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.os.Bundle;
import android.view.View;
import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.constraintlayout.widget.ConstraintLayout;
import androidx.constraintlayout.widget.Group;
import androidx.annotation.Nullable;
import com.alibaba.android.arouter.launcher.ARouter;
import com.mogo.cloud.passport.MoGoAiCloudClientConfig;
import com.mogo.commons.AbsMogoApplication;
import com.mogo.eagle.core.data.config.FunctionBuildConfig;
import com.mogo.eagle.core.data.map.CenterLine;
import com.mogo.eagle.core.data.temp.EventLogout;
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotStatusListener;
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListenerManager;
import com.mogo.eagle.core.function.call.map.CallerMapUIServiceManager;
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger;
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant;
import com.mogo.eagle.core.utilcode.util.ToastUtils;
import com.mogo.map.marker.IMogoMarker;
import com.mogo.map.marker.MogoMarkerOptions;
import com.mogo.och.bus.R;
import com.mogo.och.bus.bean.BusStationBean;
import com.mogo.och.bus.constant.BusConst;
import com.mogo.och.bus.net.login.LoginBusImpl;
import com.mogo.och.bus.presenter.BusPresenter;
import com.mogo.och.bus.ui.BusStationCommonItem;
import com.mogo.och.bus.ui.BusSwitchLineActivity;
import com.mogo.och.bus.view.SlidePanelView;
import com.mogo.och.common.module.biz.constant.OchCommonConst;
import com.mogo.och.common.module.biz.provider.LoginService;
import com.mogo.och.common.module.utils.BlinkAnimationUtil;
import com.mogo.och.common.module.utils.OCHThreadPoolManager;
import com.mogo.och.common.module.utils.QRUtilsKt;
import com.mogo.och.common.module.wigets.BindQRCodeDialog;
import com.mogo.och.common.module.wigets.MarqueeTextView;
import com.mogo.och.common.module.wigets.OCHCommitDialog;
import org.greenrobot.eventbus.Subscribe;
import org.greenrobot.eventbus.ThreadMode;
import java.util.List;
import java.util.Objects;
import me.jessyan.autosize.utils.AutoSizeUtils;
/**
* 网约车小巴界面
*
* @author tongchenfei
*/
public class BusFragment extends BaseBusTabFragment<BusFragment, BusPresenter>
implements SlidePanelView.OnSlidePanelMoveToEndListener, View.OnClickListener {
public static final String TAG = "BusFragment";
private TextView mSwitchLine; //切换路线
private MarqueeTextView mLineName;
private TextView mTaskTime;
private Group groupStationsPanel;
private ConstraintLayout noDataView;
private BusStationBean startStation = null;
private BusStationBean endStation = null;
private BusStationCommonItem firstStationItem;
private BusStationCommonItem secondStationItem;
private BusStationCommonItem thirdStationItem;
private LoginService loginService;
@Override
public String getTagName() {
return "BusFragment";
}
@Override
public void onActivityCreated(@Nullable Bundle savedInstanceState) {
super.onActivityCreated(savedInstanceState);
loginService = (LoginService) ARouter.getInstance().build(OchCommonConst.LOGINSERVICE).navigation();
if(loginService!=null){
loginService.registerFragment(this, getPresenter(),new LoginBusImpl());
}
}
@Override
public void onDestroyView() {
super.onDestroyView();
loginService.unRegisterFragment();
loginService = null;
}
@Override
protected void initViews() {
super.initViews();
mSwitchLine = findViewById(R.id.switch_line_btn);
mSwitchLine.setTag(0);
mLineName = findViewById(R.id.module_och_bus_line_name);
firstStationItem = findViewById(R.id.bus_panel_first_station);
secondStationItem = findViewById(R.id.bus_panel_second_station);
thirdStationItem = findViewById(R.id.bus_panel_third_station);
mTaskTime = findViewById(R.id.bus_task_time_tv);
groupStationsPanel = findViewById(R.id.group_stations_panel);
noDataView = findViewById(R.id.no_line_data_view);
CallerLogger.INSTANCE.d(M_BUS + TAG, "initView: " + CallerAutoPilotStatusListenerManager.INSTANCE.getAutoPilotStatusInfo().getState());
// 初始化的时候设置 UI 按钮状态
showAutopilotBiz();
mSwitchLine.setOnClickListener(this);
mLineName.setOnLongClickListener(new View.OnLongClickListener() {
@Override
public boolean onLongClick(View v) {
showHideTestBar();
return false;
}
});
}
@Subscribe(threadMode = ThreadMode.MAIN)
public void changeOverview(EventLogout eventLogout){
if (eventLogout.getMessgae() == EventLogout.LOGOUT_TYPE){
CallerLogger.INSTANCE.d(M_BUS + TAG,"changeOverview Event消息去登出");
mPresenter.logout();
}else if (eventLogout.getMessgae() == EventLogout.SHOW_QR_TYPE){ //显示二维码
CallerLogger.INSTANCE.d(M_BUS + TAG,"changeOverview Event qrcode");
String qrUrl = String.format(FunctionBuildConfig.urlJson.getBindDriverQRUrl(),
MoGoAiCloudClientConfig.getInstance().getSn());
Bitmap bmQr = QRUtilsKt.createQRCodeWithPicture(
BitmapFactory.decodeResource(getResources(), R.drawable.icon_qr_center_logo)
,qrUrl, AutoSizeUtils.dp2px(getContext(),340f),
AutoSizeUtils.dp2px(getContext(),340f),true);
if (bmQr != null){
BindQRCodeDialog.Builder builder = new BindQRCodeDialog.Builder();
builder.title(getString(R.string.bind_driver_qr_title))
.cancelStr(getString(R.string.qr_cancel))
.qrBm(bmQr).build(getContext()).show();
}else {
CallerLogger.INSTANCE.d(M_BUS + TAG,"bmQr = null ");
}
}
}
@Override
protected void onArriveStation() {
mPresenter.onAutopilotArriveAtStation(null);
}
@Override
protected void debugArrivedStation() {
mPresenter.onAutopilotArriveAtStation(null);
}
@NonNull
@Override
protected BusPresenter createPresenter() {
return new BusPresenter(this);
}
@Override
public void onResume() {
super.onResume();
}
public void hideStationsPanel(){
groupStationsPanel.setVisibility(View.GONE);
noDataView.setVisibility(View.VISIBLE);
}
public void showStationsPanel(){
groupStationsPanel.setVisibility(View.VISIBLE);
noDataView.setVisibility(View.GONE);
}
public void updateLineEmptyUI(){
setArrivedClikable(false);
showOrHideSwitchLineBtn(true);
hideStationsPanel();
hideSlidePanel();
resetStationBlinkAnim();
}
private void resetStationBlinkAnim() {
BlinkAnimationUtil.clearAnimation(firstStationItem.getCircleImageView());
BlinkAnimationUtil.clearAnimation(secondStationItem.getCircleImageView());
BlinkAnimationUtil.clearAnimation(thirdStationItem.getCircleImageView());
}
public void updateBusTaskStatus(String lineName, String lineTime,
List<BusStationBean> stationList,
int arrivingOrArrivedIndex,
boolean isArrived){
if (getActivity() == null) {
return;
}
getActivity().runOnUiThread(() -> {
if (stationList == null) {
// 获取小巴数据失败
return;
}
showStationsPanel();
showOrHideSwitchLineBtn(false);
mLineName.setText(lineName);
mTaskTime.setText(getString(R.string.bus_line_time_tag)+ lineTime);
// 渲染小巴路线数据
updateBusStationStatus(stationList,arrivingOrArrivedIndex,isArrived);
});
}
private void updateBusStationStatus(List<BusStationBean> stationList,
int arrivingOrArrivedIndex,
boolean isArrived) {
startStation = stationList.get(0);
endStation = stationList.get(stationList.size() - 1);
if (arrivingOrArrivedIndex == stationList.size() - 1 && isArrived){
//切换路线和结束路线按钮切换
showSlidePanel("单程结束");
setOrRemoveMapMaker(false, BusConst.BUS_END_MAP_MAKER, endStation.getLat()
, endStation.getLon(),R.raw.end_marker);
}else if (arrivingOrArrivedIndex == 0 && isArrived){
showSlidePanel("滑动出发");
setOrRemoveMapMaker(true, BusConst.BUS_START_MAP_MAKER,
startStation.getLat(), startStation.getLon(),R.raw.star_marker);
setOrRemoveMapMaker(true, BusConst.BUS_END_MAP_MAKER,
endStation.getLat(), endStation.getLon(),R.raw.end_marker);
}else{
if (isArrived){
// 重置滑动按钮文字
showSlidePanel("滑动出发");
}
setOrRemoveMapMaker(false, BusConst.BUS_START_MAP_MAKER, startStation.getLat()
, startStation.getLon(),R.raw.star_marker);
setOrRemoveMapMaker(true, BusConst.BUS_END_MAP_MAKER, endStation.getLat()
, endStation.getLon(),R.raw.end_marker);
}
if (stationList.size() > 2){ //只有两个站点
updateMoreThanTwoStationsUI(stationList,arrivingOrArrivedIndex,isArrived);
}else {
updateTwoStationsUI(stationList,arrivingOrArrivedIndex,isArrived);
}
updateBusTestBarInfo();
}
/**
* 有两个以上站点的路线
* @param stationList
* @param arrivingOrArrivedIndex
* @param isArrived
*/
private void updateMoreThanTwoStationsUI(List<BusStationBean> stationList,
int arrivingOrArrivedIndex,
boolean isArrived) {
secondStationItem.setStationTag("");
secondStationItem.showOrHideStationArrowBg(true);
thirdStationItem.setStationTag("");
secondStationItem.setVisibility(View.VISIBLE);
thirdStationItem.showOrHideStationArrowBg(false);
if (arrivingOrArrivedIndex == 0 || arrivingOrArrivedIndex -1 == 0
|| (arrivingOrArrivedIndex -2 == 0 && stationList.size() == 3)){
firstStationItem.setStationTag(getResources().getString(R.string.bus_station_txt_tag_start));
}else {
firstStationItem.setStationTag("");
}
if (arrivingOrArrivedIndex + 1 == stationList.size() - 1 || arrivingOrArrivedIndex == stationList.size() - 1
|| (arrivingOrArrivedIndex == 0 && arrivingOrArrivedIndex + 2 == stationList.size() - 1)){ //确认是否显示 "终"
thirdStationItem.setStationTag(getResources().getString(R.string.bus_station_txt_tag_end));
}else {
thirdStationItem.setStationTag("");
}
//圆点: 0:灰色 过站 1绿色 到站或者即将到站 2蓝色未到站
if (arrivingOrArrivedIndex == 0 && isArrived){
firstStationItem.setStationNameColor(getResources().getColor(R.color.bus_line_station_color_selected));
secondStationItem.setStationNameColor(getResources().getColor(R.color.bus_arrived_station_name_text_color));
thirdStationItem.setStationNameColor(getResources().getColor(R.color.bus_arrived_station_name_text_color));
firstStationItem.setStationName(stationList.get(0).getName());
secondStationItem.setStationName(stationList.get(1).getName());
thirdStationItem.setStationName(stationList.get(2).getName());
firstStationItem.setStationPointBg(1);
secondStationItem.setStationPointBg(2);
thirdStationItem.setStationPointBg(2);
firstStationItem.setStationArrowBg(2);
secondStationItem.setStationArrowBg(2);
}else if (arrivingOrArrivedIndex == stationList.size() - 1){
firstStationItem.setStationNameColor(getResources().getColor(R.color.bus_station_tag_txt_un_color));
secondStationItem.setStationNameColor(getResources().getColor(R.color.bus_station_tag_txt_un_color));
thirdStationItem.setStationNameColor(getResources().getColor(R.color.bus_line_station_color_selected));
firstStationItem.setStationName(stationList.get(arrivingOrArrivedIndex -2).getName());
secondStationItem.setStationName(stationList.get(arrivingOrArrivedIndex -1).getName());
thirdStationItem.setStationName(stationList.get(arrivingOrArrivedIndex).getName());
firstStationItem.setStationPointBg(0);
secondStationItem.setStationPointBg(0);
thirdStationItem.setStationPointBg(1);
firstStationItem.setStationArrowBg(0);
if (isArrived){
secondStationItem.setStationArrowBg(0);
}else {
secondStationItem.setStationArrowBg(1);
}
}else {
firstStationItem.setStationNameColor(getResources().getColor(R.color.bus_station_tag_txt_un_color));
secondStationItem.setStationNameColor(getResources().getColor(R.color.bus_line_station_color_selected));
thirdStationItem.setStationNameColor(getResources().getColor(R.color.bus_arrived_station_name_text_color));
firstStationItem.setStationName(stationList.get(arrivingOrArrivedIndex -1).getName());
secondStationItem.setStationName(stationList.get(arrivingOrArrivedIndex).getName());
thirdStationItem.setStationName(stationList.get(arrivingOrArrivedIndex + 1).getName());
firstStationItem.setStationPointBg(0);
secondStationItem.setStationPointBg(1);
thirdStationItem.setStationPointBg(2);
secondStationItem.setStationArrowBg(2);
if (isArrived){
firstStationItem.setStationArrowBg(0);
}else {
firstStationItem.setStationArrowBg(1);
}
}
}
/**
* 只有两个站点的路线
* @param stationList
* @param arrivingOrArrivedIndex
* @param isArrived
*/
private void updateTwoStationsUI(List<BusStationBean> stationList,
int arrivingOrArrivedIndex,
boolean isArrived) {
secondStationItem.setVisibility(View.GONE);
secondStationItem.showOrHideStationArrowBg(false);
thirdStationItem.showOrHideStationArrowBg(false);
firstStationItem.setStationTag(getResources().getString(R.string.bus_station_txt_tag_start));
thirdStationItem.setStationTag(getResources().getString(R.string.bus_station_txt_tag_end));
firstStationItem.setStationName(stationList.get(0).getName());
thirdStationItem.setStationName(stationList.get(1).getName());
//圆点: 0:灰色 过站 1绿色 到站或者即将到站 2蓝色未到站
if (arrivingOrArrivedIndex == 0 && isArrived){//到站
firstStationItem.setStationNameColor(getResources().getColor(R.color.bus_line_station_color_selected));
thirdStationItem.setStationNameColor(getResources().getColor(R.color.bus_arrived_station_name_text_color));
firstStationItem.setStationPointBg(1);
firstStationItem.setStationArrowBg(2);
thirdStationItem.setStationPointBg(0);
}else {
firstStationItem.setStationNameColor(getResources().getColor(R.color.bus_station_tag_txt_un_color));
thirdStationItem.setStationNameColor(getResources().getColor(R.color.bus_line_station_color_selected));
if (isArrived){ //到终点
firstStationItem.setStationPointBg(0);
firstStationItem.setStationArrowBg(0);
thirdStationItem.setStationPointBg(1);
}else { //到终点途中
firstStationItem.setStationPointBg(0);
firstStationItem.setStationArrowBg(1);
thirdStationItem.setStationPointBg(1);
}
}
}
private void showOrHideSwitchLineBtn(boolean isShow) {
if (isShow){//显示切换路线
mSwitchLine.setTag(0);
mSwitchLine.setText(getResources().getString(R.string.bus_switch_line_btn));
}else {//显示结束路线
mSwitchLine.setTag(1);
mSwitchLine.setText(getResources().getString(R.string.bus_close_line_btn));
}
}
public void hideOchBus() {
// tvNotice.setVisibility(View.GONE);
}
@Override
public int getStationPanelViewId() {
return R.layout.fragment_och_bus;
}
@Override
public void restartAutopilot() {
if (!isAnimateRunning) {
mPresenter.restartAutopilot();
}
}
@Override
public SlidePanelView.OnSlidePanelMoveToEndListener getSlidePanelOnEndListener() {
return this;
}
@Override
public void moveToEnd() {
// 开启自动驾驶到下一站
if (isAnimateRunning){
stopAutopilotAnimation();
}
mPresenter.autoDriveToNextStation();
}
/**
* 设置自动驾驶可用状态
*/
public void onAutopilotEnableChange(boolean isEnable) {
if (isEnable) {
showAutopilotBiz();
} else {
hideAutopilotBiz();
}
}
public void clearBusStationsMarkers(){
CallerLogger.INSTANCE.d(M_BUS + TAG,"clearBusStationsMarkers()");
if (null != startStation) {
setOrRemoveMapMaker(false, BusConst.BUS_START_MAP_MAKER, startStation.getLat()
, startStation.getLon(),R.raw.star_marker);
}
if (null != endStation) {
setOrRemoveMapMaker(false, BusConst.BUS_END_MAP_MAKER, endStation.getLat()
, endStation.getLon(),R.raw.end_marker);
}
//清除鹰眼右下角小地图轨迹
CallerLogger.INSTANCE.d(SceneConstant.M_MAP, "clearBusStationsMarkers --------->");
smallMapView.clearPolyline();
}
/**
* VR模式切换
*
* @param isVRMode
*/
public void onVRModeChanged(boolean isVRMode) {
if (mRootView != null) {
mRootView.setVisibility(isVRMode ? View.VISIBLE : View.GONE);
}
}
/**
* 绘制地图起点终点
*
* @param isAdd
* @param uuid
*/
private void setOrRemoveMapMaker(boolean isAdd, String uuid, double lat, double longi,int resourceId) {
if (isAdd) {
Runnable setMapMarkerRunnable = () -> {
CallerLogger.INSTANCE.d(M_BUS + "setMapMaker= "+Thread.currentThread().getName(),
uuid + "=latitude=" + lat + ",longitude=" + longi);
MogoMarkerOptions options = new MogoMarkerOptions()
.owner(BusConst.TYPE_MARKER_BUS_ORDER)
.anchor(0.5f, 0.5f)
.set3DMode(true)
.gps(true)
.controlAngle(true)
.icon3DRes(resourceId)
.latitude(lat)
.longitude(longi);
IMogoMarker marker = Objects.requireNonNull(CallerMapUIServiceManager.INSTANCE.getMarkerManager(AbsMogoApplication.getApp())).addMarker(uuid, options);
CenterLine centerLine = CallerMapUIServiceManager.INSTANCE.getMapUIController().getCenterLineInfo(
longi,lat,-1);
if (null != centerLine && marker != null) { // 有可能鹰眼map为空没有角度。判空使用后可能造成maker角度跟道路角度不一致 地图未初始化会返回空
marker.setRotateAngle(centerLine.getAngle().floatValue());
}
};
OCHThreadPoolManager.getsInstance().execute(setMapMarkerRunnable);
}else {
Runnable removeMapMarkerRunnable = () -> {
CallerLogger.INSTANCE.d(M_BUS + "RemoveMapMaker="+Thread.currentThread().getName(),
uuid+"=latitude="+lat+",longitude="+longi);
Objects.requireNonNull(CallerMapUIServiceManager.INSTANCE.getMarkerManager(AbsMogoApplication.getApp())).removeMarkers(uuid);
};
OCHThreadPoolManager.getsInstance().execute(removeMapMarkerRunnable);
}
}
@Override
public void debugAutoPilotStatus(int status) {
mPresenter.debugAutoPilotStatus(status);
}
@Override
public void onClick(View v) {
if (v.getId() == R.id.switch_line_btn) {//切换路线条件: 自动驾驶过程中点击则toast提示自动驾驶中不可切换路线
//本次行程未结束不支持切换路线。点击则toast提示当前行程未完成不可切换路线
if (CallerAutoPilotStatusListenerManager.INSTANCE.getAutoPilotStatusInfo().getState()
== IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_RUNNING) {
ToastUtils.showLong(getResources().getString(R.string.bus_switch_line_btn_warning1));
return;
}
if ((int)mSwitchLine.getTag() == 0){//切换路线
Intent intent = new Intent(getContext(), BusSwitchLineActivity.class);
startActivity(intent);
}else {//结束任务
OCHCommitDialog.Builder builder = new OCHCommitDialog.Builder();
OCHCommitDialog closeLineConfirmDialog = builder
.title(getString(R.string.bus_dialog_title))
.tips(getString(R.string.bus_dialog_tips))
.confirmStr(getString(R.string.bus_dialog_confirm))
.cancelStr(getString(R.string.bus_dialog_cancel))
.build(getContext());
closeLineConfirmDialog.setClickListener(new OCHCommitDialog.ClickListener() {
@Override
public void confirm() {
mPresenter.abortTask();
}
@Override
public void cancel() {
closeLineConfirmDialog.dismiss();
}
});
closeLineConfirmDialog.show();
}
}
}
}

View File

@@ -7,7 +7,8 @@
"socket_base_url": "",
"socket_tech_url": "",
"eagle_mis_url": "",
"eagle_dns_url": ""
"eagle_dns_url": "",
"bind_driver_qr_url": ""
},
"online": {
"och_url": "https://tech.zhidaohulian.com",
@@ -16,7 +17,8 @@
"socket_base_url": "",
"socket_tech_url": "",
"eagle_mis_url": "",
"eagle_dns_url": ""
"eagle_dns_url": "",
"bind_driver_qr_url": ""
},
"demo": {
"och_url": "http://tech-dev.zhidaohulian.com",
@@ -25,7 +27,8 @@
"socket_base_url": "",
"socket_tech_url": "",
"eagle_mis_url": "",
"eagle_dns_url": ""
"eagle_dns_url": "",
"bind_driver_qr_url": ""
}
},
"dali": {
@@ -36,7 +39,8 @@
"socket_base_url": "https://och-a.zhidaozhixing.com/arch/push/",
"socket_tech_url": "https://och-a.zhidaozhixing.com/arch/",
"eagle_mis_url": "http://eagle-mis-a.zhidaozhixing.com/",
"eagle_dns_url": "http://eagle-dns-a.zhidaozhixing.com/"
"eagle_dns_url": "http://eagle-dns-a.zhidaozhixing.com/",
"bind_driver_qr_url": "https://tech.zhidaohulian.com?pipe=asafety&sn=%1$s"
},
"online": {
"och_url": "https://och-driver-eh.zhidaozhixing.com:18182",
@@ -45,7 +49,8 @@
"socket_base_url": "https://och-driver-eh.zhidaozhixing.com:18182/arch/push/",
"socket_tech_url": "https://och-driver-eh.zhidaozhixing.com:18182/arch/",
"eagle_mis_url": "https://och-hailing-eh.zhidaozhixing.com:18182/",
"eagle_dns_url": "https://och-hailing-eh.zhidaozhixing.com:18182/"
"eagle_dns_url": "https://och-hailing-eh.zhidaozhixing.com:18182/",
"bind_driver_qr_url": "https://tech.zhidaohulian.com?pipe=ehsafety&sn=%1$s"
},
"demo": {
"och_url": "https://och-a.zhidaozhixing.com",
@@ -54,7 +59,8 @@
"socket_base_url": "https://och-a.zhidaozhixing.com/arch/push/",
"socket_tech_url": "https://och-a.zhidaozhixing.com/arch/",
"eagle_mis_url": "http://och-hailing-eh.zhidaozhixing.com:18181/",
"eagle_dns_url": "http://och-hailing-eh.zhidaozhixing.com:18181/"
"eagle_dns_url": "http://och-hailing-eh.zhidaozhixing.com:18181/",
"bind_driver_qr_url": "https://tech.zhidaohulian.com?pipe=ehsafety&sn=%1$s"
}
},
"yantai": {
@@ -65,7 +71,8 @@
"socket_base_url": "https://och-a.zhidaozhixing.com/arch/push/",
"socket_tech_url": "https://och-a.zhidaozhixing.com/arch/",
"eagle_mis_url": "http://eagle-mis-a.zhidaozhixing.com/",
"eagle_dns_url": "http://eagle-dns-a.zhidaozhixing.com/"
"eagle_dns_url": "http://eagle-dns-a.zhidaozhixing.com/",
"bind_driver_qr_url": "https://tech.zhidaohulian.com?pipe=asafety&sn=%1$s"
},
"online": {
"och_url": "https://och-driver-yt.zhidaozhixing.com",
@@ -74,7 +81,8 @@
"socket_base_url": "https://och-driver-yt.zhidaozhixing.com/arch/push/",
"socket_tech_url": "https://och-driver-yt.zhidaozhixing.com/arch/",
"eagle_mis_url": "https://och-hailing-yt.zhidaozhixing.com/",
"eagle_dns_url": "https://och-hailing-yt.zhidaozhixing.com/"
"eagle_dns_url": "https://och-hailing-yt.zhidaozhixing.com/",
"bind_driver_qr_url": "https://tech.zhidaohulian.com?pipe=ytsafety&sn=%1$s"
},
"demo": {
"och_url": "https://och-a.zhidaozhixing.com",
@@ -83,7 +91,8 @@
"socket_base_url": "https://och-a.zhidaozhixing.com/arch/push/",
"socket_tech_url": "https://och-a.zhidaozhixing.com/arch/",
"eagle_mis_url": "http://eagle-mis-a.zhidaozhixing.com/",
"eagle_dns_url": "http://eagle-dns-a.zhidaozhixing.com/"
"eagle_dns_url": "http://eagle-dns-a.zhidaozhixing.com/",
"bind_driver_qr_url": "https://tech.zhidaohulian.com?pipe=ytsafety&sn=%1$s"
}
}
}

View File

@@ -31,14 +31,27 @@ class BusOperationView @JvmOverloads constructor(
actvAccountPhone.text = phoneMask(SharedPrefs.getInstance(it).getString("och_account",""))
}
clickPersonalRightView()
clickQRBtn()
}
private fun clickQRBtn() {
actvAccountQR.onClick {
EventBus.getDefault().post(EventLogout(EventLogout.SHOW_QR_TYPE))
}
}
private fun initPersonalIcon() {
if(AppIdentityModeUtils.isTaxi(FunctionBuildConfig.appIdentityMode)){
ivGotoPersonalInfo.visibility = VISIBLE
}else{
ivGotoPersonalInfo.visibility = GONE
}
if (AppIdentityModeUtils.isShuttle(FunctionBuildConfig.appIdentityMode)) {
actvAccountQR.visibility = VISIBLE
}else{
actvAccountQR.visibility = GONE
}
}
private fun clickPersonalRightView() {

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.3 KiB

View File

@@ -60,6 +60,16 @@
android:textColor="@android:color/white"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
<androidx.appcompat.widget.AppCompatImageView
android:id="@+id/actvAccountQR"
android:layout_width="@dimen/dp_84"
android:layout_height="@dimen/dp_84"
android:src="@drawable/icon_bind_driver_qrcode"
android:layout_marginLeft="@dimen/dp_32"
app:layout_constraintLeft_toRightOf="@+id/actvAccountPhone"
app:layout_constraintTop_toTopOf="@+id/actvAccountPhone"
app:layout_constraintBottom_toBottomOf="@+id/actvAccountPhone"/>
<androidx.appcompat.widget.AppCompatImageView
android:id="@+id/ivGotoPersonalInfo"

View File

@@ -16,5 +16,7 @@ data class UrlConfig(
@SerializedName("eagle_mis_url")
val eagleMisUrl: String,
@SerializedName("eagle_dns_url")
val eagleDnsUrl: String
val eagleDnsUrl: String,
@SerializedName("bind_driver_qr_url")
val bindDriverQRUrl: String
)

View File

@@ -5,6 +5,7 @@ public class EventLogout {
private int messgaeType;
public final static int LOGOUT_TYPE = 100001;
public final static int PERSONAL_TYPE = 100002;
public final static int SHOW_QR_TYPE = 100003;
public EventLogout(int messgaeType) {
this.messgaeType = messgaeType;