[6.3.0]
[添加小智V2N消息]
@@ -63,8 +63,7 @@
|
||||
android:id="@+id/zv_msg_pop_bottom"
|
||||
android:layout_width="@dimen/dp_240"
|
||||
android:layout_height="@dimen/dp_240"
|
||||
android:layout_marginBottom="-20dp"
|
||||
app:layout_constraintBottom_toTopOf="@+id/bb_boorombar"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent" />
|
||||
|
||||
<!--消息盒子气泡视图-->
|
||||
|
||||
@@ -9,7 +9,10 @@ import chassis.VehicleStateOuterClass
|
||||
import com.amap.api.maps.model.LatLng
|
||||
import com.google.gson.reflect.TypeToken
|
||||
import com.mogo.eagle.core.data.enums.DataSourceType
|
||||
import com.mogo.eagle.core.data.enums.EventTypeEnumNew
|
||||
import com.mogo.eagle.core.data.map.MogoLocation
|
||||
import com.mogo.eagle.core.function.api.hmi.xiaozhi.event.V2N
|
||||
import com.mogo.eagle.core.function.api.hmi.xiaozhi.state.State
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListenerManager
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotStatisticsListenerManager
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerChassisDoorStateListenerManager
|
||||
@@ -18,6 +21,7 @@ import com.mogo.eagle.core.function.call.autopilot.CallerChassisLamplightListene
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerChassisLocationGCJ02ListenerManager
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerPlanningActionsListenerManager
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerPlanningRottingListenerManager
|
||||
import com.mogo.eagle.core.function.call.hmi.CallerHmiManager
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant
|
||||
import com.mogo.eagle.core.utilcode.util.ActivityUtils
|
||||
@@ -50,6 +54,7 @@ object DebugDataDispatch {
|
||||
const val stateAutopilot = "stateAutopilot"
|
||||
const val stateAutopilotFail = "stateAutopilotFail"
|
||||
const val stopSite = "stopSite"
|
||||
const val v2N = "xiaozhiV2N"
|
||||
|
||||
// adb shell am broadcast -a com.mogo.launcher.debug -f 0x011000000 --es type "location" --es path "1111/11111"
|
||||
// adb shell am broadcast -a com.mogo.launcher.debug -f 0x011000000 --es type "globalPath" --es path "sy73.json"
|
||||
@@ -60,6 +65,7 @@ object DebugDataDispatch {
|
||||
// adb shell am broadcast -a com.mogo.launcher.debug -f 0x011000000 --es type "stateAutopilotFail"
|
||||
// adb shell am broadcast -a com.mogo.launcher.debug -f 0x011000000 --es type "trajectoryStation" --ef startLon 116.74053643938474 --ef startLat 40.200487993233246 --ef endLon 116.73876977409685 --ef endLat 40.20179054129441 --el lineID 8
|
||||
// adb shell am broadcast -a com.mogo.launcher.debug -f 0x011000000 --es type "stopSite" --ei state 6 --ei action 1
|
||||
// adb shell am broadcast -a com.mogo.launcher.debug -f 0x011000000 --es type "xiaozhiV2N" --es poiType "10002" --ei state 0
|
||||
|
||||
|
||||
val ROOT_PATH =
|
||||
@@ -161,6 +167,17 @@ object DebugDataDispatch {
|
||||
pncAction.parkScenarioAction = planningaction.build()
|
||||
CallerPlanningActionsListenerManager.invokePNCActions(pncAction.build())
|
||||
}
|
||||
v2N ->{
|
||||
val state = intent.getIntExtra("state", 0)
|
||||
val poiType = intent.getStringExtra("poiType")
|
||||
poiType?.let {
|
||||
if(state==0){
|
||||
CallerHmiManager.notifyXiaoZhiStatusChanged(V2N(EventTypeEnumNew.valueOf(poiType)), State.START)
|
||||
}else{
|
||||
CallerHmiManager.notifyXiaoZhiStatusChanged(V2N(EventTypeEnumNew.valueOf(poiType)), State.STOP)
|
||||
}
|
||||
}
|
||||
}
|
||||
else -> {}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,338 @@
|
||||
package com.mogo.och.common.module.manager.xiaozhimanager
|
||||
|
||||
import com.mogo.eagle.core.data.enums.EventTypeEnumNew
|
||||
import com.mogo.eagle.core.function.api.hmi.xiaozhi.event.Event
|
||||
import com.mogo.eagle.core.function.api.hmi.xiaozhi.event.V2N
|
||||
import com.mogo.eagle.core.function.api.hmi.xiaozhi.listener.OnXiaoZhiStateChangeListener
|
||||
import com.mogo.eagle.core.function.api.hmi.xiaozhi.state.State
|
||||
import com.mogo.eagle.core.function.call.hmi.CallerHmiManager
|
||||
import com.mogo.och.common.module.R
|
||||
|
||||
object ZhiV2NManager : OnXiaoZhiStateChangeListener {
|
||||
init {
|
||||
CallerHmiManager.registerXiaoZhiStatusChangeListener(this)
|
||||
}
|
||||
|
||||
override fun onChanged(event: Event, state: State) {
|
||||
if (event is V2N) {
|
||||
var drawable: Int? = null
|
||||
when (event.type) {
|
||||
EventTypeEnumNew.TRAFFIC_CHECK -> {
|
||||
drawable = R.drawable.xiaozhi_event_qfjtjc
|
||||
}
|
||||
|
||||
EventTypeEnumNew.ROAD_CLOSED -> {
|
||||
drawable = R.drawable.xiaozhi_event_qffl
|
||||
}
|
||||
|
||||
EventTypeEnumNew.FOURS_ROAD_WORK -> {
|
||||
drawable = R.drawable.xiaozhi_event_qfsg
|
||||
}
|
||||
|
||||
EventTypeEnumNew.FOURS_BLOCK_UP -> {
|
||||
drawable = R.drawable.xiaozhi_event_qfdlyd
|
||||
}
|
||||
|
||||
EventTypeEnumNew.FOURS_PONDING -> {
|
||||
drawable = R.drawable.xiaozhi_event_xxxr
|
||||
}
|
||||
|
||||
EventTypeEnumNew.FOURS_ICE -> {
|
||||
drawable = R.drawable.xiaozhi_event_dljb
|
||||
}
|
||||
|
||||
EventTypeEnumNew.FOURS_ACCIDENT -> {
|
||||
drawable = R.drawable.xiaozhi_event_jtsg
|
||||
}
|
||||
|
||||
EventTypeEnumNew.FOURS_ACCIDENT_01 -> {
|
||||
drawable = R.drawable.xiaozhi_event_jtsg
|
||||
}
|
||||
|
||||
EventTypeEnumNew.FOURS_ACCIDENT_02 -> {
|
||||
drawable = R.drawable.xiaozhi_event_jtsg
|
||||
}
|
||||
|
||||
EventTypeEnumNew.FOURS_ACCIDENT_03 -> {
|
||||
drawable = R.drawable.xiaozhi_event_jtsg
|
||||
}
|
||||
|
||||
EventTypeEnumNew.FOURS_ACCIDENT_04 -> {
|
||||
drawable = R.drawable.xiaozhi_event_jtsg
|
||||
}
|
||||
|
||||
EventTypeEnumNew.FOURS_ACCIDENT_05 -> {
|
||||
drawable = R.drawable.xiaozhi_event_jtsg
|
||||
}
|
||||
|
||||
EventTypeEnumNew.FOURS_LIVING -> {
|
||||
//实时路况
|
||||
}
|
||||
|
||||
EventTypeEnumNew.ILLEGAL_PARK_LIVING -> {
|
||||
//违章停车
|
||||
}
|
||||
|
||||
EventTypeEnumNew.ROAD_SLIPPERY -> {
|
||||
//路面湿滑
|
||||
}
|
||||
|
||||
EventTypeEnumNew.GHOST_PROBE -> {
|
||||
drawable = R.drawable.xiaozhi_event_rxhd
|
||||
}
|
||||
|
||||
EventTypeEnumNew.TAKE_OVER_EVENT -> {
|
||||
drawable = R.drawable.xiaozhi_event_yccltx
|
||||
}
|
||||
|
||||
EventTypeEnumNew.NETWORK_WEAK_EVENT -> {
|
||||
drawable = R.drawable.xiaozhi_event_yccltx
|
||||
}
|
||||
|
||||
EventTypeEnumNew.ALERT_FRONT_CAR -> {
|
||||
//前方预警
|
||||
}
|
||||
|
||||
EventTypeEnumNew.ALERT_TRAFFIC_CONTROL -> {
|
||||
//限行管理
|
||||
}
|
||||
|
||||
EventTypeEnumNew.ALERT_TRAFFIC_LIGHT_SUGGEST -> {
|
||||
|
||||
}
|
||||
|
||||
EventTypeEnumNew.ALERT_TRAFFIC_LIGHT_WARNING -> {
|
||||
//红绿灯
|
||||
}
|
||||
|
||||
EventTypeEnumNew.ALERT_CAR_TROUBLE_WARNING -> {
|
||||
//故障车辆
|
||||
}
|
||||
|
||||
EventTypeEnumNew.ALERT_FATIGUE_DRIVING -> {
|
||||
//疲劳驾驶
|
||||
}
|
||||
|
||||
EventTypeEnumNew.ALERT_ILLEGAL_PARK -> {
|
||||
//违章停车
|
||||
}
|
||||
|
||||
EventTypeEnumNew.TYPE_USECASE_OPTIMAL_LANE -> {
|
||||
|
||||
}
|
||||
|
||||
EventTypeEnumNew.TYPE_USECASE_ID_FCW -> {
|
||||
|
||||
}
|
||||
|
||||
EventTypeEnumNew.TYPE_USECASE_ID_ICW -> {
|
||||
//R.drawable.xiaozhi_event_
|
||||
}
|
||||
|
||||
EventTypeEnumNew.TYPE_USECASE_ID_LTA -> {
|
||||
//R.drawable.xiaozhi_event_
|
||||
}
|
||||
|
||||
EventTypeEnumNew.TYPE_USECASE_ID_BSW -> {
|
||||
drawable = R.drawable.xiaozhi_event_mqpzyj
|
||||
}
|
||||
|
||||
EventTypeEnumNew.TYPE_USECASE_ID_LCW -> {
|
||||
drawable = R.drawable.xiaozhi_event_bdpzyj
|
||||
}
|
||||
|
||||
EventTypeEnumNew.TYPE_USECASE_ID_DNPW -> {
|
||||
drawable = R.drawable.xiaozhi_event_nxccyj
|
||||
}
|
||||
|
||||
EventTypeEnumNew.TYPE_USECASE_ID_EBW -> {
|
||||
drawable = R.drawable.xiaozhi_event_qxjs
|
||||
}
|
||||
|
||||
EventTypeEnumNew.TYPE_USECASE_ID_AVW -> {
|
||||
drawable = R.drawable.xiaozhi_event_yccltx
|
||||
}
|
||||
|
||||
EventTypeEnumNew.TYPE_USECASE_ID_CLW -> {
|
||||
drawable = R.drawable.xiaozhi_event_clskyj
|
||||
}
|
||||
|
||||
EventTypeEnumNew.TYPE_USECASE_ID_EVW -> {
|
||||
//R.drawable.xiaozhi_event_
|
||||
}
|
||||
|
||||
EventTypeEnumNew.TYPE_USECASE_ID_VRUCW_MOTOR_VEHICLES -> {
|
||||
drawable = R.drawable.xiaozhi_event_mtcpzyj
|
||||
}
|
||||
|
||||
EventTypeEnumNew.TYPE_USECASE_ID_VRUCW_NOT_MOTOR_VEHICLES -> {
|
||||
//R.drawable.xiaozhi_event_
|
||||
}
|
||||
|
||||
EventTypeEnumNew.TYPE_USECASE_ID_VRUCW_PERSON -> {
|
||||
drawable = R.drawable.xiaozhi_event_rxhd
|
||||
}
|
||||
|
||||
EventTypeEnumNew.TYPE_ERROR_WEAKNESS -> {
|
||||
//R.drawable.xiaozhi_event_
|
||||
}
|
||||
|
||||
EventTypeEnumNew.TYPE_USECASE_ID_IVP_RED -> {
|
||||
drawable = R.drawable.xiaozhi_event_chdyj
|
||||
}
|
||||
|
||||
EventTypeEnumNew.TYPE_USECASE_ID_IVP_GREEN -> {
|
||||
drawable = R.drawable.xiaozhi_event_chdyj
|
||||
}
|
||||
|
||||
EventTypeEnumNew.TYPE_USECASE_ID_BREAKDOWN_WARNING -> {
|
||||
drawable = R.drawable.xiaozhi_event_clskyj
|
||||
}
|
||||
|
||||
EventTypeEnumNew.TYPE_FOURS_PONDING -> {
|
||||
drawable = R.drawable.xiaozhi_event_dljs
|
||||
}
|
||||
|
||||
EventTypeEnumNew.TYPE_USECASE_ID_ROAD_PARKING -> {
|
||||
drawable = R.drawable.xiaozhi_event_jztc
|
||||
}
|
||||
|
||||
EventTypeEnumNew.TYPE_USECASE_ID_TJW -> {
|
||||
drawable = R.drawable.xiaozhi_event_qfdlyd
|
||||
}
|
||||
|
||||
EventTypeEnumNew.TYPE_USECASE_ID_SLW -> {
|
||||
drawable = R.drawable.xiaozhi_event_clcs
|
||||
}
|
||||
|
||||
EventTypeEnumNew.TYPE_USECASE_ID_ROAD_VEHICLE_RETROGRADE -> {
|
||||
//R.drawable.xiaozhi_event_
|
||||
}
|
||||
|
||||
EventTypeEnumNew.TYPE_USECASE_ID_ROAD_SPEED_LIMIT -> {
|
||||
drawable = R.drawable.xiaozhi_event_clcs
|
||||
}
|
||||
|
||||
EventTypeEnumNew.TYPE_ID_SHAPR_TURNS -> {
|
||||
drawable = R.drawable.xiaozhi_event_zzjw
|
||||
}
|
||||
|
||||
EventTypeEnumNew.TYPE_ID_BRIDGE -> {
|
||||
drawable = R.drawable.xiaozhi_event_tfq
|
||||
}
|
||||
|
||||
EventTypeEnumNew.TYPE_ID_PEDESTRIAN -> {
|
||||
drawable = R.drawable.xiaozhi_event_rxhd
|
||||
}
|
||||
|
||||
EventTypeEnumNew.TYPE_ID_SLIPPERY_ROAD -> {
|
||||
drawable = R.drawable.xiaozhi_event_dljb
|
||||
}
|
||||
|
||||
EventTypeEnumNew.TYPE_ID_TUNNEL -> {
|
||||
//R.drawable.xiaozhi_event_
|
||||
}
|
||||
|
||||
EventTypeEnumNew.TYPE_ID_FERRY -> {
|
||||
//R.drawable.xiaozhi_event_
|
||||
}
|
||||
|
||||
EventTypeEnumNew.TYPE_ID_UNEVEN_ROAD -> {
|
||||
drawable = R.drawable.xiaozhi_event_dlkw
|
||||
}
|
||||
|
||||
EventTypeEnumNew.TYPE_ID_NON_MOTOR_VEHICLE -> {
|
||||
//R.drawable.xiaozhi_event_
|
||||
}
|
||||
|
||||
EventTypeEnumNew.TYPE_ID_OBSTACLE -> {
|
||||
//R.drawable.xiaozhi_event_
|
||||
}
|
||||
|
||||
EventTypeEnumNew.TYPE_FOURS_ROAD_WORK -> {
|
||||
drawable = R.drawable.xiaozhi_event_qfsg
|
||||
}
|
||||
|
||||
EventTypeEnumNew.TYPE_VEHICLE_QUEUE -> {
|
||||
//R.drawable.xiaozhi_event_
|
||||
}
|
||||
|
||||
EventTypeEnumNew.TYPE_NO_PASSING -> {
|
||||
drawable = R.drawable.xiaozhi_event_qffl
|
||||
}
|
||||
|
||||
EventTypeEnumNew.TYPE_NO_TURNING_AROUND -> {
|
||||
//R.drawable.xiaozhi_event_
|
||||
}
|
||||
|
||||
EventTypeEnumNew.TYPE_USECASE_ID_ROAD_NO_PARKING -> {
|
||||
drawable = R.drawable.xiaozhi_event_jztc
|
||||
}
|
||||
|
||||
EventTypeEnumNew.TYPE_USECASE_ID_ROAD_NO_TOOTING -> {
|
||||
drawable = R.drawable.xiaozhi_event_jzmd
|
||||
}
|
||||
|
||||
EventTypeEnumNew.TYPE_USECASE_ID_BUS_WARNING -> {
|
||||
drawable = R.drawable.xiaozhi_event_ygdc
|
||||
}
|
||||
|
||||
EventTypeEnumNew.TYPE_USECASE_ID_NARROW_RIGHT -> {
|
||||
//R.drawable.xiaozhi_event_
|
||||
}
|
||||
|
||||
EventTypeEnumNew.TYPE_USECASE_ID_GAS_STATION -> {
|
||||
drawable = R.drawable.xiaozhi_event_qfjyz
|
||||
}
|
||||
|
||||
EventTypeEnumNew.TYPE_USECASE_ID_ROAD_PEDESTRIAN_SCHOOL -> {
|
||||
drawable = R.drawable.xiaozhi_event_qfxx
|
||||
}
|
||||
|
||||
EventTypeEnumNew.TYPE_USECASE_ID_ACCIDENT -> {
|
||||
drawable = R.drawable.xiaozhi_event_jtsg
|
||||
}
|
||||
|
||||
EventTypeEnumNew.TYPE_ATTENTION_CONFLUENCE -> {
|
||||
//R.drawable.xiaozhi_event_
|
||||
}
|
||||
|
||||
EventTypeEnumNew.TYPE_PEDESTRIAN_CROSSING -> {
|
||||
drawable = R.drawable.xiaozhi_event_rxhd
|
||||
}
|
||||
|
||||
EventTypeEnumNew.TYPE_SOCKET_ROAD_CONGESTION -> {
|
||||
drawable = R.drawable.xiaozhi_event_qfdlyd
|
||||
}
|
||||
|
||||
EventTypeEnumNew.TYPE_SOCKET_ROAD_JINGZHI -> {
|
||||
drawable = R.drawable.xiaozhi_event_clskyj
|
||||
}
|
||||
|
||||
EventTypeEnumNew.TYPE_SOCKET_ROAD_SHIGU -> {
|
||||
drawable = R.drawable.xiaozhi_event_yccltx
|
||||
}
|
||||
|
||||
EventTypeEnumNew.TYPE_SOCKET_ROAD_SHIGONG -> {
|
||||
drawable = R.drawable.xiaozhi_event_qfsg
|
||||
}
|
||||
|
||||
else -> {
|
||||
|
||||
}
|
||||
}
|
||||
if (drawable != null) {
|
||||
if(state==State.START){
|
||||
ZhiViewmanager.warnAni.drawable = drawable
|
||||
ZhiViewmanager.showListeningAni(ZhiViewmanager.warnAni,true)
|
||||
}else if(state==State.STOP){
|
||||
ZhiViewmanager.stopWarnAni()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fun load() {
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,20 +1,34 @@
|
||||
package com.mogo.och.common.module.manager.xiaozhimanager
|
||||
|
||||
import android.animation.ObjectAnimator
|
||||
import android.animation.ValueAnimator
|
||||
import android.content.Context
|
||||
import android.util.AttributeSet
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import android.view.animation.LinearInterpolator
|
||||
import androidx.appcompat.widget.AppCompatImageView
|
||||
import androidx.constraintlayout.widget.ConstraintLayout
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger
|
||||
import com.mogo.och.common.module.R
|
||||
import com.mogo.och.common.module.utils.FrameAnimatorContainer
|
||||
import com.mogo.tts.base.zhi.CallbackWidget
|
||||
import com.mogo.tts.base.zhi.ZhiRecordWinUi
|
||||
import kotlinx.android.synthetic.main.common_xiaozhi.view.aciv_v2n_event
|
||||
import kotlinx.android.synthetic.main.common_xiaozhi.view.aciv_xiaozhi
|
||||
import java.util.concurrent.ArrayBlockingQueue
|
||||
import java.util.concurrent.atomic.AtomicBoolean
|
||||
|
||||
class ZhiView @JvmOverloads constructor(
|
||||
context: Context,
|
||||
attrs: AttributeSet? = null,
|
||||
defStyleAttr: Int = 0
|
||||
) : AppCompatImageView(context, attrs, defStyleAttr), ZhiViewmanager.IViewCallback {
|
||||
class ZhiView : ConstraintLayout, ZhiViewmanager.IViewCallback {
|
||||
|
||||
constructor(context: Context) : super(context)
|
||||
|
||||
constructor(context: Context, attributeSet: AttributeSet) : super(context, attributeSet)
|
||||
|
||||
constructor(context: Context, attributeSet: AttributeSet, defStyleAttr: Int) : super(context, attributeSet, defStyleAttr)
|
||||
|
||||
constructor(context: Context, attributeSet: AttributeSet, defStyleAttr: Int, defStyleRes: Int) : super(context, attributeSet, defStyleAttr, defStyleRes)
|
||||
|
||||
companion object {
|
||||
const val TAG = "ZhiView"
|
||||
}
|
||||
@@ -25,14 +39,19 @@ class ZhiView @JvmOverloads constructor(
|
||||
|
||||
private var currentAnim:FrameAnimatorContainer? = null
|
||||
|
||||
init {
|
||||
private var animator:ObjectAnimator?=null
|
||||
|
||||
|
||||
private fun initView() {
|
||||
LayoutInflater.from(context).inflate(R.layout.common_xiaozhi, this, true)
|
||||
setOnClickListener {
|
||||
ZhiStateManager.weakUpXiaoZhi()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
override fun setFirstPlayAni(initAni: ZhiViewmanager.AniData,aniListener:FrameAnimatorContainer.OnAnimationStoppedListener){
|
||||
currentAnim = FrameAnimatorContainer(initAni.aniArrayId, 12,this)
|
||||
currentAnim = FrameAnimatorContainer(initAni.aniArrayId, 12,aciv_xiaozhi)
|
||||
currentAnim?.isOnce = initAni.isOnce
|
||||
currentAnim?.sequence = initAni.sequence
|
||||
currentAnim?.setFtp(initAni.fps)
|
||||
@@ -41,6 +60,7 @@ class ZhiView @JvmOverloads constructor(
|
||||
}
|
||||
|
||||
override fun setNewPlayData(currentPalyingAni: ZhiViewmanager.AniData) {
|
||||
handleV2NEvent(currentPalyingAni)
|
||||
currentAnim?.setData(currentPalyingAni.aniList)
|
||||
currentAnim?.isOnce = currentPalyingAni.isOnce
|
||||
currentAnim?.sequence = currentPalyingAni.sequence
|
||||
@@ -48,6 +68,7 @@ class ZhiView @JvmOverloads constructor(
|
||||
}
|
||||
|
||||
override fun changeAniImmediately(currentPalyingAni: ZhiViewmanager.AniData) {
|
||||
handleV2NEvent(currentPalyingAni)
|
||||
currentAnim?.setData(currentPalyingAni.aniList)
|
||||
currentAnim?.isOnce = currentPalyingAni.isOnce
|
||||
currentAnim?.sequence = currentPalyingAni.sequence
|
||||
@@ -55,6 +76,30 @@ class ZhiView @JvmOverloads constructor(
|
||||
currentAnim?.reStart()
|
||||
}
|
||||
|
||||
fun handleV2NEvent(currentPalyingAni: ZhiViewmanager.AniData){
|
||||
if(currentPalyingAni==ZhiViewmanager.warnAni||currentPalyingAni==ZhiViewmanager.normal2warnAni){
|
||||
currentPalyingAni.drawable?.let {
|
||||
aciv_v2n_event.setImageResource(it)
|
||||
if(animator!=null){
|
||||
animator?.cancel()
|
||||
animator = null
|
||||
}
|
||||
animator = ObjectAnimator.ofFloat(aciv_v2n_event, "alpha", 0f, 1f,0f)
|
||||
animator?.duration = 2000
|
||||
animator?.repeatCount = -1
|
||||
animator?.repeatMode = ValueAnimator.RESTART
|
||||
animator?.interpolator = LinearInterpolator()
|
||||
animator?.start()
|
||||
}
|
||||
}else{
|
||||
if(animator!=null){
|
||||
animator?.cancel()
|
||||
aciv_v2n_event.alpha = 0f
|
||||
animator = null
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
override fun restartAni() {
|
||||
currentAnim?.reStart()
|
||||
@@ -70,4 +115,12 @@ class ZhiView @JvmOverloads constructor(
|
||||
ZhiViewmanager.removeListener()
|
||||
}
|
||||
|
||||
init {
|
||||
try {
|
||||
initView()
|
||||
} catch (e: Exception) {
|
||||
e.printStackTrace()
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -11,14 +11,23 @@ object ZhiViewmanager {
|
||||
|
||||
private var iViewCallbacks: IViewCallback? = null
|
||||
|
||||
val normalAni = AniData(1, R.array.xiaozhi_normal, false, true,12)
|
||||
val listenerAni = AniData(2,R.array.xiaozhi_think,false,true,12)
|
||||
val normalAni = AniData(AniType.normal, R.array.xiaozhi_normal, false, true,12)
|
||||
val listenerAni = AniData(AniType.listener,R.array.xiaozhi_think,false,true,12)
|
||||
|
||||
val listener2Normal = AniData(3, R.array.xiaozhi_think_normal, true, false,24)
|
||||
val normal2Listener = AniData(4, R.array.xiaozhi_think_normal, true, true,24)
|
||||
val listener2Normal = AniData(AniType.listener2Normal, R.array.xiaozhi_think_normal, true, false,24)
|
||||
val normal2Listener = AniData(AniType.normal2Listener, R.array.xiaozhi_think_normal, true, true,24)
|
||||
|
||||
val beltAni = AniData(5, R.array.xiaozhi_belt, false, true,12)
|
||||
val loveAni = AniData(6, R.array.xiaozhi_love, false, true,12)
|
||||
val beltAni = AniData(AniType.beltAni, R.array.xiaozhi_belt, false, true,12)
|
||||
val loveAni = AniData(AniType.loveAni, R.array.xiaozhi_love, false, true,12)
|
||||
|
||||
val warnAni = AniData(AniType.warnAni, R.array.xiaozhi_warn, false, true,12)
|
||||
val normal2warnAni = AniData(AniType.normal2warnAni, R.array.xiaozhi_normal_warn, false, true,12)
|
||||
val warn2normalAni = AniData(AniType.warn2normalAni, R.array.xiaozhi_normal_warn, false, false,12)
|
||||
|
||||
|
||||
enum class AniType{
|
||||
normal,listener,listener2Normal,normal2Listener,beltAni,loveAni,warnAni,normal2warnAni,warn2normalAni
|
||||
}
|
||||
|
||||
private var initAni = normalAni
|
||||
private var currentAni: AniData? = null
|
||||
@@ -27,6 +36,7 @@ object ZhiViewmanager {
|
||||
|
||||
|
||||
fun addDistanceListener(listener: IViewCallback) {
|
||||
ZhiV2NManager.load()
|
||||
this.iViewCallbacks = listener
|
||||
this.currentAni = initAni
|
||||
listener.setFirstPlayAni(initAni,
|
||||
@@ -34,7 +44,7 @@ object ZhiViewmanager {
|
||||
override fun playOnce() {
|
||||
CallerLogger.d(TAG, "播放完一遍动画")
|
||||
var nextPlay = readQueue.poll()
|
||||
CallerLogger.d(TAG, "获取下一个动画${Thread.currentThread().name}--${nextPlay?.id}-${readQueue.size}")
|
||||
CallerLogger.d(TAG, "获取下一个动画${Thread.currentThread().name}--${nextPlay?.aniType}-${readQueue.size}")
|
||||
if(nextPlay == currentAni){
|
||||
return
|
||||
}
|
||||
@@ -50,7 +60,7 @@ object ZhiViewmanager {
|
||||
}else{
|
||||
// 有设置新的动画
|
||||
currentAni = nextPlay
|
||||
CallerLogger.d(TAG, "切换动画${nextPlay.id}")
|
||||
CallerLogger.d(TAG, "切换动画${nextPlay.aniType}")
|
||||
iViewCallbacks?.setNewPlayData(nextPlay)
|
||||
}
|
||||
}
|
||||
@@ -71,61 +81,90 @@ object ZhiViewmanager {
|
||||
if(lastAni==null){
|
||||
lastAni = currentAni
|
||||
}
|
||||
if(lastAni?.id==aniData.id){
|
||||
if(lastAni?.aniType==aniData.aniType){
|
||||
return
|
||||
}
|
||||
when (lastAni?.id) {
|
||||
1 -> {//正在播放默认动画
|
||||
if(aniData.id==2){
|
||||
when (lastAni?.aniType) {
|
||||
AniType.normal -> {//正在播放默认动画
|
||||
if(aniData.aniType==AniType.listener) {// 要播放倾听中动画
|
||||
iViewCallbacks?.changeAniImmediately(normal2Listener)
|
||||
currentAni = normal2Listener
|
||||
CallerLogger.d(TAG, "立刻播放${Thread.currentThread().name}--${normal2Listener.id}-${readQueue.size}")
|
||||
CallerLogger.d(TAG, "立刻播放${Thread.currentThread().name}--${normal2Listener.aniType}-${readQueue.size}")
|
||||
readQueue.offer(aniData)
|
||||
CallerLogger.d(TAG, "排队播放${Thread.currentThread().name}--${aniData.id}-${readQueue.size}")
|
||||
CallerLogger.d(TAG, "排队播放${Thread.currentThread().name}--${aniData.aniType}-${readQueue.size}")
|
||||
}else if (aniData.aniType==AniType.warnAni){
|
||||
iViewCallbacks?.changeAniImmediately(normal2warnAni)
|
||||
currentAni = normal2warnAni
|
||||
CallerLogger.d(TAG, "立刻播放${Thread.currentThread().name}--${normal2warnAni.aniType}-${readQueue.size}")
|
||||
readQueue.offer(aniData)
|
||||
CallerLogger.d(TAG, "排队播放${Thread.currentThread().name}--${aniData.aniType}-${readQueue.size}")
|
||||
}else{
|
||||
if(immediately){
|
||||
iViewCallbacks?.changeAniImmediately(aniData)
|
||||
currentAni = aniData
|
||||
CallerLogger.d(TAG, "立刻播放${Thread.currentThread().name}--${aniData.id}-${readQueue.size}")
|
||||
CallerLogger.d(TAG, "立刻播放${Thread.currentThread().name}--${aniData.aniType}-${readQueue.size}")
|
||||
}else{
|
||||
readQueue.offer(aniData)
|
||||
CallerLogger.d(TAG, "排队播放${Thread.currentThread().name}--${aniData.id}-${readQueue.size}")
|
||||
CallerLogger.d(TAG, "排队播放${Thread.currentThread().name}--${aniData.aniType}-${readQueue.size}")
|
||||
}
|
||||
}
|
||||
}
|
||||
2 -> {// 正在播放倾听中动画
|
||||
if(aniData.id==1){
|
||||
AniType.listener -> {// 正在播放倾听中动画
|
||||
if(aniData.aniType==AniType.normal){
|
||||
iViewCallbacks?.changeAniImmediately(listener2Normal)
|
||||
currentAni = listener2Normal
|
||||
CallerLogger.d(TAG, "立刻播放${Thread.currentThread().name}--${listener2Normal.id}-${readQueue.size}")
|
||||
CallerLogger.d(TAG, "立刻播放${Thread.currentThread().name}--${listener2Normal.aniType}-${readQueue.size}")
|
||||
readQueue.offer(aniData)
|
||||
CallerLogger.d(TAG, "排队播放${Thread.currentThread().name}--${aniData.id}-${readQueue.size}")
|
||||
CallerLogger.d(TAG, "排队播放${Thread.currentThread().name}--${aniData.aniType}-${readQueue.size}")
|
||||
}else{
|
||||
if(immediately){
|
||||
iViewCallbacks?.changeAniImmediately(aniData)
|
||||
currentAni = aniData
|
||||
CallerLogger.d(TAG, "立刻播放${Thread.currentThread().name}--${aniData.id}-${readQueue.size}")
|
||||
CallerLogger.d(TAG, "立刻播放${Thread.currentThread().name}--${aniData.aniType}-${readQueue.size}")
|
||||
}else{
|
||||
readQueue.offer(aniData)
|
||||
CallerLogger.d(TAG, "排队播放${Thread.currentThread().name}--${aniData.id}-${readQueue.size}")
|
||||
CallerLogger.d(TAG, "排队播放${Thread.currentThread().name}--${aniData.aniType}-${readQueue.size}")
|
||||
}
|
||||
}
|
||||
}
|
||||
AniType.warnAni -> {
|
||||
if(aniData.aniType==AniType.normal){
|
||||
iViewCallbacks?.changeAniImmediately(warn2normalAni)
|
||||
currentAni = warn2normalAni
|
||||
CallerLogger.d(TAG, "立刻播放${Thread.currentThread().name}--${warn2normalAni.aniType}-${readQueue.size}")
|
||||
readQueue.offer(aniData)
|
||||
CallerLogger.d(TAG, "排队播放${Thread.currentThread().name}--${aniData.aniType}-${readQueue.size}")
|
||||
}else{
|
||||
if(immediately){
|
||||
iViewCallbacks?.changeAniImmediately(aniData)
|
||||
currentAni = aniData
|
||||
CallerLogger.d(TAG, "立刻播放${Thread.currentThread().name}--${aniData.aniType}-${readQueue.size}")
|
||||
}else{
|
||||
readQueue.offer(aniData)
|
||||
CallerLogger.d(TAG, "排队播放${Thread.currentThread().name}--${aniData.aniType}-${readQueue.size}")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
else -> {
|
||||
if(immediately){
|
||||
iViewCallbacks?.changeAniImmediately(aniData)
|
||||
currentAni = aniData
|
||||
CallerLogger.d(TAG, "立刻播放${Thread.currentThread().name}--${aniData.id}-${readQueue.size}")
|
||||
CallerLogger.d(TAG, "立刻播放${Thread.currentThread().name}--${aniData.aniType}-${readQueue.size}")
|
||||
} else {
|
||||
readQueue.offer(aniData)
|
||||
CallerLogger.d(TAG, "排队播放${Thread.currentThread().name}--${aniData.id}-${readQueue.size}")
|
||||
CallerLogger.d(TAG, "排队播放${Thread.currentThread().name}--${aniData.aniType}-${readQueue.size}")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
fun stopWarnAni() {
|
||||
if (currentAni == warnAni) {
|
||||
showListeningAni(normalAni)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
interface IViewCallback {
|
||||
fun setFirstPlayAni(
|
||||
@@ -139,11 +178,12 @@ object ZhiViewmanager {
|
||||
}
|
||||
|
||||
data class AniData(
|
||||
val id: Int,// 动画ID
|
||||
val aniType: AniType,// 动画ID
|
||||
val aniArrayId: Int,// 动画序列号
|
||||
val isOnce: Boolean,// true 只播一次 false 循环播放
|
||||
val sequence: Boolean,// true 正向播放 false 倒着播放
|
||||
val fps:Int
|
||||
val fps:Int,
|
||||
var drawable:Int?=null
|
||||
) {
|
||||
var aniList = FrameAnimatorContainer.getData(aniArrayId)
|
||||
}
|
||||
|
||||
BIN
OCH/common/common/src/main/res/xiaozhi/drawable-nodpi/xiaozhi_event_bdpzyj.png
Executable file
|
After Width: | Height: | Size: 724 B |
BIN
OCH/common/common/src/main/res/xiaozhi/drawable-nodpi/xiaozhi_event_chdyj.png
Executable file
|
After Width: | Height: | Size: 956 B |
BIN
OCH/common/common/src/main/res/xiaozhi/drawable-nodpi/xiaozhi_event_clcs.png
Executable file
|
After Width: | Height: | Size: 1.1 KiB |
BIN
OCH/common/common/src/main/res/xiaozhi/drawable-nodpi/xiaozhi_event_clskyj.png
Executable file
|
After Width: | Height: | Size: 1.1 KiB |
BIN
OCH/common/common/src/main/res/xiaozhi/drawable-nodpi/xiaozhi_event_clyk.png
Executable file
|
After Width: | Height: | Size: 964 B |
BIN
OCH/common/common/src/main/res/xiaozhi/drawable-nodpi/xiaozhi_event_dljb.png
Executable file
|
After Width: | Height: | Size: 1.2 KiB |
BIN
OCH/common/common/src/main/res/xiaozhi/drawable-nodpi/xiaozhi_event_dljs.png
Executable file
|
After Width: | Height: | Size: 1.1 KiB |
BIN
OCH/common/common/src/main/res/xiaozhi/drawable-nodpi/xiaozhi_event_dlkw.png
Executable file
|
After Width: | Height: | Size: 940 B |
BIN
OCH/common/common/src/main/res/xiaozhi/drawable-nodpi/xiaozhi_event_hd.png
Executable file
|
After Width: | Height: | Size: 999 B |
BIN
OCH/common/common/src/main/res/xiaozhi/drawable-nodpi/xiaozhi_event_jsrx.png
Executable file
|
After Width: | Height: | Size: 920 B |
BIN
OCH/common/common/src/main/res/xiaozhi/drawable-nodpi/xiaozhi_event_jtsg.png
Executable file
|
After Width: | Height: | Size: 1011 B |
BIN
OCH/common/common/src/main/res/xiaozhi/drawable-nodpi/xiaozhi_event_jzmd.png
Executable file
|
After Width: | Height: | Size: 1.3 KiB |
BIN
OCH/common/common/src/main/res/xiaozhi/drawable-nodpi/xiaozhi_event_jztc.png
Executable file
|
After Width: | Height: | Size: 1.3 KiB |
BIN
OCH/common/common/src/main/res/xiaozhi/drawable-nodpi/xiaozhi_event_ksld.png
Executable file
|
After Width: | Height: | Size: 1.4 KiB |
BIN
OCH/common/common/src/main/res/xiaozhi/drawable-nodpi/xiaozhi_event_mqpzyj.png
Executable file
|
After Width: | Height: | Size: 967 B |
BIN
OCH/common/common/src/main/res/xiaozhi/drawable-nodpi/xiaozhi_event_mtcpzyj.png
Executable file
|
After Width: | Height: | Size: 973 B |
BIN
OCH/common/common/src/main/res/xiaozhi/drawable-nodpi/xiaozhi_event_nxccyj.png
Executable file
|
After Width: | Height: | Size: 807 B |
BIN
OCH/common/common/src/main/res/xiaozhi/drawable-nodpi/xiaozhi_event_qfdlyd.png
Executable file
|
After Width: | Height: | Size: 904 B |
BIN
OCH/common/common/src/main/res/xiaozhi/drawable-nodpi/xiaozhi_event_qffl.png
Executable file
|
After Width: | Height: | Size: 1.1 KiB |
BIN
OCH/common/common/src/main/res/xiaozhi/drawable-nodpi/xiaozhi_event_qfjtjc.png
Executable file
|
After Width: | Height: | Size: 1005 B |
BIN
OCH/common/common/src/main/res/xiaozhi/drawable-nodpi/xiaozhi_event_qfjyz.png
Executable file
|
After Width: | Height: | Size: 910 B |
BIN
OCH/common/common/src/main/res/xiaozhi/drawable-nodpi/xiaozhi_event_qfsg.png
Executable file
|
After Width: | Height: | Size: 1.1 KiB |
BIN
OCH/common/common/src/main/res/xiaozhi/drawable-nodpi/xiaozhi_event_qfxx.png
Executable file
|
After Width: | Height: | Size: 733 B |
BIN
OCH/common/common/src/main/res/xiaozhi/drawable-nodpi/xiaozhi_event_qxjs.png
Executable file
|
After Width: | Height: | Size: 932 B |
BIN
OCH/common/common/src/main/res/xiaozhi/drawable-nodpi/xiaozhi_event_qxpzyj.png
Executable file
|
After Width: | Height: | Size: 1.3 KiB |
BIN
OCH/common/common/src/main/res/xiaozhi/drawable-nodpi/xiaozhi_event_rxhd.png
Executable file
|
After Width: | Height: | Size: 1.1 KiB |
BIN
OCH/common/common/src/main/res/xiaozhi/drawable-nodpi/xiaozhi_event_tfq.png
Executable file
|
After Width: | Height: | Size: 779 B |
BIN
OCH/common/common/src/main/res/xiaozhi/drawable-nodpi/xiaozhi_event_tsclyxtx.png
Executable file
|
After Width: | Height: | Size: 974 B |
BIN
OCH/common/common/src/main/res/xiaozhi/drawable-nodpi/xiaozhi_event_tzclyxtx.png
Executable file
|
After Width: | Height: | Size: 621 B |
BIN
OCH/common/common/src/main/res/xiaozhi/drawable-nodpi/xiaozhi_event_xxls.png
Executable file
|
After Width: | Height: | Size: 715 B |
BIN
OCH/common/common/src/main/res/xiaozhi/drawable-nodpi/xiaozhi_event_xxxr.png
Executable file
|
After Width: | Height: | Size: 1.1 KiB |
BIN
OCH/common/common/src/main/res/xiaozhi/drawable-nodpi/xiaozhi_event_yccltx.png
Executable file
|
After Width: | Height: | Size: 831 B |
BIN
OCH/common/common/src/main/res/xiaozhi/drawable-nodpi/xiaozhi_event_ygdc.png
Executable file
|
After Width: | Height: | Size: 968 B |
BIN
OCH/common/common/src/main/res/xiaozhi/drawable-nodpi/xiaozhi_event_yzjw.png
Executable file
|
After Width: | Height: | Size: 961 B |
BIN
OCH/common/common/src/main/res/xiaozhi/drawable-nodpi/xiaozhi_event_zzjw.png
Executable file
|
After Width: | Height: | Size: 991 B |
|
After Width: | Height: | Size: 21 KiB |
|
After Width: | Height: | Size: 21 KiB |
|
After Width: | Height: | Size: 22 KiB |
|
After Width: | Height: | Size: 22 KiB |
|
After Width: | Height: | Size: 22 KiB |
|
After Width: | Height: | Size: 22 KiB |
|
After Width: | Height: | Size: 22 KiB |
|
After Width: | Height: | Size: 22 KiB |
|
After Width: | Height: | Size: 21 KiB |
|
After Width: | Height: | Size: 23 KiB |
|
After Width: | Height: | Size: 23 KiB |
|
After Width: | Height: | Size: 23 KiB |
|
After Width: | Height: | Size: 23 KiB |
|
After Width: | Height: | Size: 23 KiB |
|
After Width: | Height: | Size: 22 KiB |
|
After Width: | Height: | Size: 22 KiB |
|
After Width: | Height: | Size: 22 KiB |
|
After Width: | Height: | Size: 22 KiB |
|
Before Width: | Height: | Size: 21 KiB After Width: | Height: | Size: 21 KiB |
|
Before Width: | Height: | Size: 21 KiB After Width: | Height: | Size: 21 KiB |
|
Before Width: | Height: | Size: 20 KiB After Width: | Height: | Size: 20 KiB |
|
Before Width: | Height: | Size: 21 KiB After Width: | Height: | Size: 21 KiB |
|
Before Width: | Height: | Size: 21 KiB After Width: | Height: | Size: 21 KiB |
|
Before Width: | Height: | Size: 21 KiB After Width: | Height: | Size: 21 KiB |
|
Before Width: | Height: | Size: 21 KiB After Width: | Height: | Size: 21 KiB |
|
Before Width: | Height: | Size: 22 KiB After Width: | Height: | Size: 22 KiB |
|
Before Width: | Height: | Size: 21 KiB After Width: | Height: | Size: 21 KiB |
|
Before Width: | Height: | Size: 21 KiB After Width: | Height: | Size: 21 KiB |
|
Before Width: | Height: | Size: 21 KiB After Width: | Height: | Size: 21 KiB |
|
Before Width: | Height: | Size: 20 KiB After Width: | Height: | Size: 20 KiB |
|
Before Width: | Height: | Size: 21 KiB After Width: | Height: | Size: 21 KiB |
|
Before Width: | Height: | Size: 21 KiB After Width: | Height: | Size: 21 KiB |
|
Before Width: | Height: | Size: 20 KiB After Width: | Height: | Size: 20 KiB |
|
Before Width: | Height: | Size: 20 KiB After Width: | Height: | Size: 20 KiB |
|
Before Width: | Height: | Size: 20 KiB After Width: | Height: | Size: 20 KiB |
|
Before Width: | Height: | Size: 20 KiB After Width: | Height: | Size: 20 KiB |
|
Before Width: | Height: | Size: 20 KiB After Width: | Height: | Size: 20 KiB |
|
Before Width: | Height: | Size: 20 KiB After Width: | Height: | Size: 20 KiB |
|
Before Width: | Height: | Size: 20 KiB After Width: | Height: | Size: 20 KiB |
|
Before Width: | Height: | Size: 21 KiB After Width: | Height: | Size: 21 KiB |
|
Before Width: | Height: | Size: 21 KiB After Width: | Height: | Size: 21 KiB |
|
Before Width: | Height: | Size: 21 KiB After Width: | Height: | Size: 21 KiB |
|
Before Width: | Height: | Size: 21 KiB After Width: | Height: | Size: 21 KiB |
|
Before Width: | Height: | Size: 21 KiB After Width: | Height: | Size: 21 KiB |
|
Before Width: | Height: | Size: 21 KiB After Width: | Height: | Size: 21 KiB |
|
Before Width: | Height: | Size: 21 KiB After Width: | Height: | Size: 21 KiB |
|
Before Width: | Height: | Size: 21 KiB After Width: | Height: | Size: 21 KiB |
|
Before Width: | Height: | Size: 21 KiB After Width: | Height: | Size: 21 KiB |
|
Before Width: | Height: | Size: 21 KiB After Width: | Height: | Size: 21 KiB |
|
Before Width: | Height: | Size: 21 KiB After Width: | Height: | Size: 21 KiB |
|
Before Width: | Height: | Size: 20 KiB After Width: | Height: | Size: 20 KiB |
|
Before Width: | Height: | Size: 20 KiB After Width: | Height: | Size: 20 KiB |
|
Before Width: | Height: | Size: 21 KiB After Width: | Height: | Size: 21 KiB |
|
Before Width: | Height: | Size: 20 KiB After Width: | Height: | Size: 20 KiB |
|
Before Width: | Height: | Size: 21 KiB After Width: | Height: | Size: 21 KiB |
|
Before Width: | Height: | Size: 21 KiB After Width: | Height: | Size: 21 KiB |
|
Before Width: | Height: | Size: 21 KiB After Width: | Height: | Size: 21 KiB |
|
Before Width: | Height: | Size: 21 KiB After Width: | Height: | Size: 21 KiB |
|
Before Width: | Height: | Size: 22 KiB After Width: | Height: | Size: 22 KiB |
|
Before Width: | Height: | Size: 21 KiB After Width: | Height: | Size: 21 KiB |