diff --git a/OCH/common/common/src/main/java/com/mogo/och/common/module/utils/BigFrameAnimatorContainer.kt b/OCH/common/common/src/main/java/com/mogo/och/common/module/utils/BigFrameAnimatorContainer.kt index 22c8cf6ca2..5644803bfd 100644 --- a/OCH/common/common/src/main/java/com/mogo/och/common/module/utils/BigFrameAnimatorContainer.kt +++ b/OCH/common/common/src/main/java/com/mogo/och/common/module/utils/BigFrameAnimatorContainer.kt @@ -135,7 +135,15 @@ class BigFrameAnimatorContainer (resId: Int, while (true) { val startTime = System.currentTimeMillis() val (bitmap1, options) = writeQueue.take() - val index: Int = next + mIndex++ + if (mIndex >= mFrames.size){ + mIndex = 0 + if(isOnce){ + stop() + return@submit + } + } + val index: Int = mIndex val imageRes: Int = mFrames[index] var bitmap: Bitmap? = null try { @@ -169,11 +177,29 @@ class BigFrameAnimatorContainer (resId: Int, @Synchronized fun reStart(){ + resetQueue() mIndex = 0 mIsRunning = false start() } + private fun resetQueue(){ + val temp = mutableListOf>() + + val writeIterator = writeQueue.iterator() + while (writeIterator.hasNext()) { + temp.add(writeIterator.next()) + } + + val readIterator = readQueue.iterator() + while (readIterator.hasNext()) { + temp.add(readIterator.next()) + } + for (pair in temp) { + writeQueue.add(pair) + } + } + fun release(){ mShouldRun = false decodeImage?.cancel(true) diff --git a/OCH/taxi/unmanned-passenger/src/main/java/com/mogo/och/taxi/passenger/ui/checkstartautopilot/ChekAndStartAutopilotView.kt b/OCH/taxi/unmanned-passenger/src/main/java/com/mogo/och/taxi/passenger/ui/checkstartautopilot/ChekAndStartAutopilotView.kt index 7c57146120..414277180c 100644 --- a/OCH/taxi/unmanned-passenger/src/main/java/com/mogo/och/taxi/passenger/ui/checkstartautopilot/ChekAndStartAutopilotView.kt +++ b/OCH/taxi/unmanned-passenger/src/main/java/com/mogo/och/taxi/passenger/ui/checkstartautopilot/ChekAndStartAutopilotView.kt @@ -49,8 +49,6 @@ class ChekAndStartAutopilotView : WindowRelativeLayout, private fun initView(context: Context) { d(SceneConstant.M_TAXI_P + TAG, "initView") LayoutInflater.from(context).inflate(R.layout.taxt_u_p_check_startautopilot, this, true) - aniCheck2StartAutopilotView = - BigFrameAnimatorContainer(R.array.check2startautopilt, 32, aciv_check_autopilot, false) startAutopilotClose.onClick { visibility = View.GONE @@ -60,9 +58,10 @@ class ChekAndStartAutopilotView : WindowRelativeLayout, override fun onVisibilityAggregated(isVisible: Boolean) { super.onVisibilityAggregated(isVisible) if (isVisible) { - //aniCheck2StartAutopilotView?.start() + aniCheck2StartAutopilotView = + BigFrameAnimatorContainer(R.array.check2startautopilt, 39, aciv_check_autopilot, true) } else { - //aniCheck2StartAutopilotView?.stop() + aniCheck2StartAutopilotView = null } } @@ -105,6 +104,7 @@ class ChekAndStartAutopilotView : WindowRelativeLayout, checkPhoneNumber.visibility = View.GONE startAutopilotView.visibility = View.VISIBLE startAutopilotClose.visibility = View.VISIBLE + aniCheck2StartAutopilotView?.start() } } \ No newline at end of file