[6.3.0]
[decode线程 release]
This commit is contained in:
@@ -131,38 +131,40 @@ class BigFrameAnimatorContainer (resId: Int,
|
||||
writeQueue.add(Pair(mBitmap,mBitmapOptions))
|
||||
}
|
||||
|
||||
decodeImage = ThreadUtils.getIoPool().submit {
|
||||
while (true) {
|
||||
val startTime = System.currentTimeMillis()
|
||||
val (bitmap1, options) = writeQueue.take()
|
||||
mIndex++
|
||||
if (mIndex >= mFrames.size){
|
||||
mIndex = 0
|
||||
if(isOnce){
|
||||
stop()
|
||||
return@submit
|
||||
decodeImage = OCHThreadPoolManager.getsInstance().submit(object: Runnable{
|
||||
override fun run() {
|
||||
while (true) {
|
||||
val startTime = System.currentTimeMillis()
|
||||
val (bitmap1, options) = writeQueue.take()
|
||||
mIndex++
|
||||
if (mIndex >= mFrames.size){
|
||||
mIndex = 0
|
||||
if(isOnce){
|
||||
stop()
|
||||
return
|
||||
}
|
||||
}
|
||||
val index: Int = mIndex
|
||||
val imageRes: Int = mFrames[index]
|
||||
var bitmap: Bitmap? = null
|
||||
try {
|
||||
bitmap = BitmapFactory.decodeResource(
|
||||
imageView.resources,
|
||||
imageRes,
|
||||
options
|
||||
)
|
||||
options.inBitmap = bitmap
|
||||
} catch (e: Exception) {
|
||||
e.printStackTrace()
|
||||
}
|
||||
if (bitmap != null) {
|
||||
readQueue.put(Pair(bitmap, options))
|
||||
}
|
||||
val dexTime = System.currentTimeMillis() - startTime
|
||||
CallerLogger.d(TAG, "decode用时:${dexTime}ms index ${index}")
|
||||
}
|
||||
}
|
||||
val index: Int = mIndex
|
||||
val imageRes: Int = mFrames[index]
|
||||
var bitmap: Bitmap? = null
|
||||
try {
|
||||
bitmap = BitmapFactory.decodeResource(
|
||||
imageView.resources,
|
||||
imageRes,
|
||||
options
|
||||
)
|
||||
options.inBitmap = bitmap
|
||||
} catch (e: Exception) {
|
||||
e.printStackTrace()
|
||||
}
|
||||
if (bitmap != null) {
|
||||
readQueue.put(Pair(bitmap, options))
|
||||
}
|
||||
val dexTime = System.currentTimeMillis() - startTime
|
||||
CallerLogger.d(TAG, "decode用时:${dexTime}ms index ${index}")
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
//循环读取下一帧
|
||||
|
||||
@@ -73,6 +73,8 @@ class ArrivedView : WindowRelativeLayout, ArrivedViewModel.ArrivedViewCallback {
|
||||
ZhiViewmanager.showListeningAni(ZhiViewmanager.loveAni)
|
||||
} else {
|
||||
v_video_right_rear_view.resetView()
|
||||
taxiPxiaozhiLove?.stop()
|
||||
taxiPxiaozhiLove?.release()
|
||||
taxiPxiaozhiLove = null
|
||||
RxUtils.disposeSubscribe(subscribe)
|
||||
ZhiViewmanager.showListeningAni(ZhiViewmanager.normalAni)
|
||||
|
||||
@@ -17,6 +17,7 @@ import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger
|
||||
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.ThreadUtils
|
||||
import com.mogo.eagle.core.utilcode.util.UiThreadHandler
|
||||
import com.mogo.och.common.module.manager.xiaozhimanager.ZhiViewmanager
|
||||
import com.mogo.och.common.module.utils.BigFrameAnimatorContainer
|
||||
import com.mogo.och.common.module.utils.RxUtils
|
||||
@@ -88,6 +89,8 @@ class ChekAndStartAutopilotView : WindowRelativeLayout,
|
||||
aciv_start_autopilt_success_ani.alpha = 0f
|
||||
d(SceneConstant.M_TAXI_P + TAG, "透明度${aciv_start_autopilt_success_bg.alpha}---${aciv_start_autopilt_success_ani.alpha}")
|
||||
} else {
|
||||
aniCheck2StartAutopilotView?.stop()
|
||||
aniCheck2StartAutopilotView?.release()
|
||||
aniCheck2StartAutopilotView = null
|
||||
ZhiViewmanager.showListeningAni(ZhiViewmanager.normalAni)
|
||||
}
|
||||
@@ -168,15 +171,9 @@ class ChekAndStartAutopilotView : WindowRelativeLayout,
|
||||
// 启动公司logo动画
|
||||
startAnimal()
|
||||
}else {
|
||||
waitCount++
|
||||
if(waitCount<maxWaitCount) {
|
||||
RxUtils.createSubscribe(1000) {
|
||||
aniCheckAndStartAutopilot(false, 2)
|
||||
}
|
||||
}else{
|
||||
waitCount = 0
|
||||
UiThreadHandler.postDelayed({
|
||||
startAnimal()
|
||||
}
|
||||
}, 2000)
|
||||
}
|
||||
return
|
||||
}
|
||||
@@ -198,7 +195,7 @@ class ChekAndStartAutopilotView : WindowRelativeLayout,
|
||||
d(SceneConstant.M_TAXI_P + TAG, "透明度${aciv_start_autopilt_success_bg.alpha}---${aciv_start_autopilt_success_ani.alpha}")
|
||||
}
|
||||
override fun onAnimationStart(animation: Animator) {
|
||||
RxUtils.createSubscribe(350) {
|
||||
UiThreadHandler.postDelayed({
|
||||
val aniStartAutopilotSuccessAni =
|
||||
BigFrameAnimatorContainer(R.array.taxi_p_start_autopilot_fail, 20, aciv_start_autopilt_success_ani, true)
|
||||
aniStartAutopilotSuccessAni.setOnAnimStopListener(object :
|
||||
@@ -209,7 +206,8 @@ class ChekAndStartAutopilotView : WindowRelativeLayout,
|
||||
startAutopilotView.visibility = View.GONE
|
||||
startAutopilotClose.visibility = View.GONE
|
||||
|
||||
this@ChekAndStartAutopilotView.animate().alpha(0f).setListener(object: AnimatorListenerAdapter() {
|
||||
this@ChekAndStartAutopilotView.animate().alpha(0f).setListener(object :
|
||||
AnimatorListenerAdapter() {
|
||||
override fun onAnimationEnd(animation: Animator) {
|
||||
super.onAnimationEnd(animation)
|
||||
this@ChekAndStartAutopilotView.visibility = View.GONE
|
||||
@@ -225,12 +223,11 @@ class ChekAndStartAutopilotView : WindowRelativeLayout,
|
||||
aciv_start_autopilt_success_ani.alpha = 0f
|
||||
d(SceneConstant.M_TAXI_P + TAG, "透明度${aciv_start_autopilt_success_bg.alpha}---${aciv_start_autopilt_success_ani.alpha}")
|
||||
}
|
||||
}).duration=1000L
|
||||
}).duration = 1000L
|
||||
}
|
||||
}
|
||||
})
|
||||
aniStartAutopilotSuccessAni.start()
|
||||
}
|
||||
aniStartAutopilotSuccessAni.start()},350)
|
||||
}
|
||||
})
|
||||
animatorSetCompat.start()
|
||||
|
||||
@@ -15,9 +15,9 @@ import com.mogo.eagle.core.utilcode.kotlin.onClick
|
||||
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.ThreadUtils
|
||||
import com.mogo.eagle.core.utilcode.util.UiThreadHandler
|
||||
import com.mogo.och.common.module.manager.xiaozhimanager.ZhiViewmanager
|
||||
import com.mogo.och.common.module.utils.BigFrameAnimatorContainer
|
||||
import com.mogo.och.common.module.utils.RxUtils
|
||||
import com.mogo.och.taxi.passenger.R
|
||||
import com.mogo.och.taxi.passenger.widget.WindowRelativeLayout
|
||||
import kotlinx.android.synthetic.main.taxt_u_p_check_startautopilot.view.aciv_check_autopilot
|
||||
@@ -88,6 +88,8 @@ class ChekAndStartAutopilotView : WindowRelativeLayout,
|
||||
aciv_start_autopilt_success_ani.alpha = 0f
|
||||
d(SceneConstant.M_TAXI_P + TAG, "透明度${aciv_start_autopilt_success_bg.alpha}---${aciv_start_autopilt_success_ani.alpha}")
|
||||
} else {
|
||||
aniCheck2StartAutopilotView?.stop()
|
||||
aniCheck2StartAutopilotView?.release()
|
||||
aniCheck2StartAutopilotView = null
|
||||
ZhiViewmanager.showListeningAni(ZhiViewmanager.normalAni)
|
||||
}
|
||||
@@ -167,15 +169,9 @@ class ChekAndStartAutopilotView : WindowRelativeLayout,
|
||||
// 启动公司logo动画
|
||||
startAnimal()
|
||||
}else {
|
||||
waitCount++
|
||||
if(waitCount<maxWaitCount) {
|
||||
RxUtils.createSubscribe(1000) {
|
||||
aniCheckAndStartAutopilot(false, 2)
|
||||
}
|
||||
}else{
|
||||
waitCount = 0
|
||||
UiThreadHandler.postDelayed({
|
||||
startAnimal()
|
||||
}
|
||||
}, 2000)
|
||||
}
|
||||
}
|
||||
else -> {}
|
||||
@@ -196,7 +192,7 @@ class ChekAndStartAutopilotView : WindowRelativeLayout,
|
||||
d(SceneConstant.M_TAXI_P + TAG, "透明度${aciv_start_autopilt_success_bg.alpha}---${aciv_start_autopilt_success_ani.alpha}")
|
||||
}
|
||||
override fun onAnimationStart(animation: Animator) {
|
||||
RxUtils.createSubscribe(350) {
|
||||
UiThreadHandler.postDelayed({
|
||||
val aniStartAutopilotSuccessAni =
|
||||
BigFrameAnimatorContainer(R.array.taxi_p_start_autopilot_fail, 20, aciv_start_autopilt_success_ani, true)
|
||||
aniStartAutopilotSuccessAni.setOnAnimStopListener(object :
|
||||
@@ -228,8 +224,7 @@ class ChekAndStartAutopilotView : WindowRelativeLayout,
|
||||
}
|
||||
}
|
||||
})
|
||||
aniStartAutopilotSuccessAni.start()
|
||||
}
|
||||
aniStartAutopilotSuccessAni.start()},350)
|
||||
}
|
||||
})
|
||||
animatorSetCompat.start()
|
||||
|
||||
Reference in New Issue
Block a user