[6.7.2]
[fea] [乘客屏取消后台数据获取、添加saas 核销接口]
1
OCH/bus/passenger/.gitignore
vendored
@@ -1 +0,0 @@
|
|||||||
/build
|
|
||||||
@@ -1,15 +0,0 @@
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
src
|
|
||||||
- androidTest Android 测试代码
|
|
||||||
- basecommon 金旅开沃、接驳车 公用代码部分
|
|
||||||
- jinlvvan 金旅开沃 独立代码部分
|
|
||||||
- m1 金旅m1 独立代码部分
|
|
||||||
- m2 金旅m2 独立代码部分
|
|
||||||
- main 所有车型公用代码部分
|
|
||||||
- shuttle 接驳车独立代码 因为接驳车和金旅开沃代码耦合厉害暂时放入到mogo-och-bus-passenger里面
|
|
||||||
后期会创建独立module和mogo-och-bus-passenger平级
|
|
||||||
- test 普通代码测试
|
|
||||||
@@ -1,82 +0,0 @@
|
|||||||
apply plugin: 'com.android.library'
|
|
||||||
apply plugin: 'kotlin-android'
|
|
||||||
apply plugin: 'kotlin-android-extensions'
|
|
||||||
apply plugin: 'kotlin-kapt'
|
|
||||||
|
|
||||||
android {
|
|
||||||
compileSdkVersion rootProject.ext.android.compileSdkVersion
|
|
||||||
// buildToolsVersion rootProject.ext.android.buildToolsVersion
|
|
||||||
defaultConfig {
|
|
||||||
minSdkVersion rootProject.ext.android.minSdkVersion
|
|
||||||
targetSdkVersion rootProject.ext.android.targetSdkVersion
|
|
||||||
versionCode Integer.valueOf(VERSION_CODE)
|
|
||||||
versionName getValueFromRootProperties("${project.name.replace("-", "_").toUpperCase()}_VERSION")
|
|
||||||
|
|
||||||
|
|
||||||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
|
||||||
consumerProguardFiles "consumer-rules.pro"
|
|
||||||
|
|
||||||
kapt {
|
|
||||||
useBuildCache = false
|
|
||||||
arguments {
|
|
||||||
arg("AROUTER_MODULE_NAME", "bus"+project.getName())
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
compileOptions {
|
|
||||||
sourceCompatibility JavaVersion.VERSION_1_8
|
|
||||||
targetCompatibility JavaVersion.VERSION_1_8
|
|
||||||
}
|
|
||||||
|
|
||||||
lintOptions {
|
|
||||||
abortOnError false
|
|
||||||
}
|
|
||||||
|
|
||||||
buildTypes {
|
|
||||||
release {
|
|
||||||
minifyEnabled false
|
|
||||||
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
|
|
||||||
}
|
|
||||||
debug {
|
|
||||||
minifyEnabled false
|
|
||||||
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
sourceSets {
|
|
||||||
main {
|
|
||||||
res.srcDirs = [
|
|
||||||
'src/main/res',
|
|
||||||
'src/main/res/m2',
|
|
||||||
'src/main/res/jinlv',
|
|
||||||
]
|
|
||||||
java.srcDirs = [
|
|
||||||
'src/main/java',
|
|
||||||
'src/main/java/m2',
|
|
||||||
'src/main/java/jinlv',
|
|
||||||
]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
dependencies {
|
|
||||||
implementation fileTree(dir: "libs", include: ["*.jar"])
|
|
||||||
implementation rootProject.ext.dependencies.kotlinstdlib
|
|
||||||
implementation rootProject.ext.dependencies.androidxappcompat
|
|
||||||
implementation rootProject.ext.dependencies.arouter
|
|
||||||
implementation rootProject.ext.dependencies.androidxrecyclerview
|
|
||||||
implementation rootProject.ext.dependencies.material
|
|
||||||
kapt rootProject.ext.dependencies.aroutercompiler
|
|
||||||
implementation rootProject.ext.dependencies.rxandroid
|
|
||||||
implementation rootProject.ext.dependencies.androidxconstraintlayout
|
|
||||||
implementation rootProject.ext.dependencies.amapnavi3dmap
|
|
||||||
implementation project(":OCH:common:common")
|
|
||||||
compileOnly project(":libraries:mogo-map")
|
|
||||||
implementation project(':core:mogo-core-res')
|
|
||||||
|
|
||||||
androidTestImplementation rootProject.ext.dependencies.androidxjunit
|
|
||||||
testImplementation rootProject.ext.dependencies.junit
|
|
||||||
}
|
|
||||||
|
|
||||||
apply from: new File(rootProject.rootDir, "gradle/upload.gradle").toString()
|
|
||||||
@@ -1,3 +0,0 @@
|
|||||||
GROUP=com.mogo.och
|
|
||||||
POM_ARTIFACT_ID=och-bus-passenger
|
|
||||||
VERSION_CODE=1
|
|
||||||
21
OCH/bus/passenger/proguard-rules.pro
vendored
@@ -1,21 +0,0 @@
|
|||||||
# Add project specific ProGuard rules here.
|
|
||||||
# You can control the set of applied configuration files using the
|
|
||||||
# proguardFiles setting in build.gradle.
|
|
||||||
#
|
|
||||||
# For more details, see
|
|
||||||
# http://developer.android.com/guide/developing/tools/proguard.html
|
|
||||||
|
|
||||||
# If your project uses WebView with JS, uncomment the following
|
|
||||||
# and specify the fully qualified class name to the JavaScript interface
|
|
||||||
# class:
|
|
||||||
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
|
|
||||||
# public *;
|
|
||||||
#}
|
|
||||||
|
|
||||||
# Uncomment this to preserve the line number information for
|
|
||||||
# debugging stack traces.
|
|
||||||
#-keepattributes SourceFile,LineNumberTable
|
|
||||||
|
|
||||||
# If you keep the line number information, uncomment this to
|
|
||||||
# hide the original source file name.
|
|
||||||
#-renamesourcefileattribute SourceFile
|
|
||||||
@@ -1,26 +0,0 @@
|
|||||||
package com.mogo.och.bus.passenger;
|
|
||||||
|
|
||||||
import android.content.Context;
|
|
||||||
|
|
||||||
import androidx.test.platform.app.InstrumentationRegistry;
|
|
||||||
import androidx.test.ext.junit.runners.AndroidJUnit4;
|
|
||||||
|
|
||||||
import org.junit.Test;
|
|
||||||
import org.junit.runner.RunWith;
|
|
||||||
|
|
||||||
import static org.junit.Assert.*;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Instrumented test, which will execute on an Android device.
|
|
||||||
*
|
|
||||||
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
|
|
||||||
*/
|
|
||||||
@RunWith(AndroidJUnit4.class)
|
|
||||||
public class ExampleInstrumentedTest {
|
|
||||||
@Test
|
|
||||||
public void useAppContext() {
|
|
||||||
// Context of the app under test.
|
|
||||||
Context appContext = InstrumentationRegistry.getInstrumentation().getTargetContext();
|
|
||||||
assertEquals("com.mogo.och.bus.passenger.test", appContext.getPackageName());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,5 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
|
||||||
package="com.mogo.och.bus.passenger">
|
|
||||||
|
|
||||||
</manifest>
|
|
||||||
@@ -1,72 +0,0 @@
|
|||||||
package com.mogo.och.bus.passenger
|
|
||||||
|
|
||||||
import android.content.Context
|
|
||||||
import android.view.View
|
|
||||||
import androidx.fragment.app.Fragment
|
|
||||||
import com.alibaba.android.arouter.facade.annotation.Route
|
|
||||||
import com.mogo.eagle.core.data.config.FunctionBuildConfig
|
|
||||||
import com.mogo.eagle.core.utilcode.mogo.AppIdentityModeUtils
|
|
||||||
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.ActivityUtils
|
|
||||||
import com.mogo.eagle.core.utilcode.util.DeviceUtils
|
|
||||||
import com.mogo.eagle.core.utilcode.util.MultiDisplayUtils
|
|
||||||
import com.mogo.och.bus.passenger.passenger.ui.PM2BaseFragment
|
|
||||||
import com.mogo.och.bus.passenger.passenger.ui.widget.M2StatusBarView
|
|
||||||
import com.mogo.och.bus.passenger.ui.BusPStatusBarView
|
|
||||||
import com.mogo.och.bus.passenger.ui.BusPassengerRouteFragment
|
|
||||||
import com.mogo.och.common.module.constant.OchCommonConst
|
|
||||||
import com.mogo.och.common.module.biz.provider.CommonServiceImpl
|
|
||||||
import com.mogo.och.common.module.wigets.media.MediaPlayerActivity
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 网约车-Bus-乘客端
|
|
||||||
*
|
|
||||||
* Created on 2022/3/29
|
|
||||||
*/
|
|
||||||
@Route(path = OchCommonConst.BUS_PASSENGER)
|
|
||||||
class BusPassengerProvider : CommonServiceImpl() {
|
|
||||||
|
|
||||||
private val tag = BusPassengerProvider::class.java.simpleName
|
|
||||||
|
|
||||||
private var mPM2Fragment: Fragment?=null
|
|
||||||
|
|
||||||
override fun getFragment(): Fragment {
|
|
||||||
if (AppIdentityModeUtils.isB1(FunctionBuildConfig.appIdentityMode) && DeviceUtils.isEB5Model()) {
|
|
||||||
MultiDisplayUtils.startActWithSecond(ActivityUtils.getTopActivity(), MediaPlayerActivity::class.java)
|
|
||||||
}
|
|
||||||
if(mPM2Fragment==null){
|
|
||||||
mPM2Fragment = if (AppIdentityModeUtils.isB2(FunctionBuildConfig.appIdentityMode)) {
|
|
||||||
PM2BaseFragment()
|
|
||||||
} else if (AppIdentityModeUtils.isB1(FunctionBuildConfig.appIdentityMode)) {
|
|
||||||
BusPassengerRouteFragment()
|
|
||||||
} else {
|
|
||||||
BusPassengerRouteFragment()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return mPM2Fragment!!
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun resetFragment() {
|
|
||||||
super.resetFragment()
|
|
||||||
mPM2Fragment = null
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun getStatusBarView(context: Context): View {
|
|
||||||
if(statusBarView==null) {
|
|
||||||
statusBarView = if (AppIdentityModeUtils.isB2(FunctionBuildConfig.appIdentityMode)) {
|
|
||||||
M2StatusBarView(context)
|
|
||||||
} else if (AppIdentityModeUtils.isB1(FunctionBuildConfig.appIdentityMode)) {
|
|
||||||
BusPStatusBarView(context)
|
|
||||||
} else{
|
|
||||||
BusPStatusBarView(context)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return statusBarView!!
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun init(context: Context) {
|
|
||||||
CallerLogger.d(SceneConstant.M_TAXI_P + tag, "init")
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,21 +0,0 @@
|
|||||||
package com.mogo.och.bus.passenger.bean;
|
|
||||||
|
|
||||||
import com.mogo.eagle.core.data.BaseData;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author congtaowang
|
|
||||||
* @since 2021/3/22
|
|
||||||
*
|
|
||||||
* 小巴车运营状态返回参数
|
|
||||||
*/
|
|
||||||
public class BusPassengerOperationStatusResponse extends BaseData {
|
|
||||||
|
|
||||||
public Result data;
|
|
||||||
|
|
||||||
public static class Result {
|
|
||||||
private String sn; //司机屏sn
|
|
||||||
private String phone; //司机手机号
|
|
||||||
public String plateNumber; //车牌号
|
|
||||||
public int driverStatus;//0:已收车,1:已出车
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,16 +0,0 @@
|
|||||||
package com.mogo.och.bus.passenger.bean;
|
|
||||||
|
|
||||||
public
|
|
||||||
/**
|
|
||||||
* @author congtaowang
|
|
||||||
* @since 2021/3/22
|
|
||||||
*
|
|
||||||
* 根据车机行驶线路站点信息
|
|
||||||
*/
|
|
||||||
class BusPassengerQueryLineRequest {
|
|
||||||
|
|
||||||
private String sn;
|
|
||||||
public BusPassengerQueryLineRequest(String sn) {
|
|
||||||
this.sn = sn;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,29 +0,0 @@
|
|||||||
package com.mogo.och.bus.passenger.bean;
|
|
||||||
|
|
||||||
import com.mogo.eagle.core.data.BaseData;
|
|
||||||
import com.mogo.och.data.bean.BusRoutesResult;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 网约车小巴路线接口请求响应结果 返回的是对应司机屏的线路信息
|
|
||||||
*
|
|
||||||
* @author tongchenfei
|
|
||||||
*/
|
|
||||||
public class PM2RoutesResponse extends BaseData {
|
|
||||||
private BusRoutesResult data;
|
|
||||||
|
|
||||||
public BusRoutesResult getResult() {
|
|
||||||
return data;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setResult(BusRoutesResult data) {
|
|
||||||
this.data = data;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String toString() {
|
|
||||||
return "OchBusRoutesResponse{" +
|
|
||||||
"data=" + data +
|
|
||||||
'}';
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,16 +0,0 @@
|
|||||||
package com.mogo.och.bus.passenger.bean
|
|
||||||
|
|
||||||
import com.mogo.eagle.core.data.BaseData
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 网约车小巴路线接口请求响应结果 返回的是对应司机屏的线路信息
|
|
||||||
*
|
|
||||||
* @author tongchenfei
|
|
||||||
*/
|
|
||||||
data class ResponseSiteIntroduce(val data: MutableList<SiteIntroduceInfo>?) : BaseData(){
|
|
||||||
|
|
||||||
data class SiteIntroduceInfo(val siteId:Long,val introduceList:MutableList<IntroduceInfo>)
|
|
||||||
|
|
||||||
data class IntroduceInfo(val type:Int,val url :String,val seq:Int)
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,11 +0,0 @@
|
|||||||
package com.mogo.och.bus.passenger.callback;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Created on 2022/3/31
|
|
||||||
*
|
|
||||||
* Model->Presenter回调:ADAS相关(自动驾驶状态回调,到达终点等等)
|
|
||||||
*/
|
|
||||||
public interface IAutopilotStatusCallback {
|
|
||||||
|
|
||||||
void updateAutoStatus(boolean isOpen);
|
|
||||||
}
|
|
||||||
@@ -1,9 +0,0 @@
|
|||||||
package com.mogo.och.bus.passenger.callback;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author: wangmingjun
|
|
||||||
* @date: 2021/10/22
|
|
||||||
*/
|
|
||||||
public interface IBusPassegerDriverStatusCallback {
|
|
||||||
void updateDriverSn(String sn);
|
|
||||||
}
|
|
||||||
@@ -1,17 +0,0 @@
|
|||||||
package com.mogo.och.bus.passenger.callback
|
|
||||||
|
|
||||||
import com.mogo.och.data.bean.BusStationBean
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author: wangmingjun
|
|
||||||
* @date: 2023/2/2
|
|
||||||
*/
|
|
||||||
interface IDrivingInfoCallback {
|
|
||||||
fun updateLine(lineName: String, lineDuring: String)
|
|
||||||
fun updateStationsInfo(stations: MutableList<BusStationBean>, currentStationIndex: Int, isArrived: Boolean)
|
|
||||||
fun updateRemainMT(meters : Long, timeInSecond : Long) // 米,秒
|
|
||||||
fun changeOperationStatus(loginStatus : Boolean)
|
|
||||||
|
|
||||||
fun showNoTaskView();
|
|
||||||
fun hideNoTaskView();
|
|
||||||
}
|
|
||||||
@@ -1,12 +0,0 @@
|
|||||||
package com.mogo.och.bus.passenger.callback;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Created on 2022/3/31
|
|
||||||
*
|
|
||||||
* Model->Presenter回调:状态控制器监听(accOn、adas ui show、voice ui show、push ui show、v2x ui show等等)
|
|
||||||
*/
|
|
||||||
public interface ISpeedCallback {
|
|
||||||
|
|
||||||
// 自车定位
|
|
||||||
void onCarLocationChanged(float location);
|
|
||||||
}
|
|
||||||
@@ -1,35 +0,0 @@
|
|||||||
package com.mogo.och.bus.passenger.constant
|
|
||||||
|
|
||||||
import com.mogo.commons.debug.DebugConfig
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Created on 2021/12/6
|
|
||||||
*/
|
|
||||||
class BusPassengerConst {
|
|
||||||
companion object {
|
|
||||||
|
|
||||||
// 轮询line
|
|
||||||
const val LOOP_LINE_2S = 2 * 1000L
|
|
||||||
const val LOOP_LINE_1S = 1 * 1000L
|
|
||||||
const val LOOP_DELAY = 100L
|
|
||||||
|
|
||||||
// 无状态
|
|
||||||
const val STATION_STATUS_IDLE = 0
|
|
||||||
// 已过站(历史站)
|
|
||||||
const val STATION_STATUS_LEAVING = 1
|
|
||||||
// 到站(当前站)
|
|
||||||
const val STATION_STATUS_STOPPED = 2
|
|
||||||
// 未到站(未到站)
|
|
||||||
const val STATION_STATUS_ARRIVING = 3
|
|
||||||
|
|
||||||
//bus平均速度 bus的平均里程:25km/h
|
|
||||||
const val BUS_AVERAGE_SPEED = 25
|
|
||||||
//接驳/B2平均速度 bus的平均里程:10km/h
|
|
||||||
const val SHUTTLE_AVERAGE_SPEED = 10
|
|
||||||
|
|
||||||
// 订单总里程
|
|
||||||
const val BUS_SP_KEY_ORDER_SUM_DIS = "BUS_SP_KEY_ORDER_SUM_DIS"
|
|
||||||
|
|
||||||
const val QUERY_BUS_P_STATION_DELAY = 3 * 1000L
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,494 +0,0 @@
|
|||||||
package com.mogo.och.bus.passenger.model
|
|
||||||
|
|
||||||
import android.annotation.SuppressLint
|
|
||||||
import android.content.Context
|
|
||||||
import com.mogo.commons.env.ProjectUtils
|
|
||||||
import com.mogo.eagle.core.data.autopilot.AutopilotControlParameters
|
|
||||||
import com.mogo.eagle.core.data.config.FunctionBuildConfig
|
|
||||||
import com.mogo.eagle.core.data.map.MogoLocation
|
|
||||||
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotStatusListener
|
|
||||||
import com.mogo.eagle.core.function.api.autopilot.IMoGoChassisLocationGCJ02Listener
|
|
||||||
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListenerManager
|
|
||||||
import com.mogo.eagle.core.function.call.telematic.CallerTelematicListenerManager
|
|
||||||
import com.mogo.eagle.core.network.utils.GsonUtil
|
|
||||||
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.GsonUtils
|
|
||||||
import com.mogo.och.bus.passenger.bean.PM2RoutesResponse
|
|
||||||
import com.mogo.och.bus.passenger.bean.ResponseSiteIntroduce
|
|
||||||
import com.mogo.och.bus.passenger.callback.IAutopilotStatusCallback
|
|
||||||
import com.mogo.och.bus.passenger.callback.IBusPassegerDriverStatusCallback
|
|
||||||
import com.mogo.och.bus.passenger.callback.IDrivingInfoCallback
|
|
||||||
import com.mogo.och.bus.passenger.callback.ISpeedCallback
|
|
||||||
import com.mogo.och.bus.passenger.constant.BusPassengerConst
|
|
||||||
import com.mogo.och.bus.passenger.network.BusPassengerServiceManager
|
|
||||||
import com.mogo.och.common.module.biz.lansocket.IOchLanPassengerStatusListener
|
|
||||||
import com.mogo.och.common.module.biz.lansocket.LoginLanPassengerSocket
|
|
||||||
import com.mogo.och.common.module.biz.login.ILoginCallback
|
|
||||||
import com.mogo.och.common.module.biz.login.LoginStatusEnum
|
|
||||||
import com.mogo.och.common.module.biz.login.LoginStatusManager
|
|
||||||
import com.mogo.och.common.module.biz.login.OpenOrderStatusEnum
|
|
||||||
import com.mogo.och.common.module.biz.media.MediaManager
|
|
||||||
import com.mogo.och.common.module.manager.autopilot.autopilot.IOchAutopilotStatusListener
|
|
||||||
import com.mogo.och.common.module.manager.autopilot.autopilot.OchAutoPilotStatusListenerManager
|
|
||||||
import com.mogo.och.common.module.manager.autopilot.location.OchLocationManager
|
|
||||||
import com.mogo.och.common.module.manager.distance.IDistanceListener
|
|
||||||
import com.mogo.och.common.module.manager.distance.TrajectoryAndDistanceManager
|
|
||||||
import com.mogo.och.common.module.manager.logchainanalytic.OchChainLogManager
|
|
||||||
import com.mogo.och.common.module.manager.download.DownloadManager
|
|
||||||
import com.mogo.och.common.module.manager.loop.BizLoopManager
|
|
||||||
import com.mogo.och.common.module.manager.loop.LoopInfo
|
|
||||||
import com.mogo.och.common.module.manager.socket.cloud.AbnormalFactorsLoopManager
|
|
||||||
import com.mogo.och.common.module.manager.socket.lan.ILanMessageListener
|
|
||||||
import com.mogo.och.common.module.manager.socket.lan.LanSocketManager
|
|
||||||
import com.mogo.och.common.module.manager.socket.lan.bean.BusinessType
|
|
||||||
import com.mogo.och.common.module.manager.socket.lan.bean.DPMsgType
|
|
||||||
import com.mogo.och.common.module.manager.socket.lan.bean.TaskDetailsMsg
|
|
||||||
import com.mogo.och.common.module.network.OchCommonServiceCallback
|
|
||||||
import com.mogo.och.common.module.utils.OCHThreadPoolManager
|
|
||||||
import com.mogo.och.common.module.utils.PinYinUtil
|
|
||||||
import com.mogo.och.common.module.wigets.media.MediaItem
|
|
||||||
import com.mogo.och.data.bean.BusRoutesResult
|
|
||||||
import com.mogo.och.data.bean.BusStationBean
|
|
||||||
import com.mogo.och.data.bean.BusTransferData
|
|
||||||
|
|
||||||
@SuppressLint("StaticFieldLeak")
|
|
||||||
object OrderModel {
|
|
||||||
|
|
||||||
private val TAG = OrderModel::class.java.simpleName
|
|
||||||
|
|
||||||
private val TAG_LOOP_QUERY_BIND_LINE = "${TAG}_TAG_LOOP_QUERY_BIND_LINE"
|
|
||||||
|
|
||||||
private var mContext: Context? = null
|
|
||||||
|
|
||||||
private var routesResult: BusRoutesResult? = null
|
|
||||||
private var mNextStationIndex = 0 // A-B要到达站的index
|
|
||||||
|
|
||||||
|
|
||||||
var mDrivingInfoCallback: IDrivingInfoCallback? = null //行程信息
|
|
||||||
var mADASStatusCallback: IAutopilotStatusCallback? = null//Model->Presenter:自动驾驶状态相关
|
|
||||||
var mSpeedCallback: ISpeedCallback? = null //行程信息
|
|
||||||
var mDriverStatusCallback: IBusPassegerDriverStatusCallback? = null //出车收车状态
|
|
||||||
|
|
||||||
fun init(context: Context){
|
|
||||||
mContext = context
|
|
||||||
initListeners()
|
|
||||||
queryDriverByLocalDriver()
|
|
||||||
queryDriverOperationStatus()
|
|
||||||
BizLoopManager.setLoopFunction(
|
|
||||||
TAG_LOOP_QUERY_BIND_LINE,
|
|
||||||
LoopInfo(2, ::queryDriverSiteByCoordinate)
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun initListeners() {
|
|
||||||
//自动驾驶状态监听
|
|
||||||
OchAutoPilotStatusListenerManager.addListener(TAG, mGoAutopilotStatusListener)
|
|
||||||
// 定位监听
|
|
||||||
OchLocationManager.addGCJ02Listener(TAG, 3, mMapLocationListener)
|
|
||||||
// 距离终点站距离监听
|
|
||||||
TrajectoryAndDistanceManager.addDistanceListener(TAG, trajectoryListener)
|
|
||||||
AbnormalFactorsLoopManager.startLoopAbnormalFactors(mContext!!)
|
|
||||||
//司乘屏通信监听
|
|
||||||
LanSocketManager.registerSocketMessageListener(DPMsgType.TYPE_COMMON.type,LanSocketManager.commonListener)
|
|
||||||
LanSocketManager.registerSocketMessageListener(DPMsgType.TYPE_TASK_DETAILS.type,taskDetailsMsgListener)
|
|
||||||
LoginLanPassengerSocket.addListener(TAG,driverSnListener)
|
|
||||||
}
|
|
||||||
|
|
||||||
fun releaseListeners(){
|
|
||||||
//自动驾驶状态监听
|
|
||||||
OchAutoPilotStatusListenerManager.removeListener(mGoAutopilotStatusListener)
|
|
||||||
// 注销定位监听
|
|
||||||
OchLocationManager.removeGCJ02Listener(TAG)
|
|
||||||
// 距离终点站距离监听
|
|
||||||
TrajectoryAndDistanceManager.removeListener(TAG)
|
|
||||||
|
|
||||||
AbnormalFactorsLoopManager.stopLoopAbnormalFactors()
|
|
||||||
CallerTelematicListenerManager.removeListener(TAG)
|
|
||||||
BizLoopManager.removeLoopFunction(TAG_LOOP_QUERY_BIND_LINE)
|
|
||||||
LanSocketManager.unRegisterSocketMessageListener(DPMsgType.TYPE_COMMON.type,LanSocketManager.commonListener)
|
|
||||||
LanSocketManager.unRegisterSocketMessageListener(DPMsgType.TYPE_TASK_DETAILS.type,taskDetailsMsgListener)
|
|
||||||
LoginLanPassengerSocket.removeListener(TAG)
|
|
||||||
|
|
||||||
cleanStation("release")
|
|
||||||
}
|
|
||||||
|
|
||||||
fun setDrivingInfoCallback(drivingInfoCallback: IDrivingInfoCallback?) {
|
|
||||||
mDrivingInfoCallback = drivingInfoCallback
|
|
||||||
}
|
|
||||||
|
|
||||||
fun setADASStatusCallback(callback: IAutopilotStatusCallback?) {
|
|
||||||
mADASStatusCallback = callback
|
|
||||||
}
|
|
||||||
|
|
||||||
fun setSpeedCallback(mSpeedCallback: ISpeedCallback?) {
|
|
||||||
this.mSpeedCallback = mSpeedCallback
|
|
||||||
}
|
|
||||||
|
|
||||||
fun setDriverStatusCallback(callback: IBusPassegerDriverStatusCallback?) {
|
|
||||||
mDriverStatusCallback = callback
|
|
||||||
}
|
|
||||||
|
|
||||||
private val mGoAutopilotStatusListener: IOchAutopilotStatusListener =
|
|
||||||
object : IOchAutopilotStatusListener {
|
|
||||||
override fun onAutopilotStatusResponse(state: Int) {
|
|
||||||
if (IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_RUNNING != state) {
|
|
||||||
//美化模式下且行程中
|
|
||||||
if (FunctionBuildConfig.isDemoMode && routesResult !=null
|
|
||||||
) {
|
|
||||||
mADASStatusCallback?.updateAutoStatus(true)
|
|
||||||
} else {//非美化模式下
|
|
||||||
mADASStatusCallback?.updateAutoStatus(false)
|
|
||||||
}
|
|
||||||
} else {//自驾状态 2
|
|
||||||
mADASStatusCallback?.updateAutoStatus(true)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private val mMapLocationListener: IMoGoChassisLocationGCJ02Listener =
|
|
||||||
object : IMoGoChassisLocationGCJ02Listener {
|
|
||||||
override fun onChassisLocationGCJ02(mogoLocation: MogoLocation?) {
|
|
||||||
if (null == mogoLocation) return
|
|
||||||
OCHThreadPoolManager.getsInstance().locationExecute {
|
|
||||||
mSpeedCallback?.onCarLocationChanged(mogoLocation.gnssSpeed)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private val trajectoryListener: IDistanceListener = object : IDistanceListener {
|
|
||||||
override fun distanceCallback(distance: Float) {
|
|
||||||
val lastTime = distance / BusPassengerConst.BUS_AVERAGE_SPEED * 3.6 //秒
|
|
||||||
CallerLogger.d(
|
|
||||||
SceneConstant.M_BUS_P + TAG,
|
|
||||||
"轨迹排查==lastSumLength = $distance"
|
|
||||||
)
|
|
||||||
if (routesResult != null) {
|
|
||||||
for (site in routesResult!!.sites) {
|
|
||||||
if (site.drivingStatus == BusPassengerConst.STATION_STATUS_STOPPED && !site.isLeaving) {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
mDrivingInfoCallback?.updateRemainMT(distance.toLong(), lastTime.toLong())
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private val taskDetailsMsgListener = object : ILanMessageListener<TaskDetailsMsg> {
|
|
||||||
override fun targetLan(): Class<TaskDetailsMsg> {
|
|
||||||
return TaskDetailsMsg::class.java
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onLanMsgReceived(taskDetailsMsg: TaskDetailsMsg?) {
|
|
||||||
taskDetailsMsg?.let {
|
|
||||||
if (it.msg?.isEmpty() == true){
|
|
||||||
clearLocalRouteResult()
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
val result = GsonUtils.fromJson(it.msg, BusTransferData::class.java)
|
|
||||||
mDrivingInfoCallback?.changeOperationStatus(result.loginStatus == 1)
|
|
||||||
if (result != null && result.routesResult == null) {
|
|
||||||
clearLocalRouteResult()
|
|
||||||
}
|
|
||||||
if (routesResult == null ||
|
|
||||||
(result != null && result.routesResult?.writeVersion!! > routesResult!!.writeVersion)
|
|
||||||
) { //已司机端传来的为准
|
|
||||||
routesResult = result.routesResult
|
|
||||||
updatePassengerRouteInfo(routesResult)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
private val driverSnListener = object :IOchLanPassengerStatusListener{
|
|
||||||
override fun onDriverSnChagneListner(sn: String?) {
|
|
||||||
CallerLogger.d(
|
|
||||||
SceneConstant.M_BUS_P + TAG,
|
|
||||||
"onReceivedServerSn = $sn"
|
|
||||||
)
|
|
||||||
mDriverStatusCallback?.updateDriverSn(sn)
|
|
||||||
sn?.let {
|
|
||||||
querySiteIntroduce()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
fun queryDriverByLocalDriver() {
|
|
||||||
//本地去请求司机端
|
|
||||||
val msg = TaskDetailsMsg("task", BusinessType.bus)
|
|
||||||
LanSocketManager.sendMsgToServer(msg)
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun querySiteIntroduce(){
|
|
||||||
mContext?.let {
|
|
||||||
if (ProjectUtils.isSaas()) {
|
|
||||||
BusPassengerServiceManager.querySiteIntroduceBySn(it,object : OchCommonServiceCallback<ResponseSiteIntroduce>{
|
|
||||||
override fun onSuccess(response: ResponseSiteIntroduce?) {
|
|
||||||
response?.let {response->
|
|
||||||
downloadSiteIntroduce(response)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onFail(code: Int, msg: String?) {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun downloadSiteIntroduce(response: ResponseSiteIntroduce) {
|
|
||||||
response.data?.forEach {siteIntroduceInfo ->
|
|
||||||
siteIntroduceInfo.introduceList.forEach {introduceInfo ->
|
|
||||||
DownloadManager.downloadVideoFile(introduceInfo.url,null)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
private fun queryDriverOperationStatus() {
|
|
||||||
LoginStatusManager.addListener(TAG,object: ILoginCallback{
|
|
||||||
override fun onStatusChange(currentStatus: LoginStatusEnum?) {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onOpenOrderStatusEnumChange(businessEnum: OpenOrderStatusEnum?) {
|
|
||||||
when (businessEnum) {
|
|
||||||
OpenOrderStatusEnum.Ordering -> {
|
|
||||||
mDrivingInfoCallback?.changeOperationStatus(true)
|
|
||||||
}
|
|
||||||
else -> {
|
|
||||||
mDrivingInfoCallback?.changeOperationStatus(false)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onLoginErrorInfo(code: Int, msg: String?) {
|
|
||||||
super.onLoginErrorInfo(code, msg)
|
|
||||||
if(code==-10012){// 网络错误
|
|
||||||
queryDriverByLocalDriver()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun queryDriverSiteByCoordinate() {
|
|
||||||
mContext?.let {
|
|
||||||
BusPassengerServiceManager.queryDriverSiteByCoordinate(it,
|
|
||||||
object : OchCommonServiceCallback<PM2RoutesResponse> {
|
|
||||||
override fun onSuccess(data: PM2RoutesResponse?) {
|
|
||||||
if (data == null || data.result == null) {
|
|
||||||
CallerLogger.d(
|
|
||||||
SceneConstant.M_BUS_P + TAG,
|
|
||||||
"order = queryDriverSiteByCoordinate = null"
|
|
||||||
)
|
|
||||||
clearLocalRouteResult()
|
|
||||||
return
|
|
||||||
}
|
|
||||||
if (data.result != null && routesResult != null && data.result.equals(
|
|
||||||
routesResult
|
|
||||||
)) {
|
|
||||||
CallerLogger.d(
|
|
||||||
SceneConstant.M_BUS_P + TAG,
|
|
||||||
"order = queryDriverSiteByCoordinate = not update"
|
|
||||||
)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
OchChainLogManager.writeChainLog("订单信息流转","$data");
|
|
||||||
|
|
||||||
if (routesResult != null &&
|
|
||||||
routesResult!!.writeVersion < data.result.writeVersion
|
|
||||||
) {
|
|
||||||
routesResult = data.result
|
|
||||||
}
|
|
||||||
|
|
||||||
if (routesResult == null) {
|
|
||||||
routesResult = data.result
|
|
||||||
}
|
|
||||||
|
|
||||||
updatePassengerRouteInfo(data.result)
|
|
||||||
}
|
|
||||||
override fun onError() {
|
|
||||||
CallerLogger.d(
|
|
||||||
SceneConstant.M_BUS_P + TAG,
|
|
||||||
"queryDriverSiteByCoordinate = onError = sn = " + LoginLanPassengerSocket.driverSn
|
|
||||||
)
|
|
||||||
queryDriverByLocalDriver()
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onFail(code: Int, msg: String) {
|
|
||||||
CallerLogger.d(
|
|
||||||
SceneConstant.M_BUS_P + TAG,
|
|
||||||
"queryDriverSiteByCoordinate = $msg sn = ${LoginLanPassengerSocket.driverSn}"
|
|
||||||
)
|
|
||||||
if (code == 1003) {
|
|
||||||
LoginStatusManager.queryLoginStatusByNet()
|
|
||||||
cleanStation("queryDriverSiteByCoordinate 1003")
|
|
||||||
}
|
|
||||||
if (LoginLanPassengerSocket.driverSn.isEmpty()) {
|
|
||||||
//此处拦截是为了防止过程中乘客屏和司机端断连,拿不到司机端sn, 造成请求失败去刷新了界面
|
|
||||||
return
|
|
||||||
}
|
|
||||||
if (code == 1003) {
|
|
||||||
routesResult = null
|
|
||||||
cleanStation("queryDriverSiteByCoordinate 1003")
|
|
||||||
return
|
|
||||||
}
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun setTrajectoryStation(
|
|
||||||
startStationInfo: BusStationBean,
|
|
||||||
endStationInfo: BusStationBean,
|
|
||||||
lineId: Int
|
|
||||||
) {
|
|
||||||
val startStation = MogoLocation()
|
|
||||||
startStation.longitude = startStationInfo.gcjLon
|
|
||||||
startStation.latitude = startStationInfo.gcjLat
|
|
||||||
val endStation = MogoLocation()
|
|
||||||
endStation.longitude = endStationInfo.gcjLon
|
|
||||||
endStation.latitude = endStationInfo.gcjLat
|
|
||||||
TrajectoryAndDistanceManager.setStationPoint(startStation, endStation, lineId.toLong())
|
|
||||||
val introductionList = mutableListOf<MediaItem>()
|
|
||||||
endStationInfo.videoList.forEach {
|
|
||||||
if(it.type==1) {
|
|
||||||
introductionList.add(MediaItem(MediaItem.PrioritySite, it.url,MediaItem.MEDIA_TYPE_VIDEO,"",""))
|
|
||||||
}
|
|
||||||
}
|
|
||||||
MediaManager.postSiteIntroduceInfo(introductionList)
|
|
||||||
}
|
|
||||||
|
|
||||||
fun cleanStation(type: String) {
|
|
||||||
CallerLogger.d(SceneConstant.M_BUS_P + TAG, "清理站点 $type")
|
|
||||||
TrajectoryAndDistanceManager.setStationPoint(null, null, -1L)
|
|
||||||
}
|
|
||||||
|
|
||||||
fun clearLocalRouteResult() {
|
|
||||||
routesResult = null
|
|
||||||
mNextStationIndex = 0
|
|
||||||
cleanStation("queryDriverSiteByCoordinate")
|
|
||||||
mDrivingInfoCallback?.showNoTaskView()
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun updateAutopilotControlParameters(
|
|
||||||
busRoutesResult: BusRoutesResult,
|
|
||||||
leaveIndex: Int
|
|
||||||
) {
|
|
||||||
val parameters = initAutopilotControlParameters(busRoutesResult, leaveIndex)
|
|
||||||
if (null == parameters) {
|
|
||||||
CallerLogger.e(SceneConstant.M_BUS_P + TAG, "AutopilotControlParameters is empty.")
|
|
||||||
return
|
|
||||||
}
|
|
||||||
CallerLogger.d(SceneConstant.M_BUS_P + TAG, "AutopilotControlParameters is update.")
|
|
||||||
CallerAutoPilotStatusListenerManager.updateAutopilotControlParameters(parameters)
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun initAutopilotControlParameters(
|
|
||||||
busRoutesResult: BusRoutesResult,
|
|
||||||
leaveIndex: Int
|
|
||||||
): AutopilotControlParameters? {
|
|
||||||
if (busRoutesResult.sites == null) {
|
|
||||||
return null
|
|
||||||
}
|
|
||||||
val stations = busRoutesResult.sites
|
|
||||||
if (leaveIndex + 1 > stations.size - 1) {
|
|
||||||
CallerLogger.e(SceneConstant.M_BUS_P + TAG, "行程日志-mismatch condition1.")
|
|
||||||
return null
|
|
||||||
}
|
|
||||||
val currentStation = stations[leaveIndex]
|
|
||||||
val nextStation = stations[leaveIndex + 1]
|
|
||||||
val parameters = AutopilotControlParameters()
|
|
||||||
parameters.routeID = busRoutesResult.lineId
|
|
||||||
parameters.routeName = busRoutesResult.name
|
|
||||||
parameters.startName = PinYinUtil.getPinYinHeadChar(currentStation.name)
|
|
||||||
parameters.endName = PinYinUtil.getPinYinHeadChar(nextStation.name)
|
|
||||||
parameters.startLatLon =
|
|
||||||
AutopilotControlParameters.AutoPilotLonLat(currentStation.lat, currentStation.lon)
|
|
||||||
parameters.endLatLon =
|
|
||||||
AutopilotControlParameters.AutoPilotLonLat(nextStation.lat, nextStation.lon)
|
|
||||||
parameters.vehicleType = 10
|
|
||||||
if (parameters.autoPilotLine == null) {
|
|
||||||
parameters.autoPilotLine = AutopilotControlParameters.AutoPilotLine(
|
|
||||||
busRoutesResult.lineId.toLong(), busRoutesResult.name,
|
|
||||||
busRoutesResult.csvFileUrl, busRoutesResult.csvFileMd5,
|
|
||||||
busRoutesResult.txtFileUrl, busRoutesResult.txtFileMd5,
|
|
||||||
busRoutesResult.contrailSaveTime, busRoutesResult.carModel,
|
|
||||||
busRoutesResult.csvFileUrlDPQP, busRoutesResult.csvFileMd5DPQP,
|
|
||||||
busRoutesResult.txtFileUrlDPQP, busRoutesResult.txtFileMd5DPQP,
|
|
||||||
busRoutesResult.contrailSaveTimeDPQP
|
|
||||||
)
|
|
||||||
}
|
|
||||||
return parameters
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
private fun clearAutopilotControlParameters() {
|
|
||||||
CallerLogger.d(SceneConstant.M_BUS_P + TAG, "AutopilotControlParameters is clear.")
|
|
||||||
CallerAutoPilotStatusListenerManager.updateAutopilotControlParameters(null)
|
|
||||||
}
|
|
||||||
|
|
||||||
fun updatePassengerRouteInfo(result: BusRoutesResult?) {
|
|
||||||
if (result == null) {
|
|
||||||
clearLocalRouteResult()
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
CallerLogger.d(SceneConstant.M_BUS_P + TAG, "queryDriverSiteByCoordinate= update")
|
|
||||||
routesResult = result
|
|
||||||
|
|
||||||
CallerLogger.d(SceneConstant.M_BUS_P + TAG, "order = BusPassengerRoutesResult= " + GsonUtil.jsonFromObject(result))
|
|
||||||
mDrivingInfoCallback?.updateLine(result.name, result.runningDur)
|
|
||||||
if (result.sites != null) {
|
|
||||||
mDrivingInfoCallback?.hideNoTaskView()
|
|
||||||
|
|
||||||
val stations = result.sites
|
|
||||||
for (i in stations.indices) {
|
|
||||||
val station = stations[i]
|
|
||||||
if (station.drivingStatus == BusPassengerConst.STATION_STATUS_STOPPED && station.isLeaving && i + 1 < stations.size) { //离站
|
|
||||||
CallerLogger.d(
|
|
||||||
SceneConstant.M_BUS_P + TAG,
|
|
||||||
"order = station= leave"
|
|
||||||
)
|
|
||||||
mDrivingInfoCallback?.updateStationsInfo(stations, i + 1, false)
|
|
||||||
CallerLogger.d(
|
|
||||||
SceneConstant.M_BUS_P + TAG,
|
|
||||||
"och-rotting--mNextStationIndex = $mNextStationIndex , i = $i"
|
|
||||||
)
|
|
||||||
CallerLogger.d(
|
|
||||||
SceneConstant.M_BUS_P + TAG,
|
|
||||||
"och-rotting--start "
|
|
||||||
)
|
|
||||||
mNextStationIndex = i + 1
|
|
||||||
val startStation = stations[i]
|
|
||||||
val endStation = stations[i + 1]
|
|
||||||
setTrajectoryStation(startStation, endStation, result.lineId)
|
|
||||||
updateAutopilotControlParameters(result, i)
|
|
||||||
return
|
|
||||||
} else if (station.drivingStatus == BusPassengerConst.STATION_STATUS_STOPPED && !station.isLeaving) { //到站
|
|
||||||
CallerLogger.d(
|
|
||||||
SceneConstant.M_BUS_P + TAG,
|
|
||||||
"och-rotting--mNextStationIndex = $mNextStationIndex , i = $i"
|
|
||||||
)
|
|
||||||
CallerLogger.d(SceneConstant.M_BUS_P + TAG, "och-rotting--arrived ")
|
|
||||||
if (i == stations.size - 1) {
|
|
||||||
cleanStation("updatePassengerRouteInfo最后一个站点")
|
|
||||||
}
|
|
||||||
|
|
||||||
TrajectoryAndDistanceManager.suspendCalculate()
|
|
||||||
|
|
||||||
CallerLogger.d(SceneConstant.M_BUS_P + TAG, "order = station= arrive")
|
|
||||||
|
|
||||||
mDrivingInfoCallback?.updateStationsInfo(stations, i, true)
|
|
||||||
clearAutopilotControlParameters()
|
|
||||||
return
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,71 +0,0 @@
|
|||||||
package com.mogo.och.bus.passenger.network
|
|
||||||
|
|
||||||
import android.content.Context
|
|
||||||
import com.mogo.eagle.core.function.call.telematic.CallerTelematicManager.getServerToken
|
|
||||||
import com.mogo.och.bus.passenger.bean.PM2RoutesResponse
|
|
||||||
import com.mogo.cloud.passport.MoGoAiCloudClientConfig
|
|
||||||
import com.mogo.commons.debug.DebugConfig
|
|
||||||
import com.mogo.och.bus.passenger.bean.BusPassengerQueryLineRequest
|
|
||||||
import com.mogo.eagle.core.network.MoGoRetrofitFactory
|
|
||||||
import com.mogo.commons.storage.SharedPrefsMgr
|
|
||||||
import com.mogo.och.bus.passenger.bean.ResponseSiteIntroduce
|
|
||||||
import com.mogo.och.common.module.biz.lansocket.LoginLanPassengerSocket
|
|
||||||
import com.mogo.och.common.module.constant.OchCommonConst
|
|
||||||
import com.mogo.och.common.module.network.OchCommonServiceCallback
|
|
||||||
import com.mogo.och.common.module.network.OchCommonSubscribeImpl
|
|
||||||
import com.mogo.och.common.module.network.interceptor.transformTry
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Created on 2022/3/31
|
|
||||||
*/
|
|
||||||
object BusPassengerServiceManager {
|
|
||||||
|
|
||||||
private var mBusPassengerSaasServiceApi =
|
|
||||||
MoGoRetrofitFactory.getInstance(OchCommonConst.getBaseUrl()).create(PassengerSAASServiceApi::class.java)
|
|
||||||
|
|
||||||
private var mBusPassengerServiceApi =
|
|
||||||
MoGoRetrofitFactory.getInstance(OchCommonConst.getBaseUrl()).create(PassengerServiceApi::class.java)
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 查询绑定行驶的小巴车路线
|
|
||||||
* @param context
|
|
||||||
* @param callback
|
|
||||||
*/
|
|
||||||
@JvmStatic
|
|
||||||
fun queryDriverSiteByCoordinate(
|
|
||||||
context: Context, callback: OchCommonServiceCallback<PM2RoutesResponse>?
|
|
||||||
) {
|
|
||||||
if (DebugConfig.getProjectFlavor().contains("saas")){
|
|
||||||
mBusPassengerSaasServiceApi.queryDriverSiteByCoordinate(
|
|
||||||
MoGoAiCloudClientConfig.getInstance().serviceAppId,
|
|
||||||
SharedPrefsMgr.getInstance().token,
|
|
||||||
LoginLanPassengerSocket.driverSn
|
|
||||||
).transformTry()
|
|
||||||
.subscribe(OchCommonSubscribeImpl(context, callback, "queryDriverSiteByCoordinate",false))
|
|
||||||
}else{
|
|
||||||
mBusPassengerServiceApi.queryDriverSiteByCoordinate(
|
|
||||||
MoGoAiCloudClientConfig.getInstance().serviceAppId,
|
|
||||||
SharedPrefsMgr.getInstance().token,
|
|
||||||
BusPassengerQueryLineRequest(LoginLanPassengerSocket.driverSn)
|
|
||||||
).transformTry()
|
|
||||||
.subscribe(OchCommonSubscribeImpl(context, callback, "queryDriverSiteByCoordinate",false))
|
|
||||||
}
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* 查询绑定行驶的小巴车路线
|
|
||||||
* @param context
|
|
||||||
* @param callback
|
|
||||||
*/
|
|
||||||
@JvmStatic
|
|
||||||
fun querySiteIntroduceBySn(
|
|
||||||
context: Context, callback: OchCommonServiceCallback<ResponseSiteIntroduce>?
|
|
||||||
) {
|
|
||||||
mBusPassengerSaasServiceApi.querySiteIntroduceBySn(
|
|
||||||
MoGoAiCloudClientConfig.getInstance().serviceAppId,
|
|
||||||
SharedPrefsMgr.getInstance().token,
|
|
||||||
LoginLanPassengerSocket.driverSn
|
|
||||||
).transformTry()
|
|
||||||
.subscribe(OchCommonSubscribeImpl(context, callback, "querySiteIntroduceBySn"))
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,36 +0,0 @@
|
|||||||
package com.mogo.och.bus.passenger.network;
|
|
||||||
|
|
||||||
import com.mogo.och.bus.passenger.bean.PM2RoutesResponse;
|
|
||||||
import com.mogo.och.bus.passenger.bean.ResponseSiteIntroduce;
|
|
||||||
|
|
||||||
import io.reactivex.Observable;
|
|
||||||
import retrofit2.http.Body;
|
|
||||||
import retrofit2.http.GET;
|
|
||||||
import retrofit2.http.Header;
|
|
||||||
import retrofit2.http.Headers;
|
|
||||||
import retrofit2.http.POST;
|
|
||||||
import retrofit2.http.Query;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Created on 2022/3/31
|
|
||||||
*
|
|
||||||
* Bus乘客端接口定义
|
|
||||||
*/
|
|
||||||
public interface PassengerSAASServiceApi {
|
|
||||||
/**
|
|
||||||
* 查询bus司机端绑定路线
|
|
||||||
* @return 接口返回数据
|
|
||||||
*/
|
|
||||||
@Headers( {"Content-Type:application/json;charset=UTF-8"} )
|
|
||||||
@GET( "/och-bus-cabin/api/business/v1/driver/bus/lineDataWithDriver/query" )
|
|
||||||
Observable<PM2RoutesResponse> queryDriverSiteByCoordinate(@Header("appId") String appId, @Header("ticket") String ticket, @Query("sn") String sn);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 查询车辆对应站点的所有视频介绍视频
|
|
||||||
* @return 接口返回数据
|
|
||||||
*/
|
|
||||||
@Headers( {"Content-Type:application/json;charset=UTF-8"} )
|
|
||||||
@GET( "/och-bus-cabin/api/business/v1/querySiteIntroduceBySn" )
|
|
||||||
Observable<ResponseSiteIntroduce> querySiteIntroduceBySn(@Header("appId") String appId, @Header("ticket") String ticket, @Query("sn") String sn);
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,29 +0,0 @@
|
|||||||
package com.mogo.och.bus.passenger.network;
|
|
||||||
|
|
||||||
import com.mogo.och.bus.passenger.bean.BusPassengerOperationStatusResponse;
|
|
||||||
import com.mogo.och.bus.passenger.bean.BusPassengerQueryLineRequest;
|
|
||||||
import com.mogo.och.bus.passenger.bean.PM2RoutesResponse;
|
|
||||||
|
|
||||||
import io.reactivex.Observable;
|
|
||||||
import retrofit2.http.Body;
|
|
||||||
import retrofit2.http.GET;
|
|
||||||
import retrofit2.http.Header;
|
|
||||||
import retrofit2.http.Headers;
|
|
||||||
import retrofit2.http.POST;
|
|
||||||
import retrofit2.http.Query;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Created on 2022/3/31
|
|
||||||
*
|
|
||||||
* Bus乘客端接口定义
|
|
||||||
*/
|
|
||||||
public interface PassengerServiceApi {
|
|
||||||
/**
|
|
||||||
* 查询bus司机端绑定路线
|
|
||||||
* @return 接口返回数据
|
|
||||||
*/
|
|
||||||
@Headers( {"Content-Type:application/json;charset=UTF-8"} )
|
|
||||||
@POST( "/autopilot-car-hailing/line/v2/driver/bus/passenger/lineDataWithDriver/query" )
|
|
||||||
Observable<PM2RoutesResponse> queryDriverSiteByCoordinate(@Header("appId") String appId, @Header("ticket") String ticket, @Body BusPassengerQueryLineRequest request);
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,155 +0,0 @@
|
|||||||
package com.mogo.och.bus.passenger.presenter;
|
|
||||||
|
|
||||||
import static com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.M_BUS_P;
|
|
||||||
|
|
||||||
import android.os.Looper;
|
|
||||||
|
|
||||||
import androidx.annotation.NonNull;
|
|
||||||
import androidx.lifecycle.LifecycleOwner;
|
|
||||||
|
|
||||||
import com.mogo.commons.AbsMogoApplication;
|
|
||||||
import com.mogo.commons.mvp.Presenter;
|
|
||||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger;
|
|
||||||
import com.mogo.eagle.core.utilcode.util.UiThreadHandler;
|
|
||||||
import com.mogo.och.bus.passenger.callback.IBusPassegerDriverStatusCallback;
|
|
||||||
import com.mogo.och.bus.passenger.callback.IAutopilotStatusCallback;
|
|
||||||
import com.mogo.och.bus.passenger.callback.IDrivingInfoCallback;
|
|
||||||
import com.mogo.och.bus.passenger.callback.ISpeedCallback;
|
|
||||||
import com.mogo.och.bus.passenger.model.OrderModel;
|
|
||||||
import com.mogo.och.bus.passenger.ui.BusPassengerRouteFragment;
|
|
||||||
import com.mogo.och.data.bean.BusStationBean;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Created on 2022/3/31
|
|
||||||
*/
|
|
||||||
public class BaseBusPassengerPresenter extends Presenter<BusPassengerRouteFragment> implements
|
|
||||||
IAutopilotStatusCallback, ISpeedCallback, IBusPassegerDriverStatusCallback, IDrivingInfoCallback {
|
|
||||||
private static final String TAG = BaseBusPassengerPresenter.class.getSimpleName();
|
|
||||||
|
|
||||||
public BaseBusPassengerPresenter(BusPassengerRouteFragment view) {
|
|
||||||
super(view);
|
|
||||||
OrderModel.INSTANCE.init(getContext());
|
|
||||||
initListeners();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onCreate( @NonNull LifecycleOwner owner ) {
|
|
||||||
super.onCreate( owner );
|
|
||||||
CallerLogger.d( M_BUS_P + TAG, "Bus乘客端Presenter onCreate()" );
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onDestroy( @NonNull LifecycleOwner owner ) {
|
|
||||||
super.onDestroy( owner );
|
|
||||||
|
|
||||||
releaseListeners();
|
|
||||||
OrderModel.INSTANCE.releaseListeners();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void initListeners() {
|
|
||||||
OrderModel.INSTANCE.setADASStatusCallback(this);
|
|
||||||
OrderModel.INSTANCE.setSpeedCallback( this);
|
|
||||||
OrderModel.INSTANCE.setDriverStatusCallback(this);
|
|
||||||
OrderModel.INSTANCE.setDrivingInfoCallback(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void releaseListeners() {
|
|
||||||
OrderModel.INSTANCE.setADASStatusCallback(null);
|
|
||||||
OrderModel.INSTANCE.setSpeedCallback(null);
|
|
||||||
OrderModel.INSTANCE.setDriverStatusCallback(null);
|
|
||||||
OrderModel.INSTANCE.setDrivingInfoCallback(null);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void runOnUIThread( Runnable executor ) {
|
|
||||||
if ( executor == null ) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if ( Looper.myLooper() != Looper.getMainLooper() ) {
|
|
||||||
UiThreadHandler.post( executor );
|
|
||||||
} else {
|
|
||||||
executor.run();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void updateAutoStatus(boolean isOpen){
|
|
||||||
if(mView!=null) {
|
|
||||||
mView.onAutopilotStatusChanged(isOpen);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onCarLocationChanged(float speed) {
|
|
||||||
runOnUIThread(() -> {
|
|
||||||
if(mView!=null) {
|
|
||||||
mView.onCarLocationChanged(speed);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void changeOperationStatus(boolean changeStatus) {
|
|
||||||
runOnUIThread(() -> {
|
|
||||||
if(mView!=null) {
|
|
||||||
mView.changeOperationStatus(changeStatus);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void updateDriverSn(String sn) {
|
|
||||||
runOnUIThread(() -> {
|
|
||||||
if(mView!=null) {
|
|
||||||
mView.updateDriverSn(sn);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void updateLine(String lineName, String lineDurTime) {
|
|
||||||
runOnUIThread(() -> {
|
|
||||||
if(mView!=null) {
|
|
||||||
mView.updateLineInfo(lineName, lineDurTime);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void updateStationsInfo(List<BusStationBean> stations, int currentStationIndex, boolean isArrived) {
|
|
||||||
runOnUIThread(() -> {
|
|
||||||
if(mView!=null) {
|
|
||||||
mView.updateStationsInfo(stations, currentStationIndex, isArrived);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void showNoTaskView() {
|
|
||||||
runOnUIThread(() -> {
|
|
||||||
if(mView!=null) {
|
|
||||||
mView.showNoTaskView();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void hideNoTaskView() {
|
|
||||||
runOnUIThread(() -> {
|
|
||||||
if (mView != null) {
|
|
||||||
mView.hideNoTaskView();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void updateRemainMT(long meters, long timeInSecond) {
|
|
||||||
runOnUIThread(() -> {
|
|
||||||
if(mView!=null) {
|
|
||||||
mView.updateRoutePlanningToNextStation(meters, timeInSecond);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,36 +0,0 @@
|
|||||||
package com.mogo.och.bus.passenger.ui
|
|
||||||
|
|
||||||
import android.content.Context
|
|
||||||
import android.util.AttributeSet
|
|
||||||
import android.view.LayoutInflater
|
|
||||||
import com.mogo.eagle.core.function.api.devatools.IMoGoDevaToolsListener
|
|
||||||
import com.mogo.eagle.core.function.hmi.ui.widget.BlueToothView
|
|
||||||
import com.mogo.eagle.core.utilcode.util.ThreadUtils
|
|
||||||
import com.mogo.och.bus.passenger.R
|
|
||||||
import kotlinx.android.synthetic.main.p_bus_view_blue_tooth.view.blueView
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 魔戒蓝牙控件
|
|
||||||
* 放置于StatusBar右侧位置
|
|
||||||
*/
|
|
||||||
class BusPBlueToothView @JvmOverloads constructor(
|
|
||||||
context: Context,
|
|
||||||
attrs: AttributeSet? = null,
|
|
||||||
defStyleAttr: Int = 0
|
|
||||||
) : BlueToothView(context, attrs, defStyleAttr),IMoGoDevaToolsListener {
|
|
||||||
|
|
||||||
init {
|
|
||||||
LayoutInflater.from(context).inflate(R.layout.p_bus_view_blue_tooth, this, true)
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun mofangStatus(status: Boolean) {
|
|
||||||
ThreadUtils.runOnUiThread {
|
|
||||||
if (status) {
|
|
||||||
blueView.setImageResource(R.drawable.bus_p_blue_tooth_close)
|
|
||||||
} else {
|
|
||||||
blueView.setImageResource(R.drawable.bus_p_blue_tooth_open)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,70 +0,0 @@
|
|||||||
package com.mogo.och.bus.passenger.ui
|
|
||||||
|
|
||||||
import android.annotation.*
|
|
||||||
import android.content.Context
|
|
||||||
import android.util.AttributeSet
|
|
||||||
import android.view.LayoutInflater
|
|
||||||
import android.view.ViewGroup
|
|
||||||
import androidx.constraintlayout.widget.ConstraintLayout
|
|
||||||
import com.mogo.eagle.core.function.api.hmi.view.IViewControlListener
|
|
||||||
import com.mogo.eagle.core.function.api.setting.IMoGoSkinModeChangeListener
|
|
||||||
import com.mogo.eagle.core.function.call.devatools.CallerDevaToolsManager
|
|
||||||
import com.mogo.eagle.core.function.call.hmi.CallerHmiViewControlListenerManager
|
|
||||||
import com.mogo.eagle.core.function.call.setting.CallerSkinModeListenerManager
|
|
||||||
import com.mogo.eagle.core.utilcode.kotlin.*
|
|
||||||
import com.mogo.eagle.core.utilcode.util.AppUtils
|
|
||||||
import com.mogo.och.bus.passenger.R
|
|
||||||
import kotlinx.android.synthetic.main.p_bus_view_status_bar.view.tv_bus_b1_p_version
|
|
||||||
import kotlinx.coroutines.*
|
|
||||||
import me.jessyan.autosize.utils.AutoSizeUtils
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author: wangmingjun
|
|
||||||
* @date: 2023/2/14
|
|
||||||
*/
|
|
||||||
class BusPStatusBarView @JvmOverloads constructor(
|
|
||||||
context: Context, attrs: AttributeSet? = null
|
|
||||||
) : ConstraintLayout(context, attrs), IViewControlListener, IMoGoSkinModeChangeListener{
|
|
||||||
|
|
||||||
companion object {
|
|
||||||
const val TAG = "BusPStatusBarView"
|
|
||||||
}
|
|
||||||
|
|
||||||
init {
|
|
||||||
LayoutInflater.from(context).inflate(R.layout.p_bus_view_status_bar, this, true)
|
|
||||||
setBackgroundResource(R.drawable.bg_status_bar)
|
|
||||||
isClickable = true
|
|
||||||
isFocusable = true
|
|
||||||
|
|
||||||
tv_bus_b1_p_version.text = "版本:${AppUtils.getAppVersionName()}"
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
@SuppressLint("ClickableViewAccessibility")
|
|
||||||
override fun onAttachedToWindow() {
|
|
||||||
super.onAttachedToWindow()
|
|
||||||
post {
|
|
||||||
val params: ViewGroup.LayoutParams = getLayoutParams()
|
|
||||||
params.height = AutoSizeUtils.dp2px(context,40f)
|
|
||||||
layoutParams = params
|
|
||||||
}
|
|
||||||
//添加view控制
|
|
||||||
CallerHmiViewControlListenerManager.addListener(TAG,this)
|
|
||||||
// 添加换肤监听
|
|
||||||
CallerSkinModeListenerManager.addListener(TAG, this)
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onSkinModeChange(skinMode: Int) {
|
|
||||||
when (skinMode) {
|
|
||||||
0 -> setStatusBarDarkOrLight(false)
|
|
||||||
1 -> setStatusBarDarkOrLight(true)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onDetachedFromWindow() {
|
|
||||||
super.onDetachedFromWindow()
|
|
||||||
CallerHmiViewControlListenerManager.removeListener(TAG)
|
|
||||||
CallerSkinModeListenerManager.removeListener(TAG)
|
|
||||||
CallerDevaToolsManager.hideStatusBar()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,155 +0,0 @@
|
|||||||
package com.mogo.och.bus.passenger.ui;
|
|
||||||
|
|
||||||
import android.os.Bundle;
|
|
||||||
import android.view.LayoutInflater;
|
|
||||||
import android.view.View;
|
|
||||||
import android.widget.FrameLayout;
|
|
||||||
|
|
||||||
import androidx.annotation.NonNull;
|
|
||||||
import androidx.annotation.Nullable;
|
|
||||||
import androidx.appcompat.widget.AppCompatImageView;
|
|
||||||
|
|
||||||
import com.mogo.commons.mvp.IView;
|
|
||||||
import com.mogo.commons.mvp.MvpFragment;
|
|
||||||
import com.mogo.commons.mvp.Presenter;
|
|
||||||
import com.mogo.eagle.core.data.multidisplay.TelematicConstant;
|
|
||||||
import com.mogo.eagle.core.function.api.telematic.IReceivedMsgListener;
|
|
||||||
import com.mogo.eagle.core.function.call.telematic.CallerTelematicListenerManager;
|
|
||||||
import com.mogo.eagle.core.function.hmi.ui.widget.RomaPassengerView;
|
|
||||||
import com.mogo.eagle.core.function.view.MapBizView;
|
|
||||||
import com.mogo.eagle.core.utilcode.util.DeviceUtils;
|
|
||||||
import com.mogo.och.bus.passenger.R;
|
|
||||||
import com.mogo.och.common.module.manager.socket.lan.LanSocketManager;
|
|
||||||
import com.mogo.och.common.module.manager.socket.lan.bean.DPMsgType;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Created on 2022/3/31
|
|
||||||
* <p>
|
|
||||||
* Bus乘客端基础Fragment
|
|
||||||
*/
|
|
||||||
public abstract class BusPassengerBaseFragment<V extends IView, P extends Presenter<V>> extends MvpFragment<V, P> {
|
|
||||||
private static final String TAG = BusPassengerBaseFragment.class.getSimpleName();
|
|
||||||
|
|
||||||
private MapBizView mapBizView;
|
|
||||||
private FrameLayout flContainer;
|
|
||||||
private RomaPassengerView romaPView;
|
|
||||||
|
|
||||||
protected AppCompatImageView videoSwitch;
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected int getLayoutId() {
|
|
||||||
return R.layout.bus_p_base_fragment;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getTagName() {
|
|
||||||
return TAG;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void initViews() {
|
|
||||||
mapBizView = findViewById(R.id.mapBizView);
|
|
||||||
videoSwitch = findViewById(R.id.video_switch_iv);
|
|
||||||
romaPView = findViewById(R.id.romaPView);
|
|
||||||
if(DeviceUtils.isLeOrEb5Model()){
|
|
||||||
romaPView.setVisibility(View.VISIBLE);
|
|
||||||
}else{
|
|
||||||
romaPView.setVisibility(View.GONE);
|
|
||||||
}
|
|
||||||
|
|
||||||
videoSwitch.setOnClickListener(v -> openOrCloseLiveVideo());
|
|
||||||
LanSocketManager.INSTANCE.registerSocketMessageListener(DPMsgType.TYPE_COMMON.getType(),LanSocketManager.INSTANCE.getCommonListener());
|
|
||||||
CallerTelematicListenerManager.INSTANCE.addListener(TAG, new IReceivedMsgListener() {
|
|
||||||
@Override
|
|
||||||
public void onDemoMode(boolean isDemoMode) {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onReceivedServerSn(@Nullable String sn) {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onReceivedMsg(int type, @NonNull byte[] byteArray) {
|
|
||||||
if (type == TelematicConstant.CONTROL_PASSENGER_DRIVER_MONITOR) {
|
|
||||||
switch (new String(byteArray)) {
|
|
||||||
// 乘客端开启漫游
|
|
||||||
case "0": {
|
|
||||||
// mLiveShadow.setVisibility(View.GONE);
|
|
||||||
goneLiveShadow();
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
// 乘客端关闭漫游
|
|
||||||
case "1": {
|
|
||||||
// mLiveShadow.setVisibility(View.VISIBLE);
|
|
||||||
visibleLiveShadow();
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
showRouteFragment();
|
|
||||||
}
|
|
||||||
|
|
||||||
protected abstract void openOrCloseLiveVideo();
|
|
||||||
|
|
||||||
protected abstract void goneLiveShadow();
|
|
||||||
|
|
||||||
protected abstract void visibleLiveShadow();
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void initViews(Bundle savedInstanceState) {
|
|
||||||
super.initViews(savedInstanceState);
|
|
||||||
mapBizView.onCreate(savedInstanceState);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onResume() {
|
|
||||||
super.onResume();
|
|
||||||
mapBizView.onResume();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onSaveInstanceState(@NonNull Bundle outState) {
|
|
||||||
super.onSaveInstanceState(outState);
|
|
||||||
mapBizView.onSaveInstanceState(outState);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onLowMemory() {
|
|
||||||
super.onLowMemory();
|
|
||||||
mapBizView.onLowMemory();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onPause() {
|
|
||||||
super.onPause();
|
|
||||||
mapBizView.onPause();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onDestroyView() {
|
|
||||||
mapBizView.onDestroy();
|
|
||||||
CallerTelematicListenerManager.INSTANCE.removeListener(TAG);
|
|
||||||
LanSocketManager.INSTANCE.unRegisterSocketMessageListener(DPMsgType.TYPE_COMMON.getType(),LanSocketManager.INSTANCE.getCommonListener());
|
|
||||||
super.onDestroyView();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 获取站点面板view,在{@link #initViews()}时候添加到container中
|
|
||||||
*
|
|
||||||
* @return 站点面板view
|
|
||||||
*/
|
|
||||||
public abstract int getStationPanelViewId();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 显示线路信息
|
|
||||||
*/
|
|
||||||
public void showRouteFragment() {
|
|
||||||
flContainer = findViewById(R.id.bus_p_route_panel);
|
|
||||||
LayoutInflater.from(getContext()).inflate(getStationPanelViewId(), flContainer);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,440 +0,0 @@
|
|||||||
package com.mogo.och.bus.passenger.ui;
|
|
||||||
|
|
||||||
import android.annotation.SuppressLint;
|
|
||||||
import android.content.Context;
|
|
||||||
import android.graphics.drawable.AnimationDrawable;
|
|
||||||
import android.os.Bundle;
|
|
||||||
import android.view.Gravity;
|
|
||||||
import android.view.LayoutInflater;
|
|
||||||
import android.view.View;
|
|
||||||
import android.widget.TextView;
|
|
||||||
|
|
||||||
import androidx.annotation.NonNull;
|
|
||||||
import androidx.appcompat.widget.AppCompatImageView;
|
|
||||||
import androidx.appcompat.widget.AppCompatTextView;
|
|
||||||
import androidx.constraintlayout.widget.ConstraintLayout;
|
|
||||||
import androidx.constraintlayout.widget.Group;
|
|
||||||
import androidx.recyclerview.widget.RecyclerView;
|
|
||||||
|
|
||||||
import com.amap.api.maps.model.LatLng;
|
|
||||||
import com.elegant.utils.UiThreadHandler;
|
|
||||||
import com.mogo.eagle.core.data.enums.SidePattern;
|
|
||||||
import com.mogo.eagle.core.data.map.MogoLocation;
|
|
||||||
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotStatusListener;
|
|
||||||
import com.mogo.eagle.core.function.call.map.CallerMapUIServiceManager;
|
|
||||||
import com.mogo.eagle.core.function.hmi.ui.setting.ToggleDebugView;
|
|
||||||
import com.mogo.eagle.core.function.hmi.ui.widget.DriverMonitorView;
|
|
||||||
import com.mogo.commons.storage.SharedPrefsMgr;
|
|
||||||
import com.mogo.map.overlay.IMoGoOverlayManager;
|
|
||||||
import com.mogo.och.bus.passenger.R;
|
|
||||||
import com.mogo.och.bus.passenger.ui.adapter.BusPassengerLineStationsAdapter;
|
|
||||||
import com.mogo.och.bus.passenger.constant.BusPassengerConst;
|
|
||||||
import com.mogo.och.bus.passenger.presenter.BaseBusPassengerPresenter;
|
|
||||||
import com.mogo.och.bus.passenger.ui.layoutmanager.CenterLayoutManager;
|
|
||||||
import com.mogo.och.common.module.utils.NumberFormatUtil;
|
|
||||||
import com.mogo.och.common.module.utils.ResourcesUtils;
|
|
||||||
import com.mogo.och.common.module.wigets.MarqueeTextView;
|
|
||||||
import com.mogo.och.common.module.wigets.OCHGradientTextView;
|
|
||||||
import com.mogo.och.data.bean.BusStationBean;
|
|
||||||
import com.mogo.och.common.module.wigets.mapdirectionview.MapDirectionView;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author: wangmingjun
|
|
||||||
* @date: 2022/4/12
|
|
||||||
*/
|
|
||||||
public class BusPassengerRouteFragment extends
|
|
||||||
BusPassengerBaseFragment<BusPassengerRouteFragment, BaseBusPassengerPresenter> implements MapAndLiveVideoView.ChangeItemListener {
|
|
||||||
|
|
||||||
public static final String TAG = "BusPassengerRouteFragment";
|
|
||||||
|
|
||||||
private final List<BusStationBean> mStationsList = new ArrayList<>();
|
|
||||||
|
|
||||||
private OCHGradientTextView mSpeedTv;
|
|
||||||
private ConstraintLayout mNoLineInfoView;
|
|
||||||
private MarqueeTextView mLineName;
|
|
||||||
private Group mRouteInfoView;
|
|
||||||
private RecyclerView mStationsListRv;
|
|
||||||
private MapDirectionView mMapDirectionView;
|
|
||||||
private BusPassengerLineStationsAdapter mAdapter;
|
|
||||||
private TextView emptyTv;
|
|
||||||
private AppCompatImageView mAutopilotIv;
|
|
||||||
private AppCompatTextView mCurrentArriveStation;
|
|
||||||
private AppCompatTextView mCurrentArriveStationTitle;
|
|
||||||
private AppCompatTextView mCurrentArriveTip;
|
|
||||||
private AppCompatImageView mSpeakArrivedIv;
|
|
||||||
|
|
||||||
private View busPDriverMonitorView;
|
|
||||||
private DriverMonitorView driverMonitorView;
|
|
||||||
private ConstraintLayout indicatorView;
|
|
||||||
private View mapIndicator;
|
|
||||||
private View liveIndicator;
|
|
||||||
|
|
||||||
private MapAndLiveVideoView mapAndLiveVideoView;
|
|
||||||
List<View> views = new ArrayList<>();
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int getStationPanelViewId() {
|
|
||||||
return R.layout.bus_p_route_fragment;
|
|
||||||
}
|
|
||||||
|
|
||||||
@NonNull
|
|
||||||
@Override
|
|
||||||
protected BaseBusPassengerPresenter createPresenter() {
|
|
||||||
return new BaseBusPassengerPresenter(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void initViews() {
|
|
||||||
super.initViews();
|
|
||||||
|
|
||||||
mSpeedTv = findViewById(R.id.bus_p_speed_tv);
|
|
||||||
mSpeedTv.setVertrial(true);
|
|
||||||
mSpeedTv.setmColorList(new int[]{ResourcesUtils.getColor(R.color.bus_p_speed_color_start),
|
|
||||||
ResourcesUtils.getColor(R.color.bus_p_speed_color_end)});
|
|
||||||
|
|
||||||
mNoLineInfoView =findViewById(R.id.bus_p_no_order_data_view);
|
|
||||||
emptyTv = findViewById(R.id.no_order_data_tv);
|
|
||||||
|
|
||||||
mLineName = findViewById(R.id.bus_p_line_name_tv);
|
|
||||||
mAutopilotIv = findViewById(R.id.auto_status_iv);
|
|
||||||
mCurrentArriveStation = findViewById(R.id.bus_p_cur_station_name);
|
|
||||||
mCurrentArriveStationTitle = findViewById(R.id.bus_p_cur_station_title);
|
|
||||||
mCurrentArriveTip = findViewById(R.id.bus_p_cur_station_tip);
|
|
||||||
mSpeakArrivedIv = findViewById(R.id.speak_arrived_iv);
|
|
||||||
|
|
||||||
mRouteInfoView = findViewById(R.id.bus_p_line_cl);
|
|
||||||
mStationsListRv = findViewById(R.id.bus_p_line_stations_rl);
|
|
||||||
|
|
||||||
CenterLayoutManager manager = new CenterLayoutManager(getContext());
|
|
||||||
mStationsListRv.setLayoutManager(manager);
|
|
||||||
mAdapter = new BusPassengerLineStationsAdapter(getContext(), mStationsList);
|
|
||||||
mStationsListRv.setAdapter(mAdapter);
|
|
||||||
|
|
||||||
indicatorView = findViewById(R.id.busIndicatorView);
|
|
||||||
mapIndicator = findViewById(R.id.firstIndicator);
|
|
||||||
liveIndicator = findViewById(R.id.secondIndicator);
|
|
||||||
|
|
||||||
busPDriverMonitorView = LayoutInflater.from(getContext())
|
|
||||||
.inflate(R.layout.bus_p_driver_monitor_view,null);
|
|
||||||
|
|
||||||
driverMonitorView = busPDriverMonitorView.findViewById(R.id.buDriverMonitorView);
|
|
||||||
driverMonitorView.setLiveListener(new DriverMonitorView.LiveListener() {
|
|
||||||
@Override
|
|
||||||
public void onPlayError() {
|
|
||||||
goneLiveShadow();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
mSpeedTv.setOnLongClickListener(new View.OnLongClickListener() {
|
|
||||||
@Override
|
|
||||||
public boolean onLongClick(View v) {
|
|
||||||
Context context = getContext();
|
|
||||||
if(context!=null){
|
|
||||||
ToggleDebugView.Companion.
|
|
||||||
getToggleDebugView().toggle(context, Gravity.RIGHT, SidePattern.RIGHT);
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
mapAndLiveVideoView = findViewById(R.id.mapAndLiveVideoView);
|
|
||||||
|
|
||||||
initLiveView();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void initLiveView() {
|
|
||||||
views.add(new View(getContext()));// 其实是空的,真正小地图还在fragment里
|
|
||||||
views.add(busPDriverMonitorView);
|
|
||||||
mapAndLiveVideoView.setData(views);
|
|
||||||
mapAndLiveVideoView.setVisibility(View.GONE);
|
|
||||||
indicatorView.setVisibility(View.GONE);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
@SuppressLint("UseCompatLoadingForDrawables")
|
|
||||||
@Override
|
|
||||||
public void changeToItem(int position) {
|
|
||||||
// (position == 0): 空view 地图占位 (position == 1) :live video
|
|
||||||
if (position == 0){
|
|
||||||
mapIndicator.setBackground(getContext().getDrawable(R.drawable.indicator_selected_bg));
|
|
||||||
liveIndicator.setBackground(getContext().getDrawable(R.drawable.indicator_unselected_bg));
|
|
||||||
}else {
|
|
||||||
mapIndicator.setBackground(getContext().getDrawable(R.drawable.indicator_unselected_bg));
|
|
||||||
liveIndicator.setBackground(getContext().getDrawable(R.drawable.indicator_selected_bg));
|
|
||||||
}
|
|
||||||
mMapDirectionView.setVisibility(position == 0? View.VISIBLE:View.GONE);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void updateDriverSn(String sn) {
|
|
||||||
// TODO 这是测试方法,直播源为公司,凤坤旁的F车机
|
|
||||||
//if (driverMonitorView.isSOPDriverSn("F803EB2046PZD00164")){
|
|
||||||
if (driverMonitorView.isSOPDriverSn(sn)){
|
|
||||||
visibleLiveShadow();
|
|
||||||
}else {
|
|
||||||
goneLiveShadow();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void openOrCloseLiveVideo() {
|
|
||||||
if (videoSwitch.isSelected()){
|
|
||||||
driverMonitorView.stopLive();
|
|
||||||
videoSwitch.setSelected(false);
|
|
||||||
}else {
|
|
||||||
driverMonitorView.startLive();
|
|
||||||
videoSwitch.setSelected(true);
|
|
||||||
mapAndLiveVideoView.changeToSecondView();
|
|
||||||
}
|
|
||||||
mapAndLiveVideoView.setItemChangeListener(videoSwitch.isSelected()? this:null);
|
|
||||||
mapAndLiveVideoView.setVisibility(videoSwitch.isSelected()? View.VISIBLE : View.GONE);
|
|
||||||
indicatorView.setVisibility(videoSwitch.isSelected() ? View.VISIBLE : View.GONE);
|
|
||||||
mMapDirectionView.setVisibility(videoSwitch.isSelected() ? View.GONE : View.VISIBLE);
|
|
||||||
mapIndicator.setBackground(getContext().getDrawable(R.drawable.indicator_unselected_bg));
|
|
||||||
liveIndicator.setBackground(getContext().getDrawable(R.drawable.indicator_selected_bg));
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void goneLiveShadow() {
|
|
||||||
videoSwitch.setVisibility(View.GONE);
|
|
||||||
// driverMonitorView.setVisibility(View.GONE);
|
|
||||||
indicatorView.setVisibility(View.GONE);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void visibleLiveShadow() {
|
|
||||||
videoSwitch.setVisibility(View.VISIBLE);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void initViews(Bundle savedInstanceState) {
|
|
||||||
super.initViews(savedInstanceState);
|
|
||||||
mMapDirectionView = findViewById(R.id.busPLineMapView);
|
|
||||||
mMapDirectionView.onCreateView(savedInstanceState);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onResume() {
|
|
||||||
super.onResume();
|
|
||||||
if (mMapDirectionView != null) {
|
|
||||||
mMapDirectionView.onResume();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onPause() {
|
|
||||||
super.onPause();
|
|
||||||
if (mMapDirectionView != null) {
|
|
||||||
mMapDirectionView.onPause();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onDestroyView() {
|
|
||||||
IMoGoOverlayManager overlayManager = CallerMapUIServiceManager.INSTANCE.getOverlayManager();
|
|
||||||
if(overlayManager!=null) {
|
|
||||||
overlayManager.removeAllLines();
|
|
||||||
overlayManager.removeAllPoints();
|
|
||||||
}
|
|
||||||
|
|
||||||
super.onDestroyView();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onDestroy() {
|
|
||||||
super.onDestroy();
|
|
||||||
if (mMapDirectionView != null) {
|
|
||||||
mMapDirectionView.onDestroy();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void clearMapView() {
|
|
||||||
if (mMapDirectionView != null) {
|
|
||||||
mMapDirectionView.clearMapView();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void clearMapMarkers() {
|
|
||||||
if (mMapDirectionView != null) {
|
|
||||||
UiThreadHandler.post(new Runnable() {
|
|
||||||
@Override
|
|
||||||
public void run() {
|
|
||||||
mMapDirectionView.clearLineMarkers();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void changeOperationStatus(boolean status) {
|
|
||||||
if (!status) {
|
|
||||||
emptyTv.setText(getString(R.string.bus_p_no_out));
|
|
||||||
mNoLineInfoView.setVisibility(View.VISIBLE);
|
|
||||||
mRouteInfoView.setVisibility(View.GONE);
|
|
||||||
mLineName.setText(getContext().getString(R.string.bus_p_no_line));
|
|
||||||
updateArrivedStation(null,0,true);
|
|
||||||
clearMapView();
|
|
||||||
clearMapMarkers();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void showNoTaskView(){
|
|
||||||
if (mNoLineInfoView.getVisibility() == View.GONE){
|
|
||||||
mNoLineInfoView.setVisibility(View.VISIBLE);
|
|
||||||
mRouteInfoView.setVisibility(View.GONE);
|
|
||||||
mLineName.setText(getContext().getString(R.string.bus_p_no_line));
|
|
||||||
updateArrivedStation(null,0,true);
|
|
||||||
clearMapView();
|
|
||||||
clearMapMarkers();
|
|
||||||
}
|
|
||||||
emptyTv.setText(getString(R.string.bus_p_no_task));
|
|
||||||
}
|
|
||||||
|
|
||||||
public void hideNoTaskView(){
|
|
||||||
if (mNoLineInfoView.getVisibility() == View.VISIBLE){
|
|
||||||
mNoLineInfoView.setVisibility(View.GONE);
|
|
||||||
}
|
|
||||||
if (mRouteInfoView.getVisibility() == View.GONE){
|
|
||||||
mRouteInfoView.setVisibility(View.VISIBLE);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void updateLineInfo(String lineName, String lineDurTime) {
|
|
||||||
mLineName.setText(lineName);
|
|
||||||
// mOperationTime.setText(lineDurTime);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @param stations
|
|
||||||
* @param currentStationIndex
|
|
||||||
* @param isArrived 是否到站并离开,true 到达当前站 currentStationIndex 未离开, false 正在前往此站 currentStationIndex
|
|
||||||
*/
|
|
||||||
public void updateStationsInfo(List<BusStationBean> stations, int currentStationIndex, boolean isArrived) {
|
|
||||||
updateArrivedStation(stations.get(currentStationIndex).getName(),currentStationIndex,isArrived);
|
|
||||||
mStationsList.clear();
|
|
||||||
mStationsList.addAll(stations);
|
|
||||||
mAdapter.notifyDataSetChanged();
|
|
||||||
|
|
||||||
if (currentStationIndex > -1){
|
|
||||||
updateCurrentStation(currentStationIndex);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (currentStationIndex == 0 && isArrived){ //到达始发站且并未出发, 恢复站点marker 清楚路径 清空路径点
|
|
||||||
SharedPrefsMgr.getInstance().remove(BusPassengerConst.BUS_SP_KEY_ORDER_SUM_DIS);
|
|
||||||
clearMapView();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (stations.size() > 0){
|
|
||||||
updateWayPointList(stations,currentStationIndex);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void updateWayPointList(List<BusStationBean> stations,int currentStationIndex) {
|
|
||||||
List<LatLng> mLineStationsList = new ArrayList<>();
|
|
||||||
for (int i = 0; i< stations.size(); i++) {//站点集合
|
|
||||||
LatLng latLng = new LatLng(stations.get(i).getGcjLat(),stations.get(i).getGcjLon());// lat,lon
|
|
||||||
mLineStationsList.add(latLng);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (mMapDirectionView != null) {
|
|
||||||
UiThreadHandler.post(new Runnable() {
|
|
||||||
@Override
|
|
||||||
public void run() {
|
|
||||||
mMapDirectionView.setLinePointMarkerAndDraw(mLineStationsList,currentStationIndex);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void onCarLocationChanged(float speed) {
|
|
||||||
int speedKM = (int) (Math.abs(speed) * 3.6F);
|
|
||||||
mSpeedTv.setText(String.valueOf(speedKM));
|
|
||||||
}
|
|
||||||
|
|
||||||
public void updateCurrentStation(int position) {
|
|
||||||
if (mStationsListRv != null){
|
|
||||||
mStationsListRv.smoothScrollToPosition(position);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void updateArrivedStation(String station,int currentIndex,boolean isArrived){
|
|
||||||
if (null == station){
|
|
||||||
mCurrentArriveStation.setText("----");
|
|
||||||
mCurrentArriveStationTitle.setText(ResourcesUtils.getString(R.string.bus_p_cur_station_title));
|
|
||||||
mCurrentArriveTip.setText(ResourcesUtils.getString(R.string.bus_p_cur_station_arrived_tip));
|
|
||||||
mCurrentArriveTip.setBackgroundResource(R.drawable.cur_station_arrived_bg);
|
|
||||||
handleArrivingSpeakIconDrawable();
|
|
||||||
}else {
|
|
||||||
mCurrentArriveStation.setText(station);
|
|
||||||
if (currentIndex == 0){
|
|
||||||
mCurrentArriveStationTitle.setText(ResourcesUtils.getString(R.string.bus_p_cur_station_title));
|
|
||||||
mCurrentArriveTip.setText(ResourcesUtils.getString(R.string.bus_p_cur_station_arrived_tip));
|
|
||||||
mCurrentArriveTip.setBackgroundResource(R.drawable.cur_station_arrived_bg);
|
|
||||||
handleArrivingSpeakIconDrawable();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (isArrived){
|
|
||||||
mCurrentArriveStationTitle.setText(ResourcesUtils.getString(R.string.bus_p_cur_station_title));
|
|
||||||
mCurrentArriveTip.setText(ResourcesUtils.getString(R.string.bus_p_cur_station_arrived_tip));
|
|
||||||
mCurrentArriveTip.setBackgroundResource(R.drawable.cur_station_arrived_bg);
|
|
||||||
handleArrivedSpeakIconDrawable();
|
|
||||||
}else {
|
|
||||||
mCurrentArriveStationTitle.setText(ResourcesUtils.getString(R.string.bus_p_cur_next_station_title));
|
|
||||||
mCurrentArriveTip.setBackgroundResource(R.drawable.cur_station_un_arrived_bg);
|
|
||||||
handleArrivingSpeakIconDrawable();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
private void handleArrivedSpeakIconDrawable(){
|
|
||||||
AnimationDrawable animationDrawable = (AnimationDrawable) mSpeakArrivedIv.getDrawable();
|
|
||||||
animationDrawable.start();
|
|
||||||
mSpeakArrivedIv.setVisibility(View.VISIBLE);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void handleArrivingSpeakIconDrawable(){
|
|
||||||
AnimationDrawable animationDrawable = (AnimationDrawable) mSpeakArrivedIv.getDrawable();
|
|
||||||
animationDrawable.stop();
|
|
||||||
mSpeakArrivedIv.setVisibility(View.GONE);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void updateRoutePlanningToNextStation(long meters, long timeInSecond){
|
|
||||||
//更新进度条
|
|
||||||
String dis = "0";
|
|
||||||
String disUnit = "公里";
|
|
||||||
if (meters > 0){
|
|
||||||
if (meters / 1000 < 1){
|
|
||||||
disUnit = "米";
|
|
||||||
dis = String.valueOf(Math.round(meters));
|
|
||||||
}else {
|
|
||||||
disUnit = "公里";
|
|
||||||
dis = NumberFormatUtil.formatLong((double)meters / 1000);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// String strHtml2 = "<font color=\"#2D3E5F\">距离 </font>" + "<b><font color=\"#0043FF\">" + dis + "</font></b>" + "<font color=\"#2D3E5F\"> "+disUnit+"</font>"
|
|
||||||
// + "<font color=\"#2D3E5F\">   剩余 </font>" + "<b><font color=\"#0043FF\">" + (int)Math.ceil((double)timeInSecond/ 60f) + "</font></b>" + "<font color=\"#2D3E5F\"> 分钟</font>";
|
|
||||||
String str = dis+disUnit+" | "+(int)Math.ceil((double)timeInSecond/ 60f)+"分钟";
|
|
||||||
mCurrentArriveTip.setText(str);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void onAutopilotStatusChanged(boolean isInAutopilot) {
|
|
||||||
UiThreadHandler.post(new Runnable() {
|
|
||||||
@Override
|
|
||||||
public void run() {
|
|
||||||
AutopilotStatusChanged(isInAutopilot);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
public void AutopilotStatusChanged(boolean isInAutopilot) {
|
|
||||||
if (isInAutopilot) {
|
|
||||||
mAutopilotIv.setImageResource(R.drawable.auto_open);
|
|
||||||
} else {
|
|
||||||
mAutopilotIv.setImageResource(R.drawable.auto_close);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,181 +0,0 @@
|
|||||||
package com.mogo.och.bus.passenger.ui
|
|
||||||
|
|
||||||
import android.content.Context
|
|
||||||
import android.util.AttributeSet
|
|
||||||
import android.view.LayoutInflater
|
|
||||||
import android.widget.LinearLayout
|
|
||||||
import com.mogo.eagle.core.data.enums.DataSourceType
|
|
||||||
import com.mogo.eagle.core.data.enums.TrafficLightEnum
|
|
||||||
import com.mogo.eagle.core.function.api.datacenter.union.IMoGoTrafficLightListener
|
|
||||||
import com.mogo.eagle.core.function.call.v2x.CallerTrafficLightListenerManager
|
|
||||||
import com.mogo.eagle.core.utilcode.util.UiThreadHandler
|
|
||||||
import com.mogo.och.bus.passenger.R
|
|
||||||
import kotlinx.android.synthetic.main.bus_p_traffic_light_view.view.bus_p_traffic_light_bg
|
|
||||||
import kotlinx.android.synthetic.main.bus_p_traffic_light_view.view.bus_p_traffic_light_iv
|
|
||||||
import kotlinx.android.synthetic.main.bus_p_traffic_light_view.view.bus_p_traffic_light_time_tv
|
|
||||||
|
|
||||||
/**
|
|
||||||
* bus乘客端:红绿灯view
|
|
||||||
*
|
|
||||||
* Created on 2022/3/14
|
|
||||||
*/
|
|
||||||
class BusPassengerTrafficLightView @JvmOverloads constructor(
|
|
||||||
context: Context?,
|
|
||||||
attrs: AttributeSet? = null,
|
|
||||||
defStyleAttr: Int = 0
|
|
||||||
) : LinearLayout(context, attrs, defStyleAttr), IMoGoTrafficLightListener {
|
|
||||||
|
|
||||||
companion object {
|
|
||||||
private const val TAG = "BusPassengerTrafficLightView"
|
|
||||||
}
|
|
||||||
|
|
||||||
private var mCurrentLightId = TrafficLightEnum.BLACK
|
|
||||||
|
|
||||||
init {
|
|
||||||
init(context)
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun init(context: Context?) {
|
|
||||||
LayoutInflater.from(context).inflate(R.layout.bus_p_traffic_light_view, this, true)
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onAttachedToWindow() {
|
|
||||||
super.onAttachedToWindow()
|
|
||||||
CallerTrafficLightListenerManager.addListener(TAG, this)
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onDetachedFromWindow() {
|
|
||||||
super.onDetachedFromWindow()
|
|
||||||
CallerTrafficLightListenerManager.removeListener(TAG)
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 展示红绿灯预警
|
|
||||||
*
|
|
||||||
* @param checkLightId 0-都是默认,1-红,2-黄,3-绿
|
|
||||||
* @param lightSource 1:云端下发;2:自车感知
|
|
||||||
*/
|
|
||||||
override fun showTrafficLight(checkLightId: TrafficLightEnum, lightSource: DataSourceType) {
|
|
||||||
super.showTrafficLight(checkLightId, lightSource)
|
|
||||||
mCurrentLightId = checkLightId
|
|
||||||
updateTrafficLightIcon(checkLightId)
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 关闭红绿灯预警展示,并重制灯态
|
|
||||||
*/
|
|
||||||
override fun disableTrafficLight() {
|
|
||||||
super.disableTrafficLight()
|
|
||||||
UiThreadHandler.post {
|
|
||||||
mCurrentLightId = TrafficLightEnum.BLACK
|
|
||||||
this@BusPassengerTrafficLightView.visibility = GONE
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param redNum 红灯倒计时
|
|
||||||
* @param yellowNum 黄灯倒计时
|
|
||||||
* @param greenNum 绿灯倒计时
|
|
||||||
*/
|
|
||||||
override fun changeCountdownTrafficLightNum(redNum: Int, yellowNum: Int, greenNum: Int) {
|
|
||||||
super.changeCountdownTrafficLightNum(redNum, yellowNum, greenNum)
|
|
||||||
resetView()
|
|
||||||
when (mCurrentLightId) {
|
|
||||||
TrafficLightEnum.RED -> changeCountdownRed(redNum)
|
|
||||||
TrafficLightEnum.YELLOW -> changeCountdownYellow(yellowNum)
|
|
||||||
TrafficLightEnum.GREEN -> changeCountdownGreen(greenNum)
|
|
||||||
else -> UiThreadHandler.post { bus_p_traffic_light_time_tv.text = "" }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun changeCountdownRed(redNum: Int) {
|
|
||||||
super.changeCountdownRed(redNum)
|
|
||||||
UiThreadHandler.post {
|
|
||||||
if (redNum > 0) {
|
|
||||||
resetView()
|
|
||||||
bus_p_traffic_light_time_tv.text = redNum.toString()
|
|
||||||
} else {
|
|
||||||
disableTrafficLightCountDown()
|
|
||||||
bus_p_traffic_light_time_tv.text = ""
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun changeCountdownGreen(greenNum: Int) {
|
|
||||||
super.changeCountdownGreen(greenNum)
|
|
||||||
UiThreadHandler.post {
|
|
||||||
if (greenNum > 0) {
|
|
||||||
resetView()
|
|
||||||
bus_p_traffic_light_time_tv.text = greenNum.toString()
|
|
||||||
} else {
|
|
||||||
disableTrafficLightCountDown()
|
|
||||||
bus_p_traffic_light_time_tv.text = ""
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun changeCountdownYellow(yellowNum: Int) {
|
|
||||||
super.changeCountdownYellow(yellowNum)
|
|
||||||
UiThreadHandler.post {
|
|
||||||
if (yellowNum > 0) {
|
|
||||||
resetView()
|
|
||||||
bus_p_traffic_light_time_tv.text = yellowNum.toString()
|
|
||||||
} else {
|
|
||||||
disableTrafficLightCountDown()
|
|
||||||
bus_p_traffic_light_time_tv.text = ""
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 更新红绿灯icon
|
|
||||||
*
|
|
||||||
* @param lightId 0-都是默认,1-红,2-黄,3-绿
|
|
||||||
*/
|
|
||||||
private fun updateTrafficLightIcon(lightId: TrafficLightEnum) {
|
|
||||||
UiThreadHandler.post {
|
|
||||||
when (lightId) {
|
|
||||||
TrafficLightEnum.RED -> {
|
|
||||||
bus_p_traffic_light_iv.setBackgroundResource(R.drawable.bus_p_light_red_nor)
|
|
||||||
this@BusPassengerTrafficLightView.visibility = VISIBLE
|
|
||||||
}
|
|
||||||
TrafficLightEnum.YELLOW -> {
|
|
||||||
bus_p_traffic_light_iv.setBackgroundResource(R.drawable.bus_p_light_yellow_nor)
|
|
||||||
this@BusPassengerTrafficLightView.visibility = VISIBLE
|
|
||||||
}
|
|
||||||
TrafficLightEnum.GREEN -> {
|
|
||||||
bus_p_traffic_light_iv.setBackgroundResource(R.drawable.bus_p_light_green_nor)
|
|
||||||
this@BusPassengerTrafficLightView.visibility = VISIBLE
|
|
||||||
}
|
|
||||||
else -> this@BusPassengerTrafficLightView.visibility = GONE
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun disableTrafficLightCountDown() {
|
|
||||||
super.disableTrafficLightCountDown()
|
|
||||||
UiThreadHandler.post {
|
|
||||||
val layoutParams = layoutParams
|
|
||||||
if (layoutParams is MarginLayoutParams) {
|
|
||||||
val lp = layoutParams
|
|
||||||
lp.width = resources.getDimension(R.dimen.bus_p_traffic_light_icon_size).toInt()
|
|
||||||
setLayoutParams(lp)
|
|
||||||
bus_p_traffic_light_time_tv.visibility = GONE
|
|
||||||
bus_p_traffic_light_bg.layoutParams.width =
|
|
||||||
resources.getDimension(R.dimen.dp_90).toInt()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun resetView() {
|
|
||||||
val layoutParams = layoutParams
|
|
||||||
if (layoutParams is MarginLayoutParams) {
|
|
||||||
val lp = layoutParams
|
|
||||||
lp.width = resources.getDimension(R.dimen.bus_p_route_traffic_light_view_width).toInt()
|
|
||||||
setLayoutParams(lp)
|
|
||||||
bus_p_traffic_light_time_tv.visibility = VISIBLE
|
|
||||||
bus_p_traffic_light_bg.layoutParams.width =
|
|
||||||
resources.getDimension(R.dimen.bus_p_traffic_light_bg_width).toInt()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,137 +0,0 @@
|
|||||||
package com.mogo.och.bus.passenger.ui
|
|
||||||
|
|
||||||
import android.content.Context
|
|
||||||
import android.util.AttributeSet
|
|
||||||
import android.view.View
|
|
||||||
import android.widget.RelativeLayout
|
|
||||||
import androidx.viewpager.widget.PagerAdapter
|
|
||||||
import androidx.viewpager.widget.ViewPager
|
|
||||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger
|
|
||||||
import com.mogo.och.bus.passenger.ui.MapAndLiveVideoView.Companion.TAG
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author: wangmingjun
|
|
||||||
* @date: 2023/5/9
|
|
||||||
*/
|
|
||||||
|
|
||||||
class MapAndLiveVideoView @JvmOverloads constructor(
|
|
||||||
context: Context, attrs: AttributeSet? = null
|
|
||||||
) : RelativeLayout(context, attrs), ViewPager.OnPageChangeListener {
|
|
||||||
|
|
||||||
private var viewPager: ViewPager? = null
|
|
||||||
private var pagerAdapter: AdvancePagerAdapter? = null
|
|
||||||
private var changeItemListener: ChangeItemListener? = null
|
|
||||||
|
|
||||||
companion object {
|
|
||||||
const val TAG = "MapAndLiveVideoView"
|
|
||||||
}
|
|
||||||
|
|
||||||
init {
|
|
||||||
initView()
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun initView() {
|
|
||||||
viewPager = ViewPager(context)
|
|
||||||
pagerAdapter = AdvancePagerAdapter()
|
|
||||||
viewPager?.adapter = pagerAdapter
|
|
||||||
|
|
||||||
addView(viewPager, LayoutParams(-1, -1))
|
|
||||||
|
|
||||||
viewPager?.addOnPageChangeListener(this)
|
|
||||||
}
|
|
||||||
|
|
||||||
fun setData(list: MutableList<View>) {
|
|
||||||
pagerAdapter?.setData(list)
|
|
||||||
pagerAdapter?.notifyDataSetChanged()
|
|
||||||
}
|
|
||||||
|
|
||||||
fun setItemChangeListener(listener: ChangeItemListener?) {
|
|
||||||
changeItemListener = listener
|
|
||||||
}
|
|
||||||
|
|
||||||
fun changeToSecondView() {
|
|
||||||
if (viewPager?.currentItem == 0) {
|
|
||||||
startPosition = 0
|
|
||||||
}
|
|
||||||
viewPager?.currentItem = 1
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onPageScrolled(position: Int, positionOffset: Float, positionOffsetPixels: Int) {
|
|
||||||
CallerLogger.d(TAG, "onPageScrolled--position = $position")
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onPageSelected(position: Int) {
|
|
||||||
CallerLogger.d(TAG, "onPageSelected--position = $position")
|
|
||||||
}
|
|
||||||
|
|
||||||
var startPosition = 1
|
|
||||||
override fun onPageScrollStateChanged(state: Int) {
|
|
||||||
CallerLogger.d(TAG, "onPageScrollStateChanged--state = $state")
|
|
||||||
viewPager?.let {
|
|
||||||
val position = it.currentItem
|
|
||||||
if (state == 0) { //静止
|
|
||||||
if (startPosition == position) {
|
|
||||||
if (position == 0) {
|
|
||||||
it.currentItem = 1
|
|
||||||
} else {
|
|
||||||
it.currentItem = 0
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
changeItemListener?.changeToItem(it.currentItem)
|
|
||||||
}
|
|
||||||
} else if (state == 1) { // 开始滑动
|
|
||||||
startPosition = it.currentItem
|
|
||||||
} else {
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
interface ChangeItemListener {
|
|
||||||
fun changeToItem(position: Int)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
class AdvancePagerAdapter : PagerAdapter(),
|
|
||||||
ViewPager.OnPageChangeListener {
|
|
||||||
private var views: List<View>? = null
|
|
||||||
|
|
||||||
fun setData(views: List<View>?) {
|
|
||||||
this.views = views
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun instantiateItem(container: View, position: Int): Any {
|
|
||||||
CallerLogger.d(TAG, "instantiateItem--position = $position")
|
|
||||||
return try {
|
|
||||||
val currentItem = position % views!!.size
|
|
||||||
(container as ViewPager).addView(views!![currentItem])
|
|
||||||
views!![currentItem]
|
|
||||||
} catch (e: Exception) {
|
|
||||||
container
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun getCount(): Int {
|
|
||||||
return if (views == null) {
|
|
||||||
0
|
|
||||||
} else {
|
|
||||||
views!!.size
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun isViewFromObject(arg0: View, arg1: Any): Boolean {
|
|
||||||
return arg0 === arg1
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onPageScrolled(position: Int, positionOffset: Float, positionOffsetPixels: Int) {
|
|
||||||
// CallerLogger.d(TAG, "onPageScrolled--position = $position")
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onPageSelected(position: Int) {
|
|
||||||
// CallerLogger.d(TAG, "onPageSelected--position = $position")
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onPageScrollStateChanged(state: Int) {
|
|
||||||
// CallerLogger.d(TAG, "onPageScrollStateChanged--state = $state")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,141 +0,0 @@
|
|||||||
package com.mogo.och.bus.passenger.ui.adapter;
|
|
||||||
|
|
||||||
import static com.mogo.och.bus.passenger.constant.BusPassengerConst.STATION_STATUS_ARRIVING;
|
|
||||||
import static com.mogo.och.bus.passenger.constant.BusPassengerConst.STATION_STATUS_LEAVING;
|
|
||||||
import static com.mogo.och.bus.passenger.constant.BusPassengerConst.STATION_STATUS_STOPPED;
|
|
||||||
|
|
||||||
import android.content.Context;
|
|
||||||
import android.text.TextUtils;
|
|
||||||
import android.util.Log;
|
|
||||||
import android.view.LayoutInflater;
|
|
||||||
import android.view.View;
|
|
||||||
import android.view.ViewGroup;
|
|
||||||
import android.widget.ImageView;
|
|
||||||
|
|
||||||
import androidx.annotation.NonNull;
|
|
||||||
import androidx.recyclerview.widget.RecyclerView;
|
|
||||||
|
|
||||||
import com.mogo.och.bus.passenger.R;
|
|
||||||
import com.mogo.och.common.module.utils.BlinkAnimationUtil;
|
|
||||||
import com.mogo.och.common.module.wigets.MarqueeTextView;
|
|
||||||
import com.mogo.och.data.bean.BusStationBean;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author: wangmingjun
|
|
||||||
* @date: 2022/4/6
|
|
||||||
*/
|
|
||||||
public class BusPassengerLineStationsAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> {
|
|
||||||
|
|
||||||
private Context mContext;
|
|
||||||
private List<BusStationBean> mStations;
|
|
||||||
|
|
||||||
public BusPassengerLineStationsAdapter(Context context, List<BusStationBean> stations){
|
|
||||||
this.mContext = context;
|
|
||||||
this.mStations = stations;
|
|
||||||
}
|
|
||||||
|
|
||||||
@NonNull
|
|
||||||
@Override
|
|
||||||
public RecyclerView.ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
|
|
||||||
View view = LayoutInflater.from(mContext).inflate(R.layout.bus_p_stations_common_item,parent,false);
|
|
||||||
StationViewHolder viewHolder = new StationViewHolder(view);
|
|
||||||
return viewHolder;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onBindViewHolder(@NonNull RecyclerView.ViewHolder holder, int position) {
|
|
||||||
BusStationBean station = mStations.get(position);
|
|
||||||
StationViewHolder viewHolder = (StationViewHolder)holder;
|
|
||||||
viewHolder.stationName.setText(station.getName());
|
|
||||||
BlinkAnimationUtil.clearAnimation(viewHolder.stationCircle);
|
|
||||||
if (position == 0){ //第一个 起点
|
|
||||||
viewHolder.curArrowBg.setVisibility(View.GONE);
|
|
||||||
viewHolder.curArrowBottomBg.setVisibility(View.VISIBLE);
|
|
||||||
Log.d("onBindViewHolder" , "position0 = "+position);
|
|
||||||
viewHolder.stationCircle.setImageResource(R.drawable.bg_bus_p_start_tag_bg);
|
|
||||||
if (station.getDrivingStatus() == STATION_STATUS_STOPPED && !station.isLeaving()){//到达未离开
|
|
||||||
viewHolder.stationName.setTextColor(mContext.getResources().getColor(R.color.bus_p_clock_17417B));
|
|
||||||
BlinkAnimationUtil.setAnimation(viewHolder.stationCircle);
|
|
||||||
viewHolder.stationName.setEllipsize(TextUtils.TruncateAt.MARQUEE);
|
|
||||||
viewHolder.curArrowBottomBg.setBackgroundColor(mContext.getColor(R.color.bus_p_clock_1F82FB));
|
|
||||||
}else {
|
|
||||||
viewHolder.stationName.setTextColor(mContext.getResources().getColor(R.color.bus_p_clock_992D3E5F));
|
|
||||||
viewHolder.stationName.setEllipsize(TextUtils.TruncateAt.END);
|
|
||||||
viewHolder.curArrowBottomBg.setBackgroundColor(mContext.getColor(R.color.bus_p_clock_A9B6CA));
|
|
||||||
}
|
|
||||||
}else{
|
|
||||||
viewHolder.curArrowBg.setVisibility(View.VISIBLE);
|
|
||||||
viewHolder.curArrowBottomBg.setVisibility(View.VISIBLE);
|
|
||||||
BusStationBean preStation = mStations.get(position -1);
|
|
||||||
if (station.getDrivingStatus() == STATION_STATUS_LEAVING ||
|
|
||||||
(station.getDrivingStatus() == STATION_STATUS_STOPPED && station.isLeaving())){ //过站
|
|
||||||
viewHolder.stationName.setTextColor(mContext.getResources().getColor(R.color.bus_p_clock_992D3E5F));
|
|
||||||
viewHolder.curArrowBg.setBackgroundColor(mContext.getColor(R.color.bus_p_clock_A9B6CA));
|
|
||||||
viewHolder.curArrowBottomBg.setBackgroundColor(mContext.getColor(R.color.bus_p_clock_A9B6CA));
|
|
||||||
viewHolder.stationCircle.setImageResource(R.drawable.bus_p_point_gray);
|
|
||||||
viewHolder.stationName.setEllipsize(TextUtils.TruncateAt.END);
|
|
||||||
Log.d("onBindViewHolder" , "position 1 = "+position);
|
|
||||||
} else if (station.getDrivingStatus() == STATION_STATUS_STOPPED && !station.isLeaving()){//刚到站未离开的
|
|
||||||
viewHolder.stationName.setTextColor(mContext.getResources().getColor(R.color.bus_p_clock_17417B));
|
|
||||||
viewHolder.curArrowBg.setBackgroundColor(mContext.getColor(R.color.bus_p_clock_A9B6CA));
|
|
||||||
viewHolder.curArrowBottomBg.setBackgroundColor(mContext.getColor(R.color.bus_p_clock_1F82FB));
|
|
||||||
viewHolder.stationCircle.setImageResource(R.drawable.bus_p_arrive_line_green);
|
|
||||||
if (position == mStations.size() - 1){
|
|
||||||
viewHolder.stationCircle.setImageResource(R.drawable.bg_bus_p_end_tag_bg);
|
|
||||||
viewHolder.curArrowBottomBg.setVisibility(View.GONE);
|
|
||||||
}
|
|
||||||
Log.d("onBindViewHolder" , "position2 = "+position);
|
|
||||||
BlinkAnimationUtil.setAnimation(viewHolder.stationCircle);
|
|
||||||
viewHolder.stationName.setEllipsize(TextUtils.TruncateAt.MARQUEE);
|
|
||||||
}else if (station.getDrivingStatus() == STATION_STATUS_ARRIVING && preStation.isLeaving()){//即将到站
|
|
||||||
viewHolder.stationName.setTextColor(mContext.getResources().getColor(R.color.bus_p_panel_cur_station_tips_color));
|
|
||||||
viewHolder.curArrowBg.setBackgroundColor(mContext.getColor(R.color.bus_p_clock_A9B6CA));
|
|
||||||
viewHolder.curArrowBottomBg.setBackgroundColor(mContext.getColor(R.color.bus_p_clock_1F82FB));
|
|
||||||
viewHolder.stationCircle.setImageResource(R.drawable.bus_p_arrive_line_blue);
|
|
||||||
Log.d("onBindViewHolder" , "position3 = "+position);
|
|
||||||
|
|
||||||
if (position == mStations.size() - 1){
|
|
||||||
viewHolder.curArrowBottomBg.setVisibility(View.GONE);
|
|
||||||
}
|
|
||||||
|
|
||||||
}else if (station.getDrivingStatus() == STATION_STATUS_ARRIVING &&
|
|
||||||
(preStation.getDrivingStatus() == STATION_STATUS_ARRIVING
|
|
||||||
|| preStation.getDrivingStatus() == STATION_STATUS_STOPPED)){ //未到站的并且前面也是未到站或者刚到站的
|
|
||||||
viewHolder.stationName.setTextColor(mContext.getResources().getColor(R.color.bus_p_panel_cur_station_tips_color));
|
|
||||||
viewHolder.curArrowBg.setBackgroundColor(mContext.getColor(R.color.bus_p_clock_1F82FB));
|
|
||||||
viewHolder.curArrowBottomBg.setBackgroundColor(mContext.getColor(R.color.bus_p_clock_1F82FB));
|
|
||||||
viewHolder.stationCircle.setImageResource(R.drawable.bus_p_point_blue);
|
|
||||||
viewHolder.stationName.setEllipsize(TextUtils.TruncateAt.END);
|
|
||||||
|
|
||||||
if (position == mStations.size() - 1){
|
|
||||||
viewHolder.stationCircle.setImageResource(R.drawable.bg_bus_p_end_tag_bg);
|
|
||||||
viewHolder.curArrowBottomBg.setVisibility(View.GONE);
|
|
||||||
}
|
|
||||||
Log.d("onBindViewHolder" , "position4 = "+position);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int getItemCount() {
|
|
||||||
return mStations.size();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
class StationViewHolder extends RecyclerView.ViewHolder{
|
|
||||||
public MarqueeTextView stationName;
|
|
||||||
public ImageView stationCircle;
|
|
||||||
public ImageView curArrowBg;
|
|
||||||
public ImageView curArrowBottomBg;
|
|
||||||
public StationViewHolder(@NonNull View itemView) {
|
|
||||||
super(itemView);
|
|
||||||
stationName = itemView.findViewById(R.id.bus_p_station);
|
|
||||||
stationCircle = itemView.findViewById(R.id.bus_p_circle);
|
|
||||||
curArrowBg = itemView.findViewById(R.id.bus_p_cur_arrow_bg);
|
|
||||||
curArrowBottomBg = itemView.findViewById(R.id.bus_p_cur_arrow_bottom_bg);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
@@ -1,42 +0,0 @@
|
|||||||
package com.mogo.och.bus.passenger.ui.layoutmanager;
|
|
||||||
|
|
||||||
import android.content.Context;
|
|
||||||
import android.util.AttributeSet;
|
|
||||||
|
|
||||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
|
||||||
import androidx.recyclerview.widget.LinearSmoothScroller;
|
|
||||||
import androidx.recyclerview.widget.RecyclerView;
|
|
||||||
|
|
||||||
public class CenterLayoutManager extends LinearLayoutManager {
|
|
||||||
public CenterLayoutManager(Context context) {
|
|
||||||
super(context);
|
|
||||||
}
|
|
||||||
|
|
||||||
public CenterLayoutManager(Context context, int orientation, boolean reverseLayout) {
|
|
||||||
super(context, orientation, reverseLayout);
|
|
||||||
}
|
|
||||||
|
|
||||||
public CenterLayoutManager(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) {
|
|
||||||
super(context, attrs, defStyleAttr, defStyleRes);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void smoothScrollToPosition(RecyclerView recyclerView, RecyclerView.State state, int position) {
|
|
||||||
RecyclerView.SmoothScroller smoothScroller = new CenterSmoothScroller(recyclerView.getContext());
|
|
||||||
smoothScroller.setTargetPosition(position);
|
|
||||||
startSmoothScroll(smoothScroller);
|
|
||||||
}
|
|
||||||
|
|
||||||
private static class CenterSmoothScroller extends LinearSmoothScroller {
|
|
||||||
|
|
||||||
CenterSmoothScroller(Context context) {
|
|
||||||
super(context);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int calculateDtToFit(int viewStart, int viewEnd, int boxStart, int boxEnd, int snapPreference) {
|
|
||||||
return (boxStart + (boxEnd - boxStart) / 2) - (viewStart + (viewEnd - viewStart) / 2);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,16 +0,0 @@
|
|||||||
package com.mogo.och.bus.passenger.ui.widget
|
|
||||||
|
|
||||||
import android.content.Context
|
|
||||||
import android.util.AttributeSet
|
|
||||||
import com.mogo.eagle.core.function.hmi.ui.vehicle.TurnLightViewStatus
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author: wangmingjun
|
|
||||||
* @date: 2023/2/13
|
|
||||||
*/
|
|
||||||
class BusPTurnLightView @JvmOverloads constructor(
|
|
||||||
context: Context, attrs: AttributeSet? = null
|
|
||||||
) : TurnLightViewStatus(context, attrs) {
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,10 +0,0 @@
|
|||||||
package com.mogo.och.bus.passenger.passenger.callback
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author: wangmingjun
|
|
||||||
* @date: 2023/2/15
|
|
||||||
*/
|
|
||||||
interface ADASCallback {
|
|
||||||
fun updateHDMapStations(stations: MutableList<MutableList<Double>>)
|
|
||||||
fun removeHDMapStations()
|
|
||||||
}
|
|
||||||
@@ -1,16 +0,0 @@
|
|||||||
package com.mogo.och.bus.passenger.passenger.constant
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Created on 2021/12/6
|
|
||||||
*/
|
|
||||||
class M2Const {
|
|
||||||
companion object {
|
|
||||||
//站点UUID
|
|
||||||
const val M2_MAP_STATION_MAKER = "m2_map_station_maker"
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Marker类型
|
|
||||||
*/
|
|
||||||
const val TYPE_MARKER_M2_LINE = "TYPE_MARKER_M2_LINE"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,45 +0,0 @@
|
|||||||
package com.mogo.och.bus.passenger.passenger.model
|
|
||||||
|
|
||||||
import android.content.Context
|
|
||||||
import com.mogo.och.bus.passenger.passenger.callback.ADASCallback
|
|
||||||
import com.mogo.och.data.bean.BusStationBean
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author: wangmingjun
|
|
||||||
* @date: 2023/2/2
|
|
||||||
*/
|
|
||||||
class PM2ADASModel private constructor() {
|
|
||||||
|
|
||||||
private var mContext: Context? = null
|
|
||||||
private var mAdasCallback: ADASCallback? = null
|
|
||||||
|
|
||||||
companion object {
|
|
||||||
val TAG = PM2ADASModel::class.java.simpleName
|
|
||||||
val INSTANCE: PM2ADASModel by lazy(mode = LazyThreadSafetyMode.SYNCHRONIZED) {
|
|
||||||
PM2ADASModel()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
fun init(context : Context){
|
|
||||||
this.mContext = context
|
|
||||||
}
|
|
||||||
|
|
||||||
fun setAdasCallback(adasCallback: ADASCallback?){
|
|
||||||
this.mAdasCallback = adasCallback
|
|
||||||
}
|
|
||||||
|
|
||||||
fun updateHDMapStations(stations: MutableList<BusStationBean>){
|
|
||||||
var stationsList = mutableListOf<MutableList<Double>>()
|
|
||||||
for (i in stations.indices){
|
|
||||||
var listLatLng = mutableListOf<Double>() // 0: long 1:lat
|
|
||||||
listLatLng.add(stations[i].lon)
|
|
||||||
listLatLng.add(stations[i].lat)
|
|
||||||
stationsList.add(listLatLng)
|
|
||||||
}
|
|
||||||
mAdasCallback?.updateHDMapStations(stationsList)
|
|
||||||
}
|
|
||||||
|
|
||||||
fun removeHDMapStations(){
|
|
||||||
mAdasCallback?.removeHDMapStations()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,41 +0,0 @@
|
|||||||
package com.mogo.och.bus.passenger.passenger.presenter
|
|
||||||
|
|
||||||
import androidx.lifecycle.LifecycleOwner
|
|
||||||
import com.mogo.commons.mvp.Presenter
|
|
||||||
import com.mogo.och.bus.passenger.passenger.callback.ADASCallback
|
|
||||||
import com.mogo.och.bus.passenger.passenger.constant.M2Const.Companion.M2_MAP_STATION_MAKER
|
|
||||||
import com.mogo.och.bus.passenger.passenger.model.PM2ADASModel
|
|
||||||
import com.mogo.och.bus.passenger.passenger.ui.PM2HPMapFragment
|
|
||||||
|
|
||||||
class PM2ADASPresenter(view: PM2HPMapFragment?) :
|
|
||||||
Presenter<PM2HPMapFragment?>(view), ADASCallback {
|
|
||||||
|
|
||||||
init {
|
|
||||||
PM2ADASModel.INSTANCE.init(context)
|
|
||||||
initListener()
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun initListener() {
|
|
||||||
PM2ADASModel.INSTANCE.setAdasCallback(this)
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun removeListener() {
|
|
||||||
PM2ADASModel.INSTANCE.setAdasCallback(null)
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onDestroy(owner: LifecycleOwner) {
|
|
||||||
super.onDestroy(owner)
|
|
||||||
removeListener()
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun updateHDMapStations(stations: MutableList<MutableList<Double>>) {
|
|
||||||
for (i in stations.indices){
|
|
||||||
mView?.setMapMaker(M2_MAP_STATION_MAKER+i,stations[i])
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun removeHDMapStations() {
|
|
||||||
mView?.removeMapMaker(M2_MAP_STATION_MAKER)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,131 +0,0 @@
|
|||||||
package com.mogo.och.bus.passenger.passenger.presenter
|
|
||||||
|
|
||||||
import androidx.lifecycle.LifecycleOwner
|
|
||||||
import com.amap.api.maps.model.LatLng
|
|
||||||
import com.mogo.commons.mvp.Presenter
|
|
||||||
import com.mogo.eagle.core.utilcode.util.ThreadUtils
|
|
||||||
import com.mogo.och.bus.passenger.callback.IAutopilotStatusCallback
|
|
||||||
import com.mogo.och.bus.passenger.callback.ISpeedCallback
|
|
||||||
import com.mogo.och.bus.passenger.callback.IDrivingInfoCallback
|
|
||||||
import com.mogo.och.bus.passenger.model.OrderModel
|
|
||||||
import com.mogo.och.bus.passenger.passenger.model.PM2ADASModel
|
|
||||||
import com.mogo.och.bus.passenger.passenger.ui.PM2DrivingInfoFragment
|
|
||||||
import com.mogo.och.data.bean.BusStationBean
|
|
||||||
|
|
||||||
class PM2DrivingPresenter(view: PM2DrivingInfoFragment?) :
|
|
||||||
Presenter<PM2DrivingInfoFragment?>(view), IDrivingInfoCallback, IAutopilotStatusCallback,
|
|
||||||
ISpeedCallback {
|
|
||||||
|
|
||||||
init {
|
|
||||||
OrderModel.init(context)
|
|
||||||
PM2ADASModel.INSTANCE.init(context)
|
|
||||||
initListener()
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onDestroy(owner: LifecycleOwner) {
|
|
||||||
super.onDestroy(owner)
|
|
||||||
destroyListener()
|
|
||||||
OrderModel.releaseListeners()
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun initListener(){
|
|
||||||
OrderModel.setDrivingInfoCallback(this)
|
|
||||||
OrderModel.setSpeedCallback(this)
|
|
||||||
OrderModel.setADASStatusCallback(this)
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun destroyListener(){
|
|
||||||
OrderModel.setDrivingInfoCallback(null)
|
|
||||||
OrderModel.setSpeedCallback(null)
|
|
||||||
OrderModel.setADASStatusCallback(null)
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun updateLine(lineName: String, lineDuring: String) {
|
|
||||||
ThreadUtils.runOnUiThread {
|
|
||||||
mView?.updateTaskName(lineName)
|
|
||||||
mView?.updateTaskDuringTime(lineDuring)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun updateRemainMT(meters: Long, timeInSecond: Long) {
|
|
||||||
ThreadUtils.runOnUiThread {
|
|
||||||
mView?.updateRemainMT(meters, timeInSecond) //米,秒
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun changeOperationStatus(loginStatus: Boolean) {
|
|
||||||
ThreadUtils.runOnUiThread {
|
|
||||||
mView?.changeOperationStatus(loginStatus)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun showNoTaskView() {
|
|
||||||
PM2ADASModel.INSTANCE.removeHDMapStations()
|
|
||||||
ThreadUtils.runOnUiThread {
|
|
||||||
mView?.showNoTaskView()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun hideNoTaskView() {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun updateLineStations(stations: MutableList<BusStationBean>) {
|
|
||||||
|
|
||||||
val stationsList = mutableListOf<LatLng>()
|
|
||||||
val stationsListPass = mutableListOf<LatLng>()
|
|
||||||
var startStation: LatLng? = null
|
|
||||||
var endStation: LatLng? = null
|
|
||||||
|
|
||||||
for (i in stations.indices){
|
|
||||||
val station = stations[i]
|
|
||||||
val latLng = LatLng(station.gcjLat,station.gcjLon)
|
|
||||||
if(i==0){
|
|
||||||
startStation = latLng
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
if(i==stations.size-1){
|
|
||||||
endStation = latLng
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
if(station.drivingStatus==1){//行驶信息,0初始值;1已经过;2当前站;3未到站
|
|
||||||
stationsListPass.add(latLng)
|
|
||||||
}else if(station.drivingStatus==2){
|
|
||||||
if(station.isLeaving){
|
|
||||||
stationsListPass.add(latLng)
|
|
||||||
}else{
|
|
||||||
stationsList.add(latLng)
|
|
||||||
}
|
|
||||||
}else{
|
|
||||||
stationsList.add(latLng)
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
ThreadUtils.runOnUiThread {
|
|
||||||
mView?.updateLineStations(stationsList,stationsListPass,startStation,endStation)
|
|
||||||
}
|
|
||||||
PM2ADASModel.INSTANCE.updateHDMapStations(stations)
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun updateStationsInfo(stations: MutableList<BusStationBean>, currentStationIndex: Int, isArrived: Boolean) {
|
|
||||||
ThreadUtils.runOnUiThread {
|
|
||||||
mView?.updateStationsInfo(stations,currentStationIndex,isArrived)
|
|
||||||
}
|
|
||||||
updateLineStations(stations)
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun updateAutoStatus(isOpen: Boolean) {
|
|
||||||
ThreadUtils.runOnUiThread {
|
|
||||||
mView?.updateAutoStatus(isOpen)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onCarLocationChanged(speed: Float) {
|
|
||||||
val speedKM: Int = (Math.abs(speed) * 3.6f).toInt()
|
|
||||||
ThreadUtils.runOnUiThread {
|
|
||||||
mView?.updateSpeed(speedKM)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,7 +0,0 @@
|
|||||||
package com.mogo.och.bus.passenger.passenger.presenter
|
|
||||||
|
|
||||||
import com.mogo.commons.mvp.Presenter
|
|
||||||
import com.mogo.och.bus.passenger.passenger.ui.PM2BaseFragment
|
|
||||||
|
|
||||||
class PM2Presenter(view: PM2BaseFragment?) :
|
|
||||||
Presenter<PM2BaseFragment?>(view)
|
|
||||||
@@ -1,60 +0,0 @@
|
|||||||
package com.mogo.och.bus.passenger.passenger.ui
|
|
||||||
|
|
||||||
import com.mogo.commons.mvp.MvpFragment
|
|
||||||
import com.mogo.eagle.core.utilcode.util.AppUtils
|
|
||||||
import com.mogo.och.bus.passenger.R
|
|
||||||
import com.mogo.och.bus.passenger.passenger.presenter.PM2Presenter
|
|
||||||
import com.mogo.och.common.module.wigets.media.MediaPlayerFragment
|
|
||||||
import kotlinx.android.synthetic.main.bus_p_m2_fragment.tv_bug_b2_p_version
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author: wangmingjun
|
|
||||||
* @date: 2022/4/12
|
|
||||||
*/
|
|
||||||
class PM2BaseFragment :
|
|
||||||
MvpFragment<PM2BaseFragment?, PM2Presenter?>() {
|
|
||||||
|
|
||||||
private var drivingFragment : PM2DrivingInfoFragment? = null
|
|
||||||
private var hdMapFragment : PM2HPMapFragment? = null
|
|
||||||
private var mediaFragment : MediaPlayerFragment? = null
|
|
||||||
|
|
||||||
override fun getLayoutId(): Int {
|
|
||||||
return R.layout.bus_p_m2_fragment
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun getTagName(): String {
|
|
||||||
return TAG
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun initViews() {
|
|
||||||
tv_bug_b2_p_version.text = "版本:${AppUtils.getAppVersionName()}"
|
|
||||||
//隐藏小地图
|
|
||||||
initFragment()
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 初始化行程信息,高静地图,宣传 三个fragment
|
|
||||||
*/
|
|
||||||
private fun initFragment() {
|
|
||||||
|
|
||||||
if (drivingFragment == null) drivingFragment = PM2DrivingInfoFragment()
|
|
||||||
childFragmentManager.beginTransaction().add(R.id.driving_fragment, drivingFragment!!)
|
|
||||||
.show(drivingFragment!!).commitAllowingStateLoss()
|
|
||||||
|
|
||||||
if (hdMapFragment == null) hdMapFragment = PM2HPMapFragment()
|
|
||||||
childFragmentManager.beginTransaction().add(R.id.hd_map_fragment, hdMapFragment!!)
|
|
||||||
.show(hdMapFragment!!).commitAllowingStateLoss()
|
|
||||||
|
|
||||||
if (mediaFragment == null) mediaFragment = MediaPlayerFragment()
|
|
||||||
childFragmentManager.beginTransaction().add(R.id.video_fragment, mediaFragment!!)
|
|
||||||
.show(mediaFragment!!).commitAllowingStateLoss()
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun createPresenter(): PM2Presenter {
|
|
||||||
return PM2Presenter(this)
|
|
||||||
}
|
|
||||||
|
|
||||||
companion object {
|
|
||||||
val TAG = PM2BaseFragment::class.java.simpleName
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,292 +0,0 @@
|
|||||||
package com.mogo.och.bus.passenger.passenger.ui
|
|
||||||
|
|
||||||
import android.graphics.BitmapFactory
|
|
||||||
import android.graphics.drawable.AnimationDrawable
|
|
||||||
import android.os.Bundle
|
|
||||||
import android.view.View
|
|
||||||
import androidx.core.content.ContextCompat
|
|
||||||
import com.amap.api.maps.model.LatLng
|
|
||||||
import com.mogo.commons.AbsMogoApplication
|
|
||||||
import com.mogo.commons.mvp.MvpFragment
|
|
||||||
import com.mogo.eagle.core.function.hmi.ui.setting.ToggleDebugView
|
|
||||||
import com.mogo.eagle.core.function.view.SiteMarkerBean
|
|
||||||
import com.mogo.eagle.core.widget.media.video.TextureVideoViewOutlineProvider
|
|
||||||
import com.mogo.och.bus.passenger.R
|
|
||||||
import com.mogo.och.bus.passenger.passenger.presenter.PM2DrivingPresenter
|
|
||||||
import com.mogo.och.common.module.utils.DateTimeUtil.*
|
|
||||||
import com.mogo.och.common.module.utils.NumberFormatUtil
|
|
||||||
import com.mogo.och.common.module.utils.ResourcesUtils
|
|
||||||
import com.mogo.och.data.bean.BusStationBean
|
|
||||||
import kotlinx.android.synthetic.main.bus_p_m2_driving_info_fragment.auto_tv
|
|
||||||
import kotlinx.android.synthetic.main.bus_p_m2_driving_info_fragment.clg_distance_left_time
|
|
||||||
import kotlinx.android.synthetic.main.bus_p_m2_driving_info_fragment.group_not_select_line
|
|
||||||
import kotlinx.android.synthetic.main.bus_p_m2_driving_info_fragment.group_stationinfo
|
|
||||||
import kotlinx.android.synthetic.main.bus_p_m2_driving_info_fragment.iv_animal_list
|
|
||||||
import kotlinx.android.synthetic.main.bus_p_m2_driving_info_fragment.line_during_tv
|
|
||||||
import kotlinx.android.synthetic.main.bus_p_m2_driving_info_fragment.line_name_tv
|
|
||||||
import kotlinx.android.synthetic.main.bus_p_m2_driving_info_fragment.overMapView
|
|
||||||
import kotlinx.android.synthetic.main.bus_p_m2_driving_info_fragment.speed_tv
|
|
||||||
import kotlinx.android.synthetic.main.bus_p_m2_driving_info_fragment.station_name_tv
|
|
||||||
import kotlinx.android.synthetic.main.bus_p_m2_driving_info_fragment.tv_arrived_notice
|
|
||||||
import kotlinx.android.synthetic.main.bus_p_m2_driving_info_fragment.tv_distance
|
|
||||||
import kotlinx.android.synthetic.main.bus_p_m2_driving_info_fragment.tv_left_time
|
|
||||||
import kotlinx.android.synthetic.main.bus_p_m2_driving_info_fragment.tv_next_station_title
|
|
||||||
|
|
||||||
import me.jessyan.autosize.utils.AutoSizeUtils
|
|
||||||
import kotlin.math.ceil
|
|
||||||
import kotlin.math.roundToInt
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author: wangmingjun
|
|
||||||
* @date: 2022/4/12
|
|
||||||
*/
|
|
||||||
class PM2DrivingInfoFragment :
|
|
||||||
MvpFragment<PM2DrivingInfoFragment?, PM2DrivingPresenter?>() {
|
|
||||||
|
|
||||||
val stationIcon = BitmapFactory.decodeResource(AbsMogoApplication.getApp().resources, R.drawable.bus_p_m2_map_staton_icon)
|
|
||||||
val stationPassIcon = BitmapFactory.decodeResource(AbsMogoApplication.getApp().resources, R.drawable.bus_p_m2_map_staton_arrived_icon)
|
|
||||||
val startStationIcon = BitmapFactory.decodeResource(AbsMogoApplication.getApp().resources, R.drawable.bus_p_m2_map_start_icon)
|
|
||||||
val endStationIcon = BitmapFactory.decodeResource(AbsMogoApplication.getApp().resources, R.drawable.bus_p_m2_map_end_icon)
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 改变自动驾驶状态
|
|
||||||
*
|
|
||||||
* @param status 2 - running 1 - enable 2 - disable
|
|
||||||
*/
|
|
||||||
override fun getLayoutId(): Int {
|
|
||||||
return R.layout.bus_p_m2_driving_info_fragment
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun getTagName(): String {
|
|
||||||
return TAG
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun initViews() {
|
|
||||||
speed_tv.setOnLongClickListener {
|
|
||||||
context?.let { ToggleDebugView.toggleDebugView.toggle(it) }
|
|
||||||
true
|
|
||||||
}
|
|
||||||
|
|
||||||
line_name_tv.setTextColor(ResourcesUtils.getColor(R.color.bus_p_m2_line_name_tv_color))
|
|
||||||
station_name_tv.setTextColor(ResourcesUtils.getColor(R.color.bus_p_m2_line_name_tv_color))
|
|
||||||
speed_tv.setVertrial(true)
|
|
||||||
val intArrayOf = intArrayOf(
|
|
||||||
ResourcesUtils.getColor(R.color.bus_p_m2_color_43cefe),
|
|
||||||
ResourcesUtils.getColor(R.color.bus_p_m2_color_1466fb)
|
|
||||||
)
|
|
||||||
speed_tv.setmColorList(intArrayOf)
|
|
||||||
|
|
||||||
// current_time_tv.onClick {
|
|
||||||
|
|
||||||
// //测试V2X消息
|
|
||||||
// CallerMsgBoxManager.saveMsgBox(
|
|
||||||
// MsgBoxBean(
|
|
||||||
// MsgBoxType.V2X,
|
|
||||||
// V2XMsg(
|
|
||||||
// "6666",
|
|
||||||
// "超速行驶",
|
|
||||||
// ""
|
|
||||||
// )
|
|
||||||
// )
|
|
||||||
// )
|
|
||||||
//
|
|
||||||
// val noticeTrafficStylePushData = NoticeTrafficStylePushData()
|
|
||||||
// noticeTrafficStylePushData.content= "测试公告布局"
|
|
||||||
// val noticeFromCloudMsg = NoticeFrCloudMsg(null, noticeTrafficStylePushData, 1)
|
|
||||||
// CallerMsgBoxManager.saveMsgBox(
|
|
||||||
// MsgBoxBean(
|
|
||||||
// MsgBoxType.NOTICE, noticeFromCloudMsg)
|
|
||||||
// )
|
|
||||||
// BPRouteDataTestUtils.converToRouteData()
|
|
||||||
// }
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun initViews(savedInstanceState: Bundle?) {
|
|
||||||
super.initViews(savedInstanceState)
|
|
||||||
overMapView?.let {
|
|
||||||
it.onCreateView(savedInstanceState)
|
|
||||||
val radius = AutoSizeUtils.dp2px(requireContext(), 16f)
|
|
||||||
it.outlineProvider = TextureVideoViewOutlineProvider(radius.toFloat())
|
|
||||||
it.clipToOutline = true
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onResume() {
|
|
||||||
super.onResume()
|
|
||||||
overMapView?.let{
|
|
||||||
it.onResume()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onPause() {
|
|
||||||
super.onPause()
|
|
||||||
overMapView?.let{
|
|
||||||
it.onPause()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onDestroyView() {
|
|
||||||
overMapView?.let{
|
|
||||||
it.onDestroy()
|
|
||||||
}
|
|
||||||
super.onDestroyView()
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
fun updateSpeed(speed: Int){
|
|
||||||
speed_tv.text = speed.toString()
|
|
||||||
}
|
|
||||||
|
|
||||||
fun updateTaskName(name: String){
|
|
||||||
line_name_tv.text = name
|
|
||||||
}
|
|
||||||
|
|
||||||
fun updateTaskDuringTime(time : String){
|
|
||||||
line_during_tv.text = time
|
|
||||||
}
|
|
||||||
|
|
||||||
fun changeOperationStatus(status:Boolean){
|
|
||||||
if (!status){
|
|
||||||
showNoTaskView()
|
|
||||||
clearCustomPolyline()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
fun showNoTaskView(){
|
|
||||||
line_name_tv.text = ResourcesUtils.getString(R.string.bus_p_m2_not_select_line_content)
|
|
||||||
updateNoStationView()
|
|
||||||
overMapView?.let {
|
|
||||||
it.clearSiteMarkers()
|
|
||||||
}
|
|
||||||
clearCustomPolyline()
|
|
||||||
}
|
|
||||||
|
|
||||||
fun clearCustomPolyline(){
|
|
||||||
overMapView?.let {
|
|
||||||
it.clearCustomPolyline()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
private fun updateNoStationView(){
|
|
||||||
station_name_tv.setTextColor(ResourcesUtils.getColor(R.color.bus_p_m2_next_tv_color))
|
|
||||||
station_name_tv.text = ResourcesUtils.getString(R.string.bus_p_m2_empty_tv)
|
|
||||||
tv_distance.text = ResourcesUtils.getString(R.string.bus_p_m2_empty_remain_km)
|
|
||||||
tv_left_time.text = ResourcesUtils.getString(R.string.bus_p_m2_empty_remain_minute)
|
|
||||||
noLineShow()
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun createPresenter(): PM2DrivingPresenter {
|
|
||||||
return PM2DrivingPresenter(this)
|
|
||||||
}
|
|
||||||
|
|
||||||
fun updateAutoStatus(isAutoPilot: Boolean) {
|
|
||||||
if (isAutoPilot){
|
|
||||||
context?.let { auto_tv.setTextColor(ContextCompat.getColor(it,R.color.bus_p_m2_white_color)) }
|
|
||||||
context?.let { auto_tv.background = ContextCompat.getDrawable(it,R.drawable.bus_p_m2_auto_button_bg) }
|
|
||||||
}else{
|
|
||||||
context?.let { auto_tv.setTextColor(ContextCompat.getColor(it,R.color.bus_p_m2_color_7094ad)) }
|
|
||||||
context?.let { auto_tv.background = ContextCompat.getDrawable(it,R.drawable.bus_p_m2_bg_p_m2_auto) }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
fun updateLineStations(
|
|
||||||
stations: MutableList<LatLng>,
|
|
||||||
stationsPass: MutableList<LatLng>,
|
|
||||||
startStation: LatLng?,
|
|
||||||
endStation: LatLng?
|
|
||||||
){
|
|
||||||
overMapView?.let {
|
|
||||||
val stationsList: MutableList<SiteMarkerBean> = mutableListOf()
|
|
||||||
startStation?.let { start->
|
|
||||||
stationsList.add(SiteMarkerBean(start,startStationIcon,0.5f,0.5f))
|
|
||||||
}
|
|
||||||
for (stationsPass in stationsPass) {
|
|
||||||
stationsList.add(SiteMarkerBean(stationsPass,stationPassIcon,0.5f,0.5f))
|
|
||||||
}
|
|
||||||
for (stationsPass in stations) {
|
|
||||||
stationsList.add(SiteMarkerBean(stationsPass,stationIcon,0.5f,0.5f))
|
|
||||||
}
|
|
||||||
endStation?.let {end->
|
|
||||||
stationsList.add(SiteMarkerBean(end,endStationIcon,0.5f,0.5f))
|
|
||||||
}
|
|
||||||
it.drawSiteMarkers(stationsList)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
fun updateStationsInfo(stations: MutableList<BusStationBean>, currentStationIndex: Int, isArrived: Boolean){
|
|
||||||
if (stations.size == 0) return
|
|
||||||
if (0<= currentStationIndex && currentStationIndex<stations.size){
|
|
||||||
station_name_tv.setTextColor(ResourcesUtils.getColor(R.color.bus_p_m2_next_tv_color))
|
|
||||||
station_name_tv.text = stations[currentStationIndex].name
|
|
||||||
}
|
|
||||||
if (currentStationIndex == 0 && isArrived){
|
|
||||||
clearCustomPolyline()
|
|
||||||
}
|
|
||||||
if (isArrived){//到站
|
|
||||||
tv_distance.text = ResourcesUtils.getString(R.string.bus_p_m2_empty_remain_km)
|
|
||||||
tv_left_time.text = ResourcesUtils.getString(R.string.bus_p_m2_empty_remain_minute)
|
|
||||||
tv_next_station_title.text = ResourcesUtils.getString(R.string.bus_p_m2_station_title_arrived_tv)
|
|
||||||
haveLineAndArrivedStation()
|
|
||||||
}else{ //前往目的地中
|
|
||||||
tv_next_station_title.text = ResourcesUtils.getString(R.string.bus_p_m2_next_station_title)
|
|
||||||
haveLineAndArriveingStation()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 剩余里程和时间
|
|
||||||
*/
|
|
||||||
fun updateRemainMT(meters: Long, timeInSecond: Long) { //米。秒
|
|
||||||
var disUnit = "公里"
|
|
||||||
var remainDis: String? = "0"
|
|
||||||
|
|
||||||
if (meters > 0) {
|
|
||||||
if (meters / 1000 < 1) {
|
|
||||||
disUnit = "米"
|
|
||||||
remainDis = meters.toFloat().roundToInt().toString()
|
|
||||||
} else {
|
|
||||||
disUnit = "公里"
|
|
||||||
remainDis = NumberFormatUtil.formatLong(meters.toDouble() / 1000)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
val time = ceil(timeInSecond / 60f).toInt()
|
|
||||||
|
|
||||||
"$remainDis$disUnit".also { tv_distance.text = it }
|
|
||||||
"${time}分钟".also { tv_left_time.text = it }
|
|
||||||
}
|
|
||||||
|
|
||||||
fun noLineShow(){
|
|
||||||
// 没有线路展示
|
|
||||||
group_not_select_line.visibility = View.VISIBLE
|
|
||||||
// 下一个站点
|
|
||||||
group_stationinfo.visibility = View.GONE
|
|
||||||
// 距离和剩余大概时间
|
|
||||||
clg_distance_left_time.visibility = View.GONE
|
|
||||||
// 到达站点
|
|
||||||
tv_arrived_notice.visibility = View.GONE
|
|
||||||
|
|
||||||
iv_animal_list.visibility = View.GONE
|
|
||||||
}
|
|
||||||
// 有线路正在到站点
|
|
||||||
fun haveLineAndArriveingStation(){
|
|
||||||
group_not_select_line.visibility = View.GONE
|
|
||||||
group_stationinfo.visibility = View.VISIBLE
|
|
||||||
clg_distance_left_time.visibility = View.VISIBLE
|
|
||||||
tv_arrived_notice.visibility = View.GONE
|
|
||||||
iv_animal_list.visibility = View.GONE
|
|
||||||
}
|
|
||||||
// 有线路到达站点
|
|
||||||
private fun haveLineAndArrivedStation(){
|
|
||||||
group_not_select_line.visibility = View.GONE
|
|
||||||
group_stationinfo.visibility = View.VISIBLE
|
|
||||||
clg_distance_left_time.visibility = View.GONE
|
|
||||||
tv_arrived_notice.visibility = View.VISIBLE
|
|
||||||
iv_animal_list.visibility = View.VISIBLE
|
|
||||||
val animationDrawable = iv_animal_list.drawable as AnimationDrawable
|
|
||||||
animationDrawable.start()
|
|
||||||
}
|
|
||||||
|
|
||||||
companion object {
|
|
||||||
private val TAG = PM2DrivingInfoFragment::class.java.simpleName
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,132 +0,0 @@
|
|||||||
package com.mogo.och.bus.passenger.passenger.ui
|
|
||||||
|
|
||||||
import android.os.Bundle
|
|
||||||
import com.mogo.commons.mvp.MvpFragment
|
|
||||||
import com.mogo.eagle.core.function.call.map.CallerMapUIServiceManager
|
|
||||||
import com.mogo.eagle.core.function.call.map.CallerMapUIServiceManager.getOverlayManager
|
|
||||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger.d
|
|
||||||
import com.mogo.map.overlay.core.Level
|
|
||||||
import com.mogo.map.overlay.point.Point
|
|
||||||
import com.mogo.map.MapDataWrapper
|
|
||||||
import com.mogo.och.bus.passenger.R
|
|
||||||
import com.mogo.och.bus.passenger.passenger.constant.M2Const.Companion.TYPE_MARKER_M2_LINE
|
|
||||||
import com.mogo.och.bus.passenger.passenger.presenter.PM2ADASPresenter
|
|
||||||
import com.mogo.och.common.module.utils.OCHThreadPoolManager
|
|
||||||
import kotlinx.android.synthetic.main.bus_p_m2_hpmap_fragment.mapBizView
|
|
||||||
|
|
||||||
import java.util.*
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author: wangmingjun
|
|
||||||
* @date: 2022/4/12
|
|
||||||
*/
|
|
||||||
class PM2HPMapFragment :
|
|
||||||
MvpFragment<PM2HPMapFragment?, PM2ADASPresenter?>() {
|
|
||||||
/**
|
|
||||||
* 改变自动驾驶状态
|
|
||||||
*
|
|
||||||
* @param status 2 - running 1 - enable 2 - disable
|
|
||||||
*/
|
|
||||||
override fun getLayoutId(): Int {
|
|
||||||
return R.layout.bus_p_m2_hpmap_fragment
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun getTagName(): String {
|
|
||||||
return TAG
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun initViews() {
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun initViews(savedInstanceState: Bundle?) {
|
|
||||||
super.initViews(savedInstanceState)
|
|
||||||
mapBizView.onCreate(savedInstanceState)
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onResume() {
|
|
||||||
super.onResume()
|
|
||||||
mapBizView.onResume()
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onLowMemory() {
|
|
||||||
super.onLowMemory()
|
|
||||||
mapBizView.onLowMemory()
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onSaveInstanceState(outState: Bundle) {
|
|
||||||
super.onSaveInstanceState(outState)
|
|
||||||
mapBizView.onSaveInstanceState(outState)
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onPause() {
|
|
||||||
super.onPause()
|
|
||||||
mapBizView.onPause()
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onDestroyView() {
|
|
||||||
mapBizView.onDestroy()
|
|
||||||
CallerMapUIServiceManager.getOverlayManager()?.let {
|
|
||||||
it.removeAllLines()
|
|
||||||
it.removeAllPoints()
|
|
||||||
}
|
|
||||||
super.onDestroyView()
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun createPresenter(): PM2ADASPresenter {
|
|
||||||
return PM2ADASPresenter(this)
|
|
||||||
}
|
|
||||||
|
|
||||||
companion object {
|
|
||||||
private val TAG = PM2HPMapFragment::class.java.simpleName
|
|
||||||
}
|
|
||||||
|
|
||||||
fun setMapMaker(
|
|
||||||
uuid: String,
|
|
||||||
station: MutableList<Double>,
|
|
||||||
) {
|
|
||||||
//开启线程执行起终点marker设置
|
|
||||||
val setMapMarkerRunnable = Runnable {
|
|
||||||
d(
|
|
||||||
"setMapMaker= " + Thread.currentThread().name,
|
|
||||||
uuid + "=latitude=" + station[1] + ",longitude=" + station[0]
|
|
||||||
)
|
|
||||||
|
|
||||||
val builder = Point.Options.Builder(
|
|
||||||
TYPE_MARKER_M2_LINE,
|
|
||||||
Level.MAP_MARKER
|
|
||||||
)
|
|
||||||
.setId(uuid)
|
|
||||||
.anchor(0.5f, 0.5f)
|
|
||||||
.set3DMode(true)
|
|
||||||
.isUseGps(true)
|
|
||||||
.controlAngle(true)
|
|
||||||
.icon3DRes(R.raw.star_marker)
|
|
||||||
.longitude(station[0])
|
|
||||||
.latitude(station[1])
|
|
||||||
MapDataWrapper.getCenterLineInfo(
|
|
||||||
station[0], station[1], -1f
|
|
||||||
) {
|
|
||||||
// 有可能鹰眼map为空没有角度。判空使用后可能造成maker角度跟道路角度不一致 地图未初始化会返回空
|
|
||||||
it?.let{
|
|
||||||
builder.rotate(it.angle.toFloat())
|
|
||||||
}
|
|
||||||
val overlayManager = getOverlayManager()
|
|
||||||
overlayManager?.showOrUpdatePoint(builder.build())
|
|
||||||
}
|
|
||||||
}
|
|
||||||
OCHThreadPoolManager.getsInstance().execute(setMapMarkerRunnable)
|
|
||||||
}
|
|
||||||
|
|
||||||
fun removeMapMaker(
|
|
||||||
uuid: String,
|
|
||||||
) {
|
|
||||||
//开启线程移除起终点marker设置
|
|
||||||
val removeMapMarkerRunnable = Runnable {
|
|
||||||
d("RemoveMapMaker=" + Thread.currentThread().name, uuid)
|
|
||||||
val overlayManager = getOverlayManager()
|
|
||||||
overlayManager?.removeAllPointsInOwner(TYPE_MARKER_M2_LINE)
|
|
||||||
}
|
|
||||||
OCHThreadPoolManager.getsInstance().execute(removeMapMarkerRunnable)
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,36 +0,0 @@
|
|||||||
package com.mogo.och.bus.passenger.passenger.ui.widget
|
|
||||||
|
|
||||||
import android.content.Context
|
|
||||||
import android.util.AttributeSet
|
|
||||||
import android.view.LayoutInflater
|
|
||||||
import com.mogo.eagle.core.function.api.devatools.IMoGoDevaToolsListener
|
|
||||||
import com.mogo.eagle.core.function.hmi.ui.widget.BlueToothView
|
|
||||||
import com.mogo.eagle.core.utilcode.util.ThreadUtils
|
|
||||||
import com.mogo.och.bus.passenger.R
|
|
||||||
import kotlinx.android.synthetic.main.bus_p_m2_view_blue_tooth.view.blueView
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 魔戒蓝牙控件
|
|
||||||
* 放置于StatusBar右侧位置
|
|
||||||
*/
|
|
||||||
class M2BlueToothView @JvmOverloads constructor(
|
|
||||||
context: Context,
|
|
||||||
attrs: AttributeSet? = null,
|
|
||||||
defStyleAttr: Int = 0
|
|
||||||
) : BlueToothView(context, attrs, defStyleAttr),IMoGoDevaToolsListener {
|
|
||||||
|
|
||||||
init {
|
|
||||||
LayoutInflater.from(context).inflate(R.layout.bus_p_m2_view_blue_tooth, this, true)
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun mofangStatus(status: Boolean) {
|
|
||||||
ThreadUtils.runOnUiThread {
|
|
||||||
if (status) {
|
|
||||||
blueView.setImageResource(R.drawable.bus_p_m2_blue_tooth_close)
|
|
||||||
} else {
|
|
||||||
blueView.setImageResource(R.drawable.bus_p_m2_blue_tooth_open)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,181 +0,0 @@
|
|||||||
package com.mogo.och.bus.passenger.passenger.ui.widget
|
|
||||||
|
|
||||||
import android.content.Context
|
|
||||||
import android.util.AttributeSet
|
|
||||||
import android.view.LayoutInflater
|
|
||||||
import android.widget.LinearLayout
|
|
||||||
import com.mogo.eagle.core.data.enums.DataSourceType
|
|
||||||
import com.mogo.eagle.core.data.enums.TrafficLightEnum
|
|
||||||
import com.mogo.eagle.core.function.api.datacenter.union.IMoGoTrafficLightListener
|
|
||||||
import com.mogo.eagle.core.function.call.v2x.CallerTrafficLightListenerManager
|
|
||||||
import com.mogo.eagle.core.utilcode.util.UiThreadHandler
|
|
||||||
import com.mogo.och.bus.passenger.R
|
|
||||||
import kotlinx.android.synthetic.main.bus_p_m2_traffic_light_view.view.m2_p_traffic_light_bg
|
|
||||||
import kotlinx.android.synthetic.main.bus_p_m2_traffic_light_view.view.m2_p_traffic_light_iv
|
|
||||||
import kotlinx.android.synthetic.main.bus_p_m2_traffic_light_view.view.m2_p_traffic_light_time_tv
|
|
||||||
|
|
||||||
/**
|
|
||||||
* bus乘客端:红绿灯view
|
|
||||||
*
|
|
||||||
* Created on 2022/3/14
|
|
||||||
*/
|
|
||||||
class M2PTrafficLightView @JvmOverloads constructor(
|
|
||||||
context: Context?,
|
|
||||||
attrs: AttributeSet? = null,
|
|
||||||
defStyleAttr: Int = 0
|
|
||||||
) : LinearLayout(context, attrs, defStyleAttr), IMoGoTrafficLightListener {
|
|
||||||
|
|
||||||
companion object {
|
|
||||||
private const val TAG = "M2PTrafficLightView"
|
|
||||||
}
|
|
||||||
|
|
||||||
private var mCurrentLightId = TrafficLightEnum.BLACK
|
|
||||||
|
|
||||||
init {
|
|
||||||
init(context)
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun init(context: Context?) {
|
|
||||||
LayoutInflater.from(context).inflate(R.layout.bus_p_m2_traffic_light_view, this, true)
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onAttachedToWindow() {
|
|
||||||
super.onAttachedToWindow()
|
|
||||||
CallerTrafficLightListenerManager.addListener(TAG, this)
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onDetachedFromWindow() {
|
|
||||||
super.onDetachedFromWindow()
|
|
||||||
CallerTrafficLightListenerManager.removeListener(TAG)
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 展示红绿灯预警
|
|
||||||
*
|
|
||||||
* @param checkLightId 0-都是默认,1-红,2-黄,3-绿
|
|
||||||
* @param lightSource 1:云端下发;2:自车感知
|
|
||||||
*/
|
|
||||||
override fun showTrafficLight(checkLightId: TrafficLightEnum, lightSource: DataSourceType) {
|
|
||||||
super.showTrafficLight(checkLightId, lightSource)
|
|
||||||
mCurrentLightId = checkLightId
|
|
||||||
updateTrafficLightIcon(checkLightId)
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 关闭红绿灯预警展示,并重制灯态
|
|
||||||
*/
|
|
||||||
override fun disableTrafficLight() {
|
|
||||||
super.disableTrafficLight()
|
|
||||||
UiThreadHandler.post {
|
|
||||||
mCurrentLightId = TrafficLightEnum.BLACK
|
|
||||||
this@M2PTrafficLightView.visibility = GONE
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param redNum 红灯倒计时
|
|
||||||
* @param yellowNum 黄灯倒计时
|
|
||||||
* @param greenNum 绿灯倒计时
|
|
||||||
*/
|
|
||||||
override fun changeCountdownTrafficLightNum(redNum: Int, yellowNum: Int, greenNum: Int) {
|
|
||||||
super.changeCountdownTrafficLightNum(redNum, yellowNum, greenNum)
|
|
||||||
resetView()
|
|
||||||
when (mCurrentLightId) {
|
|
||||||
TrafficLightEnum.RED -> changeCountdownRed(redNum)
|
|
||||||
TrafficLightEnum.YELLOW -> changeCountdownYellow(yellowNum)
|
|
||||||
TrafficLightEnum.GREEN -> changeCountdownGreen(greenNum)
|
|
||||||
else -> UiThreadHandler.post { m2_p_traffic_light_time_tv.text = "" }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun changeCountdownRed(redNum: Int) {
|
|
||||||
super.changeCountdownRed(redNum)
|
|
||||||
UiThreadHandler.post {
|
|
||||||
if (redNum > 0) {
|
|
||||||
resetView()
|
|
||||||
m2_p_traffic_light_time_tv.text = redNum.toString()
|
|
||||||
} else {
|
|
||||||
disableTrafficLightCountDown()
|
|
||||||
m2_p_traffic_light_time_tv.text = ""
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun changeCountdownGreen(greenNum: Int) {
|
|
||||||
super.changeCountdownGreen(greenNum)
|
|
||||||
UiThreadHandler.post {
|
|
||||||
if (greenNum > 0) {
|
|
||||||
resetView()
|
|
||||||
m2_p_traffic_light_time_tv.text = greenNum.toString()
|
|
||||||
} else {
|
|
||||||
disableTrafficLightCountDown()
|
|
||||||
m2_p_traffic_light_time_tv.text = ""
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun changeCountdownYellow(yellowNum: Int) {
|
|
||||||
super.changeCountdownYellow(yellowNum)
|
|
||||||
UiThreadHandler.post {
|
|
||||||
if (yellowNum > 0) {
|
|
||||||
resetView()
|
|
||||||
m2_p_traffic_light_time_tv.text = yellowNum.toString()
|
|
||||||
} else {
|
|
||||||
disableTrafficLightCountDown()
|
|
||||||
m2_p_traffic_light_time_tv.text = ""
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 更新红绿灯icon
|
|
||||||
*
|
|
||||||
* @param lightId 0-都是默认,1-红,2-黄,3-绿
|
|
||||||
*/
|
|
||||||
private fun updateTrafficLightIcon(lightId: TrafficLightEnum) {
|
|
||||||
UiThreadHandler.post {
|
|
||||||
when (lightId) {
|
|
||||||
TrafficLightEnum.RED -> {
|
|
||||||
m2_p_traffic_light_iv.setBackgroundResource(R.drawable.bus_p_m2_light_red_nor)
|
|
||||||
this@M2PTrafficLightView.visibility = VISIBLE
|
|
||||||
}
|
|
||||||
TrafficLightEnum.YELLOW -> {
|
|
||||||
m2_p_traffic_light_iv.setBackgroundResource(R.drawable.bus_p_m2_light_yellow_nor)
|
|
||||||
this@M2PTrafficLightView.visibility = VISIBLE
|
|
||||||
}
|
|
||||||
TrafficLightEnum.GREEN -> {
|
|
||||||
m2_p_traffic_light_iv.setBackgroundResource(R.drawable.bus_p_m2_light_green_nor)
|
|
||||||
this@M2PTrafficLightView.visibility = VISIBLE
|
|
||||||
}
|
|
||||||
else -> this@M2PTrafficLightView.visibility = GONE
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun disableTrafficLightCountDown() {
|
|
||||||
super.disableTrafficLightCountDown()
|
|
||||||
UiThreadHandler.post {
|
|
||||||
val layoutParams = layoutParams
|
|
||||||
if (layoutParams is MarginLayoutParams) {
|
|
||||||
val lp = layoutParams
|
|
||||||
lp.width = resources.getDimension(R.dimen.dp_40).toInt()
|
|
||||||
setLayoutParams(lp)
|
|
||||||
m2_p_traffic_light_time_tv.visibility = GONE
|
|
||||||
m2_p_traffic_light_bg.layoutParams.width =
|
|
||||||
resources.getDimension(R.dimen.dp_40).toInt()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun resetView() {
|
|
||||||
val layoutParams = layoutParams
|
|
||||||
if (layoutParams is MarginLayoutParams) {
|
|
||||||
val lp = layoutParams
|
|
||||||
lp.width = resources.getDimension(R.dimen.dp_60).toInt()
|
|
||||||
setLayoutParams(lp)
|
|
||||||
m2_p_traffic_light_time_tv.visibility = VISIBLE
|
|
||||||
m2_p_traffic_light_bg.layoutParams.width =
|
|
||||||
resources.getDimension(R.dimen.dp_60).toInt()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,114 +0,0 @@
|
|||||||
package com.mogo.och.bus.passenger.passenger.ui.widget
|
|
||||||
|
|
||||||
import android.annotation.*
|
|
||||||
import android.content.Context
|
|
||||||
import android.graphics.Color
|
|
||||||
import android.util.AttributeSet
|
|
||||||
import android.view.LayoutInflater
|
|
||||||
import android.view.ViewGroup
|
|
||||||
import androidx.constraintlayout.widget.ConstraintLayout
|
|
||||||
import chassis.ChassisStatesOuterClass
|
|
||||||
import com.mogo.eagle.core.function.api.autopilot.IMoGoChassisStatesListener
|
|
||||||
import com.mogo.eagle.core.function.api.hmi.view.IViewControlListener
|
|
||||||
import com.mogo.eagle.core.function.api.setting.IMoGoSkinModeChangeListener
|
|
||||||
import com.mogo.eagle.core.function.call.autopilot.CallerChassisStatesListenerManager
|
|
||||||
import com.mogo.eagle.core.function.call.devatools.CallerDevaToolsManager
|
|
||||||
import com.mogo.eagle.core.function.call.hmi.CallerHmiViewControlListenerManager
|
|
||||||
import com.mogo.eagle.core.function.call.setting.CallerSkinModeListenerManager
|
|
||||||
import com.mogo.eagle.core.utilcode.kotlin.*
|
|
||||||
import com.mogo.eagle.core.utilcode.util.ClickUtils
|
|
||||||
import com.mogo.eagle.core.utilcode.util.ThreadUtils
|
|
||||||
import com.mogo.och.bus.passenger.R
|
|
||||||
import kotlinx.android.synthetic.main.bus_p_m2_view_status_bar.view.progress
|
|
||||||
import kotlinx.android.synthetic.main.bus_p_m2_view_status_bar.view.tv_power_cos
|
|
||||||
import kotlinx.coroutines.*
|
|
||||||
import me.jessyan.autosize.utils.AutoSizeUtils
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author: wangmingjun
|
|
||||||
* @date: 2023/2/14
|
|
||||||
*/
|
|
||||||
class M2StatusBarView @JvmOverloads constructor(
|
|
||||||
context: Context, attrs: AttributeSet? = null
|
|
||||||
) : ConstraintLayout(context, attrs), IViewControlListener, IMoGoSkinModeChangeListener,
|
|
||||||
IMoGoChassisStatesListener {
|
|
||||||
|
|
||||||
companion object {
|
|
||||||
const val TAG = "M2StatusBarView"
|
|
||||||
}
|
|
||||||
|
|
||||||
@Volatile
|
|
||||||
private var oldBmsSoc: Float = -1.0f
|
|
||||||
|
|
||||||
init {
|
|
||||||
LayoutInflater.from(context).inflate(R.layout.bus_p_m2_view_status_bar, this, true)
|
|
||||||
setBackgroundColor(Color.parseColor("#80FFFFFF"))
|
|
||||||
isClickable = true
|
|
||||||
isFocusable = true
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
@SuppressLint("ClickableViewAccessibility")
|
|
||||||
override fun onAttachedToWindow() {
|
|
||||||
super.onAttachedToWindow()
|
|
||||||
post {
|
|
||||||
val params: ViewGroup.LayoutParams = getLayoutParams()
|
|
||||||
params.height = AutoSizeUtils.dp2px(context,40f)
|
|
||||||
layoutParams = params
|
|
||||||
}
|
|
||||||
//添加view控制
|
|
||||||
CallerHmiViewControlListenerManager.addListener(TAG,this)
|
|
||||||
// 添加换肤监听
|
|
||||||
CallerSkinModeListenerManager.addListener(TAG, this)
|
|
||||||
//电量
|
|
||||||
CallerChassisStatesListenerManager.addListener(TAG,this)
|
|
||||||
|
|
||||||
progress?.also {
|
|
||||||
it.progress = 50
|
|
||||||
}
|
|
||||||
tv_power_cos?.also {
|
|
||||||
it.text = "50%"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onSkinModeChange(skinMode: Int) {
|
|
||||||
when (skinMode) {
|
|
||||||
0 -> setStatusBarDarkOrLight(false)
|
|
||||||
1 -> setStatusBarDarkOrLight(true)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onDetachedFromWindow() {
|
|
||||||
super.onDetachedFromWindow()
|
|
||||||
CallerHmiViewControlListenerManager.removeListener(TAG)
|
|
||||||
CallerSkinModeListenerManager.removeListener(TAG)
|
|
||||||
CallerChassisStatesListenerManager.removeListener(TAG)
|
|
||||||
CallerDevaToolsManager.hideStatusBar()
|
|
||||||
}
|
|
||||||
|
|
||||||
@SuppressLint("SetTextI18n")
|
|
||||||
override fun onBatteryManagementSystemStates(states: ChassisStatesOuterClass.BMSSystemStates) {
|
|
||||||
ThreadUtils.runOnUiThread({
|
|
||||||
if (ClickUtils.isClickTooFrequent(this,1000)) {
|
|
||||||
return@runOnUiThread
|
|
||||||
}
|
|
||||||
val bmsSoc = states.bmsSoc
|
|
||||||
try {
|
|
||||||
if (oldBmsSoc != bmsSoc ) {
|
|
||||||
scope.launch {
|
|
||||||
if(bmsSoc >1){
|
|
||||||
progress?.also { it.progress = bmsSoc.toInt() }
|
|
||||||
tv_power_cos?.also { it.text = "${bmsSoc.toInt()}%" }
|
|
||||||
}else{
|
|
||||||
val power = (bmsSoc * 100).toInt()
|
|
||||||
progress?.also { it.progress = power }
|
|
||||||
tv_power_cos?.also {it.text = "$power%" }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} finally {
|
|
||||||
oldBmsSoc = bmsSoc
|
|
||||||
}
|
|
||||||
},ThreadUtils.MODE.QUEUE)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,197 +0,0 @@
|
|||||||
package com.mogo.och.bus.passenger.passenger.ui.widget
|
|
||||||
|
|
||||||
import android.animation.AnimatorSet
|
|
||||||
import android.animation.ObjectAnimator
|
|
||||||
import android.content.Context
|
|
||||||
import android.util.AttributeSet
|
|
||||||
import android.view.LayoutInflater
|
|
||||||
import android.view.View
|
|
||||||
import android.view.animation.AlphaAnimation
|
|
||||||
import android.view.animation.Animation
|
|
||||||
import android.widget.ImageView
|
|
||||||
import androidx.constraintlayout.widget.ConstraintLayout
|
|
||||||
import com.mogo.eagle.core.function.api.datacenter.union.IMoGoTurnLightListener
|
|
||||||
import com.mogo.eagle.core.function.call.v2x.CallerTurnLightListenerManager
|
|
||||||
import com.mogo.eagle.core.utilcode.util.ThreadUtils
|
|
||||||
import com.mogo.och.bus.passenger.R
|
|
||||||
import com.mogo.och.common.module.manager.light.TurnLightManager
|
|
||||||
import kotlinx.android.synthetic.main.bus_p_m2_turn_light_status.view.left_nor_image
|
|
||||||
import kotlinx.android.synthetic.main.bus_p_m2_turn_light_status.view.left_select_image
|
|
||||||
import kotlinx.android.synthetic.main.bus_p_m2_turn_light_status.view.right_nor_image
|
|
||||||
import kotlinx.android.synthetic.main.bus_p_m2_turn_light_status.view.right_select_image
|
|
||||||
import kotlinx.android.synthetic.main.bus_p_m2_turn_light_status.view.turn_light_layout
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author: wangmingjun
|
|
||||||
* @date: 2023/2/13
|
|
||||||
*/
|
|
||||||
class M2TurnLightView @JvmOverloads constructor(
|
|
||||||
context: Context,
|
|
||||||
attrs: AttributeSet? = null,
|
|
||||||
defStyleAttr: Int = 0
|
|
||||||
) : ConstraintLayout(context, attrs, defStyleAttr),
|
|
||||||
IMoGoTurnLightListener, TurnLightManager.TurnLightListener {
|
|
||||||
|
|
||||||
|
|
||||||
companion object {
|
|
||||||
private const val TAG = "TurnLightViewStatus"
|
|
||||||
}
|
|
||||||
|
|
||||||
private var isLeftLight: Boolean = false
|
|
||||||
private var isRightLight: Boolean = false
|
|
||||||
private var isDisappear: Boolean = false
|
|
||||||
|
|
||||||
init {
|
|
||||||
LayoutInflater.from(context)
|
|
||||||
.inflate(R.layout.bus_p_m2_turn_light_status, this, true)
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onAttachedToWindow() {
|
|
||||||
super.onAttachedToWindow()
|
|
||||||
CallerTurnLightListenerManager.addListener(TAG,this)
|
|
||||||
TurnLightManager.addTurnLightStatusChangeListener(TAG,this)
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onDetachedFromWindow() {
|
|
||||||
super.onDetachedFromWindow()
|
|
||||||
CallerTurnLightListenerManager.removeListener(TAG)
|
|
||||||
TurnLightManager.removeTurnLightStatusChangeListener(TAG)
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun hideTurnLightView() {
|
|
||||||
ThreadUtils.runOnUiThread{
|
|
||||||
if (!isDisappear) {
|
|
||||||
isDisappear = true
|
|
||||||
isLeftLight = false
|
|
||||||
isRightLight = false
|
|
||||||
animationDisappear()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun statusChange(newStatus: TurnLightManager.TurnLightStatus) {
|
|
||||||
ThreadUtils.runOnUiThread {
|
|
||||||
setTurnLight(newStatus)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 转向灯动画
|
|
||||||
*/
|
|
||||||
private fun setTurnLight(directionLight: TurnLightManager.TurnLightStatus) {
|
|
||||||
if (!isAttachedToWindow) {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
//根据左右进行显示和隐藏,实际要判断每个来的时间和频度
|
|
||||||
when (directionLight) {
|
|
||||||
TurnLightManager.TurnLightStatus.TURN_LIGHT_LEFT -> { //左转向
|
|
||||||
if (!isLeftLight) {
|
|
||||||
isLeftLight = true
|
|
||||||
isRightLight = false
|
|
||||||
isDisappear = false
|
|
||||||
showNormalAnimation()
|
|
||||||
left_select_image.visibility = View.VISIBLE
|
|
||||||
right_select_image.visibility = View.GONE
|
|
||||||
right_select_image.clearAnimation()
|
|
||||||
setAnimation(left_select_image)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
TurnLightManager.TurnLightStatus.TURN_LIGHT_RIGHT -> { //右转向
|
|
||||||
if (!isRightLight) {
|
|
||||||
isRightLight = true
|
|
||||||
isLeftLight = false
|
|
||||||
isDisappear = false
|
|
||||||
showNormalAnimation()
|
|
||||||
left_select_image.visibility = View.GONE
|
|
||||||
right_select_image.visibility = View.VISIBLE
|
|
||||||
left_select_image.clearAnimation()
|
|
||||||
setAnimation(right_select_image)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
TurnLightManager.TurnLightStatus.TURN_LIGHT_NONE -> { //消失
|
|
||||||
if (!isDisappear) {
|
|
||||||
isDisappear = true
|
|
||||||
isLeftLight = false
|
|
||||||
isRightLight = false
|
|
||||||
animationDisappear()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//显示背景
|
|
||||||
private fun showNormalAnimation() {
|
|
||||||
val appearAnimation = AlphaAnimation(0f, 1.0f)
|
|
||||||
appearAnimation.duration = 300
|
|
||||||
val appearAnimationImage = AlphaAnimation(0f, 1.0f)
|
|
||||||
appearAnimation.duration = 500
|
|
||||||
turn_light_layout.startAnimation(appearAnimation)
|
|
||||||
left_nor_image.startAnimation(appearAnimationImage)
|
|
||||||
right_nor_image.startAnimation(appearAnimationImage)
|
|
||||||
|
|
||||||
turn_light_layout.visibility = View.VISIBLE
|
|
||||||
left_nor_image.visibility = View.VISIBLE
|
|
||||||
right_nor_image.visibility = View.VISIBLE
|
|
||||||
}
|
|
||||||
|
|
||||||
//消失动画,当转向等数据为空时候
|
|
||||||
private fun animationDisappear() {
|
|
||||||
left_select_image.visibility = View.GONE
|
|
||||||
right_select_image.visibility = View.GONE
|
|
||||||
left_select_image.clearAnimation()
|
|
||||||
right_select_image.clearAnimation()
|
|
||||||
|
|
||||||
left_nor_image.clearAnimation()
|
|
||||||
right_nor_image.clearAnimation()
|
|
||||||
turn_light_layout.clearAnimation()
|
|
||||||
|
|
||||||
val disappearAnimationLeft = AlphaAnimation(1.0f, 0f)
|
|
||||||
disappearAnimationLeft.duration = 300
|
|
||||||
|
|
||||||
val disappearAnimationBg = AlphaAnimation(1.0f, 0f)
|
|
||||||
disappearAnimationBg.duration = 500
|
|
||||||
|
|
||||||
left_nor_image.startAnimation(disappearAnimationLeft)
|
|
||||||
right_nor_image.startAnimation(disappearAnimationLeft)
|
|
||||||
turn_light_layout.startAnimation(disappearAnimationBg)
|
|
||||||
|
|
||||||
disappearAnimationLeft.setAnimationListener(object : Animation.AnimationListener {
|
|
||||||
override fun onAnimationRepeat(p0: Animation?) {
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onAnimationStart(p0: Animation?) {
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onAnimationEnd(p0: Animation?) {
|
|
||||||
left_nor_image.visibility = View.GONE
|
|
||||||
right_nor_image.visibility = View.GONE
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
disappearAnimationBg.setAnimationListener(object : Animation.AnimationListener {
|
|
||||||
override fun onAnimationRepeat(p0: Animation?) {
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onAnimationStart(p0: Animation?) {
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onAnimationEnd(p0: Animation?) {
|
|
||||||
turn_light_layout.visibility = View.GONE
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
//实现图片闪烁效果
|
|
||||||
private fun setAnimation(imageView: ImageView) {
|
|
||||||
val animationSet = AnimatorSet()
|
|
||||||
val valueAnimator = ObjectAnimator.ofFloat(imageView, "alpha", 0f, 1.0f)
|
|
||||||
val valueAnimatorDisappear = ObjectAnimator.ofFloat(imageView, "alpha", 1.0f, 0f)
|
|
||||||
valueAnimator.duration = 1000
|
|
||||||
valueAnimatorDisappear.duration = 800
|
|
||||||
valueAnimator.repeatCount = -1
|
|
||||||
valueAnimatorDisappear.repeatCount = -1
|
|
||||||
animationSet.playTogether(valueAnimatorDisappear, valueAnimator)
|
|
||||||
animationSet.start()
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
Before Width: | Height: | Size: 2.8 KiB |
|
Before Width: | Height: | Size: 5.7 KiB |
|
Before Width: | Height: | Size: 2.0 KiB |
|
Before Width: | Height: | Size: 6.2 KiB |
|
Before Width: | Height: | Size: 5.9 KiB |
|
Before Width: | Height: | Size: 1.1 KiB |
|
Before Width: | Height: | Size: 1.8 KiB |
|
Before Width: | Height: | Size: 1.8 KiB |
|
Before Width: | Height: | Size: 10 KiB |
|
Before Width: | Height: | Size: 17 KiB |
|
Before Width: | Height: | Size: 900 B |
|
Before Width: | Height: | Size: 838 B |
|
Before Width: | Height: | Size: 13 KiB |
|
Before Width: | Height: | Size: 12 KiB |
|
Before Width: | Height: | Size: 12 KiB |
|
Before Width: | Height: | Size: 765 B |
|
Before Width: | Height: | Size: 797 B |
|
Before Width: | Height: | Size: 795 B |
|
Before Width: | Height: | Size: 1.2 KiB |
|
Before Width: | Height: | Size: 1.2 KiB |
|
Before Width: | Height: | Size: 1.2 KiB |
|
Before Width: | Height: | Size: 6.6 KiB |
|
Before Width: | Height: | Size: 4.3 KiB |
|
Before Width: | Height: | Size: 4.2 KiB |
|
Before Width: | Height: | Size: 1.3 KiB |
|
Before Width: | Height: | Size: 18 KiB |
|
Before Width: | Height: | Size: 16 KiB |
|
Before Width: | Height: | Size: 1.6 KiB |
|
Before Width: | Height: | Size: 1.6 KiB |
|
Before Width: | Height: | Size: 16 KiB |
|
Before Width: | Height: | Size: 10 KiB |
|
Before Width: | Height: | Size: 354 KiB |
|
Before Width: | Height: | Size: 5.6 KiB |
|
Before Width: | Height: | Size: 9.3 KiB |
|
Before Width: | Height: | Size: 4.7 KiB |
|
Before Width: | Height: | Size: 844 B |
|
Before Width: | Height: | Size: 4.7 KiB |
|
Before Width: | Height: | Size: 855 B |
|
Before Width: | Height: | Size: 40 KiB |
|
Before Width: | Height: | Size: 8.1 KiB |
|
Before Width: | Height: | Size: 8.5 KiB |
|
Before Width: | Height: | Size: 19 KiB |
|
Before Width: | Height: | Size: 19 KiB |
|
Before Width: | Height: | Size: 287 KiB |
|
Before Width: | Height: | Size: 838 B |
|
Before Width: | Height: | Size: 43 KiB |
|
Before Width: | Height: | Size: 200 B |
|
Before Width: | Height: | Size: 821 B |
|
Before Width: | Height: | Size: 1.6 KiB |
|
Before Width: | Height: | Size: 594 B |
@@ -1,6 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
|
||||||
android:shape="rectangle">
|
|
||||||
<solid android:color="@color/bus_p_end_station_circle_borner_color" />
|
|
||||||
<corners android:radius="@dimen/bus_p_station_circle_radius_size" />
|
|
||||||
</shape>
|
|
||||||
@@ -1,6 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
|
||||||
android:shape="rectangle">
|
|
||||||
<solid android:color="@color/bus_p_tag_line_color" />
|
|
||||||
<corners android:radius="@dimen/bus_p_station_circle_radius_size" />
|
|
||||||
</shape>
|
|
||||||
@@ -1,6 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
|
||||||
android:shape="rectangle">
|
|
||||||
<solid android:color="@color/bus_p_start_station_circle_borner_color" />
|
|
||||||
<corners android:radius="@dimen/bus_p_station_circle_radius_size" />
|
|
||||||
</shape>
|
|
||||||