[taxi-u-p]
[专场动画]
This commit is contained in:
yangyakun
2023-12-18 22:22:34 +08:00
parent 0b1bf2ff91
commit bb428607cc
2 changed files with 31 additions and 5 deletions

View File

@@ -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<Pair<Bitmap, BitmapFactory.Options>>()
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)

View File

@@ -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()
}
}