[6.7.2]
[fea] [删除 bus、shuttle driver]
1
OCH/bus/driver/.gitignore
vendored
@@ -1 +0,0 @@
|
||||
/build
|
||||
@@ -1,68 +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'
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation fileTree(dir: "libs", include: ["*.jar"])
|
||||
implementation rootProject.ext.dependencies.kotlinstdlib
|
||||
implementation rootProject.ext.dependencies.androidxappcompat
|
||||
implementation rootProject.ext.dependencies.arouter
|
||||
kapt rootProject.ext.dependencies.aroutercompiler
|
||||
implementation rootProject.ext.dependencies.androidxconstraintlayout
|
||||
implementation rootProject.ext.dependencies.amapnavi3dmap
|
||||
|
||||
implementation rootProject.ext.dependencies.rxjava
|
||||
implementation rootProject.ext.dependencies.rxandroid
|
||||
implementation rootProject.ext.dependencies.androidxrecyclerview
|
||||
compileOnly rootProject.ext.dependencies.recyclerviewadapterhelper
|
||||
|
||||
implementation project(":OCH:common:common")
|
||||
compileOnly project(":libraries:mogo-map")
|
||||
|
||||
}
|
||||
|
||||
apply from: new File(rootProject.rootDir, "gradle/upload.gradle").toString()
|
||||
@@ -1,3 +0,0 @@
|
||||
GROUP=com.mogo.och
|
||||
POM_ARTIFACT_ID=och-bus
|
||||
VERSION_CODE=1
|
||||
21
OCH/bus/driver/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,11 +0,0 @@
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="com.mogo.och.bus">
|
||||
|
||||
<application>
|
||||
<activity android:name=".ui.BusSwitchLineActivity"
|
||||
android:theme="@style/SwitchLineDialogStyle"
|
||||
android:launchMode="singleTask"
|
||||
android:screenOrientation="landscape" />
|
||||
</application>
|
||||
|
||||
</manifest>
|
||||
@@ -1,40 +0,0 @@
|
||||
package com.mogo.och.bus
|
||||
|
||||
import android.content.Context
|
||||
import androidx.fragment.app.Fragment
|
||||
import com.alibaba.android.arouter.facade.annotation.Route
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger
|
||||
import com.mogo.och.bus.fragment.BusFragment
|
||||
import com.mogo.och.bus.util.BusAnalyticsManager
|
||||
import com.mogo.och.common.module.constant.OchCommonConst
|
||||
import com.mogo.och.common.module.biz.provider.CommonServiceImpl
|
||||
import com.mogo.och.common.module.manager.autopilot.autopilot.OchAutopilotAnalytics
|
||||
|
||||
/**
|
||||
* 网约车小巴业务实现入口
|
||||
*
|
||||
* @author tongchenfei
|
||||
*/
|
||||
@Route(path = OchCommonConst.BUS_DRIVER)
|
||||
class BusDriverProvider : CommonServiceImpl() {
|
||||
|
||||
private val tag = BusDriverProvider::class.java.simpleName
|
||||
private var busFragment: BusFragment?=null
|
||||
|
||||
override fun getFragment(): Fragment {
|
||||
if(busFragment==null){
|
||||
busFragment = BusFragment()
|
||||
}
|
||||
OchAutopilotAnalytics.ochEventKey = BusAnalyticsManager
|
||||
return busFragment!!
|
||||
}
|
||||
|
||||
override fun resetFragment() {
|
||||
busFragment = null
|
||||
OchAutopilotAnalytics.ochEventKey = null
|
||||
}
|
||||
|
||||
override fun init(context: Context) {
|
||||
CallerLogger.d(tag, "准备show fragment")
|
||||
}
|
||||
}
|
||||
@@ -1,14 +0,0 @@
|
||||
package com.mogo.och.bus.bean
|
||||
|
||||
import java.io.Serializable
|
||||
|
||||
/**
|
||||
* @author: wangmingjun
|
||||
* @date: 2022/9/23
|
||||
*/
|
||||
data class WriteOffPassenger(
|
||||
var phone: String? = null,
|
||||
var orderNo: String? = null,
|
||||
@JvmField var passengerSize: Int = 0,
|
||||
var writeOffTime: Long = 0
|
||||
) : Serializable
|
||||
@@ -1,8 +0,0 @@
|
||||
package com.mogo.och.bus.bean.request
|
||||
|
||||
import com.mogo.commons.storage.SharedPrefsMgr
|
||||
|
||||
/**
|
||||
* 中止/结束任务请求
|
||||
*/
|
||||
data class BusCloseTaskRequest(val taskId: Int, val sn: String = SharedPrefsMgr.getInstance().sn)
|
||||
@@ -1,11 +0,0 @@
|
||||
package com.mogo.och.bus.bean.request
|
||||
|
||||
import com.mogo.commons.storage.SharedPrefsMgr
|
||||
|
||||
/**
|
||||
* @author congtaowang
|
||||
* @since 2021/3/22
|
||||
*
|
||||
* 根据车机行驶线路站点信息
|
||||
*/
|
||||
data class BusQueryLineStationsRequest(private val sn: String = SharedPrefsMgr.getInstance().sn)
|
||||
@@ -1,12 +0,0 @@
|
||||
package com.mogo.och.bus.bean.request
|
||||
|
||||
import com.mogo.commons.storage.SharedPrefsMgr
|
||||
|
||||
/**
|
||||
* @author: wangmingjun
|
||||
* @date: 2021/10/18
|
||||
*/
|
||||
data class BusResetDrivingLineRequest(//切换到的线路id
|
||||
val taskId: Int,
|
||||
val sn: String = SharedPrefsMgr.getInstance().sn
|
||||
)
|
||||
@@ -1,16 +0,0 @@
|
||||
package com.mogo.och.bus.bean.request
|
||||
|
||||
/**
|
||||
* Created by pangfan on 2021/8/19
|
||||
*
|
||||
* 订单状态更新请求数据结构
|
||||
*/
|
||||
class BusRoutePlanningUpdateReqBean(
|
||||
var sn: String, var lineId: Int, var startSiteId: Int,
|
||||
var endSiteId: Int, var points: List<Result>
|
||||
) {
|
||||
data class Result(
|
||||
var latitude: Double? = null,
|
||||
var longitude: Double? = null
|
||||
)
|
||||
}
|
||||
@@ -1,16 +0,0 @@
|
||||
package com.mogo.och.bus.bean.request
|
||||
|
||||
import com.mogo.commons.storage.SharedPrefsMgr
|
||||
|
||||
/**
|
||||
* @author congtaowang
|
||||
* @since 2021/3/22
|
||||
*
|
||||
* 小巴车运营状态请求参数
|
||||
*/
|
||||
class BusUpdateSiteStatusRequest(
|
||||
var taskId: Int, //站点id
|
||||
var siteId: Int, //站点序号
|
||||
var seq: Int,
|
||||
var sn: String = SharedPrefsMgr.getInstance().sn
|
||||
)
|
||||
@@ -1,17 +0,0 @@
|
||||
package com.mogo.och.bus.bean.request
|
||||
|
||||
import com.mogo.och.bus.constant.BusConst
|
||||
import java.util.UUID
|
||||
|
||||
/**
|
||||
* Created on 2021/9/16
|
||||
*
|
||||
* 上传车机心跳信息请求数据
|
||||
*/
|
||||
class CarHeartbeatReqBean(
|
||||
var sn: String, //经度
|
||||
var lon: Double, //纬度
|
||||
var lat: Double,
|
||||
var msgId: String = UUID.randomUUID().toString(), //心跳信息唯一标识
|
||||
var interval: Int = (BusConst.LOOP_PERIOD_60S / 1000).toInt() //上报间隔,单位秒,非必传,默认60秒
|
||||
)
|
||||
@@ -1,15 +0,0 @@
|
||||
package com.mogo.och.bus.bean.response
|
||||
|
||||
import com.mogo.eagle.core.data.BaseData
|
||||
|
||||
/**
|
||||
* @author: wangmingjun
|
||||
* @date: 2022/2/9
|
||||
*/
|
||||
data class BusQueryLineTaskResponse(var data: List<Result>?) : BaseData() {
|
||||
|
||||
data class Result(
|
||||
var id: Int = 0,
|
||||
var taskStartTime: Long = 0,
|
||||
)
|
||||
}
|
||||
@@ -1,22 +0,0 @@
|
||||
package com.mogo.och.bus.bean.response
|
||||
|
||||
import com.mogo.eagle.core.data.BaseData
|
||||
|
||||
/**
|
||||
* @author: wangmingjun
|
||||
* @date: 2022/2/9
|
||||
*/
|
||||
data class BusQueryLinesResponse(var data: MutableList<Result>?) : BaseData() {
|
||||
data class Result(
|
||||
var lineId: Int = 0, //线路id
|
||||
var name: String? = null, //线路名字
|
||||
var choose: Int = 0, // 1:绑定 2:未被绑定
|
||||
var startSiteName: String? = null, //始发站名称
|
||||
var endSiteName: String? = null, //终点名称
|
||||
|
||||
var open: Boolean = false, //true 打开状态 false
|
||||
var haveTask: Boolean = false,
|
||||
|
||||
var taskList: MutableList<BusQueryLineTaskResponse.Result>? = null
|
||||
)
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
package com.mogo.och.bus.bean.response
|
||||
|
||||
import com.mogo.eagle.core.data.BaseData
|
||||
import com.mogo.och.data.bean.BusRoutesResult
|
||||
|
||||
/**
|
||||
* 网约车小巴路线接口请求响应结果
|
||||
*
|
||||
* @author tongchenfei
|
||||
*/
|
||||
data class BusRoutesResponse(var result: BusRoutesResult) : BaseData()
|
||||
@@ -1,14 +0,0 @@
|
||||
package com.mogo.och.bus.callback;
|
||||
|
||||
import com.mogo.och.bus.bean.response.BusQueryLineTaskResponse;
|
||||
import com.mogo.och.bus.bean.response.BusQueryLinesResponse;
|
||||
|
||||
/**
|
||||
* @author: wangmingjun
|
||||
* @date: 2022/2/9
|
||||
*/
|
||||
public interface IBusLinesCallback {
|
||||
void onBusLinesChange(BusQueryLinesResponse lines);
|
||||
void onChangeLineIdSuccess();
|
||||
void onBusLineTasks(BusQueryLineTaskResponse o, int position,boolean autoRefresh);
|
||||
}
|
||||
@@ -1,30 +0,0 @@
|
||||
package com.mogo.och.bus.callback;
|
||||
|
||||
import com.mogo.och.bus.bean.WriteOffPassenger;
|
||||
import com.mogo.och.data.bean.BusStationBean;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author: wangmingjun
|
||||
* @date: 2022/9/26
|
||||
*/
|
||||
public interface IPassengerCallback {
|
||||
void playPassenger(WriteOffPassenger passenger);
|
||||
//自驾返回失败
|
||||
void onStartAdasFailure();
|
||||
void startOpenAutopilot();
|
||||
|
||||
void updateBusTaskStatus(String lineName,String lintTime,
|
||||
List<BusStationBean> stationList,
|
||||
int arrivingOrArrivedIndex,
|
||||
boolean isArrived);
|
||||
|
||||
/**
|
||||
* 结束清理一遍、选择任务后清理一遍
|
||||
*/
|
||||
void clearBusStationsMarkers();
|
||||
|
||||
void updateEmptyUi();
|
||||
void hideSlidePanel();
|
||||
}
|
||||
@@ -1,57 +0,0 @@
|
||||
package com.mogo.och.bus.constant
|
||||
|
||||
/**
|
||||
* Created on 2021/12/6
|
||||
*/
|
||||
class BusConst {
|
||||
companion object {
|
||||
// OCH arouter 路由path
|
||||
|
||||
// 测试用的广播
|
||||
const val BROADCAST_TEST_BUS_CONTROL_TYPE_EXTRA_KEY = "sceneType"
|
||||
// 无状态
|
||||
const val STATION_STATUS_IDLE = 0
|
||||
// 已过站(历史站)
|
||||
const val STATION_STATUS_LEAVING = 1
|
||||
// 到站(当前站)
|
||||
const val STATION_STATUS_STOPPED = 2
|
||||
// 未到站(未到站)
|
||||
const val STATION_STATUS_ARRIVING = 3
|
||||
|
||||
// 上报心跳轮询ms
|
||||
const val LOOP_PERIOD_60S = 60 * 1000L
|
||||
// 开始服务启动自动驾驶等待时间(埋点上传)
|
||||
const val LOOP_PERIOD_15S = 15 * 1000L
|
||||
const val LOOP_PERIOD_1S = 1 * 1000L
|
||||
const val LOOP_DELAY = 100L
|
||||
|
||||
// 下发给MEC轨迹信息间隔时间 10秒
|
||||
const val LOOP_PERIOD_10S = 10 * 1000L
|
||||
// 尝试下发给MEC轨迹最多10次
|
||||
const val LOOP_SEND_TRAJ_TIMES = 10
|
||||
|
||||
//起点UUID
|
||||
const val BUS_START_MAP_MAKER = "bus_start_map_maker";
|
||||
//终点UUID
|
||||
const val BUS_END_MAP_MAKER = "bus_end_map_maker";
|
||||
|
||||
|
||||
/**
|
||||
* 订单起终点Marker类型
|
||||
*/
|
||||
const val TYPE_MARKER_BUS_ORDER = "TYPE_MARKER_BUS_ORDER"
|
||||
|
||||
const val TIMER_START_AUTOPILOT_INTERVAL = 20 * 1000L
|
||||
|
||||
//围栏到站 暂定10米
|
||||
const val ARRIVE_AT_END_STATION_DISTANCE = 15
|
||||
|
||||
// 轮询
|
||||
const val LOOP_PASSENGER_5S = 5 * 1000L
|
||||
const val LOOP_PASSENGER_2S = 2 * 1000L
|
||||
const val LOOP_PASSENGER_1S = 1 * 1000L
|
||||
const val LOOP_DELAY_500 = 500L
|
||||
|
||||
const val DELAY_10S = 10 * 1000L
|
||||
}
|
||||
}
|
||||
@@ -1,420 +0,0 @@
|
||||
package com.mogo.och.bus.fragment
|
||||
|
||||
import android.animation.ObjectAnimator
|
||||
import android.annotation.SuppressLint
|
||||
import android.os.Bundle
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import android.view.animation.LinearInterpolator
|
||||
import android.widget.TextView
|
||||
import com.mogo.commons.AbsMogoApplication
|
||||
import com.mogo.commons.mvp.IView
|
||||
import com.mogo.commons.mvp.MvpFragment
|
||||
import com.mogo.commons.mvp.Presenter
|
||||
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotStatusListener
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotControlManager.isCanStartAutopilot
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListenerManager.getState
|
||||
import com.mogo.eagle.core.function.call.devatools.CallerDevaToolsManager.attachAutopilotBeforeLaunchView
|
||||
import com.mogo.eagle.core.utilcode.mogo.view.OnPreventFastClickListener
|
||||
import com.mogo.eagle.core.utilcode.util.UiThreadHandler
|
||||
import com.mogo.och.bus.R
|
||||
import com.mogo.och.bus.constant.BusConst
|
||||
import com.mogo.och.bus.model.OrderModel
|
||||
import com.mogo.och.bus.view.SlidePanelView
|
||||
import com.mogo.och.common.module.utils.ResourcesUtils
|
||||
import com.mogo.och.common.module.utils.ResourcesUtils.getColor
|
||||
import com.mogo.och.common.module.utils.SoundPoolHelper
|
||||
import kotlinx.android.synthetic.main.bus_base_fragment.bus_autopilot_btn_iv
|
||||
import kotlinx.android.synthetic.main.bus_base_fragment.bus_autopolot_btn_tv
|
||||
import kotlinx.android.synthetic.main.bus_base_fragment.fl_speed
|
||||
import kotlinx.android.synthetic.main.bus_base_fragment.mapBizView
|
||||
import kotlinx.android.synthetic.main.bus_base_fragment.module_mogo_och_arrived_tv
|
||||
import kotlinx.android.synthetic.main.bus_base_fragment.module_mogo_och_autopilot_status
|
||||
import kotlinx.android.synthetic.main.bus_base_fragment.module_mogo_och_slide_panel
|
||||
import kotlinx.android.synthetic.main.bus_base_fragment.module_mogo_och_station_panel_container
|
||||
import kotlinx.android.synthetic.main.bus_base_fragment.smallMapView
|
||||
import org.greenrobot.eventbus.EventBus
|
||||
|
||||
/**
|
||||
* 网约车基础Fragment,主要负责布局通用界面,处理站点面板和通话面板互斥情况
|
||||
*
|
||||
*
|
||||
* 部分业务放在了此处处理
|
||||
*
|
||||
* @author tongchenfei
|
||||
*/
|
||||
abstract class BaseBusTabFragment<V : IView?, P : Presenter<V>?> : MvpFragment<V, P>(){
|
||||
|
||||
//启动自驾动画
|
||||
private var autopilotLoadingAnimator: ObjectAnimator? = null
|
||||
var isAnimateRunning = false
|
||||
|
||||
private val TAG = "BaseBusTabFragment"
|
||||
|
||||
/**
|
||||
* 滑动按钮触发的事件
|
||||
*/
|
||||
private val onSlideToEndListener = SlidePanelView.OnSlidePanelMoveToEndListener {
|
||||
// 此处做一个代理,处理一下共有情况
|
||||
if (slidePanelOnEndListener != null) {
|
||||
slidePanelOnEndListener!!.moveToEnd()
|
||||
}
|
||||
}
|
||||
|
||||
override fun getLayoutId(): Int {
|
||||
return R.layout.bus_base_fragment
|
||||
}
|
||||
|
||||
override fun initViews() {
|
||||
attachAutopilotBeforeLaunchView(fl_speed.context, fl_speed)
|
||||
LayoutInflater.from(context).inflate(stationPanelViewId, module_mogo_och_station_panel_container)
|
||||
module_mogo_och_slide_panel!!.setOnSlidePanelMoveToEndListener(onSlideToEndListener)
|
||||
initListener()
|
||||
setAutopilotBtnStatus(getState(), isCanStartAutopilot(false, 0))
|
||||
module_mogo_och_autopilot_status!!.setOnClickListener(object : OnPreventFastClickListener() {
|
||||
override fun onClickImpl(v: View) {
|
||||
restartAutopilot()
|
||||
}
|
||||
})
|
||||
|
||||
module_mogo_och_arrived_tv.setOnClickListener { onArriveStation() }
|
||||
|
||||
}
|
||||
|
||||
override fun initViews(savedInstanceState: Bundle?) {
|
||||
super.initViews(savedInstanceState)
|
||||
mapBizView!!.onCreate(savedInstanceState)
|
||||
smallMapView!!.onCreateView(savedInstanceState)
|
||||
}
|
||||
|
||||
override fun onResume() {
|
||||
super.onResume()
|
||||
mapBizView!!.onResume()
|
||||
smallMapView!!.onResume()
|
||||
}
|
||||
|
||||
override fun onCreateView(
|
||||
inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?
|
||||
): View? {
|
||||
EventBus.getDefault().register(this)
|
||||
return super.onCreateView(inflater, container, savedInstanceState)
|
||||
}
|
||||
|
||||
protected abstract fun onArriveStation()
|
||||
|
||||
override fun onSaveInstanceState(outState: Bundle) {
|
||||
super.onSaveInstanceState(outState)
|
||||
mapBizView!!.onSaveInstanceState(outState)
|
||||
}
|
||||
|
||||
override fun onLowMemory() {
|
||||
super.onLowMemory()
|
||||
mapBizView!!.onLowMemory()
|
||||
}
|
||||
|
||||
override fun onPause() {
|
||||
super.onPause()
|
||||
mapBizView!!.onPause()
|
||||
smallMapView!!.onPause()
|
||||
}
|
||||
|
||||
override fun onDestroyView() {
|
||||
mapBizView!!.onDestroy()
|
||||
if (smallMapView != null) {
|
||||
smallMapView!!.onDestroy()
|
||||
}
|
||||
EventBus.getDefault().unregister(this)
|
||||
super.onDestroyView()
|
||||
}
|
||||
|
||||
/**
|
||||
* 测试到站
|
||||
*/
|
||||
protected abstract fun debugArrivedStation()
|
||||
private fun initListener() {}
|
||||
|
||||
/**
|
||||
* 展示滑动按钮
|
||||
*
|
||||
* @param text 指定的文字
|
||||
*/
|
||||
fun showSlidePanel(text: String?) {
|
||||
UiThreadHandler.post({
|
||||
module_mogo_och_slide_panel!!.setText(text)
|
||||
module_mogo_och_slide_panel!!.visibility = View.VISIBLE
|
||||
}, UiThreadHandler.MODE.QUEUE)
|
||||
setArrivedClickable(false)
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置进站按钮状态
|
||||
*
|
||||
* @param isClickable
|
||||
*/
|
||||
fun setArrivedClickable(isClickable: Boolean) {
|
||||
UiThreadHandler.post({
|
||||
module_mogo_och_arrived_tv!!.isEnabled = isClickable
|
||||
if (isClickable) {
|
||||
module_mogo_och_arrived_tv!!.setTextColor(getColor(R.color.bus_white))
|
||||
} else {
|
||||
module_mogo_och_arrived_tv!!.setTextColor(getColor(R.color.bus_arrived_btn_un_clickable_color))
|
||||
}
|
||||
}, UiThreadHandler.MODE.QUEUE)
|
||||
}
|
||||
|
||||
/**
|
||||
* 隐藏滑动按钮
|
||||
*/
|
||||
fun hideSlidePanel() {
|
||||
UiThreadHandler.post(
|
||||
{ module_mogo_och_slide_panel!!.visibility = View.GONE },
|
||||
UiThreadHandler.MODE.QUEUE
|
||||
)
|
||||
}
|
||||
|
||||
fun playDI() {
|
||||
SoundPoolHelper.getSoundPoolHelper().playSoundWithRedId(context, R.raw.bus_di)
|
||||
}
|
||||
|
||||
/**
|
||||
* 改变自动驾驶状态
|
||||
*
|
||||
* @param autopilotStatus 0:不可用 1:可用状态 2:自动驾驶中
|
||||
*/
|
||||
fun onAutopilotStatusChanged(autopilotStatus: Int, canStartAutopilt: Boolean) {
|
||||
UiThreadHandler.post({
|
||||
changeAutopilotBtnView(
|
||||
autopilotStatus,
|
||||
isAnimateRunning,
|
||||
canStartAutopilt
|
||||
)
|
||||
}, UiThreadHandler.MODE.QUEUE)
|
||||
}
|
||||
|
||||
fun setAutopilotBtnStatus(autopilotStatus: Int, canStartAutopilt: Boolean) {
|
||||
if (IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_DISABLE
|
||||
== autopilotStatus
|
||||
) { //0不可用
|
||||
bus_autopolot_btn_tv!!.setTextColor(getColor(R.color.bus_autopilot_text_color_disable))
|
||||
bus_autopolot_btn_tv!!.text =
|
||||
ResourcesUtils.getString(R.string.bus_loading_autopilot_runnig_tv)
|
||||
bus_autopilot_btn_iv!!.setImageResource(R.drawable.bus_disable_autopilot_icon)
|
||||
module_mogo_och_autopilot_status!!.isClickable = true
|
||||
module_mogo_och_autopilot_status!!.setBackgroundResource(R.drawable.bus_autopilot_0_1_status_bg)
|
||||
} else {
|
||||
bus_autopolot_btn_tv!!.setTextColor(
|
||||
AbsMogoApplication.getApp().getColor(R.color.bus_autopilot_text_color_normal)
|
||||
)
|
||||
bus_autopilot_btn_iv!!.setImageResource(R.drawable.bus_ic_autopilot)
|
||||
if (IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_ENABLE == autopilotStatus) { //1可用
|
||||
bus_autopolot_btn_tv!!.text =
|
||||
ResourcesUtils.getString(R.string.bus_loading_autopilot_runnig_tv)
|
||||
if (canStartAutopilt) {
|
||||
module_mogo_och_autopilot_status!!.isClickable = true
|
||||
module_mogo_och_autopilot_status!!.setBackgroundResource(R.drawable.bus_autopilot_0_1_status_bg)
|
||||
} else {
|
||||
bus_autopolot_btn_tv!!.setTextColor(
|
||||
AbsMogoApplication.getApp()
|
||||
.getColor(R.color.bus_autopilot_text_color_disable)
|
||||
)
|
||||
bus_autopilot_btn_iv!!.setImageResource(R.drawable.bus_disable_autopilot_icon)
|
||||
module_mogo_och_autopilot_status!!.isClickable = true
|
||||
module_mogo_och_autopilot_status!!.setBackgroundResource(R.drawable.bus_autopilot_0_1_status_bg)
|
||||
}
|
||||
} else if (IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_RUNNING == autopilotStatus) {
|
||||
bus_autopolot_btn_tv!!.setText(R.string.bus_loading_autopilot_runnig_tv)
|
||||
module_mogo_och_autopilot_status!!.isClickable = true
|
||||
module_mogo_och_autopilot_status!!.setBackgroundResource(R.drawable.bus_autopilot_2_status_bg)
|
||||
} else if (IMoGoAutopilotStatusListener.STATUS_PARALLEL_DRIVING
|
||||
== autopilotStatus
|
||||
) {
|
||||
bus_autopolot_btn_tv!!.setText(R.string.bus_pingxing_driver)
|
||||
module_mogo_och_autopilot_status!!.isClickable = false
|
||||
module_mogo_och_autopilot_status!!.setBackgroundResource(R.drawable.common_autopilot_pxjs)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fun updateAutopilotStatus(autopilotStatus: Int) {
|
||||
if (IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_RUNNING
|
||||
== autopilotStatus
|
||||
) { //2 running
|
||||
bus_autopilot_btn_iv!!.setImageResource(R.drawable.bus_right_autopilot_icon)
|
||||
bus_autopolot_btn_tv!!.setTextColor(getColor(R.color.bus_autopilot_text_color_normal))
|
||||
bus_autopolot_btn_tv!!.text =
|
||||
ResourcesUtils.getString(R.string.bus_loading_autopilot_success_tv)
|
||||
// ctvAutopilotStatus.setSelected(false);
|
||||
module_mogo_och_autopilot_status!!.isClickable = false
|
||||
} else {
|
||||
bus_autopilot_btn_iv!!.setImageResource(R.drawable.bus_wrong_autopilot_icon)
|
||||
bus_autopolot_btn_tv!!.setTextColor(getColor(R.color.bus_autopilot_text_color_normal))
|
||||
bus_autopolot_btn_tv!!.text =
|
||||
ResourcesUtils.getString(R.string.bus_loading_autopilot_failure_tv)
|
||||
module_mogo_och_autopilot_status!!.isClickable = false
|
||||
// ctvAutopilotStatus.setSelected(false);
|
||||
}
|
||||
UiThreadHandler.postDelayed({
|
||||
setAutopilotBtnStatus(
|
||||
autopilotStatus,
|
||||
isCanStartAutopilot(false, 0)
|
||||
)
|
||||
}, 1000)
|
||||
}
|
||||
|
||||
private fun changeAutopilotBtnView(
|
||||
autopilotStatus: Int,
|
||||
isAnimateRunning: Boolean,
|
||||
canStartAutopilt: Boolean
|
||||
) {
|
||||
if (isAnimateRunning && IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_RUNNING
|
||||
!= autopilotStatus
|
||||
) {
|
||||
// 主动开启自动驾驶中,不为2(为0、1)则继续loading
|
||||
return
|
||||
}
|
||||
if (isAnimateRunning) {
|
||||
stopAnimAndUpdateBtnStatus()
|
||||
} else {
|
||||
setAutopilotBtnStatus(autopilotStatus, canStartAutopilt)
|
||||
}
|
||||
}
|
||||
|
||||
fun stopAnimAndUpdateBtnStatus() {
|
||||
stopAutopilotAnimation()
|
||||
updateAutopilotStatus(getState())
|
||||
}
|
||||
|
||||
/**
|
||||
* 隐藏【自动驾驶】按钮
|
||||
*/
|
||||
fun hideAutopilotBiz() {}
|
||||
|
||||
/**
|
||||
* 展示【自动驾驶】按钮
|
||||
*/
|
||||
fun showAutopilotBiz() {}
|
||||
open val slidePanelOnEndListener: SlidePanelView.OnSlidePanelMoveToEndListener?
|
||||
get() = null
|
||||
|
||||
/**
|
||||
* 获取站点面板view,在[.initViews]时候添加到container中
|
||||
*
|
||||
* @return 站点面板view
|
||||
*/
|
||||
abstract val stationPanelViewId: Int
|
||||
|
||||
/**
|
||||
* 重新开启自动驾驶
|
||||
*/
|
||||
abstract fun restartAutopilot()
|
||||
|
||||
/**
|
||||
* 模拟自动驾驶返回状态
|
||||
*
|
||||
* @param status
|
||||
*/
|
||||
abstract fun debugAutoPilotStatus(status: Int)
|
||||
|
||||
/**
|
||||
* 开启自动驾驶中间动画
|
||||
*/
|
||||
fun startAutopilotAnimation() {
|
||||
isAnimateRunning = true
|
||||
bus_autopolot_btn_tv!!.text =
|
||||
ResourcesUtils.getString(R.string.bus_loading_autopilot_tv)
|
||||
bus_autopolot_btn_tv!!.setTextColor(getColor(R.color.bus_autopilot_text_color_normal))
|
||||
module_mogo_och_autopilot_status!!.isClickable = true
|
||||
bus_autopilot_btn_iv!!.setImageResource(R.drawable.bus_loading_autopilot_icon)
|
||||
if (autopilotLoadingAnimator == null) {
|
||||
autopilotLoadingAnimator =
|
||||
ObjectAnimator.ofFloat(bus_autopilot_btn_iv, "rotation", 0f, 360f)
|
||||
autopilotLoadingAnimator!!.interpolator = LinearInterpolator()
|
||||
autopilotLoadingAnimator!!.repeatCount = -1 //无限循环
|
||||
autopilotLoadingAnimator!!.setDuration(1000) //设置持续时间
|
||||
}
|
||||
autopilotLoadingAnimator!!.start() //动画开始
|
||||
startingAutoApilotCountDown()
|
||||
}
|
||||
|
||||
private fun startingAutoApilotCountDown() {
|
||||
//10s 若自动驾驶没有开启,则结束动画
|
||||
UiThreadHandler.postDelayed({ //未启动成功做处理
|
||||
if (isAnimateRunning) { // 只判断动画是否在进行,根据自动驾驶当前状态去设置自动驾驶状态
|
||||
stopAutopilotAnimation()
|
||||
updateAutopilotStatus(getState())
|
||||
}
|
||||
}, BusConst.TIMER_START_AUTOPILOT_INTERVAL)
|
||||
}
|
||||
|
||||
/**
|
||||
* 停止自动驾驶中间动画
|
||||
*/
|
||||
protected fun stopAutopilotAnimation() {
|
||||
if (autopilotLoadingAnimator != null) {
|
||||
autopilotLoadingAnimator!!.end()
|
||||
bus_autopilot_btn_iv!!.clearAnimation()
|
||||
autopilotLoadingAnimator = null
|
||||
isAnimateRunning = false
|
||||
}
|
||||
}
|
||||
|
||||
override fun onDestroy() {
|
||||
super.onDestroy()
|
||||
}
|
||||
|
||||
/**
|
||||
* Bus调试信息:线路、轨迹等信息
|
||||
*
|
||||
*
|
||||
* START
|
||||
*/
|
||||
private var busTestBar: View? = null
|
||||
private var lineIdTV: TextView? = null
|
||||
private var lineNameTV: TextView? = null
|
||||
private var trajMd5TV: TextView? = null
|
||||
private var stopMd5TV: TextView? = null
|
||||
private var trajMd5DPQPTV: TextView? = null
|
||||
private var stopMd5DPQPTV: TextView? = null
|
||||
@SuppressLint("SetTextI18n")
|
||||
fun showHideTestBar() {
|
||||
if (busTestBar == null) {
|
||||
busTestBar = findViewById(R.id.module_mogo_och_bus_test_bar)
|
||||
lineIdTV = findViewById(R.id.bus_test_bar_current_line_id)
|
||||
lineNameTV = findViewById(R.id.bus_test_bar_current_line_name)
|
||||
trajMd5TV = findViewById(R.id.bus_test_bar_current_traj_md5)
|
||||
stopMd5TV = findViewById(R.id.bus_test_bar_current_stop_md5)
|
||||
trajMd5DPQPTV = findViewById(R.id.bus_test_bar_current_traj_md5_dpqp)
|
||||
stopMd5DPQPTV = findViewById(R.id.bus_test_bar_current_stop_md5_dpqp)
|
||||
}
|
||||
if (busTestBar!!.visibility == View.VISIBLE) {
|
||||
busTestBar!!.visibility = View.GONE
|
||||
} else {
|
||||
val routesResult = OrderModel.getInstance().busRoutesResult
|
||||
lineIdTV!!.text = "lineId:" + (routesResult?.lineId?.toString() ?: "")
|
||||
lineNameTV!!.text = "lineName:" + if (routesResult == null) "" else routesResult.name
|
||||
trajMd5TV!!.text = "TMd5:" + if (routesResult == null) "" else routesResult.csvFileMd5
|
||||
stopMd5TV!!.text = "SMd5:" + if (routesResult == null) "" else routesResult.txtFileMd5
|
||||
trajMd5DPQPTV!!.text =
|
||||
"TMd5DPQP:" + if (routesResult == null) "" else routesResult.csvFileMd5DPQP
|
||||
stopMd5DPQPTV!!.text =
|
||||
"SMd5DPQP:" + if (routesResult == null) "" else routesResult.txtFileMd5DPQP
|
||||
busTestBar!!.visibility = View.VISIBLE
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressLint("SetTextI18n")
|
||||
fun updateBusTestBarInfo() {
|
||||
if (busTestBar != null && busTestBar!!.visibility == View.VISIBLE) {
|
||||
val routesResult = OrderModel.getInstance().busRoutesResult
|
||||
lineIdTV!!.text = "lineId:" + (routesResult?.lineId?.toString() ?: "")
|
||||
lineNameTV!!.text = "lineName:" + if (routesResult == null) "" else routesResult.name
|
||||
trajMd5TV!!.text = "TMd5:" + if (routesResult == null) "" else routesResult.csvFileMd5
|
||||
stopMd5TV!!.text = "SMd5:" + if (routesResult == null) "" else routesResult.txtFileMd5
|
||||
trajMd5DPQPTV!!.text =
|
||||
"TMd5DPQP:" + if (routesResult == null) "" else routesResult.csvFileMd5DPQP
|
||||
stopMd5DPQPTV!!.text =
|
||||
"SMd5DPQP:" + if (routesResult == null) "" else routesResult.txtFileMd5DPQP
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,512 +0,0 @@
|
||||
package com.mogo.och.bus.fragment
|
||||
|
||||
import android.content.Intent
|
||||
import android.graphics.BitmapFactory
|
||||
import android.os.Bundle
|
||||
import android.view.View
|
||||
import com.mogo.commons.storage.SharedPrefsMgr
|
||||
import com.mogo.eagle.core.data.config.FunctionBuildConfig
|
||||
import com.mogo.eagle.core.data.temp.EventLogout
|
||||
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotStatusListener
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListenerManager.getState
|
||||
import com.mogo.eagle.core.function.call.map.CallerMapUIServiceManager.getOverlayManager
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger.d
|
||||
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.ToastUtils
|
||||
import com.mogo.eagle.core.utilcode.util.UiThreadHandler
|
||||
import com.mogo.map.MogoMap
|
||||
import com.mogo.map.overlay.core.Level
|
||||
import com.mogo.map.overlay.point.Point
|
||||
import com.mogo.och.bus.R
|
||||
import com.mogo.och.bus.constant.BusConst
|
||||
import com.mogo.och.bus.presenter.BusPresenter
|
||||
import com.mogo.och.bus.ui.BusSwitchLineActivity
|
||||
import com.mogo.och.bus.view.SlidePanelView
|
||||
import com.mogo.och.common.module.utils.BlinkAnimationUtil
|
||||
import com.mogo.och.common.module.utils.OCHThreadPoolManager
|
||||
import com.mogo.och.common.module.utils.ResourcesUtils
|
||||
import com.mogo.och.common.module.utils.ResourcesUtils.getColor
|
||||
import com.mogo.och.common.module.utils.createQRCodeWithPicture
|
||||
import com.mogo.och.common.module.wigets.BindQRCodeDialog
|
||||
import com.mogo.och.common.module.wigets.OCHCommitDialog
|
||||
import com.mogo.och.data.bean.BusStationBean
|
||||
import kotlinx.android.synthetic.main.bug_fragment_och.bus_panel_first_station
|
||||
import kotlinx.android.synthetic.main.bug_fragment_och.bus_panel_second_station
|
||||
import kotlinx.android.synthetic.main.bug_fragment_och.bus_panel_third_station
|
||||
import kotlinx.android.synthetic.main.bug_fragment_och.bus_task_time_tv
|
||||
import kotlinx.android.synthetic.main.bug_fragment_och.group_stations_panel
|
||||
import kotlinx.android.synthetic.main.bug_fragment_och.module_och_bus_line_name
|
||||
import kotlinx.android.synthetic.main.bug_fragment_och.switch_line_btn
|
||||
import kotlinx.android.synthetic.main.bus_base_fragment.smallMapView
|
||||
import kotlinx.android.synthetic.main.bus_no_line_view.no_line_data_view
|
||||
import me.jessyan.autosize.utils.AutoSizeUtils
|
||||
import org.greenrobot.eventbus.Subscribe
|
||||
import org.greenrobot.eventbus.ThreadMode
|
||||
|
||||
/**
|
||||
* 网约车小巴界面
|
||||
*
|
||||
* @author tongchenfei
|
||||
*/
|
||||
class BusFragment : BaseBusTabFragment<BusFragment?, BusPresenter?>(),
|
||||
SlidePanelView.OnSlidePanelMoveToEndListener, View.OnClickListener {
|
||||
private var startStation: BusStationBean? = null
|
||||
private var endStation: BusStationBean? = null
|
||||
override fun getTagName(): String {
|
||||
return "BusFragment"
|
||||
}
|
||||
|
||||
override fun onActivityCreated(savedInstanceState: Bundle?) {
|
||||
super.onActivityCreated(savedInstanceState)
|
||||
}
|
||||
|
||||
override fun onDestroyView() {
|
||||
if (mPresenter != null) {
|
||||
mPresenter!!.onDestroy(this)
|
||||
}
|
||||
val overlayManager = getOverlayManager()
|
||||
if (overlayManager != null) {
|
||||
overlayManager.removeAllLines()
|
||||
overlayManager.removeAllPoints()
|
||||
}
|
||||
super.onDestroyView()
|
||||
}
|
||||
|
||||
override fun initViews() {
|
||||
super.initViews()
|
||||
switch_line_btn!!.tag = 0
|
||||
d(SceneConstant.M_BUS + TAG, "initView: " + getState())
|
||||
// 初始化的时候设置 UI 按钮状态
|
||||
showAutopilotBiz()
|
||||
switch_line_btn!!.setOnClickListener(this)
|
||||
module_och_bus_line_name!!.setOnLongClickListener { v: View? ->
|
||||
showHideTestBar()
|
||||
false
|
||||
}
|
||||
}
|
||||
|
||||
@Subscribe(threadMode = ThreadMode.MAIN)
|
||||
fun changeOverview(eventLogout: EventLogout) {
|
||||
if (eventLogout.messgae == EventLogout.LOGOUT_TYPE) {
|
||||
d(SceneConstant.M_BUS + TAG, "changeOverview Event消息去登出")
|
||||
mPresenter!!.logout()
|
||||
} else if (eventLogout.messgae == EventLogout.SHOW_QR_TYPE) { //显示二维码
|
||||
d(SceneConstant.M_BUS + TAG, "changeOverview Event qrcode")
|
||||
val qrUrl = String.format(
|
||||
FunctionBuildConfig.urlJson.bindDriverQRUrl,
|
||||
SharedPrefsMgr.getInstance().sn
|
||||
)
|
||||
val bmQr = createQRCodeWithPicture(
|
||||
BitmapFactory.decodeResource(resources, R.drawable.icon_qr_center_logo),
|
||||
qrUrl,
|
||||
AutoSizeUtils.dp2px(context, 340f),
|
||||
AutoSizeUtils.dp2px(context, 340f),
|
||||
true
|
||||
)
|
||||
if (bmQr != null) {
|
||||
context?.let {
|
||||
val builder = BindQRCodeDialog.Builder()
|
||||
builder.title(ResourcesUtils.getString(R.string.bind_driver_qr_title))
|
||||
.cancelStr(ResourcesUtils.getString(R.string.qr_cancel))
|
||||
.qrBm(bmQr).build(it)!!.show()
|
||||
}
|
||||
|
||||
} else {
|
||||
d(SceneConstant.M_BUS + TAG, "bmQr = null ")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override fun onArriveStation() {
|
||||
mPresenter!!.arriveStation(null, "点击进站触发进站操作")
|
||||
}
|
||||
|
||||
override fun debugArrivedStation() {
|
||||
mPresenter!!.arriveStation(null, "点击debug进站按钮触发进站操作")
|
||||
}
|
||||
|
||||
override val stationPanelViewId: Int
|
||||
get() = R.layout.bug_fragment_och
|
||||
|
||||
override fun createPresenter(): BusPresenter {
|
||||
return BusPresenter(this)
|
||||
}
|
||||
|
||||
override fun onResume() {
|
||||
super.onResume()
|
||||
}
|
||||
|
||||
fun hideStationsPanel() {
|
||||
group_stations_panel!!.visibility = View.GONE
|
||||
no_line_data_view!!.visibility = View.VISIBLE
|
||||
}
|
||||
|
||||
fun showStationsPanel() {
|
||||
group_stations_panel!!.visibility = View.VISIBLE
|
||||
no_line_data_view!!.visibility = View.GONE
|
||||
}
|
||||
|
||||
fun updateLineEmptyUI() {
|
||||
setArrivedClickable(false)
|
||||
showOrHideSwitchLineBtn(true)
|
||||
hideStationsPanel()
|
||||
hideSlidePanel()
|
||||
resetStationBlinkAnim()
|
||||
}
|
||||
|
||||
private fun resetStationBlinkAnim() {
|
||||
BlinkAnimationUtil.clearAnimation(bus_panel_first_station!!.getCircleImageView())
|
||||
BlinkAnimationUtil.clearAnimation(bus_panel_second_station!!.getCircleImageView())
|
||||
BlinkAnimationUtil.clearAnimation(bus_panel_third_station!!.getCircleImageView())
|
||||
}
|
||||
|
||||
fun updateBusTaskStatus(
|
||||
lineName: String?, lineTime: String,
|
||||
stationList: List<BusStationBean>?,
|
||||
arrivingOrArrivedIndex: Int,
|
||||
isArrived: Boolean
|
||||
) {
|
||||
UiThreadHandler.post(Runnable {
|
||||
if (activity == null) {
|
||||
return@Runnable
|
||||
}
|
||||
if (stationList == null) {
|
||||
// 获取小巴数据失败
|
||||
return@Runnable
|
||||
}
|
||||
showStationsPanel()
|
||||
showOrHideSwitchLineBtn(false)
|
||||
module_och_bus_line_name!!.text = lineName
|
||||
bus_task_time_tv!!.text = ResourcesUtils.getString(R.string.bus_line_time_tag) + lineTime
|
||||
// 渲染小巴路线数据
|
||||
updateBusStationStatus(stationList, arrivingOrArrivedIndex, isArrived)
|
||||
}, UiThreadHandler.MODE.QUEUE)
|
||||
}
|
||||
|
||||
private fun updateBusStationStatus(
|
||||
stationList: List<BusStationBean>,
|
||||
arrivingOrArrivedIndex: Int,
|
||||
isArrived: Boolean
|
||||
) {
|
||||
startStation = stationList[0]
|
||||
endStation = stationList[stationList.size - 1]
|
||||
if (arrivingOrArrivedIndex == stationList.size - 1 && isArrived) {
|
||||
//切换路线和结束路线按钮切换
|
||||
showSlidePanel("单程结束")
|
||||
setOrRemoveMapMaker(
|
||||
false,
|
||||
BusConst.BUS_END_MAP_MAKER,
|
||||
endStation!!.lat,
|
||||
endStation!!.lon,
|
||||
R.raw.end_marker
|
||||
)
|
||||
} else if (arrivingOrArrivedIndex == 0 && isArrived) {
|
||||
showSlidePanel("滑动出发")
|
||||
setOrRemoveMapMaker(
|
||||
true, BusConst.BUS_START_MAP_MAKER,
|
||||
startStation!!.lat, startStation!!.lon, R.raw.star_marker
|
||||
)
|
||||
setOrRemoveMapMaker(
|
||||
true, BusConst.BUS_END_MAP_MAKER,
|
||||
endStation!!.lat, endStation!!.lon, R.raw.end_marker
|
||||
)
|
||||
} else {
|
||||
if (isArrived) {
|
||||
// 重置滑动按钮文字
|
||||
showSlidePanel("滑动出发")
|
||||
}
|
||||
setOrRemoveMapMaker(
|
||||
false,
|
||||
BusConst.BUS_START_MAP_MAKER,
|
||||
startStation!!.lat,
|
||||
startStation!!.lon,
|
||||
R.raw.star_marker
|
||||
)
|
||||
setOrRemoveMapMaker(
|
||||
true,
|
||||
BusConst.BUS_END_MAP_MAKER,
|
||||
endStation!!.lat,
|
||||
endStation!!.lon,
|
||||
R.raw.end_marker
|
||||
)
|
||||
}
|
||||
if (stationList.size > 2) { //只有两个站点
|
||||
updateMoreThanTwoStationsUI(stationList, arrivingOrArrivedIndex, isArrived)
|
||||
} else {
|
||||
updateTwoStationsUI(stationList, arrivingOrArrivedIndex, isArrived)
|
||||
}
|
||||
updateBusTestBarInfo()
|
||||
}
|
||||
|
||||
/**
|
||||
* 有两个以上站点的路线
|
||||
* @param stationList
|
||||
* @param arrivingOrArrivedIndex
|
||||
* @param isArrived
|
||||
*/
|
||||
private fun updateMoreThanTwoStationsUI(
|
||||
stationList: List<BusStationBean>,
|
||||
arrivingOrArrivedIndex: Int,
|
||||
isArrived: Boolean
|
||||
) {
|
||||
bus_panel_second_station!!.setStationTag("")
|
||||
bus_panel_second_station!!.showOrHideStationArrowBg(true)
|
||||
bus_panel_third_station!!.setStationTag("")
|
||||
bus_panel_second_station!!.visibility = View.VISIBLE
|
||||
bus_panel_third_station!!.showOrHideStationArrowBg(false)
|
||||
if (arrivingOrArrivedIndex == 0 || arrivingOrArrivedIndex - 1 == 0 || arrivingOrArrivedIndex - 2 == 0 && stationList.size == 3) {
|
||||
bus_panel_first_station!!.setStationTag(ResourcesUtils.getString(R.string.bus_station_txt_tag_start))
|
||||
} else {
|
||||
bus_panel_first_station!!.setStationTag("")
|
||||
}
|
||||
if (arrivingOrArrivedIndex + 1 == stationList.size - 1 || arrivingOrArrivedIndex == stationList.size - 1 || arrivingOrArrivedIndex == 0 && arrivingOrArrivedIndex + 2 == stationList.size - 1) { //确认是否显示 "终"
|
||||
bus_panel_third_station!!.setStationTag(ResourcesUtils.getString(R.string.bus_station_txt_tag_end))
|
||||
} else {
|
||||
bus_panel_third_station!!.setStationTag("")
|
||||
}
|
||||
|
||||
//圆点: 0:灰色 过站 1:绿色 到站或者即将到站 2:蓝色:未到站
|
||||
if (arrivingOrArrivedIndex == 0 && isArrived) {
|
||||
bus_panel_first_station!!.setStationNameColor(getColor(R.color.bus_line_station_color_selected))
|
||||
bus_panel_second_station!!.setStationNameColor(getColor(R.color.bus_arrived_station_name_text_color))
|
||||
bus_panel_third_station!!.setStationNameColor(getColor(R.color.bus_arrived_station_name_text_color))
|
||||
bus_panel_first_station!!.setStationName(stationList[0].name)
|
||||
bus_panel_second_station!!.setStationName(stationList[1].name)
|
||||
bus_panel_third_station!!.setStationName(stationList[2].name)
|
||||
bus_panel_first_station!!.setStationPointBg(1)
|
||||
bus_panel_second_station!!.setStationPointBg(2)
|
||||
bus_panel_third_station!!.setStationPointBg(2)
|
||||
bus_panel_first_station!!.setStationArrowBg(2)
|
||||
bus_panel_second_station!!.setStationArrowBg(2)
|
||||
} else if (arrivingOrArrivedIndex == stationList.size - 1) {
|
||||
bus_panel_first_station!!.setStationNameColor(getColor(R.color.bus_station_tag_txt_un_color))
|
||||
bus_panel_second_station!!.setStationNameColor(getColor(R.color.bus_station_tag_txt_un_color))
|
||||
bus_panel_third_station!!.setStationNameColor(getColor(R.color.bus_line_station_color_selected))
|
||||
bus_panel_first_station!!.setStationName(stationList[arrivingOrArrivedIndex - 2].name)
|
||||
bus_panel_second_station!!.setStationName(stationList[arrivingOrArrivedIndex - 1].name)
|
||||
bus_panel_third_station!!.setStationName(stationList[arrivingOrArrivedIndex].name)
|
||||
bus_panel_first_station!!.setStationPointBg(0)
|
||||
bus_panel_second_station!!.setStationPointBg(0)
|
||||
bus_panel_third_station!!.setStationPointBg(1)
|
||||
bus_panel_first_station!!.setStationArrowBg(0)
|
||||
if (isArrived) {
|
||||
bus_panel_second_station!!.setStationArrowBg(0)
|
||||
} else {
|
||||
bus_panel_second_station!!.setStationArrowBg(1)
|
||||
}
|
||||
} else {
|
||||
bus_panel_first_station!!.setStationNameColor(getColor(R.color.bus_station_tag_txt_un_color))
|
||||
bus_panel_second_station!!.setStationNameColor(getColor(R.color.bus_line_station_color_selected))
|
||||
bus_panel_third_station!!.setStationNameColor(getColor(R.color.bus_arrived_station_name_text_color))
|
||||
bus_panel_first_station!!.setStationName(stationList[arrivingOrArrivedIndex - 1].name)
|
||||
bus_panel_second_station!!.setStationName(stationList[arrivingOrArrivedIndex].name)
|
||||
bus_panel_third_station!!.setStationName(stationList[arrivingOrArrivedIndex + 1].name)
|
||||
bus_panel_first_station!!.setStationPointBg(0)
|
||||
bus_panel_second_station!!.setStationPointBg(1)
|
||||
bus_panel_third_station!!.setStationPointBg(2)
|
||||
bus_panel_second_station!!.setStationArrowBg(2)
|
||||
if (isArrived) {
|
||||
bus_panel_first_station!!.setStationArrowBg(0)
|
||||
} else {
|
||||
bus_panel_first_station!!.setStationArrowBg(1)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 只有两个站点的路线
|
||||
* @param stationList
|
||||
* @param arrivingOrArrivedIndex
|
||||
* @param isArrived
|
||||
*/
|
||||
private fun updateTwoStationsUI(
|
||||
stationList: List<BusStationBean>,
|
||||
arrivingOrArrivedIndex: Int,
|
||||
isArrived: Boolean
|
||||
) {
|
||||
bus_panel_second_station!!.visibility = View.GONE
|
||||
bus_panel_second_station!!.showOrHideStationArrowBg(false)
|
||||
bus_panel_third_station!!.showOrHideStationArrowBg(false)
|
||||
bus_panel_first_station!!.setStationTag(ResourcesUtils.getString(R.string.bus_station_txt_tag_start))
|
||||
bus_panel_third_station!!.setStationTag(ResourcesUtils.getString(R.string.bus_station_txt_tag_end))
|
||||
bus_panel_first_station!!.setStationName(stationList[0].name)
|
||||
bus_panel_third_station!!.setStationName(stationList[1].name)
|
||||
|
||||
//圆点: 0:灰色 过站 1:绿色 到站或者即将到站 2:蓝色:未到站
|
||||
if (arrivingOrArrivedIndex == 0 && isArrived) { //到站
|
||||
bus_panel_first_station!!.setStationNameColor(getColor(R.color.bus_line_station_color_selected))
|
||||
bus_panel_third_station!!.setStationNameColor(getColor(R.color.bus_arrived_station_name_text_color))
|
||||
bus_panel_first_station!!.setStationPointBg(1)
|
||||
bus_panel_first_station!!.setStationArrowBg(2)
|
||||
bus_panel_third_station!!.setStationPointBg(0)
|
||||
} else {
|
||||
bus_panel_first_station!!.setStationNameColor(getColor(R.color.bus_station_tag_txt_un_color))
|
||||
bus_panel_third_station!!.setStationNameColor(getColor(R.color.bus_line_station_color_selected))
|
||||
if (isArrived) { //到终点
|
||||
bus_panel_first_station!!.setStationPointBg(0)
|
||||
bus_panel_first_station!!.setStationArrowBg(0)
|
||||
bus_panel_third_station!!.setStationPointBg(1)
|
||||
} else { //到终点途中
|
||||
bus_panel_first_station!!.setStationPointBg(0)
|
||||
bus_panel_first_station!!.setStationArrowBg(1)
|
||||
bus_panel_third_station!!.setStationPointBg(1)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private fun showOrHideSwitchLineBtn(isShow: Boolean) {
|
||||
if (isShow) { //显示切换路线
|
||||
switch_line_btn!!.tag = 0
|
||||
switch_line_btn!!.text = ResourcesUtils.getString(R.string.bus_switch_line_btn)
|
||||
} else { //显示结束路线
|
||||
switch_line_btn!!.tag = 1
|
||||
switch_line_btn!!.text = ResourcesUtils.getString(R.string.bus_close_line_btn)
|
||||
}
|
||||
}
|
||||
|
||||
override fun restartAutopilot() {
|
||||
if (!isAnimateRunning) {
|
||||
mPresenter!!.restartAutopilot()
|
||||
}
|
||||
}
|
||||
|
||||
override fun moveToEnd() {
|
||||
// 开启自动驾驶到下一站
|
||||
if (isAnimateRunning) {
|
||||
stopAutopilotAnimation()
|
||||
}
|
||||
mPresenter!!.autoDriveToNextStation()
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置自动驾驶可用状态
|
||||
*/
|
||||
fun onAutopilotEnableChange(isEnable: Boolean) {
|
||||
if (isEnable) {
|
||||
showAutopilotBiz()
|
||||
} else {
|
||||
hideAutopilotBiz()
|
||||
}
|
||||
}
|
||||
|
||||
fun clearBusStationsMarkers() {
|
||||
d(SceneConstant.M_BUS + TAG, "clearBusStationsMarkers()")
|
||||
if (null != startStation) {
|
||||
setOrRemoveMapMaker(
|
||||
false,
|
||||
BusConst.BUS_START_MAP_MAKER,
|
||||
startStation!!.lat,
|
||||
startStation!!.lon,
|
||||
R.raw.star_marker
|
||||
)
|
||||
}
|
||||
if (null != endStation) {
|
||||
setOrRemoveMapMaker(
|
||||
false,
|
||||
BusConst.BUS_END_MAP_MAKER,
|
||||
endStation!!.lat,
|
||||
endStation!!.lon,
|
||||
R.raw.end_marker
|
||||
)
|
||||
}
|
||||
|
||||
//清除鹰眼右下角小地图轨迹
|
||||
d(SceneConstant.M_BUS, "clearBusStationsMarkers --------->")
|
||||
smallMapView.clearPolyline()
|
||||
}
|
||||
|
||||
/**
|
||||
* 绘制地图起点终点
|
||||
*
|
||||
* @param isAdd
|
||||
* @param uuid
|
||||
*/
|
||||
private fun setOrRemoveMapMaker(
|
||||
isAdd: Boolean,
|
||||
uuid: String,
|
||||
lat: Double,
|
||||
longi: Double,
|
||||
resourceId: Int
|
||||
) {
|
||||
if (isAdd) {
|
||||
val setMapMarkerRunnable = Runnable {
|
||||
d(
|
||||
SceneConstant.M_BUS + "setMapMaker= " + Thread.currentThread().name,
|
||||
"$uuid=latitude=$lat,longitude=$longi"
|
||||
)
|
||||
val builder =
|
||||
Point.Options.Builder(BusConst.TYPE_MARKER_BUS_ORDER, Level.MAP_MARKER)
|
||||
.setId(uuid)
|
||||
.anchor(0.5f, 0.5f)
|
||||
.set3DMode(true)
|
||||
.isUseGps(true)
|
||||
.controlAngle(false)
|
||||
.icon3DRes(resourceId)
|
||||
.latitude(lat)
|
||||
.longitude(longi)
|
||||
val overlayManager = getOverlayManager()
|
||||
overlayManager?.showOrUpdatePoint(builder.build(), MogoMap.DEFAULT)
|
||||
}
|
||||
OCHThreadPoolManager.getsInstance().execute(setMapMarkerRunnable)
|
||||
} else {
|
||||
val removeMapMarkerRunnable = Runnable {
|
||||
d(
|
||||
SceneConstant.M_BUS + "RemoveMapMaker=" + Thread.currentThread().name,
|
||||
"$uuid=latitude=$lat,longitude=$longi"
|
||||
)
|
||||
val overlayManager = getOverlayManager()
|
||||
overlayManager?.removePoint(uuid)
|
||||
}
|
||||
OCHThreadPoolManager.getsInstance().execute(removeMapMarkerRunnable)
|
||||
}
|
||||
}
|
||||
|
||||
override fun debugAutoPilotStatus(status: Int) {
|
||||
mPresenter!!.debugAutoPilotStatus(status)
|
||||
}
|
||||
|
||||
override fun onClick(v: View) {
|
||||
if (v.id == R.id.switch_line_btn) { //切换路线条件: 自动驾驶过程中,点击则toast提示:自动驾驶中,不可切换路线
|
||||
//本次行程未结束,不支持切换路线。点击则toast提示:当前行程未完成,不可切换路线
|
||||
if (getState()
|
||||
== IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_RUNNING
|
||||
) {
|
||||
ToastUtils.showLong(ResourcesUtils.getString(R.string.bus_switch_line_btn_warning1))
|
||||
return
|
||||
}
|
||||
if (switch_line_btn!!.tag as Int == 0) { //切换路线
|
||||
val intent = Intent(context, BusSwitchLineActivity::class.java)
|
||||
ActivityUtils.startActivity(intent)
|
||||
} else { //结束任务
|
||||
context?.let {
|
||||
val builder = OCHCommitDialog.Builder()
|
||||
val closeLineConfirmDialog = builder
|
||||
.title(ResourcesUtils.getString(R.string.bus_dialog_title))
|
||||
.tips(ResourcesUtils.getString(R.string.bus_dialog_tips))
|
||||
.confirmStr(ResourcesUtils.getString(R.string.bus_dialog_confirm))
|
||||
.cancelStr(ResourcesUtils.getString(R.string.bus_dialog_cancel))
|
||||
.build(it)
|
||||
closeLineConfirmDialog!!.setClickListener(object : OCHCommitDialog.ClickListener {
|
||||
override fun confirm() {
|
||||
mPresenter!!.abortTask()
|
||||
}
|
||||
|
||||
override fun cancel() {
|
||||
closeLineConfirmDialog.dismiss()
|
||||
}
|
||||
})
|
||||
closeLineConfirmDialog.show()
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override val slidePanelOnEndListener: SlidePanelView.OnSlidePanelMoveToEndListener
|
||||
get() = this
|
||||
|
||||
companion object {
|
||||
const val TAG = "BusFragment"
|
||||
}
|
||||
}
|
||||
@@ -1,154 +0,0 @@
|
||||
package com.mogo.och.bus.model;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
import com.mogo.commons.AbsMogoApplication;
|
||||
import com.mogo.commons.storage.SharedPrefsMgr;
|
||||
import com.mogo.eagle.core.utilcode.util.NetworkUtils;
|
||||
import com.mogo.eagle.core.utilcode.util.ToastUtils;
|
||||
import com.mogo.och.bus.R;
|
||||
import com.mogo.och.bus.bean.response.BusQueryLineTaskResponse;
|
||||
import com.mogo.och.bus.bean.response.BusQueryLinesResponse;
|
||||
import com.mogo.och.bus.bean.response.BusRoutesResponse;
|
||||
import com.mogo.och.bus.callback.IBusLinesCallback;
|
||||
import com.mogo.och.bus.net.OrderServiceManager;
|
||||
import com.mogo.och.bus.ui.BusSwitchLineActivity;
|
||||
import com.mogo.och.common.module.network.OchCommonServiceCallback;
|
||||
import com.mogo.och.common.module.manager.logchainanalytic.OchChainLogManager;
|
||||
|
||||
/**
|
||||
* @author: wangmingjun
|
||||
* @date: 2022/2/9
|
||||
*/
|
||||
public class BusLineModel {
|
||||
private static volatile BusLineModel sInstance;
|
||||
private Context mContext;
|
||||
private IBusLinesCallback mBusLinesCallback;
|
||||
private static final byte[] obj = new byte[0];
|
||||
|
||||
private BusLineModel() {
|
||||
}
|
||||
public static BusLineModel getInstance() {
|
||||
if ( sInstance == null ) {
|
||||
synchronized ( obj ) {
|
||||
if ( sInstance == null ) {
|
||||
sInstance = new BusLineModel();
|
||||
}
|
||||
}
|
||||
}
|
||||
return sInstance;
|
||||
}
|
||||
|
||||
public void init() {
|
||||
mContext = AbsMogoApplication.getApp();
|
||||
}
|
||||
public void setBusLinesCallback(IBusLinesCallback callback){
|
||||
mBusLinesCallback = callback;
|
||||
}
|
||||
public void queryBusLines(){
|
||||
OrderServiceManager.queryBusLines(mContext, new OchCommonServiceCallback<BusQueryLinesResponse>() {
|
||||
@Override
|
||||
public void onSuccess(BusQueryLinesResponse data) {
|
||||
if (null == data && mBusLinesCallback != null) {
|
||||
mBusLinesCallback.onBusLinesChange(null);
|
||||
return;
|
||||
}
|
||||
|
||||
if (mBusLinesCallback != null){
|
||||
mBusLinesCallback.onBusLinesChange(data);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError() {
|
||||
if (!NetworkUtils.isConnected(mContext)) {
|
||||
ToastUtils.showShort(mContext.getString(R.string.network_error_tip));
|
||||
} else {
|
||||
ToastUtils.showShort(mContext.getString(R.string.request_error_tip));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFail(int code, String failMsg) {
|
||||
if (!NetworkUtils.isConnected(mContext)) {
|
||||
ToastUtils.showShort("网络异常,请稍后重试");
|
||||
}else {
|
||||
ToastUtils.showShort("查询所有绑定路线失败:"+failMsg);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过线路id 查询线路排班表
|
||||
* @param lineId 线路id
|
||||
* @param position 位置
|
||||
*/
|
||||
public void queryBusLineTasksById(int lineId, int position,boolean autoRefresh){
|
||||
OrderServiceManager.queryBusTaskByLineId(mContext, String.valueOf(lineId),new OchCommonServiceCallback<BusQueryLineTaskResponse>() {
|
||||
@Override
|
||||
public void onSuccess(BusQueryLineTaskResponse data) {
|
||||
if (null == data && mBusLinesCallback != null) {
|
||||
mBusLinesCallback.onBusLineTasks(null,position,autoRefresh);
|
||||
return;
|
||||
}
|
||||
|
||||
if (mBusLinesCallback != null){
|
||||
mBusLinesCallback.onBusLineTasks(data,position,autoRefresh);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError() {
|
||||
if (!NetworkUtils.isConnected(mContext)) {
|
||||
ToastUtils.showShort(mContext.getString(R.string.network_error_tip));
|
||||
} else {
|
||||
ToastUtils.showShort(mContext.getString(R.string.request_error_tip));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFail(int code, String failMsg) {
|
||||
if (!NetworkUtils.isConnected(mContext)) {
|
||||
ToastUtils.showShort("网络异常,请稍后重试");
|
||||
}else {
|
||||
ToastUtils.showShort("查询所有绑定路线失败:"+failMsg);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public void commitSwitchLineId(int taskId,int lineId){
|
||||
OchChainLogManager.writeChainLog("选择线路","taskId:"+taskId+"--lineId:"+lineId);
|
||||
OrderServiceManager.switchLine(mContext,taskId, new OchCommonServiceCallback<BusRoutesResponse>() {
|
||||
@Override
|
||||
public void onSuccess(BusRoutesResponse o) {
|
||||
OchChainLogManager.writeChainLog("选择线路成功","taskId:"+taskId+"--lineId:"+lineId);
|
||||
SharedPrefsMgr.getInstance().putInt(BusSwitchLineActivity.LASTCOMMITLINEID,lineId);
|
||||
if (mBusLinesCallback != null){
|
||||
mBusLinesCallback.onChangeLineIdSuccess();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError() {
|
||||
if (!NetworkUtils.isConnected(mContext)) {
|
||||
OchChainLogManager.writeChainLog("选择线路失败","taskId:"+taskId+"--lineId:"+lineId);
|
||||
ToastUtils.showShort(mContext.getString(R.string.network_error_tip));
|
||||
} else {
|
||||
ToastUtils.showShort(mContext.getString(R.string.request_error_tip));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFail(int code, String failMsg) {
|
||||
if (!NetworkUtils.isConnected(mContext)) {
|
||||
ToastUtils.showShort("网络异常,请稍后重试");
|
||||
}else {
|
||||
ToastUtils.showShort("选择任务失败:"+failMsg);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,166 +0,0 @@
|
||||
package com.mogo.och.bus.net
|
||||
|
||||
import com.mogo.eagle.core.data.BaseData
|
||||
import com.mogo.och.bus.bean.request.BusCloseTaskRequest
|
||||
import com.mogo.och.bus.bean.request.BusQueryLineStationsRequest
|
||||
import com.mogo.och.bus.bean.request.BusResetDrivingLineRequest
|
||||
import com.mogo.och.bus.bean.request.BusRoutePlanningUpdateReqBean
|
||||
import com.mogo.och.bus.bean.request.BusUpdateSiteStatusRequest
|
||||
import com.mogo.och.bus.bean.request.CarHeartbeatReqBean
|
||||
import com.mogo.och.bus.bean.response.BusQueryLineTaskResponse
|
||||
import com.mogo.och.bus.bean.response.BusQueryLinesResponse
|
||||
import com.mogo.och.bus.bean.response.BusRoutesResponse
|
||||
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
|
||||
|
||||
/**
|
||||
* 小巴车相关接口
|
||||
*
|
||||
* @author tongchenfei
|
||||
*
|
||||
*
|
||||
* wiki: http://wiki.zhidaohulian.com/pages/viewpage.action?pageId=48970072
|
||||
*/
|
||||
interface IBascApiService {
|
||||
/**
|
||||
* 根据车机坐标获取所在区域全部站点信息
|
||||
*
|
||||
* @param request 请求参数
|
||||
* @return 接口返回数据
|
||||
*/
|
||||
@Headers("Content-Type:application/json;charset=UTF-8")
|
||||
@POST("/autopilot-car-hailing/line/v2/driver/bus/lineDataWithDriver/query")
|
||||
fun queryBusRoutes(
|
||||
@Header("appId") appId: String?,
|
||||
@Header("ticket") ticket: String?,
|
||||
@Body request: BusQueryLineStationsRequest?
|
||||
): Observable<BusRoutesResponse>
|
||||
|
||||
/**
|
||||
* @param request 请求参数{"destLine":1,"sn":"F803EB2046PZD00229"} 这个接口是重置bus线路的, 不是重置线路中站点的
|
||||
* @return 返回值是重置后的车站列表
|
||||
* 开始路线
|
||||
*/
|
||||
@Headers("Content-Type:application/json;charset=UTF-8")
|
||||
@POST("/autopilot-car-hailing/cab/flow/v1/bus/driver/bus/startTask")
|
||||
fun switchLine(
|
||||
@Header("appId") appId: String?,
|
||||
@Header("ticket") ticket: String?,
|
||||
@Body request: BusResetDrivingLineRequest?
|
||||
): Observable<BusRoutesResponse>
|
||||
|
||||
/**
|
||||
* 离站,通知服务器
|
||||
* @param request
|
||||
* @return
|
||||
*/
|
||||
@Headers("Content-Type:application/json;charset=UTF-8")
|
||||
@POST("/autopilot-car-hailing/cab/flow/v1/bus/driver/bus/leave")
|
||||
fun leaveStation(
|
||||
@Header("appId") appId: String?,
|
||||
@Header("ticket") ticket: String?,
|
||||
@Body request: BusUpdateSiteStatusRequest?
|
||||
): Observable<BaseData>
|
||||
|
||||
/**
|
||||
* 到站 更新到站信息
|
||||
* @param request
|
||||
* @return
|
||||
*/
|
||||
@Headers("Content-type:application/json;charset=UTF-8")
|
||||
@POST("/autopilot-car-hailing/cab/flow/v1/bus/driver/bus/arrive")
|
||||
fun arriveSiteStation(
|
||||
@Header("appId") appId: String?,
|
||||
@Header("ticket") ticket: String?,
|
||||
@Body request: BusUpdateSiteStatusRequest?
|
||||
): Observable<BaseData>
|
||||
|
||||
|
||||
/**
|
||||
* 车机端上传心跳数据(只在出车状态时上传):包含高德坐标系经纬度
|
||||
* @param data
|
||||
* @return
|
||||
*/
|
||||
@Headers("Content-type:application/json;charset=UTF-8")
|
||||
@POST("/autopilot-car-hailing/location/v2/driver/bus/heartbeat")
|
||||
fun runCarHeartbeat(
|
||||
@Header("appId") appId: String?,
|
||||
@Header("ticket") ticket: String?,
|
||||
@Body data: CarHeartbeatReqBean?
|
||||
): Observable<BaseData>
|
||||
|
||||
/**
|
||||
* 查询车辆配置的所有路线
|
||||
* @param appId
|
||||
* @param ticket
|
||||
* @param sn
|
||||
* @return
|
||||
*/
|
||||
@GET("/autopilot-car-hailing/line/v2/driver/bus/bindLine/query")
|
||||
fun queryBusLines(
|
||||
@Header("appId") appId: String?,
|
||||
@Header("ticket") ticket: String?,
|
||||
@Query("sn") sn: String?
|
||||
): Observable<BusQueryLinesResponse>
|
||||
|
||||
/**
|
||||
* 查询路线当天的任务
|
||||
* @param appId
|
||||
* @param ticket
|
||||
* @param lineId 线路id
|
||||
* @return
|
||||
*/
|
||||
@GET("/autopilot-car-hailing/line/v2/driver/bus/task/query")
|
||||
fun queryBusTaskByLineId(@Header("appId") appId: String?, @Header("ticket") ticket: String?, @Query("lineId") lineId: String?): Observable<BusQueryLineTaskResponse>
|
||||
|
||||
|
||||
/**
|
||||
* 上传轨迹信息
|
||||
* @param appId
|
||||
* @param ticket
|
||||
* @param data
|
||||
* @return
|
||||
*/
|
||||
@Headers("Content-type:application/json;charset=UTF-8")
|
||||
@POST("/autopilot-car-hailing/location/v2/driver/bus/saveLineCoordinate")
|
||||
fun updateOrderRoute(
|
||||
@Header("appId") appId: String?,
|
||||
@Header("ticket") ticket: String?,
|
||||
@Body data: BusRoutePlanningUpdateReqBean?
|
||||
): Observable<BaseData>
|
||||
|
||||
/**
|
||||
* 中止任务
|
||||
* @param appId
|
||||
* @param ticket
|
||||
* @param data
|
||||
* @return
|
||||
*/
|
||||
@POST("/autopilot-car-hailing/cab/flow/v1/bus/driver/bus/abortTask")
|
||||
fun abortTask(
|
||||
@Header("appId") appId: String?,
|
||||
@Header("ticket") ticket: String?,
|
||||
@Body data: BusCloseTaskRequest?
|
||||
): Observable<BaseData>
|
||||
|
||||
/**
|
||||
* 任务正常跑完结束
|
||||
* @param appId
|
||||
* @param ticket
|
||||
* @param data
|
||||
* @return
|
||||
*/
|
||||
@Headers("Content-type:application/json;charset=UTF-8")
|
||||
@POST("/autopilot-car-hailing/cab/flow/v1/bus/driver/bus/endTask")
|
||||
fun endTask(
|
||||
@Header("appId") appId: String?,
|
||||
@Header("ticket") ticket: String?,
|
||||
@Body data: BusCloseTaskRequest?
|
||||
): Observable<BaseData>
|
||||
}
|
||||
|
||||
@@ -1,143 +0,0 @@
|
||||
package com.mogo.och.bus.net
|
||||
|
||||
import com.mogo.eagle.core.data.BaseData
|
||||
import com.mogo.och.bus.bean.request.BusCloseTaskRequest
|
||||
import com.mogo.och.bus.bean.request.BusResetDrivingLineRequest
|
||||
import com.mogo.och.bus.bean.request.BusRoutePlanningUpdateReqBean
|
||||
import com.mogo.och.bus.bean.request.BusUpdateSiteStatusRequest
|
||||
import com.mogo.och.bus.bean.response.BusQueryLineTaskResponse
|
||||
import com.mogo.och.bus.bean.response.BusQueryLinesResponse
|
||||
import com.mogo.och.bus.bean.response.BusRoutesResponse
|
||||
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
|
||||
|
||||
/**
|
||||
* 小巴车相关接口
|
||||
*
|
||||
* @author tongchenfei
|
||||
*
|
||||
*
|
||||
* wiki: http://wiki.zhidaohulian.com/pages/viewpage.action?pageId=48970072
|
||||
*/
|
||||
interface ISAASApiService {
|
||||
/**
|
||||
* 根据车机坐标获取所在区域全部站点信息
|
||||
*/
|
||||
@Headers("Content-Type:application/json;charset=UTF-8")
|
||||
@GET("/och-bus-cabin/api/business/v1/driver/bus/lineDataWithDriver/query")
|
||||
fun queryBusRoutes(
|
||||
@Header("appId") appId: String?,
|
||||
@Header("ticket") ticket: String?,
|
||||
@Query("sn") sn: String?
|
||||
): Observable<BusRoutesResponse>
|
||||
|
||||
/**
|
||||
* @param request 请求参数{"destLine":1,"sn":"F803EB2046PZD00229"} 这个接口是重置bus线路的, 不是重置线路中站点的
|
||||
* @return 返回值是重置后的车站列表
|
||||
* 开始路线
|
||||
*/
|
||||
@Headers("Content-Type:application/json;charset=UTF-8")
|
||||
@POST("/och-bus-cabin/cab/flow/v1/bus/driver/startTask")
|
||||
fun switchLine(
|
||||
@Header("appId") appId: String?,
|
||||
@Header("ticket") ticket: String?,
|
||||
@Body request: BusResetDrivingLineRequest?
|
||||
): Observable<BusRoutesResponse>
|
||||
|
||||
/**
|
||||
* 离站,通知服务器
|
||||
*/
|
||||
@Headers("Content-Type:application/json;charset=UTF-8")
|
||||
@POST("/och-bus-cabin/cab/flow/v1/bus/driver/leave")
|
||||
fun leaveStation(
|
||||
@Header("appId") appId: String?,
|
||||
@Header("ticket") ticket: String?,
|
||||
@Body request: BusUpdateSiteStatusRequest?
|
||||
): Observable<BaseData>
|
||||
|
||||
/**
|
||||
* 到站 更新到站信息
|
||||
*/
|
||||
@Headers("Content-type:application/json;charset=UTF-8")
|
||||
@POST("/och-bus-cabin/cab/flow/v1/bus/driver/arrive")
|
||||
fun arriveSiteStation(
|
||||
@Header("appId") appId: String?,
|
||||
@Header("ticket") ticket: String?,
|
||||
@Body request: BusUpdateSiteStatusRequest?
|
||||
): Observable<BaseData>
|
||||
|
||||
|
||||
/**
|
||||
* 查询车辆配置的所有路线
|
||||
*/
|
||||
@Headers("Content-type:application/json;charset=UTF-8")
|
||||
@GET("/och-bus-cabin/api/business/v1/driver/BusBindLine")
|
||||
fun queryBusLines(
|
||||
@Header("appId") appId: String?,
|
||||
@Header("ticket") ticket: String?,
|
||||
@Query("sn") sn: String?
|
||||
): Observable<BusQueryLinesResponse>
|
||||
|
||||
/**
|
||||
* 查询路线当天的任务
|
||||
* @param appId
|
||||
* @param ticket
|
||||
* @param lineId 线路id
|
||||
* @return
|
||||
*/
|
||||
@Headers("Content-type:application/json;charset=UTF-8")
|
||||
@GET("/och-bus-cabin/api/business/v1/driver/bus/task/query")
|
||||
fun queryBusTaskByLineId(
|
||||
@Header("appId") appId: String?,
|
||||
@Header("ticket") ticket: String?,
|
||||
@Query("lineId") lineId: String?
|
||||
): Observable<BusQueryLineTaskResponse>
|
||||
|
||||
|
||||
/**
|
||||
* 上传轨迹信息
|
||||
*/
|
||||
@Headers("Content-type:application/json;charset=UTF-8")
|
||||
@POST("/autopilot-car-hailing/location/v2/driver/bus/saveLineCoordinate")
|
||||
fun updateOrderRoute(
|
||||
@Header("appId") appId: String?,
|
||||
@Header("ticket") ticket: String?,
|
||||
@Body data: BusRoutePlanningUpdateReqBean?
|
||||
): Observable<BaseData>
|
||||
|
||||
/**
|
||||
* 中止任务
|
||||
* @param appId
|
||||
* @param ticket
|
||||
* @param data
|
||||
* @return
|
||||
*/
|
||||
@Headers("Content-type:application/json;charset=UTF-8")
|
||||
@POST("/och-bus-cabin/cab/flow/v1/bus/driver/abortTask")
|
||||
fun abortTask(
|
||||
@Header("appId") appId: String?,
|
||||
@Header("ticket") ticket: String?,
|
||||
@Body data: BusCloseTaskRequest?
|
||||
): Observable<BaseData>
|
||||
|
||||
/**
|
||||
* 任务正常跑完结束
|
||||
* @param appId
|
||||
* @param ticket
|
||||
* @param data
|
||||
* @return
|
||||
*/
|
||||
@Headers("Content-type:application/json;charset=UTF-8")
|
||||
@POST("/och-bus-cabin/cab/flow/v1/bus/driver/endTask")
|
||||
fun endTask(
|
||||
@Header("appId") appId: String?,
|
||||
@Header("ticket") ticket: String?,
|
||||
@Body data: BusCloseTaskRequest?
|
||||
): Observable<BaseData>
|
||||
}
|
||||
|
||||
@@ -1,331 +0,0 @@
|
||||
package com.mogo.och.bus.net
|
||||
|
||||
import android.content.Context
|
||||
import com.mogo.cloud.passport.MoGoAiCloudClientConfig
|
||||
import com.mogo.commons.debug.DebugConfig
|
||||
import com.mogo.eagle.core.data.BaseData
|
||||
import com.mogo.eagle.core.network.MoGoRetrofitFactory
|
||||
import com.mogo.commons.storage.SharedPrefsMgr
|
||||
import com.mogo.eagle.core.data.map.MogoLocation
|
||||
import com.mogo.och.bus.bean.request.BusCloseTaskRequest
|
||||
import com.mogo.och.bus.bean.request.BusQueryLineStationsRequest
|
||||
import com.mogo.och.bus.bean.request.BusResetDrivingLineRequest
|
||||
import com.mogo.och.bus.bean.request.BusRoutePlanningUpdateReqBean
|
||||
import com.mogo.och.bus.bean.request.BusUpdateSiteStatusRequest
|
||||
import com.mogo.och.bus.bean.request.CarHeartbeatReqBean
|
||||
import com.mogo.och.bus.bean.response.BusQueryLineTaskResponse
|
||||
import com.mogo.och.bus.bean.response.BusQueryLinesResponse
|
||||
import com.mogo.och.bus.bean.response.BusRoutesResponse
|
||||
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
|
||||
|
||||
/**
|
||||
* @author: wangmingjun
|
||||
* @date: 2021/10/20
|
||||
*/
|
||||
object OrderServiceManager {
|
||||
|
||||
private val M_SERVICE: IBascApiService = MoGoRetrofitFactory.getInstance(OchCommonConst.getBaseUrl()).create(
|
||||
IBascApiService::class.java
|
||||
)
|
||||
|
||||
private val M_SAAS_SERVICE: ISAASApiService = MoGoRetrofitFactory.getInstance(OchCommonConst.getBaseUrl()).create(
|
||||
ISAASApiService::class.java
|
||||
)
|
||||
|
||||
/**
|
||||
* 查询小巴车当前任务
|
||||
* @param context
|
||||
* @param callback
|
||||
*/
|
||||
@JvmStatic
|
||||
fun queryBusRoutes(context: Context, callback: OchCommonServiceCallback<BusRoutesResponse>?) {
|
||||
//获取当前高德坐标
|
||||
if (DebugConfig.getProjectFlavor().contains("saas")){
|
||||
M_SAAS_SERVICE.queryBusRoutes(
|
||||
MoGoAiCloudClientConfig.getInstance().serviceAppId,
|
||||
SharedPrefsMgr.getInstance().token,
|
||||
SharedPrefsMgr.getInstance().sn
|
||||
)
|
||||
.transformTry()
|
||||
.subscribe(OchCommonSubscribeImpl(context, callback, "queryBusRoutes"))
|
||||
|
||||
}else{
|
||||
M_SERVICE.queryBusRoutes(
|
||||
MoGoAiCloudClientConfig.getInstance().serviceAppId,
|
||||
SharedPrefsMgr.getInstance().token,
|
||||
BusQueryLineStationsRequest()
|
||||
)
|
||||
.transformTry()
|
||||
.subscribe(OchCommonSubscribeImpl(context, callback, "queryBusRoutes"))
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 重置线路站点
|
||||
* @param context
|
||||
* @param taskId
|
||||
* @param callback
|
||||
*/
|
||||
@JvmStatic
|
||||
fun switchLine(
|
||||
context: Context,
|
||||
taskId: Int,
|
||||
callback: OchCommonServiceCallback<BusRoutesResponse>?
|
||||
) {
|
||||
|
||||
if (DebugConfig.getProjectFlavor().contains("saas")){
|
||||
M_SAAS_SERVICE.switchLine(
|
||||
MoGoAiCloudClientConfig.getInstance().serviceAppId,
|
||||
SharedPrefsMgr.getInstance().token,
|
||||
BusResetDrivingLineRequest(taskId)
|
||||
)
|
||||
.transformTry()
|
||||
.subscribe(OchCommonSubscribeImpl(context, callback, "switchLine"))
|
||||
}else{
|
||||
M_SERVICE.switchLine(
|
||||
MoGoAiCloudClientConfig.getInstance().serviceAppId,
|
||||
SharedPrefsMgr.getInstance().token,
|
||||
BusResetDrivingLineRequest(taskId)
|
||||
)
|
||||
.transformTry()
|
||||
.subscribe(OchCommonSubscribeImpl(context, callback, "switchLine"))
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 中断当前任务
|
||||
* @param context
|
||||
* @param taskId
|
||||
* @param callback
|
||||
*/
|
||||
@JvmStatic
|
||||
fun abortTask(context: Context, taskId: Int, callback: OchCommonServiceCallback<BaseData>?) {
|
||||
|
||||
if (DebugConfig.getProjectFlavor().contains("saas")){
|
||||
M_SAAS_SERVICE.abortTask(
|
||||
MoGoAiCloudClientConfig.getInstance().serviceAppId,
|
||||
SharedPrefsMgr.getInstance().token,
|
||||
BusCloseTaskRequest(taskId)
|
||||
)
|
||||
.transformTry()
|
||||
.subscribe(OchCommonSubscribeImpl(context, callback, "abortTask"))
|
||||
}else{
|
||||
M_SERVICE.abortTask(
|
||||
MoGoAiCloudClientConfig.getInstance().serviceAppId,
|
||||
SharedPrefsMgr.getInstance().token,
|
||||
BusCloseTaskRequest(taskId)
|
||||
)
|
||||
.transformTry()
|
||||
.subscribe(OchCommonSubscribeImpl(context, callback, "abortTask"))
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 正常结束任务
|
||||
* @param context
|
||||
* @param taskId
|
||||
* @param callback
|
||||
*/
|
||||
@JvmStatic
|
||||
fun endTask(context: Context, taskId: Int, callback: OchCommonServiceCallback<BaseData>?) {
|
||||
if (DebugConfig.getProjectFlavor().contains("saas")){
|
||||
M_SAAS_SERVICE.endTask(
|
||||
MoGoAiCloudClientConfig.getInstance().serviceAppId,
|
||||
SharedPrefsMgr.getInstance().token,
|
||||
BusCloseTaskRequest(taskId)
|
||||
)
|
||||
.transformTry()
|
||||
.subscribe(OchCommonSubscribeImpl(context, callback, "endTask"))
|
||||
}else{
|
||||
M_SERVICE.endTask(
|
||||
MoGoAiCloudClientConfig.getInstance().serviceAppId,
|
||||
SharedPrefsMgr.getInstance().token,
|
||||
BusCloseTaskRequest(taskId)
|
||||
)
|
||||
.transformTry()
|
||||
.subscribe(OchCommonSubscribeImpl(context, callback, "endTask"))
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 离站上报
|
||||
* @param context
|
||||
* @param seq
|
||||
* @param siteId
|
||||
* @param callback
|
||||
*/
|
||||
@JvmStatic
|
||||
fun leaveStation(
|
||||
context: Context,
|
||||
seq: Int,
|
||||
siteId: Int,
|
||||
taskId: Int,
|
||||
callback: OchCommonServiceCallback<BaseData>?
|
||||
) {
|
||||
if (DebugConfig.getProjectFlavor().contains("saas")){
|
||||
M_SAAS_SERVICE.leaveStation(
|
||||
MoGoAiCloudClientConfig.getInstance().serviceAppId,
|
||||
SharedPrefsMgr.getInstance().token,
|
||||
BusUpdateSiteStatusRequest(taskId, siteId, seq)
|
||||
)
|
||||
.transformTry()
|
||||
.subscribe(OchCommonSubscribeImpl(context, callback, "leaveStation"))
|
||||
}else{
|
||||
M_SERVICE.leaveStation(
|
||||
MoGoAiCloudClientConfig.getInstance().serviceAppId,
|
||||
SharedPrefsMgr.getInstance().token,
|
||||
BusUpdateSiteStatusRequest(taskId, siteId, seq)
|
||||
)
|
||||
.transformTry()
|
||||
.subscribe(OchCommonSubscribeImpl(context, callback, "leaveStation"))
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 到站更新站点状态
|
||||
* @param context
|
||||
* @param seq
|
||||
* @param siteId
|
||||
* @param callback
|
||||
*/
|
||||
@JvmStatic
|
||||
fun arriveSiteStation(
|
||||
context: Context, seq: Int, siteId: Int, taskId: Int,
|
||||
callback: OchCommonServiceCallback<BaseData>?
|
||||
) {
|
||||
if (DebugConfig.getProjectFlavor().contains("saas")){
|
||||
M_SAAS_SERVICE.arriveSiteStation(
|
||||
MoGoAiCloudClientConfig.getInstance().serviceAppId,
|
||||
SharedPrefsMgr.getInstance().token,
|
||||
BusUpdateSiteStatusRequest(taskId, siteId, seq)
|
||||
)
|
||||
.transformTry()
|
||||
.subscribe(OchCommonSubscribeImpl(context, callback, "arriveSiteStation"))
|
||||
}else{
|
||||
M_SERVICE.arriveSiteStation(
|
||||
MoGoAiCloudClientConfig.getInstance().serviceAppId,
|
||||
SharedPrefsMgr.getInstance().token,
|
||||
BusUpdateSiteStatusRequest(taskId, siteId, seq)
|
||||
)
|
||||
.transformTry()
|
||||
.subscribe(OchCommonSubscribeImpl(context, callback, "arriveSiteStation"))
|
||||
}
|
||||
}
|
||||
|
||||
@JvmStatic
|
||||
fun queryBusLines(context: Context, callback: OchCommonServiceCallback<BusQueryLinesResponse>?) {
|
||||
if (DebugConfig.getProjectFlavor().contains("saas")){
|
||||
M_SAAS_SERVICE.queryBusLines(
|
||||
MoGoAiCloudClientConfig.getInstance().serviceAppId,
|
||||
SharedPrefsMgr.getInstance().token,
|
||||
SharedPrefsMgr.getInstance().sn
|
||||
)
|
||||
.transformTry()
|
||||
.subscribe(OchCommonSubscribeImpl(context, callback, "queryBusLines"))
|
||||
}else{
|
||||
M_SERVICE.queryBusLines(
|
||||
MoGoAiCloudClientConfig.getInstance().serviceAppId,
|
||||
SharedPrefsMgr.getInstance().token,
|
||||
SharedPrefsMgr.getInstance().sn
|
||||
)
|
||||
.transformTry()
|
||||
.subscribe(OchCommonSubscribeImpl(context, callback, "queryBusLines"))
|
||||
}
|
||||
|
||||
}
|
||||
@JvmStatic
|
||||
fun queryBusTaskByLineId(
|
||||
context: Context,
|
||||
lineId: String?,
|
||||
callback: OchCommonServiceCallback<BusQueryLineTaskResponse>?
|
||||
) {
|
||||
if (DebugConfig.getProjectFlavor().contains("saas")){
|
||||
M_SAAS_SERVICE.queryBusTaskByLineId(
|
||||
MoGoAiCloudClientConfig.getInstance().serviceAppId,
|
||||
SharedPrefsMgr.getInstance().token,
|
||||
lineId
|
||||
)
|
||||
.transformTry()
|
||||
.subscribe(OchCommonSubscribeImpl(context, callback, "queryBusLines"))
|
||||
}else{
|
||||
M_SERVICE.queryBusTaskByLineId(
|
||||
MoGoAiCloudClientConfig.getInstance().serviceAppId,
|
||||
SharedPrefsMgr.getInstance().token,
|
||||
lineId
|
||||
)
|
||||
.transformTry()
|
||||
.subscribe(OchCommonSubscribeImpl(context, callback, "queryBusLines"))
|
||||
}
|
||||
}
|
||||
@JvmStatic
|
||||
fun updateOrderRoute(
|
||||
context: Context,
|
||||
lineId: Int,
|
||||
startSiteId: Int,
|
||||
endSiteId: Int,
|
||||
points: List<MogoLocation>,
|
||||
callback: OchCommonServiceCallback<BaseData>?
|
||||
) {
|
||||
val pointsResult = mutableListOf<BusRoutePlanningUpdateReqBean.Result>()
|
||||
points.forEach {
|
||||
val result = BusRoutePlanningUpdateReqBean.Result()
|
||||
result.latitude = it.latitude;
|
||||
result.longitude = it.longitude;
|
||||
pointsResult.add(result);
|
||||
}
|
||||
if (DebugConfig.getProjectFlavor().contains("saas")){
|
||||
M_SAAS_SERVICE.updateOrderRoute(
|
||||
MoGoAiCloudClientConfig.getInstance().serviceAppId,
|
||||
SharedPrefsMgr.getInstance().token,
|
||||
BusRoutePlanningUpdateReqBean(
|
||||
SharedPrefsMgr.getInstance().sn, lineId, startSiteId, endSiteId, pointsResult
|
||||
)
|
||||
)
|
||||
.transformTry()
|
||||
.subscribe(OchCommonSubscribeImpl(context, callback, "updateOrderRoute"))
|
||||
}else{
|
||||
M_SERVICE.updateOrderRoute(
|
||||
MoGoAiCloudClientConfig.getInstance().serviceAppId,
|
||||
SharedPrefsMgr.getInstance().token,
|
||||
BusRoutePlanningUpdateReqBean(
|
||||
SharedPrefsMgr.getInstance().sn, lineId, startSiteId, endSiteId, pointsResult
|
||||
)
|
||||
)
|
||||
.transformTry()
|
||||
.subscribe(OchCommonSubscribeImpl(context, callback, "updateOrderRoute"))
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 车机端上传心跳数据(只在出车状态时上传):包含高德坐标系经纬度
|
||||
* @param context
|
||||
* @param lon
|
||||
* @param lat
|
||||
* @param callback
|
||||
*/
|
||||
@JvmStatic
|
||||
fun runCarHeartbeat(
|
||||
context: Context, lon: Double, lat: Double,
|
||||
callback: OchCommonServiceCallback<BaseData>?
|
||||
) {
|
||||
if (DebugConfig.getProjectFlavor().contains("saas")){
|
||||
|
||||
}else{
|
||||
M_SERVICE.runCarHeartbeat(
|
||||
MoGoAiCloudClientConfig.getInstance().serviceAppId,
|
||||
SharedPrefsMgr.getInstance().token,
|
||||
CarHeartbeatReqBean(
|
||||
SharedPrefsMgr.getInstance().sn, lon, lat
|
||||
)
|
||||
)
|
||||
.transformTry()
|
||||
.subscribe(OchCommonSubscribeImpl(context, callback, "runCarHeartbeat",false))
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,119 +0,0 @@
|
||||
package com.mogo.och.bus.presenter;
|
||||
|
||||
import android.os.Looper;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.lifecycle.LifecycleOwner;
|
||||
|
||||
import com.mogo.commons.mvp.Presenter;
|
||||
import com.mogo.eagle.core.utilcode.util.UiThreadHandler;
|
||||
import com.mogo.och.bus.bean.response.BusQueryLineTaskResponse;
|
||||
import com.mogo.och.bus.bean.response.BusQueryLinesResponse;
|
||||
import com.mogo.och.bus.callback.IBusLinesCallback;
|
||||
import com.mogo.och.bus.model.BusLineModel;
|
||||
import com.mogo.och.bus.model.OrderModel;
|
||||
import com.mogo.och.bus.ui.BusSwitchLineView;
|
||||
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import io.reactivex.Observable;
|
||||
import io.reactivex.disposables.Disposable;
|
||||
|
||||
/**
|
||||
* @author: wangmingjun
|
||||
* @date: 2022/2/9
|
||||
*/
|
||||
public class BusLinePresenter extends Presenter<BusSwitchLineView> implements IBusLinesCallback {
|
||||
|
||||
private Disposable subscribe;
|
||||
|
||||
public BusLinePresenter(BusSwitchLineView view) {
|
||||
super(view);
|
||||
BusLineModel.getInstance().init();
|
||||
OrderModel.getInstance().init();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCreate(@NonNull LifecycleOwner owner) {
|
||||
super.onCreate(owner);
|
||||
initListener();
|
||||
}
|
||||
|
||||
private void initListener() {
|
||||
BusLineModel.getInstance().setBusLinesCallback(this);
|
||||
}
|
||||
|
||||
private void runOnUIThread( Runnable executor ) {
|
||||
if ( executor == null ) {
|
||||
return;
|
||||
}
|
||||
if ( Looper.myLooper() != Looper.getMainLooper() ) {
|
||||
UiThreadHandler.post( executor );
|
||||
} else {
|
||||
executor.run();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBusLinesChange(BusQueryLinesResponse lines) {
|
||||
runOnUIThread(() -> mView.onBusLinesChange(lines));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onChangeLineIdSuccess() {
|
||||
OrderModel.getInstance().clearBusStationDatas();
|
||||
UiThreadHandler.post(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
if(mView!=null) {
|
||||
mView.onChangeLineIdSuccess();
|
||||
}
|
||||
}
|
||||
}, UiThreadHandler.MODE.QUEUE);
|
||||
}
|
||||
|
||||
public void queryBusLines(){
|
||||
BusLineModel.getInstance().queryBusLines();
|
||||
}
|
||||
|
||||
public void queryBusLineTasks(int lineId, int position,boolean close){
|
||||
if(subscribe!=null&&!subscribe.isDisposed()){
|
||||
subscribe.dispose();
|
||||
}
|
||||
if(close){
|
||||
return;
|
||||
}
|
||||
BusLineModel.getInstance().queryBusLineTasksById(lineId,position,false);
|
||||
subscribe = Observable.interval(3, TimeUnit.MINUTES).subscribe(aLong -> {
|
||||
BusLineModel.getInstance().queryBusLineTasksById(lineId,position,true);
|
||||
});
|
||||
}
|
||||
|
||||
public void commitSwitchLineId(int taskId,int lineId){
|
||||
BusLineModel.getInstance().commitSwitchLineId(taskId,lineId);
|
||||
}
|
||||
|
||||
public void removeListener(){
|
||||
BusLineModel.getInstance().setBusLinesCallback(null);
|
||||
}
|
||||
|
||||
public void queryBusRoutes(){
|
||||
OrderModel.getInstance().queryBusRoutes();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDestroy(@NonNull LifecycleOwner owner) {
|
||||
super.onDestroy(owner);
|
||||
if(subscribe!=null&&!subscribe.isDisposed()){
|
||||
subscribe.dispose();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void onBusLineTasks(BusQueryLineTaskResponse o, int position,boolean autoRefresh) {
|
||||
if(mView!=null) {
|
||||
mView.onBusLineTasks(o,position,autoRefresh);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,55 +0,0 @@
|
||||
package com.mogo.och.bus.presenter;
|
||||
|
||||
import static com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.M_BUS;
|
||||
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger;
|
||||
import com.mogo.och.bus.constant.BusConst;
|
||||
import com.mogo.och.bus.model.OrderModel;
|
||||
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import io.reactivex.Observable;
|
||||
import io.reactivex.android.schedulers.AndroidSchedulers;
|
||||
import io.reactivex.disposables.Disposable;
|
||||
import io.reactivex.schedulers.Schedulers;
|
||||
|
||||
/**
|
||||
* Created on 2021/11/22
|
||||
*
|
||||
* 管理轮询逻辑(订单轮询、新单轮询、新单抢单结果轮询等等)
|
||||
*/
|
||||
public class BusModelLoopManager {
|
||||
|
||||
private static final String TAG = BusModelLoopManager.class.getSimpleName();
|
||||
|
||||
private static final class SingletonHolder {
|
||||
private static final BusModelLoopManager INSTANCE = new BusModelLoopManager();
|
||||
}
|
||||
|
||||
public static BusModelLoopManager getInstance() {
|
||||
return SingletonHolder.INSTANCE;
|
||||
}
|
||||
|
||||
private Disposable mHeartbeatDisposable; //心跳轮询
|
||||
|
||||
public void startHeartbeatLoop() {
|
||||
if (mHeartbeatDisposable != null && !mHeartbeatDisposable.isDisposed()) {
|
||||
return;
|
||||
}
|
||||
CallerLogger.i(M_BUS + TAG, "startHeartbeatLoop()");
|
||||
mHeartbeatDisposable = Observable.interval(BusConst.LOOP_DELAY,
|
||||
BusConst.LOOP_PERIOD_60S, TimeUnit.MILLISECONDS)
|
||||
.map((aLong -> aLong + 1))
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(aLong -> OrderModel.getInstance().runCarHeartbeat());
|
||||
}
|
||||
|
||||
public void stopHeartbeatLoop() {
|
||||
if (mHeartbeatDisposable != null) {
|
||||
CallerLogger.i(M_BUS + TAG, "stopHeartbeatLoop()");
|
||||
mHeartbeatDisposable.dispose();
|
||||
mHeartbeatDisposable = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,259 +0,0 @@
|
||||
package com.mogo.och.bus.presenter
|
||||
|
||||
import androidx.lifecycle.LifecycleOwner
|
||||
import com.mogo.commons.AbsMogoApplication
|
||||
import com.mogo.commons.mvp.Presenter
|
||||
import com.mogo.eagle.core.data.config.FunctionBuildConfig
|
||||
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotStatusListener
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotControlManager
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListenerManager
|
||||
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.UiThreadHandler
|
||||
import com.mogo.och.bus.bean.WriteOffPassenger
|
||||
import com.mogo.och.bus.callback.IPassengerCallback
|
||||
import com.mogo.och.bus.fragment.BusFragment
|
||||
import com.mogo.och.bus.model.OrderModel
|
||||
import com.mogo.och.bus.util.BusTrajectoryManager
|
||||
import com.mogo.och.bus.util.BusVoiceManager
|
||||
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.manager.autopilot.OCHAdasAbilityManager
|
||||
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.autopilot.bean.ArrivedStation
|
||||
import com.mogo.och.data.bean.BusStationBean
|
||||
import mogo_msg.MogoReportMsg;
|
||||
|
||||
/**
|
||||
* 网约车小巴
|
||||
*/
|
||||
class BusPresenter(view: BusFragment?) : Presenter<BusFragment?>(view), ILoginCallback,
|
||||
IPassengerCallback, IOchAutopilotStatusListener {
|
||||
private val mStationList: MutableList<BusStationBean> = ArrayList<BusStationBean>()
|
||||
private var mCurrentStation = 0
|
||||
|
||||
init {
|
||||
//2021.11.1 鹰眼架构整合,由IMoGoAutopilotStatusListener逐步替代IMogoAdasOCHCallback接口
|
||||
OrderModel.getInstance().init()
|
||||
OCHAdasAbilityManager.getInstance().init(AbsMogoApplication.getApp())
|
||||
}
|
||||
|
||||
override fun onCreate(owner: LifecycleOwner) {
|
||||
super.onCreate(owner)
|
||||
initModelListener()
|
||||
|
||||
OrderModel.getInstance().queryBusCacheRoutes()
|
||||
}
|
||||
|
||||
override fun onDestroy(owner: LifecycleOwner) {
|
||||
super.onDestroy(owner)
|
||||
OrderModel.getInstance().release()
|
||||
releaseListener()
|
||||
}
|
||||
|
||||
fun initModelListener() {
|
||||
OrderModel.getInstance().setPassengerCallback(this)
|
||||
OchAutoPilotStatusListenerManager.addListener(TAG, this)
|
||||
LoginStatusManager.addListener(TAG, this)
|
||||
}
|
||||
|
||||
fun releaseListener() {
|
||||
OrderModel.getInstance().setPassengerCallback(null)
|
||||
OCHAdasAbilityManager.getInstance().release()
|
||||
OchAutoPilotStatusListenerManager.removeListener(TAG)
|
||||
LoginStatusManager.removeListener(TAG)
|
||||
}
|
||||
|
||||
fun abortTask() {
|
||||
OrderModel.getInstance().abortTask()
|
||||
}
|
||||
|
||||
fun autoDriveToNextStation() {
|
||||
OrderModel.getInstance().autoDriveToNextStation()
|
||||
}
|
||||
|
||||
fun restartAutopilot() {
|
||||
if (OrderModel.getInstance().isGoingToNextStation) {
|
||||
OrderModel.getInstance().restartAutopilot()
|
||||
}
|
||||
}
|
||||
|
||||
// 登出
|
||||
fun logout() {
|
||||
OrderModel.getInstance().logout()
|
||||
}
|
||||
|
||||
override fun updateBusTaskStatus(
|
||||
lineName: String, lineTime: String,
|
||||
stationList: List<BusStationBean>,
|
||||
arrivingOrArrivedIndex: Int,
|
||||
isArrived: Boolean
|
||||
) {
|
||||
mStationList.clear()
|
||||
mStationList.addAll(stationList)
|
||||
mCurrentStation = if (arrivingOrArrivedIndex == 0 || isArrived) {
|
||||
arrivingOrArrivedIndex
|
||||
} else {
|
||||
arrivingOrArrivedIndex - 1
|
||||
}
|
||||
CallerLogger.d(
|
||||
SceneConstant.Companion.M_BUS + "BusOrderModel =",
|
||||
" mCurrentStation =$mCurrentStation"
|
||||
)
|
||||
UiThreadHandler.post({
|
||||
mView?.updateBusTaskStatus(
|
||||
lineName, lineTime,
|
||||
stationList, arrivingOrArrivedIndex, isArrived
|
||||
)
|
||||
}, UiThreadHandler.MODE.QUEUE)
|
||||
}
|
||||
|
||||
override fun updateEmptyUi() {
|
||||
UiThreadHandler.post({
|
||||
mView?.updateLineEmptyUI()
|
||||
}, UiThreadHandler.MODE.QUEUE)
|
||||
}
|
||||
|
||||
override fun clearBusStationsMarkers() {
|
||||
UiThreadHandler.post({
|
||||
mView?.clearBusStationsMarkers()
|
||||
}, UiThreadHandler.MODE.QUEUE)
|
||||
}
|
||||
|
||||
override fun hideSlidePanel() {
|
||||
mView?.hideSlidePanel()
|
||||
mView?.setArrivedClickable(true)
|
||||
}
|
||||
|
||||
override fun onAutopilotArriveAtStation(arrivedStation: ArrivedStation) {
|
||||
CallerLogger.e(
|
||||
SceneConstant.Companion.M_BUS + TAG,
|
||||
"行程日志-onAutopilotArriveAtStation arrive"
|
||||
)
|
||||
arriveStation(arrivedStation, "底盘触发进站")
|
||||
}
|
||||
|
||||
fun arriveStation(arrivedStation: ArrivedStation?, type: String?) {
|
||||
OrderModel.getInstance().onArriveAt(arrivedStation, type)
|
||||
}
|
||||
|
||||
|
||||
override fun onAutopilotStatusResponse(state: Int) {
|
||||
when (state) {
|
||||
IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_ENABLE, IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_DISABLE, IMoGoAutopilotStatusListener.STATUS_PARALLEL_DRIVING -> {
|
||||
if (FunctionBuildConfig.isDemoMode
|
||||
&& ((mCurrentStation >= 0 && mCurrentStation <= mStationList.size - 1)
|
||||
&& OrderModel.getInstance().isGoingToNextStation
|
||||
)
|
||||
) {
|
||||
CallerLogger.d(SceneConstant.Companion.M_BUS + "BusOrderModel=", "有美化功能")
|
||||
return
|
||||
}
|
||||
// 改变UI自动驾驶状态
|
||||
UiThreadHandler.post({
|
||||
mView?.onAutopilotStatusChanged(
|
||||
state,
|
||||
CallerAutoPilotControlManager.isCanStartAutopilot(false, 0)
|
||||
)
|
||||
}, UiThreadHandler.MODE.QUEUE)
|
||||
}
|
||||
|
||||
IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_RUNNING -> {
|
||||
OrderModel.getInstance().triggerStartServiceEvent(
|
||||
OrderModel.getInstance().isRestartAutopilot, true, 0
|
||||
)
|
||||
// 改变UI自动驾驶状态
|
||||
UiThreadHandler.post({
|
||||
mView?.onAutopilotStatusChanged(
|
||||
state,
|
||||
CallerAutoPilotControlManager.isCanStartAutopilot(false, 0)
|
||||
)
|
||||
}, UiThreadHandler.MODE.QUEUE)
|
||||
}
|
||||
|
||||
else -> UiThreadHandler.post({
|
||||
mView?.onAutopilotEnableChange(false)
|
||||
}, UiThreadHandler.MODE.QUEUE)
|
||||
}
|
||||
}
|
||||
|
||||
override fun onAutopilotStatusResponseFromCan(state: Int) {
|
||||
if (state == IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_RUNNING) {
|
||||
OrderModel.getInstance().triggerStartServiceEvent(
|
||||
OrderModel.getInstance().isRestartAutopilot, true, 1
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
override fun startOpenAutopilot() {
|
||||
//非美化模式下启动动画
|
||||
UiThreadHandler.post({
|
||||
mView?.startAutopilotAnimation()
|
||||
}, UiThreadHandler.MODE.QUEUE)
|
||||
|
||||
//中间站点再次开启自驾时, 自动驾驶状态是2未改变, 此次鹰眼底层不再返给业务,需优化按钮动画显示
|
||||
if (IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_RUNNING
|
||||
== CallerAutoPilotStatusListenerManager.getState() && mView != null
|
||||
) {
|
||||
mView?.onAutopilotStatusChanged(
|
||||
CallerAutoPilotStatusListenerManager.getState(),
|
||||
CallerAutoPilotControlManager.isCanStartAutopilot(false, 0)
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 测试使用
|
||||
*/
|
||||
fun debugAutoPilotStatus(status: Int) {
|
||||
onAutopilotStatusResponse(status)
|
||||
}
|
||||
|
||||
|
||||
override fun onAutopilotGuardian(guardianInfo: MogoReportMsg.MogoReportMessage?, lineId: Long) {
|
||||
BusTrajectoryManager.getInstance().onAutopilotGuardian(guardianInfo, lineId)
|
||||
}
|
||||
|
||||
|
||||
override fun onStatusChange(currentStatus: LoginStatusEnum) {
|
||||
CallerLogger.d(
|
||||
SceneConstant.Companion.M_BUS + TAG,
|
||||
" loginStatus =" + LoginStatusManager.isLogin()
|
||||
)
|
||||
if (LoginStatusManager.isLogin()) {
|
||||
OrderModel.getInstance().startOrStopOrderLoop(true)
|
||||
OrderModel.getInstance().queryBusCacheRoutes()
|
||||
} else {
|
||||
BusTrajectoryManager.getInstance().stopTrajReqLoop()
|
||||
OrderModel.getInstance().startOrStopOrderLoop(false)
|
||||
BusTrajectoryManager.getInstance().stopTrajReqLoop()
|
||||
clearBusStationsMarkers()
|
||||
mView?.hideSlidePanel()
|
||||
OrderModel.getInstance().closeBeautificationMode()
|
||||
}
|
||||
}
|
||||
|
||||
override fun playPassenger(passenger: WriteOffPassenger) {
|
||||
val passengerNum = passenger.passengerSize
|
||||
BusVoiceManager.writeOffCount(passengerNum)
|
||||
}
|
||||
|
||||
override fun onStartAdasFailure() {
|
||||
UiThreadHandler.post({
|
||||
mView?.stopAnimAndUpdateBtnStatus()
|
||||
}, UiThreadHandler.MODE.QUEUE)
|
||||
}
|
||||
|
||||
override fun canStartAutopilot(canStart: Boolean) {
|
||||
mView?.onAutopilotStatusChanged(
|
||||
CallerAutoPilotStatusListenerManager.getState(),
|
||||
canStart
|
||||
)
|
||||
}
|
||||
|
||||
companion object {
|
||||
private const val TAG = "BusPresenter"
|
||||
}
|
||||
}
|
||||
@@ -1,99 +0,0 @@
|
||||
package com.mogo.och.bus.ui
|
||||
|
||||
import android.content.Context
|
||||
import android.util.AttributeSet
|
||||
import android.view.LayoutInflater
|
||||
import android.widget.ImageView
|
||||
import android.widget.LinearLayout
|
||||
import androidx.core.content.ContextCompat
|
||||
import com.mogo.och.bus.R
|
||||
import com.mogo.och.common.module.utils.BlinkAnimationUtil
|
||||
import kotlinx.android.synthetic.main.bus_stations_common_item.view.*
|
||||
|
||||
/**
|
||||
* @author: wangmingjun
|
||||
* @date: 2022/9/15
|
||||
*/
|
||||
class BusStationCommonItem @JvmOverloads constructor(
|
||||
context: Context,
|
||||
attrs: AttributeSet? = null,
|
||||
defStyleAttr: Int = 0
|
||||
) : LinearLayout(context, attrs, defStyleAttr){
|
||||
|
||||
init {
|
||||
LayoutInflater.from(context).inflate(R.layout.bus_stations_common_item,this,true)
|
||||
}
|
||||
|
||||
fun setStationName(name: String){
|
||||
busStationNameTv.text = name
|
||||
}
|
||||
|
||||
fun setStationNameColor(color: Int){
|
||||
busStationNameTv.setTextColor(color)
|
||||
}
|
||||
|
||||
fun setStationPointBg(type: Int) { // 0:灰色 过站 1:绿色 到站或者即将到站 2:蓝色:未到站
|
||||
BlinkAnimationUtil.clearAnimation(busCircleIv)
|
||||
when (type) {
|
||||
0 -> {
|
||||
busCircleIvBg.visibility = GONE
|
||||
busCircleIv.setImageDrawable(
|
||||
ContextCompat.getDrawable(
|
||||
context,
|
||||
R.drawable.icon_point_grey_bus
|
||||
)
|
||||
)
|
||||
}
|
||||
1 -> {
|
||||
busCircleIvBg.visibility = VISIBLE
|
||||
busCircleIv.setImageDrawable(
|
||||
ContextCompat.getDrawable(
|
||||
context,
|
||||
R.drawable.icon_point_green_bus
|
||||
)
|
||||
)
|
||||
BlinkAnimationUtil.setAnimation(busCircleIv)
|
||||
}
|
||||
2 -> {
|
||||
busCircleIvBg.visibility = GONE
|
||||
busCircleIv.setImageDrawable(
|
||||
ContextCompat.getDrawable(
|
||||
context,
|
||||
R.drawable.icon_point_blue_bus
|
||||
)
|
||||
)
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
fun getCircleImageView() : ImageView{
|
||||
return busCircleIv
|
||||
}
|
||||
|
||||
fun setStationArrowBg(type: Int){// 0:灰色 过站 1:绿色 前往下一站 2:蓝色 未到站
|
||||
when(type){
|
||||
0 -> busArrowBg.setImageResource(R.drawable.icon_arrow_grey_bus)
|
||||
1 -> busArrowBg.setImageResource(R.drawable.icon_arrow_green_bus)
|
||||
2 -> busArrowBg.setImageResource(R.drawable.icon_arrow_blue_bus)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
fun setStationTag(tag: String){ // 0:起 1:终
|
||||
if (tag.isNullOrEmpty()){
|
||||
busTagTxt.visibility = GONE
|
||||
}else{
|
||||
busTagTxt.text = tag
|
||||
busTagTxt.visibility = VISIBLE
|
||||
}
|
||||
}
|
||||
|
||||
fun showOrHideStationArrowBg(isShow:Boolean){
|
||||
if (isShow){
|
||||
busArrowBg.visibility = VISIBLE
|
||||
}else{
|
||||
busArrowBg.visibility = GONE
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,223 +0,0 @@
|
||||
package com.mogo.och.bus.ui
|
||||
|
||||
import android.graphics.Point
|
||||
import android.os.Bundle
|
||||
import android.view.Gravity
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import android.view.WindowManager
|
||||
import android.widget.ImageView
|
||||
import android.widget.TextView
|
||||
import androidx.constraintlayout.widget.ConstraintLayout
|
||||
import androidx.recyclerview.widget.LinearLayoutManager
|
||||
import androidx.recyclerview.widget.RecyclerView
|
||||
import com.mogo.commons.mvp.MvpActivity
|
||||
import com.mogo.commons.storage.SharedPrefsMgr
|
||||
import com.mogo.och.bus.presenter.BusLinePresenter
|
||||
import com.mogo.och.bus.ui.adapter.SwitchLineAdapter
|
||||
import com.mogo.och.bus.bean.response.BusQueryLinesResponse
|
||||
import com.mogo.och.bus.ui.adapter.OpenItemAnimator
|
||||
import com.mogo.eagle.core.utilcode.mogo.view.SpacesItemDecoration
|
||||
import com.mogo.eagle.core.utilcode.util.ToastUtils
|
||||
import com.mogo.och.bus.R
|
||||
import com.mogo.och.bus.bean.response.BusQueryLineTaskResponse
|
||||
import com.mogo.och.common.module.utils.ResourcesUtils
|
||||
import java.util.ArrayList
|
||||
|
||||
/**
|
||||
* @author: wangmingjun
|
||||
* @date: 2022/2/8
|
||||
*/
|
||||
class BusSwitchLineActivity : MvpActivity<BusSwitchLineView?, BusLinePresenter?>(),
|
||||
View.OnClickListener, BusSwitchLineView {
|
||||
|
||||
companion object{
|
||||
const val LASTCOMMITLINEID = "lastcommitlineid"
|
||||
}
|
||||
|
||||
private lateinit var mClose: ImageView
|
||||
private lateinit var mNoDatasView: ConstraintLayout
|
||||
private lateinit var mLinesListView: RecyclerView
|
||||
private lateinit var mLineCommitBtn: TextView
|
||||
private lateinit var mAdapter: SwitchLineAdapter
|
||||
private lateinit var linearLayoutManager:LinearLayoutManager
|
||||
private val mData: MutableList<BusQueryLinesResponse.Result> = ArrayList()
|
||||
override fun getLayoutId(): Int {
|
||||
return R.layout.bus_switch_line
|
||||
}
|
||||
|
||||
override fun createPresenter(): BusLinePresenter {
|
||||
return BusLinePresenter(this)
|
||||
}
|
||||
|
||||
override fun initViews() {
|
||||
initWH()
|
||||
initView()
|
||||
}
|
||||
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
initDatas()
|
||||
}
|
||||
|
||||
/**
|
||||
* 初始化view
|
||||
*/
|
||||
private fun initView() {
|
||||
mClose = findViewById(R.id.switch_line_close)
|
||||
mClose.setOnClickListener(this)
|
||||
mNoDatasView = findViewById(R.id.no_order_data_view)
|
||||
mLineCommitBtn = findViewById(R.id.switch_line_btn_commit)
|
||||
mLineCommitBtn.setOnClickListener(this)
|
||||
mLinesListView = findViewById(R.id.switch_line_rv)
|
||||
linearLayoutManager = LinearLayoutManager(this)
|
||||
mLinesListView.setLayoutManager(linearLayoutManager)
|
||||
mLinesListView.setItemAnimator(OpenItemAnimator())
|
||||
mAdapter = SwitchLineAdapter(applicationContext, mData)
|
||||
mLinesListView.addItemDecoration(
|
||||
SpacesItemDecoration(
|
||||
4
|
||||
)
|
||||
)
|
||||
mLinesListView.setAdapter(mAdapter)
|
||||
//设置item 点击事件
|
||||
mAdapter.setOnLineItemClickListener(object :SwitchLineAdapter.LineItemClickListener{
|
||||
override fun onItemClick(position: Int, close: Boolean) {
|
||||
mPresenter?.queryBusLineTasks(mData[position].lineId, position, close)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置布局宽高
|
||||
*/
|
||||
private fun initWH() {
|
||||
val window = window
|
||||
val params = window.attributes
|
||||
val windowManager = getSystemService(WINDOW_SERVICE) as WindowManager
|
||||
val point = Point()
|
||||
windowManager.defaultDisplay.getSize(point) //用于获取屏幕高度
|
||||
params.width = (point.x * 0.375).toInt()
|
||||
params.height = ViewGroup.LayoutParams.MATCH_PARENT
|
||||
window.attributes = params
|
||||
window.setGravity(Gravity.START or Gravity.BOTTOM)
|
||||
}
|
||||
|
||||
/**
|
||||
* 初始化数据
|
||||
*/
|
||||
private fun initDatas() {
|
||||
mPresenter?.queryBusLines()
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询返回绑定路线集合
|
||||
* @param data
|
||||
*/
|
||||
override fun onBusLinesChange(data: BusQueryLinesResponse?) {
|
||||
if (null == data) {
|
||||
showNoData(true)
|
||||
return
|
||||
}
|
||||
val lastCommitLineid = SharedPrefsMgr.getInstance().getInt(LASTCOMMITLINEID, -1)
|
||||
if (data.data != null && data.data.isNullOrEmpty()) {
|
||||
showNoData(false)
|
||||
mData.clear()
|
||||
mData.addAll(data.data!!)
|
||||
mAdapter.notifyDataSetChanged()
|
||||
if(lastCommitLineid>0){
|
||||
mData.forEachIndexed { index, line ->
|
||||
if(line.lineId==lastCommitLineid){
|
||||
line.open = true
|
||||
mPresenter?.queryBusLineTasks(line.lineId,index,false)
|
||||
return
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
showNoData(true)
|
||||
}
|
||||
}
|
||||
|
||||
override fun onChangeLineIdSuccess() {
|
||||
ToastUtils.showLong(ResourcesUtils.getString(R.string.bus_change_line_commit_tip_s))
|
||||
mPresenter?.queryBusRoutes()
|
||||
mAdapter.setOnLineItemClickListener(null)
|
||||
mPresenter?.removeListener()
|
||||
finish()
|
||||
}
|
||||
|
||||
override fun onBusLineTasks(lineTaskInfo: BusQueryLineTaskResponse?, position: Int, autoRefresh:Boolean) {
|
||||
val result = mData[position]
|
||||
if (result.taskList == null) {
|
||||
result.taskList = ArrayList()
|
||||
}
|
||||
if (lineTaskInfo == null) {
|
||||
result.haveTask = true
|
||||
// 打开操作
|
||||
mAdapter.notifyItemChanged(position)
|
||||
} else {
|
||||
if (lineTaskInfo.data.isNullOrEmpty()) {
|
||||
result.haveTask = true
|
||||
lineTaskInfo.data = ArrayList()
|
||||
}
|
||||
if (lineTaskInfo.data!!.size != result.taskList!!.size) { // 不相等有变动 重新赋值
|
||||
result.taskList!!.clear()
|
||||
result.taskList!!.addAll(lineTaskInfo.data!!)
|
||||
if(autoRefresh) {
|
||||
mAdapter.checkTaskId = -1
|
||||
mAdapter.checkLineId = -1
|
||||
lineTaskInfo.data?.forEach {
|
||||
if (it.id == mAdapter.checkTaskId) {
|
||||
mAdapter.checkTaskId = it.id
|
||||
mAdapter.checkLineId = result.lineId
|
||||
}
|
||||
}
|
||||
}
|
||||
// 打开操作
|
||||
mAdapter.notifyItemChanged(position)
|
||||
linearLayoutManager.stackFromEnd = (position==mData.size-1||position==mData.size-2)&&mData.size>6
|
||||
mLinesListView.smoothScrollToPosition(position)
|
||||
}else if(lineTaskInfo.data.isNullOrEmpty()){
|
||||
mAdapter.notifyItemChanged(position)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 有无数据UI显示
|
||||
* @param b
|
||||
*/
|
||||
private fun showNoData(b: Boolean) {
|
||||
if (b) {
|
||||
mLinesListView.visibility = View.GONE
|
||||
mLineCommitBtn.visibility = View.GONE
|
||||
mNoDatasView.visibility = View.VISIBLE
|
||||
} else {
|
||||
mLinesListView.visibility = View.VISIBLE
|
||||
mLineCommitBtn.visibility = View.VISIBLE
|
||||
mNoDatasView.visibility = View.GONE
|
||||
}
|
||||
}
|
||||
|
||||
override fun onClick(v: View) {
|
||||
//关闭dialog
|
||||
if (v.id == R.id.switch_line_close) {
|
||||
finish()
|
||||
return
|
||||
}
|
||||
//切换路线提交
|
||||
if (v.id == R.id.switch_line_btn_commit) {
|
||||
if(mAdapter.checkLineId!=-1&&mAdapter.checkTaskId!=-1){
|
||||
mPresenter?.commitSwitchLineId(mAdapter.checkTaskId,mAdapter.checkLineId)
|
||||
}else{
|
||||
ToastUtils.showLong("请选择任务")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override fun onDestroy() {
|
||||
mPresenter!!.removeListener()
|
||||
super.onDestroy()
|
||||
}
|
||||
}
|
||||
@@ -1,18 +0,0 @@
|
||||
package com.mogo.och.bus.ui;
|
||||
|
||||
import com.mogo.commons.mvp.IView;
|
||||
import com.mogo.och.bus.bean.response.BusQueryLineTaskResponse;
|
||||
import com.mogo.och.bus.bean.response.BusQueryLinesResponse;
|
||||
|
||||
/**
|
||||
* @author: wangmingjun
|
||||
* @date: 2022/2/10
|
||||
*/
|
||||
public interface BusSwitchLineView extends IView {
|
||||
|
||||
void onBusLinesChange(BusQueryLinesResponse data);
|
||||
void onChangeLineIdSuccess();
|
||||
|
||||
void onBusLineTasks(BusQueryLineTaskResponse o, int position,boolean autoRefresh);
|
||||
}
|
||||
|
||||
@@ -1,642 +0,0 @@
|
||||
package com.mogo.och.bus.ui.adapter;
|
||||
|
||||
import android.animation.Animator;
|
||||
import android.animation.AnimatorListenerAdapter;
|
||||
import android.animation.TimeInterpolator;
|
||||
import android.animation.ValueAnimator;
|
||||
import android.view.View;
|
||||
import android.view.ViewPropertyAnimator;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.core.view.ViewCompat;
|
||||
import androidx.recyclerview.widget.DefaultItemAnimator;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* This implementation of {@link RecyclerView.ItemAnimator} provides basic
|
||||
* animations on remove, add, and move events that happen to the items in
|
||||
* a RecyclerView. RecyclerView uses a DefaultItemAnimator by default.
|
||||
*
|
||||
* @see RecyclerView#setItemAnimator(RecyclerView.ItemAnimator)
|
||||
*/
|
||||
public class OpenItemAnimator extends DefaultItemAnimator {
|
||||
private static final boolean DEBUG = false;
|
||||
|
||||
private static TimeInterpolator sDefaultInterpolator;
|
||||
|
||||
private final ArrayList<RecyclerView.ViewHolder> mPendingRemovals = new ArrayList<>();
|
||||
private final ArrayList<RecyclerView.ViewHolder> mPendingAdditions = new ArrayList<>();
|
||||
private final ArrayList<MoveInfo> mPendingMoves = new ArrayList<>();
|
||||
private final ArrayList<ChangeInfo> mPendingChanges = new ArrayList<>();
|
||||
|
||||
private final ArrayList<ArrayList<RecyclerView.ViewHolder>> mAdditionsList = new ArrayList<>();
|
||||
private final ArrayList<ArrayList<MoveInfo>> mMovesList = new ArrayList<>();
|
||||
private final ArrayList<ArrayList<ChangeInfo>> mChangesList = new ArrayList<>();
|
||||
|
||||
private final ArrayList<RecyclerView.ViewHolder> mAddAnimations = new ArrayList<>();
|
||||
private final ArrayList<RecyclerView.ViewHolder> mMoveAnimations = new ArrayList<>();
|
||||
private final ArrayList<RecyclerView.ViewHolder> mRemoveAnimations = new ArrayList<>();
|
||||
private final ArrayList<RecyclerView.ViewHolder> mChangeAnimations = new ArrayList<>();
|
||||
|
||||
private static class MoveInfo {
|
||||
public RecyclerView.ViewHolder holder;
|
||||
public int fromX, fromY, toX, toY;
|
||||
|
||||
MoveInfo(RecyclerView.ViewHolder holder, int fromX, int fromY, int toX, int toY) {
|
||||
this.holder = holder;
|
||||
this.fromX = fromX;
|
||||
this.fromY = fromY;
|
||||
this.toX = toX;
|
||||
this.toY = toY;
|
||||
}
|
||||
}
|
||||
|
||||
private static class ChangeInfo {
|
||||
public RecyclerView.ViewHolder oldHolder, newHolder;
|
||||
public int fromX, fromY, toX, toY;
|
||||
private ChangeInfo(RecyclerView.ViewHolder oldHolder, RecyclerView.ViewHolder newHolder) {
|
||||
this.oldHolder = oldHolder;
|
||||
this.newHolder = newHolder;
|
||||
}
|
||||
|
||||
ChangeInfo(RecyclerView.ViewHolder oldHolder, RecyclerView.ViewHolder newHolder,
|
||||
int fromX, int fromY, int toX, int toY) {
|
||||
this(oldHolder, newHolder);
|
||||
this.fromX = fromX;
|
||||
this.fromY = fromY;
|
||||
this.toX = toX;
|
||||
this.toY = toY;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "ChangeInfo{"
|
||||
+ "oldHolder=" + oldHolder
|
||||
+ ", newHolder=" + newHolder
|
||||
+ ", fromX=" + fromX
|
||||
+ ", fromY=" + fromY
|
||||
+ ", toX=" + toX
|
||||
+ ", toY=" + toY
|
||||
+ '}';
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void runPendingAnimations() {
|
||||
boolean removalsPending = !mPendingRemovals.isEmpty();
|
||||
boolean movesPending = !mPendingMoves.isEmpty();
|
||||
boolean changesPending = !mPendingChanges.isEmpty();
|
||||
boolean additionsPending = !mPendingAdditions.isEmpty();
|
||||
if (!removalsPending && !movesPending && !additionsPending && !changesPending) {
|
||||
// nothing to animate
|
||||
return;
|
||||
}
|
||||
// First, remove stuff
|
||||
for (RecyclerView.ViewHolder holder : mPendingRemovals) {
|
||||
animateRemoveImpl(holder);
|
||||
}
|
||||
mPendingRemovals.clear();
|
||||
// Next, move stuff
|
||||
if (movesPending) {
|
||||
final ArrayList<MoveInfo> moves = new ArrayList<>(mPendingMoves);
|
||||
mMovesList.add(moves);
|
||||
mPendingMoves.clear();
|
||||
Runnable mover = () -> {
|
||||
for (MoveInfo moveInfo : moves) {
|
||||
animateMoveImpl(moveInfo.holder, moveInfo.fromX, moveInfo.fromY,
|
||||
moveInfo.toX, moveInfo.toY);
|
||||
}
|
||||
moves.clear();
|
||||
mMovesList.remove(moves);
|
||||
};
|
||||
if (removalsPending) {
|
||||
View view = moves.get(0).holder.itemView;
|
||||
ViewCompat.postOnAnimationDelayed(view, mover, getRemoveDuration());
|
||||
} else {
|
||||
mover.run();
|
||||
}
|
||||
}
|
||||
// Next, change stuff, to run in parallel with move animations
|
||||
if (changesPending) {
|
||||
final ArrayList<ChangeInfo> changes = new ArrayList<>(mPendingChanges);
|
||||
mChangesList.add(changes);
|
||||
mPendingChanges.clear();
|
||||
Runnable changer = () -> {
|
||||
for (ChangeInfo change : changes) {
|
||||
animateChangeImpl(change);
|
||||
}
|
||||
changes.clear();
|
||||
mChangesList.remove(changes);
|
||||
};
|
||||
if (removalsPending) {
|
||||
RecyclerView.ViewHolder holder = changes.get(0).oldHolder;
|
||||
ViewCompat.postOnAnimationDelayed(holder.itemView, changer, getRemoveDuration());
|
||||
} else {
|
||||
changer.run();
|
||||
}
|
||||
}
|
||||
// Next, add stuff
|
||||
if (additionsPending) {
|
||||
final ArrayList<RecyclerView.ViewHolder> additions = new ArrayList<>(mPendingAdditions);
|
||||
mAdditionsList.add(additions);
|
||||
mPendingAdditions.clear();
|
||||
Runnable adder = () -> {
|
||||
for (RecyclerView.ViewHolder holder : additions) {
|
||||
animateAddImpl(holder);
|
||||
}
|
||||
additions.clear();
|
||||
mAdditionsList.remove(additions);
|
||||
};
|
||||
if (removalsPending || movesPending || changesPending) {
|
||||
long removeDuration = removalsPending ? getRemoveDuration() : 0;
|
||||
long moveDuration = movesPending ? getMoveDuration() : 0;
|
||||
long changeDuration = changesPending ? getChangeDuration() : 0;
|
||||
long totalDelay = removeDuration + Math.max(moveDuration, changeDuration);
|
||||
View view = additions.get(0).itemView;
|
||||
ViewCompat.postOnAnimationDelayed(view, adder, totalDelay);
|
||||
} else {
|
||||
adder.run();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean animateRemove(final RecyclerView.ViewHolder holder) {
|
||||
resetAnimation(holder);
|
||||
mPendingRemovals.add(holder);
|
||||
return true;
|
||||
}
|
||||
|
||||
private void animateRemoveImpl(final RecyclerView.ViewHolder holder) {
|
||||
final View view = holder.itemView;
|
||||
final ViewPropertyAnimator animation = view.animate();
|
||||
mRemoveAnimations.add(holder);
|
||||
animation.setDuration(getRemoveDuration()).alpha(0).setListener(
|
||||
new AnimatorListenerAdapter() {
|
||||
@Override
|
||||
public void onAnimationStart(Animator animator) {
|
||||
dispatchRemoveStarting(holder);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAnimationEnd(Animator animator) {
|
||||
animation.setListener(null);
|
||||
view.setAlpha(1);
|
||||
dispatchRemoveFinished(holder);
|
||||
mRemoveAnimations.remove(holder);
|
||||
dispatchFinishedWhenDone();
|
||||
}
|
||||
}).start();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean animateAdd(final RecyclerView.ViewHolder holder) {
|
||||
resetAnimation(holder);
|
||||
holder.itemView.setAlpha(0);
|
||||
mPendingAdditions.add(holder);
|
||||
return true;
|
||||
}
|
||||
|
||||
void animateAddImpl(final RecyclerView.ViewHolder holder) {
|
||||
final View view = holder.itemView;
|
||||
final ViewPropertyAnimator animation = view.animate();
|
||||
mAddAnimations.add(holder);
|
||||
animation.alpha(1).setDuration(getAddDuration())
|
||||
.setListener(new AnimatorListenerAdapter() {
|
||||
@Override
|
||||
public void onAnimationStart(Animator animator) {
|
||||
dispatchAddStarting(holder);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAnimationCancel(Animator animator) {
|
||||
view.setAlpha(1);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAnimationEnd(Animator animator) {
|
||||
animation.setListener(null);
|
||||
dispatchAddFinished(holder);
|
||||
mAddAnimations.remove(holder);
|
||||
dispatchFinishedWhenDone();
|
||||
}
|
||||
}).start();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean animateMove(final RecyclerView.ViewHolder holder, int fromX, int fromY,
|
||||
int toX, int toY) {
|
||||
final View view = holder.itemView;
|
||||
fromX += (int) holder.itemView.getTranslationX();
|
||||
fromY += (int) holder.itemView.getTranslationY();
|
||||
resetAnimation(holder);
|
||||
int deltaX = toX - fromX;
|
||||
int deltaY = toY - fromY;
|
||||
if (deltaX == 0 && deltaY == 0) {
|
||||
dispatchMoveFinished(holder);
|
||||
return false;
|
||||
}
|
||||
if (deltaX != 0) {
|
||||
view.setTranslationX(-deltaX);
|
||||
}
|
||||
if (deltaY != 0) {
|
||||
view.setTranslationY(-deltaY);
|
||||
}
|
||||
mPendingMoves.add(new MoveInfo(holder, fromX, fromY, toX, toY));
|
||||
return true;
|
||||
}
|
||||
|
||||
void animateMoveImpl(final RecyclerView.ViewHolder holder, int fromX, int fromY, int toX, int toY) {
|
||||
final View view = holder.itemView;
|
||||
final int deltaX = toX - fromX;
|
||||
final int deltaY = toY - fromY;
|
||||
if (deltaX != 0) {
|
||||
view.animate().translationX(0);
|
||||
}
|
||||
if (deltaY != 0) {
|
||||
view.animate().translationY(0);
|
||||
}
|
||||
// TODO: make EndActions end listeners instead, since end actions aren't called when
|
||||
// vpas are canceled (and can't end them. why?)
|
||||
// need listener functionality in VPACompat for this. Ick.
|
||||
final ViewPropertyAnimator animation = view.animate();
|
||||
mMoveAnimations.add(holder);
|
||||
animation.setDuration(getMoveDuration()).setListener(new AnimatorListenerAdapter() {
|
||||
@Override
|
||||
public void onAnimationStart(Animator animator) {
|
||||
dispatchMoveStarting(holder);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAnimationCancel(Animator animator) {
|
||||
if (deltaX != 0) {
|
||||
view.setTranslationX(0);
|
||||
}
|
||||
if (deltaY != 0) {
|
||||
view.setTranslationY(0);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAnimationEnd(Animator animator) {
|
||||
animation.setListener(null);
|
||||
dispatchMoveFinished(holder);
|
||||
mMoveAnimations.remove(holder);
|
||||
dispatchFinishedWhenDone();
|
||||
}
|
||||
}).start();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean animateChange(RecyclerView.ViewHolder oldHolder, RecyclerView.ViewHolder newHolder,
|
||||
int fromX, int fromY, int toX, int toY) {
|
||||
if (oldHolder == newHolder) {
|
||||
// Don't know how to run change animations when the same view holder is re-used.
|
||||
// run a move animation to handle position changes.
|
||||
return animateMove(oldHolder, fromX, fromY, toX, toY);
|
||||
}
|
||||
final float prevTranslationX = oldHolder.itemView.getTranslationX();
|
||||
final float prevTranslationY = oldHolder.itemView.getTranslationY();
|
||||
final float prevAlpha = oldHolder.itemView.getAlpha();
|
||||
resetAnimation(oldHolder);
|
||||
int deltaX = (int) (toX - fromX - prevTranslationX);
|
||||
int deltaY = (int) (toY - fromY - prevTranslationY);
|
||||
// recover prev translation state after ending animation
|
||||
oldHolder.itemView.setTranslationX(prevTranslationX);
|
||||
oldHolder.itemView.setTranslationY(prevTranslationY);
|
||||
oldHolder.itemView.setAlpha(prevAlpha);
|
||||
if (newHolder != null) {
|
||||
// carry over translation values
|
||||
resetAnimation(newHolder);
|
||||
newHolder.itemView.setTranslationX(-deltaX);
|
||||
newHolder.itemView.setTranslationY(-deltaY);
|
||||
newHolder.itemView.setAlpha(0);
|
||||
}
|
||||
mPendingChanges.add(new ChangeInfo(oldHolder, newHolder, fromX, fromY, toX, toY));
|
||||
return true;
|
||||
}
|
||||
|
||||
void animateChangeImpl(final ChangeInfo changeInfo) {
|
||||
final RecyclerView.ViewHolder holder = changeInfo.oldHolder;
|
||||
final View view = holder == null ? null : holder.itemView;
|
||||
final RecyclerView.ViewHolder newHolder = changeInfo.newHolder;
|
||||
final View newView = newHolder != null ? newHolder.itemView : null;
|
||||
if (view != null) {
|
||||
final ViewPropertyAnimator oldViewAnim = view.animate().setDuration(
|
||||
getChangeDuration());
|
||||
mChangeAnimations.add(changeInfo.oldHolder);
|
||||
oldViewAnim.translationX((float) (changeInfo.toX - changeInfo.fromX));
|
||||
oldViewAnim.translationY((float) (changeInfo.toY - changeInfo.fromY));
|
||||
oldViewAnim.alpha(0).setListener(new AnimatorListenerAdapter() {
|
||||
@Override
|
||||
public void onAnimationStart(Animator animator) {
|
||||
dispatchChangeStarting(changeInfo.oldHolder, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAnimationEnd(Animator animator) {
|
||||
oldViewAnim.setListener(null);
|
||||
view.setAlpha(1);
|
||||
view.setTranslationX(0);
|
||||
view.setTranslationY(0);
|
||||
dispatchChangeFinished(changeInfo.oldHolder, true);
|
||||
mChangeAnimations.remove(changeInfo.oldHolder);
|
||||
dispatchFinishedWhenDone();
|
||||
}
|
||||
}).start();
|
||||
}
|
||||
if (newView != null) {
|
||||
final ViewPropertyAnimator newViewAnimation = newView.animate();
|
||||
mChangeAnimations.add(changeInfo.newHolder);
|
||||
newViewAnimation.translationX(0).translationY(0).setDuration(getChangeDuration())
|
||||
.alpha(1).setListener(new AnimatorListenerAdapter() {
|
||||
@Override
|
||||
public void onAnimationStart(Animator animator) {
|
||||
dispatchChangeStarting(changeInfo.newHolder, false);
|
||||
}
|
||||
@Override
|
||||
public void onAnimationEnd(Animator animator) {
|
||||
newViewAnimation.setListener(null);
|
||||
newView.setAlpha(1);
|
||||
newView.setTranslationX(0);
|
||||
newView.setTranslationY(0);
|
||||
dispatchChangeFinished(changeInfo.newHolder, false);
|
||||
mChangeAnimations.remove(changeInfo.newHolder);
|
||||
dispatchFinishedWhenDone();
|
||||
}
|
||||
}).start();
|
||||
}
|
||||
}
|
||||
|
||||
private void endChangeAnimation(List<ChangeInfo> infoList, RecyclerView.ViewHolder item) {
|
||||
for (int i = infoList.size() - 1; i >= 0; i--) {
|
||||
ChangeInfo changeInfo = infoList.get(i);
|
||||
if (endChangeAnimationIfNecessary(changeInfo, item)) {
|
||||
if (changeInfo.oldHolder == null && changeInfo.newHolder == null) {
|
||||
infoList.remove(changeInfo);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void endChangeAnimationIfNecessary(ChangeInfo changeInfo) {
|
||||
if (changeInfo.oldHolder != null) {
|
||||
endChangeAnimationIfNecessary(changeInfo, changeInfo.oldHolder);
|
||||
}
|
||||
if (changeInfo.newHolder != null) {
|
||||
endChangeAnimationIfNecessary(changeInfo, changeInfo.newHolder);
|
||||
}
|
||||
}
|
||||
private boolean endChangeAnimationIfNecessary(ChangeInfo changeInfo, RecyclerView.ViewHolder item) {
|
||||
boolean oldItem = false;
|
||||
if (changeInfo.newHolder == item) {
|
||||
changeInfo.newHolder = null;
|
||||
} else if (changeInfo.oldHolder == item) {
|
||||
changeInfo.oldHolder = null;
|
||||
oldItem = true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
item.itemView.setAlpha(1);
|
||||
item.itemView.setTranslationX(0);
|
||||
item.itemView.setTranslationY(0);
|
||||
dispatchChangeFinished(item, oldItem);
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void endAnimation(RecyclerView.ViewHolder item) {
|
||||
final View view = item.itemView;
|
||||
// this will trigger end callback which should set properties to their target values.
|
||||
view.animate().cancel();
|
||||
// TODO if some other animations are chained to end, how do we cancel them as well?
|
||||
for (int i = mPendingMoves.size() - 1; i >= 0; i--) {
|
||||
MoveInfo moveInfo = mPendingMoves.get(i);
|
||||
if (moveInfo.holder == item) {
|
||||
view.setTranslationY(0);
|
||||
view.setTranslationX(0);
|
||||
dispatchMoveFinished(item);
|
||||
mPendingMoves.remove(i);
|
||||
}
|
||||
}
|
||||
endChangeAnimation(mPendingChanges, item);
|
||||
if (mPendingRemovals.remove(item)) {
|
||||
view.setAlpha(1);
|
||||
dispatchRemoveFinished(item);
|
||||
}
|
||||
if (mPendingAdditions.remove(item)) {
|
||||
view.setAlpha(1);
|
||||
dispatchAddFinished(item);
|
||||
}
|
||||
|
||||
for (int i = mChangesList.size() - 1; i >= 0; i--) {
|
||||
ArrayList<ChangeInfo> changes = mChangesList.get(i);
|
||||
endChangeAnimation(changes, item);
|
||||
if (changes.isEmpty()) {
|
||||
mChangesList.remove(i);
|
||||
}
|
||||
}
|
||||
for (int i = mMovesList.size() - 1; i >= 0; i--) {
|
||||
ArrayList<MoveInfo> moves = mMovesList.get(i);
|
||||
for (int j = moves.size() - 1; j >= 0; j--) {
|
||||
MoveInfo moveInfo = moves.get(j);
|
||||
if (moveInfo.holder == item) {
|
||||
view.setTranslationY(0);
|
||||
view.setTranslationX(0);
|
||||
dispatchMoveFinished(item);
|
||||
moves.remove(j);
|
||||
if (moves.isEmpty()) {
|
||||
mMovesList.remove(i);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
for (int i = mAdditionsList.size() - 1; i >= 0; i--) {
|
||||
ArrayList<RecyclerView.ViewHolder> additions = mAdditionsList.get(i);
|
||||
if (additions.remove(item)) {
|
||||
view.setAlpha(1);
|
||||
dispatchAddFinished(item);
|
||||
if (additions.isEmpty()) {
|
||||
mAdditionsList.remove(i);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// animations should be ended by the cancel above.
|
||||
//noinspection Pointless BooleanExpression,ConstantConditions
|
||||
if (mRemoveAnimations.remove(item) && DEBUG) {
|
||||
throw new IllegalStateException("after animation is cancelled, item should not be in "
|
||||
+ "mRemoveAnimations list");
|
||||
}
|
||||
|
||||
//noinspection Pointless BooleanExpression,ConstantConditions
|
||||
if (mAddAnimations.remove(item) && DEBUG) {
|
||||
throw new IllegalStateException("after animation is cancelled, item should not be in "
|
||||
+ "mAddAnimations list");
|
||||
}
|
||||
|
||||
//noinspection Pointless BooleanExpression,ConstantConditions
|
||||
if (mChangeAnimations.remove(item) && DEBUG) {
|
||||
throw new IllegalStateException("after animation is cancelled, item should not be in "
|
||||
+ "mChangeAnimations list");
|
||||
}
|
||||
|
||||
//noinspection Pointless BooleanExpression,ConstantConditions
|
||||
if (mMoveAnimations.remove(item) && DEBUG) {
|
||||
throw new IllegalStateException("after animation is cancelled, item should not be in "
|
||||
+ "mMoveAnimations list");
|
||||
}
|
||||
dispatchFinishedWhenDone();
|
||||
}
|
||||
|
||||
private void resetAnimation(RecyclerView.ViewHolder holder) {
|
||||
if (sDefaultInterpolator == null) {
|
||||
sDefaultInterpolator = new ValueAnimator().getInterpolator();
|
||||
}
|
||||
holder.itemView.animate().setInterpolator(sDefaultInterpolator);
|
||||
endAnimation(holder);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isRunning() {
|
||||
return (!mPendingAdditions.isEmpty()
|
||||
|| !mPendingChanges.isEmpty()
|
||||
|| !mPendingMoves.isEmpty()
|
||||
|| !mPendingRemovals.isEmpty()
|
||||
|| !mMoveAnimations.isEmpty()
|
||||
|| !mRemoveAnimations.isEmpty()
|
||||
|| !mAddAnimations.isEmpty()
|
||||
|| !mChangeAnimations.isEmpty()
|
||||
|| !mMovesList.isEmpty()
|
||||
|| !mAdditionsList.isEmpty()
|
||||
|| !mChangesList.isEmpty());
|
||||
}
|
||||
|
||||
/**
|
||||
* Check the state of currently pending and running animations. If there are none
|
||||
* pending/running, call {@link #dispatchAnimationsFinished()} to notify any
|
||||
* listeners.
|
||||
*/
|
||||
void dispatchFinishedWhenDone() {
|
||||
if (!isRunning()) {
|
||||
dispatchAnimationsFinished();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void endAnimations() {
|
||||
int count = mPendingMoves.size();
|
||||
for (int i = count - 1; i >= 0; i--) {
|
||||
MoveInfo item = mPendingMoves.get(i);
|
||||
View view = item.holder.itemView;
|
||||
view.setTranslationY(0);
|
||||
view.setTranslationX(0);
|
||||
dispatchMoveFinished(item.holder);
|
||||
mPendingMoves.remove(i);
|
||||
}
|
||||
count = mPendingRemovals.size();
|
||||
for (int i = count - 1; i >= 0; i--) {
|
||||
RecyclerView.ViewHolder item = mPendingRemovals.get(i);
|
||||
dispatchRemoveFinished(item);
|
||||
mPendingRemovals.remove(i);
|
||||
}
|
||||
count = mPendingAdditions.size();
|
||||
for (int i = count - 1; i >= 0; i--) {
|
||||
RecyclerView.ViewHolder item = mPendingAdditions.get(i);
|
||||
item.itemView.setAlpha(1);
|
||||
dispatchAddFinished(item);
|
||||
mPendingAdditions.remove(i);
|
||||
}
|
||||
count = mPendingChanges.size();
|
||||
for (int i = count - 1; i >= 0; i--) {
|
||||
endChangeAnimationIfNecessary(mPendingChanges.get(i));
|
||||
}
|
||||
mPendingChanges.clear();
|
||||
if (!isRunning()) {
|
||||
return;
|
||||
}
|
||||
|
||||
int listCount = mMovesList.size();
|
||||
for (int i = listCount - 1; i >= 0; i--) {
|
||||
ArrayList<MoveInfo> moves = mMovesList.get(i);
|
||||
count = moves.size();
|
||||
for (int j = count - 1; j >= 0; j--) {
|
||||
MoveInfo moveInfo = moves.get(j);
|
||||
RecyclerView.ViewHolder item = moveInfo.holder;
|
||||
View view = item.itemView;
|
||||
view.setTranslationY(0);
|
||||
view.setTranslationX(0);
|
||||
dispatchMoveFinished(moveInfo.holder);
|
||||
moves.remove(j);
|
||||
if (moves.isEmpty()) {
|
||||
mMovesList.remove(moves);
|
||||
}
|
||||
}
|
||||
}
|
||||
listCount = mAdditionsList.size();
|
||||
for (int i = listCount - 1; i >= 0; i--) {
|
||||
ArrayList<RecyclerView.ViewHolder> additions = mAdditionsList.get(i);
|
||||
count = additions.size();
|
||||
for (int j = count - 1; j >= 0; j--) {
|
||||
RecyclerView.ViewHolder item = additions.get(j);
|
||||
View view = item.itemView;
|
||||
view.setAlpha(1);
|
||||
dispatchAddFinished(item);
|
||||
additions.remove(j);
|
||||
if (additions.isEmpty()) {
|
||||
mAdditionsList.remove(additions);
|
||||
}
|
||||
}
|
||||
}
|
||||
listCount = mChangesList.size();
|
||||
for (int i = listCount - 1; i >= 0; i--) {
|
||||
ArrayList<ChangeInfo> changes = mChangesList.get(i);
|
||||
count = changes.size();
|
||||
for (int j = count - 1; j >= 0; j--) {
|
||||
endChangeAnimationIfNecessary(changes.get(j));
|
||||
if (changes.isEmpty()) {
|
||||
mChangesList.remove(changes);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
cancelAll(mRemoveAnimations);
|
||||
cancelAll(mMoveAnimations);
|
||||
cancelAll(mAddAnimations);
|
||||
cancelAll(mChangeAnimations);
|
||||
|
||||
dispatchAnimationsFinished();
|
||||
}
|
||||
|
||||
void cancelAll(List<RecyclerView.ViewHolder> viewHolders) {
|
||||
for (int i = viewHolders.size() - 1; i >= 0; i--) {
|
||||
viewHolders.get(i).itemView.animate().cancel();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
* <p>
|
||||
* If the payload list is not empty, DefaultItemAnimator returns <code>true</code>.
|
||||
* When this is the case:
|
||||
* <ul>
|
||||
* <li>If you override {@link #animateChange(RecyclerView.ViewHolder, RecyclerView.ViewHolder, int, int, int, int)}, both
|
||||
* ViewHolder arguments will be the same instance.
|
||||
* </li>
|
||||
* <li>
|
||||
* If you are not overriding {@link #animateChange(RecyclerView.ViewHolder, RecyclerView.ViewHolder, int, int, int, int)},
|
||||
* then DefaultItemAnimator will call {@link #animateMove(RecyclerView.ViewHolder, int, int, int, int)} and
|
||||
* run a move animation instead.
|
||||
* </li>
|
||||
* </ul>
|
||||
*/
|
||||
@Override
|
||||
public boolean canReuseUpdatedViewHolder(@NonNull RecyclerView.ViewHolder viewHolder,
|
||||
@NonNull List<Object> payloads) {
|
||||
return !payloads.isEmpty() || super.canReuseUpdatedViewHolder(viewHolder, payloads);
|
||||
}
|
||||
}
|
||||
@@ -1,182 +0,0 @@
|
||||
package com.mogo.och.bus.ui.adapter
|
||||
|
||||
import android.content.Context
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import android.widget.ImageView
|
||||
import androidx.appcompat.widget.AppCompatTextView
|
||||
import androidx.core.content.ContextCompat
|
||||
import androidx.recyclerview.widget.GridLayoutManager
|
||||
import androidx.recyclerview.widget.RecyclerView
|
||||
import com.mogo.och.bus.R
|
||||
import com.mogo.och.bus.bean.response.BusQueryLinesResponse
|
||||
import com.mogo.och.bus.ui.adapter.SwitchLineAdapter.SwitchLineViewHolder
|
||||
import java.lang.Exception
|
||||
import kotlin.text.StringBuilder
|
||||
|
||||
/**
|
||||
* 路线列表adapter
|
||||
*/
|
||||
class SwitchLineAdapter(
|
||||
private val mContext: Context,
|
||||
private val mData: List<BusQueryLinesResponse.Result>
|
||||
) : RecyclerView.Adapter<SwitchLineViewHolder>() {
|
||||
companion object{
|
||||
const val TAG = "SwitchLineAdapter"
|
||||
}
|
||||
// RecyclerView设置点击事件
|
||||
private var mItemClickListener: LineItemClickListener? = null
|
||||
var checkLineId:Int = -1
|
||||
var checkTaskId:Int = -1
|
||||
override fun onCreateViewHolder(
|
||||
parent: ViewGroup,
|
||||
viewType: Int
|
||||
): SwitchLineViewHolder {
|
||||
val view = LayoutInflater.from(mContext).inflate(
|
||||
R.layout.bus_switch_line_list_item, parent, false
|
||||
)
|
||||
return SwitchLineViewHolder(view)
|
||||
}
|
||||
|
||||
override fun onBindViewHolder(holder: SwitchLineViewHolder, position: Int) {
|
||||
val currentPosition = holder.bindingAdapterPosition
|
||||
val line = mData[currentPosition]
|
||||
if(line.name!=null&&line.name!!.length>10){
|
||||
line.name = line.name!!.substring(0,10)+"…"
|
||||
}
|
||||
holder.lineName.text = line.name
|
||||
val sb = StringBuilder()
|
||||
if (line.endSiteName!=null&&line.endSiteName!!.length>10) {
|
||||
sb.append(line.endSiteName!!.substring(0,5))
|
||||
sb.append("…")
|
||||
sb.append(line.endSiteName!!.substring(line.endSiteName!!.length-5,line.endSiteName!!.length))
|
||||
}else{
|
||||
sb.append(line.endSiteName)
|
||||
}
|
||||
val string = mContext.getString(R.string.bus_line_goto_end, sb.toString())
|
||||
holder.lineEndName.text = string
|
||||
holder.rvLineTask.layoutManager = GridLayoutManager(mContext, 3)
|
||||
val switchLineTaskAdapter = SwitchLineTaskAdapter(
|
||||
mContext,
|
||||
checkTaskId,
|
||||
line.taskList,
|
||||
object : SwitchLineTaskAdapter.TaskItemClickListener {
|
||||
override fun onItemClick(position: Int,isCheck:Boolean) {
|
||||
try {
|
||||
if (isCheck) {
|
||||
checkLineId = line.lineId
|
||||
checkTaskId = line.taskList!![position].id ?: 0
|
||||
} else {
|
||||
checkLineId = -1
|
||||
checkTaskId = -1
|
||||
}
|
||||
}catch (e:Exception){
|
||||
e.printStackTrace()
|
||||
checkLineId=-1
|
||||
checkTaskId=-1
|
||||
}
|
||||
}
|
||||
})
|
||||
holder.rvLineTask.adapter = switchLineTaskAdapter
|
||||
holder.rvLineTask.isFocusableInTouchMode = false
|
||||
holder.actvShowMore.visibility = View.VISIBLE
|
||||
|
||||
if(line.open){
|
||||
if(line.taskList.isNullOrEmpty()){
|
||||
holder.actvShowMore.text = mContext.getString(R.string.bus_switch_line_no_task)
|
||||
holder.actvShowMore.setTextColor(ContextCompat.getColor(mContext,R.color.bus_color_4dffffff))
|
||||
holder.vLineTask.visibility = View.GONE
|
||||
holder.rvLineTask.visibility = View.GONE
|
||||
holder.selectIv.visibility = View.INVISIBLE
|
||||
holder.itemView.setBackgroundResource(R.drawable.bus_shape_select_line_item_bg_normal)
|
||||
}else {
|
||||
holder.actvShowMore.text = mContext.getString(R.string.bus_switch_line_select_task)
|
||||
holder.actvShowMore.setTextColor(ContextCompat.getColor(mContext,android.R.color.white))
|
||||
holder.vLineTask.visibility = View.VISIBLE
|
||||
holder.rvLineTask.visibility = View.VISIBLE
|
||||
holder.selectIv.visibility = View.VISIBLE
|
||||
holder.itemView.setBackgroundResource(R.drawable.bus_shape_select_line_item_bg_selected)
|
||||
holder.selectIv.apply {
|
||||
pivotX = 9.5f
|
||||
pivotY = 17f
|
||||
rotation = 90f
|
||||
}
|
||||
}
|
||||
}else{
|
||||
if(line.haveTask){
|
||||
holder.actvShowMore.text = mContext.getString(R.string.bus_switch_line_no_task)
|
||||
holder.actvShowMore.setTextColor(ContextCompat.getColor(mContext,R.color.bus_color_4dffffff))
|
||||
holder.vLineTask.visibility = View.GONE
|
||||
holder.rvLineTask.visibility = View.GONE
|
||||
holder.selectIv.visibility = View.INVISIBLE
|
||||
holder.itemView.setBackgroundResource(R.drawable.bus_shape_select_line_item_bg_normal)
|
||||
}else {
|
||||
holder.actvShowMore.text = mContext.getString(R.string.bus_switch_line_select_task)
|
||||
holder.actvShowMore.setTextColor(ContextCompat.getColor(mContext,android.R.color.white))
|
||||
holder.vLineTask.visibility = View.GONE
|
||||
holder.rvLineTask.visibility = View.GONE
|
||||
holder.selectIv.visibility = View.VISIBLE
|
||||
holder.itemView.setBackgroundResource(R.drawable.bus_shape_select_line_item_bg_normal)
|
||||
holder.selectIv.apply {
|
||||
pivotX = 9.5f
|
||||
pivotY = 17f
|
||||
rotation = 0f
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//设置item点击事件
|
||||
holder.itemView.setOnClickListener {
|
||||
if(holder.actvShowMore.text==mContext.getString(R.string.bus_switch_line_no_task)){
|
||||
return@setOnClickListener
|
||||
}
|
||||
mData.forEachIndexed { index, result ->
|
||||
if(result.open){
|
||||
result.open = false;
|
||||
notifyItemChanged(index)
|
||||
if(result.taskList!=null) {
|
||||
result.taskList!!.clear()
|
||||
}
|
||||
if(index==currentPosition){// 点击当前已经打开的item 去关闭定时网络请求
|
||||
mItemClickListener?.onItemClick(currentPosition,true)
|
||||
return@setOnClickListener
|
||||
}
|
||||
}
|
||||
}
|
||||
mItemClickListener?.onItemClick(currentPosition,false)
|
||||
line.open = holder.rvLineTask.visibility == View.GONE
|
||||
}
|
||||
}
|
||||
|
||||
override fun getItemCount(): Int {
|
||||
return mData.size
|
||||
}
|
||||
|
||||
fun setOnLineItemClickListener(itemClickListener: LineItemClickListener?) {
|
||||
mItemClickListener = itemClickListener
|
||||
}
|
||||
|
||||
class SwitchLineViewHolder(itemView: View) : RecyclerView.ViewHolder(itemView) {
|
||||
val selectIv: ImageView
|
||||
val lineName: AppCompatTextView//线路名称
|
||||
val lineEndName: AppCompatTextView //终点
|
||||
val actvShowMore: AppCompatTextView //选择时间
|
||||
val rvLineTask: RecyclerView// 排班时间
|
||||
val vLineTask: View// 白色分割线
|
||||
|
||||
init {
|
||||
selectIv = itemView.findViewById(R.id.switch_line_item_select_iv)
|
||||
lineName = itemView.findViewById(R.id.switch_line_name)
|
||||
lineEndName = itemView.findViewById(R.id.switch_line_end_station)
|
||||
rvLineTask = itemView.findViewById(R.id.rv_line_task_list)
|
||||
vLineTask = itemView.findViewById(R.id.v_line_task)
|
||||
actvShowMore = itemView.findViewById(R.id.actv_show_more)
|
||||
}
|
||||
}
|
||||
|
||||
interface LineItemClickListener {
|
||||
fun onItemClick(position: Int,close:Boolean)
|
||||
}
|
||||
}
|
||||
@@ -1,76 +0,0 @@
|
||||
package com.mogo.och.bus.ui.adapter
|
||||
|
||||
import android.content.Context
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import android.widget.TextView
|
||||
import androidx.recyclerview.widget.RecyclerView
|
||||
import com.mogo.eagle.core.utilcode.util.TimeUtils
|
||||
import com.mogo.och.bus.R
|
||||
import com.mogo.och.bus.bean.response.BusQueryLineTaskResponse
|
||||
import com.mogo.och.bus.ui.adapter.SwitchLineTaskAdapter.SwitchLineTaskViewHolder
|
||||
|
||||
/**
|
||||
* 路线列表adapter
|
||||
*/
|
||||
class SwitchLineTaskAdapter(
|
||||
private val mContext: Context,
|
||||
private var checkTaskId:Int,
|
||||
private val mData: List<BusQueryLineTaskResponse.Result>?,
|
||||
private val mTaskItemClickListener: TaskItemClickListener?
|
||||
) : RecyclerView.Adapter<SwitchLineTaskViewHolder>() {
|
||||
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): SwitchLineTaskViewHolder {
|
||||
val view = LayoutInflater.from(mContext).inflate(
|
||||
R.layout.bus_switch_line_list_task_item, parent, false
|
||||
)
|
||||
return SwitchLineTaskViewHolder(view)
|
||||
}
|
||||
|
||||
override fun onBindViewHolder(holder: SwitchLineTaskViewHolder, position: Int) {
|
||||
val currentPosition = holder.bindingAdapterPosition
|
||||
val task = mData!![currentPosition]
|
||||
val taskStartTime = TimeUtils.millis2String(task.taskStartTime, "HH:mm")
|
||||
holder.lineTask.text = taskStartTime
|
||||
if(checkTaskId==task.id){
|
||||
holder.lineTask.setBackgroundResource(R.drawable.bus_shape_select_line_item_time_bg_selected)
|
||||
}else{
|
||||
holder.lineTask.setBackgroundResource(R.drawable.bus_shape_select_line_item_time_bg)
|
||||
}
|
||||
holder.lineTask.setOnClickListener {
|
||||
if(checkTaskId==task.id){
|
||||
checkTaskId = -1
|
||||
mTaskItemClickListener?.onItemClick(currentPosition,false)
|
||||
}else {
|
||||
resetOther()
|
||||
checkTaskId = task.id
|
||||
mTaskItemClickListener?.onItemClick(currentPosition,true)
|
||||
}
|
||||
notifyItemChanged(currentPosition)
|
||||
}
|
||||
}
|
||||
|
||||
private fun resetOther() {
|
||||
mData?.forEachIndexed { index, result ->
|
||||
if(result.id==checkTaskId){
|
||||
checkTaskId = -1
|
||||
notifyItemChanged(index)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override fun getItemCount(): Int {
|
||||
return mData?.size ?: 0
|
||||
}
|
||||
|
||||
class SwitchLineTaskViewHolder(itemView: View) : RecyclerView.ViewHolder(itemView) {
|
||||
val lineTask: TextView // 时间
|
||||
init {
|
||||
lineTask = itemView.findViewById(R.id.actv_line_task)
|
||||
}
|
||||
}
|
||||
|
||||
interface TaskItemClickListener {
|
||||
fun onItemClick(position: Int,isCheck:Boolean)
|
||||
}
|
||||
}
|
||||
@@ -1,37 +0,0 @@
|
||||
package com.mogo.och.bus.util
|
||||
|
||||
import com.mogo.och.common.module.manager.autopilot.autopilot.IOchEventKey
|
||||
|
||||
/**
|
||||
* OCH Bus埋点工具
|
||||
*
|
||||
* Created on 2022/3/24
|
||||
*/
|
||||
object BusAnalyticsManager: IOchEventKey {
|
||||
|
||||
// 埋点key:接管后点击'自动驾驶'按钮启动
|
||||
private const val EVENT_KEY_RESTART_AUTOPILOT = "event_key_och_bus_restart_autopilot"
|
||||
// 埋点key:开始服务开启自动驾驶(成功/失败)
|
||||
private const val EVENT_KEY_START_SERVICE = "event_key_och_bus_start_service"
|
||||
// 埋点key:开启自动驾驶前已识别的异常,会导致无法开启自驾
|
||||
private const val EVENT_KEY_AP_UNABLE_START_REASON = "event_key_och_bus_ap_unable_start_reason"
|
||||
// 埋点key:点击启动自驾
|
||||
private const val EVENT_KEY_CLICK_START_AUTOPILOT = "event_key_och_bus_click_start_autopilot"
|
||||
|
||||
|
||||
override fun getEventKeyStartService(): String {
|
||||
return EVENT_KEY_START_SERVICE
|
||||
}
|
||||
|
||||
override fun getEventKeyRestartService(): String {
|
||||
return EVENT_KEY_RESTART_AUTOPILOT
|
||||
}
|
||||
|
||||
override fun getEventKeyApUnableStartReason(): String {
|
||||
return EVENT_KEY_AP_UNABLE_START_REASON
|
||||
}
|
||||
|
||||
override fun getEventKeyClickStartAutopilot(): String {
|
||||
return EVENT_KEY_CLICK_START_AUTOPILOT
|
||||
}
|
||||
}
|
||||
@@ -1,204 +0,0 @@
|
||||
package com.mogo.och.bus.util;
|
||||
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
import com.mogo.eagle.core.data.autopilot.AutopilotControlParameters;
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotControlManager;
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger;
|
||||
import com.mogo.eagle.core.utilcode.util.GsonUtils;
|
||||
import com.mogo.och.bus.constant.BusConst;
|
||||
import com.mogo.och.bus.model.OrderModel;
|
||||
import com.mogo.och.common.module.biz.login.LoginStatusManager;
|
||||
import com.mogo.och.common.module.manager.logchainanalytic.OchChainLogManager;
|
||||
import com.mogo.och.data.bean.BusRoutesResult;
|
||||
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import io.reactivex.Observable;
|
||||
import io.reactivex.android.schedulers.AndroidSchedulers;
|
||||
import io.reactivex.disposables.Disposable;
|
||||
import io.reactivex.schedulers.Schedulers;
|
||||
import mogo_msg.MogoReportMsg;
|
||||
|
||||
import static com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.M_BUS;
|
||||
|
||||
/**
|
||||
* Bus轨迹管理:给MEC下发用于轨迹下载的信息
|
||||
* Created on 2022/6/23
|
||||
*/
|
||||
public class BusTrajectoryManager {
|
||||
private static final String TAG = BusTrajectoryManager.class.getSimpleName();
|
||||
|
||||
private static final class SingletonHolder {
|
||||
private static final BusTrajectoryManager INSTANCE = new BusTrajectoryManager();
|
||||
}
|
||||
|
||||
public static BusTrajectoryManager getInstance() {
|
||||
return BusTrajectoryManager.SingletonHolder.INSTANCE;
|
||||
}
|
||||
|
||||
private AutopilotControlParameters.AutoPilotLine mAutoPilotLine = null;
|
||||
private Disposable mSendReqDisposable = null;
|
||||
|
||||
public BusTrajectoryManager() {
|
||||
mAutoPilotLine = new AutopilotControlParameters.AutoPilotLine(-1, "",
|
||||
"", "", "", "", 0, "",
|
||||
"", "", "", "", 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* 同步Bus路线信息
|
||||
*/
|
||||
public void syncTrajectoryInfo() {
|
||||
BusRoutesResult routesResult = OrderModel.getInstance().getBusRoutesResult();
|
||||
if (LoginStatusManager.isLogin() && routesResult != null
|
||||
&& OrderModel.getInstance().getCurrentStationIndex() == 0
|
||||
&& !OrderModel.getInstance().isGoingToNextStation()) {
|
||||
CallerLogger.d(M_BUS + TAG, "syncTrajectoryInfo() start.");
|
||||
startTrajReqLoop();
|
||||
} else {
|
||||
// 无路线信息or当前未在始发站
|
||||
CallerLogger.d(M_BUS + TAG, "syncTrajectoryInfo() stop.");
|
||||
stopTrajReqLoop();
|
||||
}
|
||||
}
|
||||
|
||||
public void onAutopilotGuardian(@Nullable MogoReportMsg.MogoReportMessage guardianInfo,long lineId) {
|
||||
onAutopilotGuardian(guardianInfo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 接口MEC反馈的常规信息(MAP v2.5.0新增轨迹相关信息)
|
||||
* @param guardianInfo
|
||||
*/
|
||||
public void onAutopilotGuardian(@Nullable MogoReportMsg.MogoReportMessage guardianInfo) {
|
||||
if (guardianInfo == null || !guardianInfo.hasCode()) return;
|
||||
if ("ISYS_INIT_TRAJECTORY_START".equals(guardianInfo.getCode())) {
|
||||
// 1. 轨迹管理_轨迹开始下载(本地已有对应轨迹也触发)
|
||||
CallerLogger.d(M_BUS + TAG, "onAutopilotGuardian() 轨迹开始下载");
|
||||
OchChainLogManager.writeChainLog("轨迹监控","onAutopilotGuardian() 轨迹开始下载", true, OchChainLogManager.EVENT_KEY_INFE_WITH_TRAJECTORY);
|
||||
// ToastUtils.showShort("轨迹开始下载");
|
||||
stopTrajReqLoop();
|
||||
} else if ("ISYS_INIT_TRAJECTORY_SUCCESS".equals(guardianInfo.getCode())) {
|
||||
// 2. 轨迹管理_轨迹下载成功(本地已有对应轨迹也触发)
|
||||
CallerLogger.d(M_BUS + TAG, "onAutopilotGuardian() 轨迹下载成功");
|
||||
OchChainLogManager.writeChainLog("轨迹监控","onAutopilotGuardian() 轨迹下载成功", true, OchChainLogManager.EVENT_KEY_INFE_WITH_TRAJECTORY);
|
||||
// ToastUtils.showShort("轨迹下载成功");
|
||||
stopTrajReqLoop();
|
||||
} else if ("ISYS_INIT_TRAJECTORY_FAILURE".equals(guardianInfo.getCode())) {
|
||||
// 3. 轨迹管理_轨迹下载失败,本地无对应轨迹
|
||||
CallerLogger.d(M_BUS + TAG, "onAutopilotGuardian() " +
|
||||
"轨迹下载失败,本地无对应轨迹");
|
||||
OchChainLogManager.writeChainLog("轨迹监控","onAutopilotGuardian() 轨迹下载失败,本地无对应轨迹", true, OchChainLogManager.EVENT_KEY_INFE_WITH_TRAJECTORY);
|
||||
// ToastUtils.showShort("轨迹下载失败,本地无对应轨迹");
|
||||
} else if ("ISYS_INIT_TRAJECTORY_WARNING".equals(guardianInfo.getCode())) {
|
||||
// 4. 轨迹管理_轨迹下载失败,本地有对应轨迹,认为成功
|
||||
CallerLogger.d(M_BUS + TAG, "onAutopilotGuardian() " +
|
||||
"轨迹下载失败,本地有对应轨迹,认为成功");
|
||||
OchChainLogManager.writeChainLog("轨迹监控","onAutopilotGuardian() 轨迹下载失败,本地有对应轨迹,认为成功", true, OchChainLogManager.EVENT_KEY_INFE_WITH_TRAJECTORY);
|
||||
// ToastUtils.showShort("轨迹下载失败,本地有对应轨迹,认为成功");
|
||||
} else if ("ISYS_INIT_TRAJECTORY_TIMEOUT".equals(guardianInfo.getCode())) {
|
||||
// 5. 轨迹管理_轨迹下载超时
|
||||
CallerLogger.d(M_BUS + TAG, "onAutopilotGuardian() 轨迹下载超时");
|
||||
OchChainLogManager.writeChainLog("轨迹监控","onAutopilotGuardian() 轨迹下载超时", true, OchChainLogManager.EVENT_KEY_INFE_WITH_TRAJECTORY);
|
||||
// ToastUtils.showShort("轨迹下载超时");
|
||||
} else if ("ISSM_FUNC_AUTO_PILOT_READY".equals(guardianInfo.getCode())) {
|
||||
// 收到ssm的自动驾驶变为ready,再次下发轨迹下载.解决:域控重启,或者102域控启动太早,107节点初始化未完成导致的轨迹未进行下载。
|
||||
CallerLogger.d(M_BUS + TAG, "onAutopilotGuardian() ssm ready,再次发起下载");
|
||||
OchChainLogManager.writeChainLog("轨迹监控","onAutopilotGuardian() 再次发起下载", true, OchChainLogManager.EVENT_KEY_INFE_WITH_TRAJECTORY);
|
||||
syncTrajectoryInfo();
|
||||
}
|
||||
}
|
||||
|
||||
private void setupAutoPilotLine() {
|
||||
BusRoutesResult routesResult = OrderModel.getInstance().getBusRoutesResult();
|
||||
if (routesResult == null) {
|
||||
CallerLogger.e(M_BUS + TAG,
|
||||
"setupAutoPilotLine(): routesResult is null.");
|
||||
return;
|
||||
} else {
|
||||
if (mAutoPilotLine == null) {
|
||||
mAutoPilotLine = new AutopilotControlParameters.AutoPilotLine(
|
||||
routesResult.getLineId(), routesResult.getName(),
|
||||
routesResult.csvFileUrl, routesResult.csvFileMd5,
|
||||
routesResult.txtFileUrl, routesResult.txtFileMd5,
|
||||
routesResult.contrailSaveTime, routesResult.carModel,
|
||||
routesResult.csvFileUrlDPQP, routesResult.csvFileMd5DPQP,
|
||||
routesResult.txtFileUrlDPQP, routesResult.txtFileMd5DPQP,
|
||||
routesResult.contrailSaveTimeDPQP);
|
||||
} else {
|
||||
mAutoPilotLine.setLineId(routesResult.getLineId());
|
||||
mAutoPilotLine.setLineName(routesResult.getName());
|
||||
mAutoPilotLine.setTrajUrl(routesResult.csvFileUrl);
|
||||
mAutoPilotLine.setTrajMd5(routesResult.csvFileMd5);
|
||||
mAutoPilotLine.setStopUrl(routesResult.txtFileUrl);
|
||||
mAutoPilotLine.setStopMd5(routesResult.txtFileMd5);
|
||||
mAutoPilotLine.setTimestamp(routesResult.contrailSaveTime);
|
||||
mAutoPilotLine.setVehicleModel(routesResult.carModel);
|
||||
mAutoPilotLine.setTrajUrl_dpqp(routesResult.csvFileUrlDPQP);
|
||||
mAutoPilotLine.setTrajMd5_dpqp(routesResult.csvFileMd5DPQP);
|
||||
mAutoPilotLine.setStopUrl_dpqp(routesResult.txtFileUrlDPQP);
|
||||
mAutoPilotLine.setStopMd5_dpqp(routesResult.txtFileMd5DPQP);
|
||||
mAutoPilotLine.setTimestamp_dpqp(routesResult.contrailSaveTimeDPQP);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void clearAutoPilotLine() {
|
||||
if (mAutoPilotLine == null) return;
|
||||
mAutoPilotLine.setLineId(-1);
|
||||
mAutoPilotLine.setLineName("");
|
||||
mAutoPilotLine.setTrajUrl("");
|
||||
mAutoPilotLine.setTrajMd5("");
|
||||
mAutoPilotLine.setStopUrl("");
|
||||
mAutoPilotLine.setStopMd5("");
|
||||
mAutoPilotLine.setTimestamp(0);
|
||||
mAutoPilotLine.setVehicleModel("");
|
||||
mAutoPilotLine.setTrajUrl_dpqp("");
|
||||
mAutoPilotLine.setTrajMd5_dpqp("");
|
||||
mAutoPilotLine.setStopUrl_dpqp("");
|
||||
mAutoPilotLine.setStopMd5_dpqp("");
|
||||
mAutoPilotLine.setTimestamp_dpqp(0);
|
||||
}
|
||||
|
||||
private void startTrajReqLoop() {
|
||||
if (mSendReqDisposable != null && !mSendReqDisposable.isDisposed()) {
|
||||
return;
|
||||
}
|
||||
CallerLogger.d(M_BUS + TAG, "startTrajReqLoop()");
|
||||
setupAutoPilotLine();
|
||||
mSendReqDisposable = Observable.interval(BusConst.LOOP_DELAY,
|
||||
BusConst.LOOP_PERIOD_10S, TimeUnit.MILLISECONDS)
|
||||
.map((aLong -> aLong + 1))
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(aLong -> {
|
||||
if (aLong > BusConst.LOOP_SEND_TRAJ_TIMES) {
|
||||
stopTrajReqLoop();
|
||||
return;
|
||||
}
|
||||
CallerLogger.d(M_BUS + TAG, "loop sendTrajectoryReq: " + aLong);
|
||||
sendTrajectoryReq();
|
||||
});
|
||||
}
|
||||
|
||||
public void stopTrajReqLoop() {
|
||||
if (mSendReqDisposable != null) {
|
||||
CallerLogger.d(M_BUS + TAG, "stopTrajReqLoop()");
|
||||
mSendReqDisposable.dispose();
|
||||
mSendReqDisposable = null;
|
||||
clearAutoPilotLine();
|
||||
}
|
||||
}
|
||||
|
||||
private void sendTrajectoryReq() {
|
||||
if (mAutoPilotLine == null) {
|
||||
CallerLogger.e(M_BUS + TAG, "sendTrajectoryReq(): mAutoPilotLine is null!!!");
|
||||
return;
|
||||
}
|
||||
OchChainLogManager.writeChainLog("轨迹监控","sendTrajectoryReq() 下发轨迹 轨迹id"+mAutoPilotLine.getLineId(), true, OchChainLogManager.EVENT_KEY_INFE_WITH_TRAJECTORY);
|
||||
CallerAutoPilotControlManager.INSTANCE.sendTrajectoryDownloadReq(mAutoPilotLine);
|
||||
CallerLogger.d(M_BUS + TAG, "sendTrajectoryReq(): "
|
||||
+ GsonUtils.toJson(mAutoPilotLine));
|
||||
}
|
||||
}
|
||||
@@ -1,162 +0,0 @@
|
||||
package com.mogo.och.bus.util
|
||||
|
||||
import com.mogo.commons.AbsMogoApplication
|
||||
import com.mogo.commons.voice.AIAssist
|
||||
import com.mogo.eagle.core.data.config.FunctionBuildConfig
|
||||
import com.mogo.eagle.core.utilcode.mogo.AppIdentityModeUtils
|
||||
import com.mogo.och.bus.R
|
||||
import com.mogo.och.common.module.manager.socket.lan.LanSocketManager
|
||||
import com.mogo.och.common.module.manager.socket.lan.bean.AppConnectMsg
|
||||
import com.mogo.och.common.module.utils.ResourcesUtils
|
||||
import com.mogo.och.common.module.voice.VoiceNotice
|
||||
import com.mogo.tts.base.LangTtsEntity
|
||||
import com.mogo.tts.base.LanguageType
|
||||
import java.util.ArrayList
|
||||
|
||||
object BusVoiceManager {
|
||||
|
||||
fun arrivedStationBus(siteNameCN: String?, siteNameKR: String?) {
|
||||
val context = AbsMogoApplication.getApp()
|
||||
val list: MutableList<LangTtsEntity> = ArrayList()
|
||||
siteNameCN?.let {
|
||||
val chineseTTS = LangTtsEntity(
|
||||
context.getString(R.string.bus_arrived_station_tip, it),
|
||||
LanguageType.CHINESE
|
||||
)
|
||||
val engTTS = LangTtsEntity(
|
||||
context.getString(R.string.bus_arrived_station_english_tip, it),
|
||||
LanguageType.ENGLISH
|
||||
)
|
||||
val koreanTTS = LangTtsEntity(
|
||||
context.getString(R.string.bus_arrived_station_korean_tip, siteNameKR ?: it),
|
||||
LanguageType.KOREAN
|
||||
)
|
||||
list.add(chineseTTS)
|
||||
list.add(engTTS)
|
||||
list.add(koreanTTS)
|
||||
|
||||
}
|
||||
|
||||
if (AppIdentityModeUtils.isB1(FunctionBuildConfig.appIdentityMode)) {
|
||||
VoiceNotice.showNotice(list, AIAssist.LEVEL1, null)
|
||||
} else if (AppIdentityModeUtils.isB2(FunctionBuildConfig.appIdentityMode)) {
|
||||
siteNameCN?.let {
|
||||
sendArrivedStationToClient(it)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private fun sendArrivedStationToClient(arriveStation: String) {
|
||||
val arrivedMsg = AppConnectMsg(
|
||||
isViewShow = false,
|
||||
isPlay = true,
|
||||
msg = ResourcesUtils.getString(R.string.bus_arrived_station_tip, arriveStation),
|
||||
)
|
||||
LanSocketManager.sendMsgToClient(arrivedMsg)
|
||||
}
|
||||
|
||||
fun leaveStationBus(siteNameCN: String?, siteNameKR: String?) {
|
||||
val list: MutableList<LangTtsEntity> = ArrayList()
|
||||
val context = AbsMogoApplication.getApp()
|
||||
siteNameCN?.let {
|
||||
val chineseTTS = LangTtsEntity(
|
||||
context.getString(R.string.bus_leave_station_tip, it),
|
||||
LanguageType.CHINESE
|
||||
)
|
||||
val engTTS = LangTtsEntity(
|
||||
context.getString(R.string.bus_leave_station_english_tip, it),
|
||||
LanguageType.ENGLISH
|
||||
)
|
||||
list.add(chineseTTS)
|
||||
list.add(engTTS)
|
||||
|
||||
val koreanTTS = LangTtsEntity(
|
||||
context.getString(R.string.bus_leave_station_korean_tip, siteNameKR ?: it),
|
||||
LanguageType.KOREAN
|
||||
)
|
||||
|
||||
list.add(koreanTTS)
|
||||
}
|
||||
|
||||
if (AppIdentityModeUtils.isB1(FunctionBuildConfig.appIdentityMode)) {
|
||||
VoiceNotice.showNotice(list, AIAssist.LEVEL1, null)
|
||||
} else if (AppIdentityModeUtils.isB2(FunctionBuildConfig.appIdentityMode)) {
|
||||
siteNameCN?.let {
|
||||
sendStartStationToClient(it)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private fun sendStartStationToClient(nextStation: String) {
|
||||
val startMsg = AppConnectMsg(
|
||||
isViewShow = false,
|
||||
isPlay = true,
|
||||
msg = ResourcesUtils.getString(R.string.bus_leave_station_tip, nextStation),
|
||||
)
|
||||
LanSocketManager.sendMsgToClient(startMsg)
|
||||
}
|
||||
|
||||
fun endOrderBus() {
|
||||
val context = AbsMogoApplication.getApp()
|
||||
val list: MutableList<LangTtsEntity> = ArrayList()
|
||||
val chineseTTS =
|
||||
LangTtsEntity(context.getString(R.string.bus_end_task_tip), LanguageType.CHINESE)
|
||||
val engTTS = LangTtsEntity(
|
||||
context.getString(R.string.bus_end_task_english_tip),
|
||||
LanguageType.ENGLISH
|
||||
)
|
||||
val koreanTTS =
|
||||
LangTtsEntity(context.getString(R.string.bus_end_task_korean_tip), LanguageType.KOREAN)
|
||||
list.add(chineseTTS)
|
||||
list.add(engTTS)
|
||||
list.add(koreanTTS)
|
||||
|
||||
if (AppIdentityModeUtils.isB1(FunctionBuildConfig.appIdentityMode)) {
|
||||
VoiceNotice.showNotice(list, AIAssist.LEVEL0, null)
|
||||
} else if (AppIdentityModeUtils.isB2(FunctionBuildConfig.appIdentityMode)) {
|
||||
sendEndTaskToClient()
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private fun sendEndTaskToClient() {
|
||||
val endMsg = AppConnectMsg(
|
||||
isViewShow = false,
|
||||
isPlay = true,
|
||||
msg = ResourcesUtils.getString(R.string.bus_end_task_tip),
|
||||
)
|
||||
LanSocketManager.sendMsgToClient(endMsg)
|
||||
}
|
||||
|
||||
|
||||
fun writeOffCount(successNum: Int) {
|
||||
if (successNum <= 1) {
|
||||
VoiceNotice.showNotice("核验通过", AIAssist.LEVEL3)
|
||||
//sendWriteOffNumToClient("核验通过")
|
||||
} else {
|
||||
VoiceNotice.showNotice("$successNum 人核验通过", AIAssist.LEVEL3)
|
||||
//sendWriteOffNumToClient("$successNum 人核验通过")
|
||||
}
|
||||
}
|
||||
|
||||
private fun sendWriteOffNumToClient(msg: String?) {
|
||||
val passengerMsg = AppConnectMsg(
|
||||
isViewShow = false,
|
||||
isPlay = true,
|
||||
msg = msg!!,
|
||||
)
|
||||
LanSocketManager.sendMsgToClient(passengerMsg)
|
||||
}
|
||||
|
||||
|
||||
// 距离发车还有1分钟
|
||||
fun showLeafTime(tips: String) {
|
||||
//语音提示
|
||||
VoiceNotice.showNotice(tips)
|
||||
}
|
||||
|
||||
fun writeOffFaile(reaseon: String) {
|
||||
VoiceNotice.showNotice(reaseon, AIAssist.LEVEL3)
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,59 +0,0 @@
|
||||
package com.mogo.och.bus.view
|
||||
|
||||
import android.content.Context
|
||||
import android.os.Bundle
|
||||
import android.util.AttributeSet
|
||||
import android.view.LayoutInflater
|
||||
import android.widget.FrameLayout
|
||||
import com.mogo.eagle.core.data.config.FunctionBuildConfig
|
||||
import com.mogo.eagle.core.function.view.MapBizView
|
||||
import com.mogo.eagle.core.utilcode.mogo.AppIdentityModeUtils
|
||||
import com.mogo.map.uicontroller.IMogoMapUIController
|
||||
import com.mogo.och.bus.R
|
||||
|
||||
class BizMapView @JvmOverloads constructor(
|
||||
context: Context,
|
||||
attrs: AttributeSet? = null,
|
||||
defStyleAttr: Int = 0
|
||||
) : FrameLayout(context, attrs, defStyleAttr) {
|
||||
|
||||
private lateinit var mapBizView: MapBizView
|
||||
|
||||
init {
|
||||
if (AppIdentityModeUtils.isB2(FunctionBuildConfig.appIdentityMode)) {
|
||||
LayoutInflater.from(context).inflate(R.layout.bus_m2_bizmap_map, this, true)
|
||||
}else if(AppIdentityModeUtils.isB1(FunctionBuildConfig.appIdentityMode)){
|
||||
LayoutInflater.from(context).inflate(R.layout.bus_jl_bizmap_map, this, true)
|
||||
}else{
|
||||
LayoutInflater.from(context).inflate(R.layout.bus_jl_bizmap_map, this, true)
|
||||
}
|
||||
mapBizView = findViewById(R.id.bizMapView)
|
||||
}
|
||||
|
||||
fun getUI(): IMogoMapUIController? {
|
||||
return mapBizView.getUI()
|
||||
}
|
||||
|
||||
fun onCreate(bundle: Bundle?) {
|
||||
mapBizView.onCreate(bundle)
|
||||
}
|
||||
fun onResume() {
|
||||
mapBizView.onResume()
|
||||
}
|
||||
|
||||
fun onSaveInstanceState(outState: Bundle){
|
||||
mapBizView.onSaveInstanceState(outState)
|
||||
}
|
||||
|
||||
fun onLowMemory() {
|
||||
mapBizView.onLowMemory()
|
||||
}
|
||||
|
||||
fun onPause() {
|
||||
mapBizView.onPause()
|
||||
}
|
||||
|
||||
fun onDestroy() {
|
||||
mapBizView.onDestroy()
|
||||
}
|
||||
}
|
||||
@@ -1,305 +0,0 @@
|
||||
package com.mogo.och.bus.view;
|
||||
|
||||
import android.animation.ObjectAnimator;
|
||||
import android.animation.ValueAnimator;
|
||||
import android.content.Context;
|
||||
import android.content.res.TypedArray;
|
||||
import android.graphics.Bitmap;
|
||||
import android.graphics.BitmapFactory;
|
||||
import android.graphics.Canvas;
|
||||
import android.graphics.Color;
|
||||
import android.graphics.LinearGradient;
|
||||
import android.graphics.Matrix;
|
||||
import android.graphics.Paint;
|
||||
import android.graphics.Rect;
|
||||
import android.graphics.RectF;
|
||||
import android.graphics.Shader;
|
||||
import android.util.AttributeSet;
|
||||
import android.view.MotionEvent;
|
||||
import android.view.View;
|
||||
import android.view.animation.DecelerateInterpolator;
|
||||
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
import com.mogo.commons.AbsMogoApplication;
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger;
|
||||
import com.mogo.eagle.core.utilcode.util.ConvertUtils;
|
||||
import com.mogo.eagle.core.utilcode.util.ThreadUtils;
|
||||
import com.mogo.eagle.core.utilcode.util.UiThreadHandler;
|
||||
import com.mogo.och.bus.R;
|
||||
import com.mogo.och.common.module.manager.logchainanalytic.OchChainLogManager;
|
||||
|
||||
import me.jessyan.autosize.AutoSizeConfig;
|
||||
import me.jessyan.autosize.utils.AutoSizeUtils;
|
||||
|
||||
/**
|
||||
* 滑块滑动面板
|
||||
*
|
||||
* @author tongchenfei
|
||||
*/
|
||||
public class SlidePanelView extends View {
|
||||
private static final String TAG = "SlidePanelView";
|
||||
|
||||
public SlidePanelView(Context context) {
|
||||
this(context, null);
|
||||
}
|
||||
|
||||
public SlidePanelView(Context context, @Nullable AttributeSet attrs) {
|
||||
this(context, attrs, 0);
|
||||
}
|
||||
|
||||
public SlidePanelView(Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
|
||||
super(context, attrs, defStyleAttr);
|
||||
TypedArray mTypedArray = context.obtainStyledAttributes(attrs, R.styleable.SlidePanelView);
|
||||
textSize = (int) mTypedArray.getDimension(R.styleable.SlidePanelView_textSize, textSize);
|
||||
BLOCK_START_X = (int) mTypedArray.getDimension(R.styleable.SlidePanelView_BLOCK_START_X, BLOCK_START_X);
|
||||
BLOCK_START_Y = (int) mTypedArray.getDimension(R.styleable.SlidePanelView_BLOCK_START_Y, BLOCK_START_Y);
|
||||
NORMAL_TEXT_MARGIN_LEFT = (int) mTypedArray.getDimension(R.styleable.SlidePanelView_NORMAL_TEXT_MARGIN_LEFT, NORMAL_TEXT_MARGIN_LEFT);
|
||||
NORMAL_TEXT_MARGIN_RIGHT = (int) mTypedArray.getDimension(R.styleable.SlidePanelView_NORMAL_TEXT_MARGIN_RIGHT, NORMAL_TEXT_MARGIN_RIGHT);
|
||||
SHORT_TEXT_MARGIN_LEFT = (int) mTypedArray.getDimension(R.styleable.SlidePanelView_SHORT_TEXT_MARGIN_LEFT, SHORT_TEXT_MARGIN_LEFT);
|
||||
SHORT_TEXT_MARGIN_RIGHT = (int) mTypedArray.getDimension(R.styleable.SlidePanelView_SHORT_TEXT_MARGIN_RIGHT, SHORT_TEXT_MARGIN_RIGHT);
|
||||
mTypedArray.recycle();
|
||||
init();
|
||||
}
|
||||
|
||||
private final Paint bgPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
|
||||
private final Paint blockPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
|
||||
private final Paint textPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
|
||||
|
||||
private static int textSize = 40;
|
||||
private static int BLOCK_START_X = AutoSizeUtils.dp2px(AbsMogoApplication.getApp(),15);
|
||||
private static int BLOCK_START_Y = AutoSizeUtils.dp2px(AbsMogoApplication.getApp(),15);
|
||||
private static int NORMAL_TEXT_MARGIN_LEFT = AutoSizeUtils.dp2px(AbsMogoApplication.getApp(),40);
|
||||
private static int NORMAL_TEXT_MARGIN_RIGHT = AutoSizeUtils.dp2px(AbsMogoApplication.getApp(),60);
|
||||
private static int SHORT_TEXT_MARGIN_LEFT = AutoSizeUtils.dp2px(AbsMogoApplication.getApp(),60);
|
||||
private static int SHORT_TEXT_MARGIN_RIGHT = AutoSizeUtils.dp2px(AbsMogoApplication.getApp(),70);
|
||||
|
||||
private int textMarginLeft = NORMAL_TEXT_MARGIN_LEFT;
|
||||
private int textMarginRight = NORMAL_TEXT_MARGIN_RIGHT;
|
||||
|
||||
private OnSlidePanelMoveToEndListener moveToEndListener;
|
||||
|
||||
private int blockWidth = 0;
|
||||
private int blockOffset = 0;
|
||||
|
||||
private float lastX;
|
||||
private boolean isToEnd = false;
|
||||
|
||||
private static final String STRING_SLIDE_TO_RIGHT = "向右滑动";
|
||||
private RectF bgRectF;
|
||||
private Bitmap bmBlock;
|
||||
|
||||
private final Matrix gradientMatrix = new Matrix();
|
||||
private float matrixTranslate;
|
||||
private final Rect textRect = new Rect();
|
||||
private LinearGradient textGradient;
|
||||
|
||||
private ObjectAnimator matrixAnim;
|
||||
|
||||
private String blockText = STRING_SLIDE_TO_RIGHT;
|
||||
private final Paint.FontMetrics blockTextMetrics = new Paint.FontMetrics();
|
||||
|
||||
private static final int GRADIENT_OFFSET = 200;
|
||||
|
||||
public void setOnSlidePanelMoveToEndListener(OnSlidePanelMoveToEndListener moveToEndListener) {
|
||||
this.moveToEndListener = moveToEndListener;
|
||||
}
|
||||
|
||||
private void setBlockOffset(int blockOffset) {
|
||||
this.blockOffset = blockOffset;
|
||||
invalidate();
|
||||
}
|
||||
|
||||
private void setMatrixTranslate(float matrixTranslate) {
|
||||
this.matrixTranslate = matrixTranslate;
|
||||
invalidate();
|
||||
}
|
||||
|
||||
public void setText(String text) {
|
||||
this.blockText = text;
|
||||
requestLayout();
|
||||
invalidate();
|
||||
}
|
||||
|
||||
private void init() {
|
||||
bgRectF = new RectF(0, 0, 0, 0);
|
||||
bgPaint.setColor(Color.parseColor("#CC0F1325"));
|
||||
bgPaint.setStyle(Paint.Style.FILL);
|
||||
|
||||
textPaint.setStyle(Paint.Style.FILL);
|
||||
textPaint.setTextSize(textSize);
|
||||
textPaint.setTextAlign(Paint.Align.LEFT);
|
||||
textGradient = new LinearGradient(-GRADIENT_OFFSET, 0, 0, 0, new int[]{0x33ffffff, 0xffffffff, 0x33ffffff}, null, Shader.TileMode.CLAMP);
|
||||
textGradient.setLocalMatrix(gradientMatrix);
|
||||
textPaint.setShader(textGradient);
|
||||
textPaint.getFontMetrics(blockTextMetrics);
|
||||
decodeImage();
|
||||
}
|
||||
|
||||
private void decodeImage(){
|
||||
ThreadUtils.getCpuPool().execute(() -> {
|
||||
int size = AutoSizeUtils.dp2px(getContext(), 120);
|
||||
BitmapFactory.Options opts = new BitmapFactory.Options();
|
||||
opts.inDensity = (int) AutoSizeConfig.getInstance().getInitDensity();
|
||||
bmBlock = BitmapFactory.decodeResource(getResources(), R.drawable.bus_base_slide_block,opts);
|
||||
bmBlock = Bitmap.createScaledBitmap(bmBlock, size, size, true);
|
||||
blockWidth = bmBlock.getWidth();
|
||||
UiThreadHandler.post(this::requestLayout,UiThreadHandler.MODE.QUEUE);
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
|
||||
int widthMode = MeasureSpec.getMode(widthMeasureSpec);
|
||||
int heightMode = MeasureSpec.getMode(heightMeasureSpec);
|
||||
int widthSize;
|
||||
int heightSize;
|
||||
|
||||
if (blockText.length() < 5) {
|
||||
textMarginLeft = SHORT_TEXT_MARGIN_LEFT;
|
||||
textMarginRight = SHORT_TEXT_MARGIN_RIGHT;
|
||||
} else {
|
||||
textMarginLeft = NORMAL_TEXT_MARGIN_LEFT;
|
||||
textMarginRight = NORMAL_TEXT_MARGIN_RIGHT;
|
||||
}
|
||||
|
||||
if(bmBlock!=null) {
|
||||
if (widthMode == MeasureSpec.AT_MOST) {
|
||||
// 宽度根据图片大小,字符串长度,各种间隔确定
|
||||
// 高度根据图片大小和上下间隔确定
|
||||
textPaint.getTextBounds(blockText, 0, blockText.length(), textRect);
|
||||
widthSize = BLOCK_START_X * 2 + bmBlock.getWidth() + textMarginLeft + textMarginRight + textRect.width();
|
||||
heightSize = BLOCK_START_Y * 2 + bmBlock.getHeight();
|
||||
widthMeasureSpec = MeasureSpec.makeMeasureSpec(widthSize, widthMode);
|
||||
heightMeasureSpec = MeasureSpec.makeMeasureSpec(heightSize, heightMode);
|
||||
}
|
||||
}
|
||||
|
||||
super.onMeasure(widthMeasureSpec, heightMeasureSpec);
|
||||
}
|
||||
|
||||
private float textOffset = 0;
|
||||
|
||||
@Override
|
||||
protected void onSizeChanged(int w, int h, int oldw, int oldh) {
|
||||
super.onSizeChanged(w, h, oldw, oldh);
|
||||
if (bgRectF != null){
|
||||
bgRectF.left = 0;
|
||||
bgRectF.top = 0;
|
||||
bgRectF.right = w;
|
||||
bgRectF.bottom = h;
|
||||
}
|
||||
|
||||
if (matrixAnim != null) {
|
||||
matrixAnim.cancel();
|
||||
}
|
||||
textOffset = (getHeight() - blockTextMetrics.ascent - blockTextMetrics.descent) / 2;
|
||||
matrixAnim = ObjectAnimator.ofFloat(this, "matrixTranslate", 0, w + GRADIENT_OFFSET).setDuration(2000);
|
||||
matrixAnim.setRepeatCount(ValueAnimator.INFINITE);
|
||||
matrixAnim.start();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onAttachedToWindow() {
|
||||
super.onAttachedToWindow();
|
||||
if (matrixAnim != null) {
|
||||
matrixAnim.start();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onDetachedFromWindow() {
|
||||
super.onDetachedFromWindow();
|
||||
if (matrixAnim != null) {
|
||||
matrixAnim.cancel();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onTouchEvent(MotionEvent event) {
|
||||
float x = event.getX();
|
||||
float y = event.getY();
|
||||
|
||||
switch (event.getAction()) {
|
||||
case MotionEvent.ACTION_DOWN:
|
||||
if (x > BLOCK_START_X + blockOffset && x < blockWidth + BLOCK_START_X + blockOffset && y > BLOCK_START_Y && y < getHeight() - BLOCK_START_Y) {
|
||||
isToEnd = false;
|
||||
lastX = x;
|
||||
}
|
||||
break;
|
||||
case MotionEvent.ACTION_MOVE:
|
||||
if (lastX != 0) {
|
||||
blockOffset = (int) (x - lastX);
|
||||
if (blockOffset < 0) {
|
||||
blockOffset = 0;
|
||||
}
|
||||
if (blockOffset + BLOCK_START_X + blockWidth > getWidth()) {
|
||||
// 超出右边界
|
||||
blockOffset = getWidth() - BLOCK_START_X - blockWidth;
|
||||
if (!isToEnd) {
|
||||
isToEnd = true;
|
||||
if (moveToEndListener != null) {
|
||||
moveToEndListener.moveToEnd();
|
||||
}
|
||||
startBlockBackAnim();
|
||||
}
|
||||
}
|
||||
invalidate();
|
||||
}
|
||||
break;
|
||||
case MotionEvent.ACTION_UP:
|
||||
// 执行滑块回归动画
|
||||
if (!isToEnd) {
|
||||
startBlockBackAnim();
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
private void startBlockBackAnim() {
|
||||
ObjectAnimator blockBackAnimator = ObjectAnimator.ofInt(this, "blockOffset", blockOffset, 0);
|
||||
blockBackAnimator.setInterpolator(new DecelerateInterpolator());
|
||||
blockBackAnimator.setDuration(1000L * blockOffset / getWidth());
|
||||
blockBackAnimator.start();
|
||||
lastX = 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onDraw(Canvas canvas) {
|
||||
super.onDraw(canvas);
|
||||
// 画背景
|
||||
canvas.drawRoundRect(bgRectF, (float) getHeight() / 2.0f, (float) getHeight() / 2.0f, bgPaint);
|
||||
// 画文字
|
||||
gradientMatrix.setTranslate(matrixTranslate, 0);
|
||||
textGradient.setLocalMatrix(gradientMatrix);
|
||||
canvas.save();
|
||||
canvas.drawText(blockText, (float) (blockWidth + BLOCK_START_X + textMarginLeft), (float) textOffset, textPaint);
|
||||
canvas.restore();
|
||||
if (bmBlock != null) {
|
||||
if(bmBlock.getByteCount()>=5*1024*1024){
|
||||
OchChainLogManager.writeChainLog("崩溃兜底策略",
|
||||
"图片大小监听"+ ConvertUtils.byte2FitMemorySize(bmBlock.getByteCount()),true,OchChainLogManager.EVENT_KEY_INFE_ERROR);
|
||||
bmBlock.recycle();
|
||||
bmBlock = null;
|
||||
blockWidth = 0;
|
||||
decodeImage();
|
||||
}else {
|
||||
// 画滑块
|
||||
canvas.drawBitmap(bmBlock, (float) (BLOCK_START_X + blockOffset), (float) BLOCK_START_Y, blockPaint);
|
||||
CallerLogger.d(TAG,"图片大小监听"+ ConvertUtils.byte2FitMemorySize(bmBlock.getByteCount()));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public interface OnSlidePanelMoveToEndListener {
|
||||
/**
|
||||
* 滑块滑到了末尾
|
||||
*/
|
||||
void moveToEnd();
|
||||
}
|
||||
}
|
||||
@@ -1,4 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item android:color="@color/bus_autopilot_text_color_normal"/>
|
||||
</selector>
|
||||
|
Before Width: | Height: | Size: 4.8 KiB |
|
Before Width: | Height: | Size: 2.8 KiB |
|
Before Width: | Height: | Size: 323 B |
|
Before Width: | Height: | Size: 1.7 KiB |
|
Before Width: | Height: | Size: 1.4 KiB |
|
Before Width: | Height: | Size: 1.3 KiB |
|
Before Width: | Height: | Size: 338 B |
|
Before Width: | Height: | Size: 32 KiB |
|
Before Width: | Height: | Size: 26 KiB |
|
Before Width: | Height: | Size: 25 KiB |
|
Before Width: | Height: | Size: 53 KiB |
|
Before Width: | Height: | Size: 47 KiB |
|
Before Width: | Height: | Size: 491 B |
|
Before Width: | Height: | Size: 2.5 KiB |
|
Before Width: | Height: | Size: 13 KiB |
|
Before Width: | Height: | Size: 1004 B |
|
Before Width: | Height: | Size: 25 KiB |
|
Before Width: | Height: | Size: 34 KiB |
|
Before Width: | Height: | Size: 3.3 KiB |
|
Before Width: | Height: | Size: 5.1 KiB |
|
Before Width: | Height: | Size: 3.7 KiB |
|
Before Width: | Height: | Size: 2.3 KiB |
|
Before Width: | Height: | Size: 3.9 KiB |
|
Before Width: | Height: | Size: 5.0 KiB |
|
Before Width: | Height: | Size: 4.7 KiB |
|
Before Width: | Height: | Size: 5.2 KiB |
|
Before Width: | Height: | Size: 377 B |
|
Before Width: | Height: | Size: 400 B |
|
Before Width: | Height: | Size: 402 B |
|
Before Width: | Height: | Size: 6.9 KiB |
|
Before Width: | Height: | Size: 6.9 KiB |
|
Before Width: | Height: | Size: 6.7 KiB |
|
Before Width: | Height: | Size: 13 KiB |
|
Before Width: | Height: | Size: 1.4 KiB |
|
Before Width: | Height: | Size: 3.7 KiB |
|
Before Width: | Height: | Size: 1.5 KiB |
|
Before Width: | Height: | Size: 100 KiB |
|
Before Width: | Height: | Size: 14 KiB |
@@ -1,7 +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="#ff000000"/>
|
||||
<corners android:radius="@dimen/bus_traffic_light_layout_corner"/>
|
||||
</shape>
|
||||
@@ -1,8 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item android:state_pressed="true" android:drawable="@drawable/common_autopilot_press">
|
||||
</item>
|
||||
<item android:drawable="@drawable/common_autopilot_unable">
|
||||
</item>
|
||||
</selector>
|
||||
|
||||
@@ -1,8 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item android:state_pressed="true" android:drawable="@drawable/common_autopilot_press">
|
||||
</item>
|
||||
<item android:drawable="@drawable/common_autopilot_in_autopilot">
|
||||
</item>
|
||||
</selector>
|
||||
|
||||
@@ -1,7 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item android:drawable="@drawable/bus_selected_btn" android:state_checked="true"/>
|
||||
<item android:drawable="@drawable/bus_unselect_btn" android:state_checked="false"/>
|
||||
<item android:drawable="@drawable/bus_unselect_btn"/>
|
||||
|
||||
</selector>
|
||||
@@ -1,8 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item>
|
||||
<shape android:shape="rectangle">
|
||||
<gradient android:angle="180" android:endColor="#000B4B" android:startColor="#001C83" />
|
||||
</shape>
|
||||
</item>
|
||||
</selector>
|
||||
@@ -1,8 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item>
|
||||
<shape android:shape="rectangle">
|
||||
<gradient android:angle="180" android:endColor="#0027FF" android:startColor="#4267FF" />
|
||||
</shape>
|
||||
</item>
|
||||
</selector>
|
||||
@@ -1,8 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item android:drawable="@drawable/bus_operation_status_select_bg" android:state_focused="true" android:state_pressed="true" />
|
||||
<item android:drawable="@drawable/bus_operation_status_select_bg" android:state_focused="false" android:state_pressed="true" />
|
||||
<item android:drawable="@drawable/bus_operation_status_select_bg" android:state_selected="true" />
|
||||
<item android:drawable="@drawable/bus_operation_status_select_bg" android:state_focused="true" />
|
||||
<item android:drawable="@drawable/bus_operation_status_bg" />
|
||||
</selector>
|
||||
@@ -1,5 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<solid android:color="#2B6EFF"/>
|
||||
<corners android:radius="33dp"/>
|
||||
</shape>
|
||||
@@ -1,19 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item>
|
||||
<shape>
|
||||
<corners android:radius="27dp" />
|
||||
<solid android:color="#3B4577"/>
|
||||
</shape>
|
||||
</item>
|
||||
<item
|
||||
android:bottom="3dp"
|
||||
android:left="3dp"
|
||||
android:right="3dp"
|
||||
android:top="3dp">
|
||||
<shape>
|
||||
<corners android:radius="27dp" />
|
||||
<solid android:color="#3B4577"/>
|
||||
</shape>
|
||||
</item>
|
||||
</layer-list>
|
||||
@@ -1,12 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:shape="oval">
|
||||
<size android:width="26dp" android:height="26dp"/>
|
||||
<corners android:radius="13dp" />
|
||||
<gradient
|
||||
android:angle="225"
|
||||
android:startColor="#FF0030"
|
||||
android:endColor="#CF2E00"
|
||||
android:type="linear" />
|
||||
|
||||
</shape>
|
||||
@@ -1,7 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:shape="rectangle">
|
||||
<gradient
|
||||
android:endColor="#660043FF"
|
||||
android:startColor="#0028345E" />
|
||||
</shape>
|
||||
@@ -1,7 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:shape="rectangle">
|
||||
<gradient
|
||||
android:endColor="#CC0043FF"
|
||||
android:startColor="#0028345E" />
|
||||
</shape>
|
||||
@@ -1,7 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:shape="rectangle">
|
||||
<stroke android:color="#A7B6F0" android:width="@dimen/dp_4"/>
|
||||
<solid android:color="#1AA7B6F0" />
|
||||
<corners android:radius="@dimen/dp_13"/>
|
||||
</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">
|
||||
<gradient android:startColor="#029DFF" android:endColor="#F00056FF"/>
|
||||
<corners android:radius="@dimen/dp_13"/>
|
||||
</shape>
|
||||
@@ -1,12 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:shape="line">
|
||||
<stroke
|
||||
android:width="6dp"
|
||||
android:dashGap="5dp"
|
||||
android:dashWidth="5dp"
|
||||
android:color="@color/bus_current_station_notice_text_color" />
|
||||
<gradient
|
||||
android:startColor="#f00"
|
||||
android:endColor="#0f0" />
|
||||
</shape>
|
||||
@@ -1,11 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item
|
||||
android:left="-600dp"
|
||||
android:right="-600dp">
|
||||
<rotate
|
||||
android:drawable="@drawable/bus_station_green_dash_line"
|
||||
android:visible="true"
|
||||
android:fromDegrees="90" />
|
||||
</item>
|
||||
</layer-list>
|
||||
@@ -1,11 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item>
|
||||
<shape android:shape="rectangle">
|
||||
|
||||
<corners android:bottomLeftRadius="40dp"
|
||||
android:bottomRightRadius="40dp"/>
|
||||
<gradient android:angle="180" android:endColor="#004DFF" android:startColor="#20AAFF" />
|
||||
</shape>
|
||||
</item>
|
||||
</selector>
|
||||
@@ -1,10 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:shape="rectangle">
|
||||
<corners android:radius="24dp" />
|
||||
<gradient
|
||||
android:angle="0"
|
||||
android:endColor="#0056FF"
|
||||
android:startColor="#029DFF"
|
||||
android:type="linear" />
|
||||
</shape>
|
||||
@@ -1,9 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:shape="rectangle">
|
||||
|
||||
<corners android:radius="@dimen/bus_switch_image_circle" />
|
||||
|
||||
<solid android:color="@color/bus_switch_map_bg_c" />
|
||||
|
||||
</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">
|
||||
<corners android:radius="@dimen/dp_20"></corners>
|
||||
<solid android:color="@color/bus_task_time_bg_color"></solid>
|
||||
</shape>
|
||||