[5.0.0]
[帧动画抽取]
This commit is contained in:
@@ -15,6 +15,8 @@ import com.mogo.eagle.core.function.view.SiteMarkerBean
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.Companion.M_BUS_P
|
||||
import com.mogo.eagle.core.utilcode.util.UiThreadHandler
|
||||
import com.mogo.map.listener.IMogoMapListener
|
||||
import com.mogo.map.listener.MogoMapListenerHandler
|
||||
import com.mogo.map.uicontroller.VisualAngleMode
|
||||
import com.mogo.och.bus.passenger.R
|
||||
import com.mogo.och.bus.passenger.bean.event.EventLineSites
|
||||
@@ -37,7 +39,7 @@ import java.lang.ref.WeakReference
|
||||
* @author: wangmingjun
|
||||
* @date: 2022/4/12
|
||||
*/
|
||||
class MainFragment : MvpFragment<MainFragment?, BusPassengerPresenter?>() {
|
||||
class MainFragment : MvpFragment<MainFragment?, BusPassengerPresenter?>(), IMogoMapListener {
|
||||
|
||||
private var bpFunctionGroupDialogFragment: WeakReference<M1ContainFragment>? = null
|
||||
private var m1CarUserNoOrderFragment: WeakReference<M1CarUserNoOrderFragment>? = null
|
||||
@@ -139,6 +141,7 @@ class MainFragment : MvpFragment<MainFragment?, BusPassengerPresenter?>() {
|
||||
mapBizView.getUI().changeMapVisualAngle(VisualAngleMode.MODE_MEDIUM_SIGHT, null)
|
||||
mapBizView.getUI().changeZoom2(0.8f)
|
||||
}
|
||||
MogoMapListenerHandler.mogoMapListenerHandler.registerHostMapListener(TAG, this)
|
||||
}
|
||||
|
||||
fun setCarMode(type: Int) {
|
||||
@@ -240,6 +243,11 @@ class MainFragment : MvpFragment<MainFragment?, BusPassengerPresenter?>() {
|
||||
EventBus.getDefault().unregister(this)
|
||||
}
|
||||
|
||||
override fun onMapLoaded() {
|
||||
super.onMapLoaded()
|
||||
getMapUIController()?.setAllGesturesEnabled(false)
|
||||
}
|
||||
|
||||
fun showOpenAndCloseDoor() {
|
||||
val bpFunctionGroup = bpFunctionGroupDialogFragment?.get()
|
||||
bpFunctionGroup?.dismissAllowingStateLoss()
|
||||
|
||||
@@ -11,7 +11,7 @@ import android.view.View
|
||||
import androidx.constraintlayout.widget.ConstraintLayout
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger
|
||||
import com.mogo.och.bus.passenger.R
|
||||
import com.mogo.och.taxi.passenger.widget.animutils.AnimationsContainer
|
||||
import com.mogo.och.common.module.utils.FrameAnimatorContainer
|
||||
import kotlinx.android.synthetic.main.m1_devices_lock_unlock.view.aciv_screen_lock
|
||||
import kotlinx.android.synthetic.main.m1_devices_lock_unlock.view.aciv_screen_lock_bg
|
||||
import kotlinx.android.synthetic.main.m1_devices_lock_unlock.view.aciv_screen_unlock_ani
|
||||
@@ -30,7 +30,7 @@ class LockAndUnlockView : ConstraintLayout, LockManager.LockStatusCallback {
|
||||
|
||||
val TAG = "UnLockView"
|
||||
|
||||
private var animations: AnimationsContainer? = null
|
||||
private var animations: FrameAnimatorContainer? = null
|
||||
private var downType: DownType = DownType.NONE
|
||||
|
||||
private var handler: Handler?=null
|
||||
@@ -55,9 +55,9 @@ class LockAndUnlockView : ConstraintLayout, LockManager.LockStatusCallback {
|
||||
super.onAttachedToWindow()
|
||||
LockManager.setAutoStatusCallback(TAG, this)
|
||||
aciv_screen_unlock_ani?.let {
|
||||
animations = AnimationsContainer(R.array.openlock, 24, it)
|
||||
animations = FrameAnimatorContainer(R.array.openlock, 24, it,initFirstFrame = false)
|
||||
animations!!.setOnAnimStopListener(object :
|
||||
AnimationsContainer.OnAnimationStoppedListener {
|
||||
FrameAnimatorContainer.OnAnimationStoppedListener {
|
||||
override fun AnimationStopped() {
|
||||
it.setImageDrawable(null)
|
||||
}
|
||||
|
||||
@@ -32,6 +32,7 @@
|
||||
android:id="@+id/aciv_screen_unlock_ani"
|
||||
android:layout_width="@dimen/dp_90"
|
||||
android:layout_height="@dimen/dp_90"
|
||||
android:src="@drawable/open_lock_000"
|
||||
app:layout_constraintTop_toTopOf="@+id/aciv_screen_lock_bg"
|
||||
app:layout_constraintBottom_toBottomOf="@+id/aciv_screen_lock_bg"
|
||||
app:layout_constraintStart_toStartOf="@+id/aciv_screen_lock_bg"
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.mogo.och.taxi.passenger.widget.animutils
|
||||
package com.mogo.och.common.module.utils
|
||||
|
||||
import android.graphics.Bitmap
|
||||
import android.graphics.BitmapFactory
|
||||
@@ -9,7 +9,7 @@ import android.widget.ImageView
|
||||
import com.mogo.commons.AbsMogoApplication
|
||||
import java.lang.ref.SoftReference
|
||||
|
||||
class AnimationsContainer(resId: Int, fps: Int, imageView: ImageView) {
|
||||
class FrameAnimatorContainer (resId: Int, fps: Int, imageView: ImageView,initFirstFrame:Boolean = true){
|
||||
private lateinit var mFrames: IntArray // 帧数组
|
||||
private var mIndex = 0 // 当前帧
|
||||
private var mShouldRun = false // 开始/停止播放用
|
||||
@@ -22,10 +22,10 @@ class AnimationsContainer(resId: Int, fps: Int, imageView: ImageView) {
|
||||
private var mBitmapOptions: BitmapFactory.Options? = null //Bitmap管理类,可有效减少Bitmap的OOM问题
|
||||
|
||||
init {
|
||||
createAnimation(imageView, getData(resId), fps)
|
||||
createAnimation(imageView, getData(resId), fps,initFirstFrame)
|
||||
}
|
||||
|
||||
private fun createAnimation(imageView: ImageView, frames: IntArray, fps: Int) {
|
||||
private fun createAnimation(imageView: ImageView, frames: IntArray, fps: Int, initFirstFrame:Boolean) {
|
||||
mHandler = Handler(Looper.myLooper()!!)
|
||||
mFrames = frames
|
||||
mIndex = -1
|
||||
@@ -33,7 +33,9 @@ class AnimationsContainer(resId: Int, fps: Int, imageView: ImageView) {
|
||||
mShouldRun = false
|
||||
mIsRunning = false
|
||||
mDelayMillis = 1000 / fps //帧动画时间间隔,毫秒
|
||||
imageView.setImageResource(mFrames[0])
|
||||
if(initFirstFrame) {
|
||||
imageView.setImageResource(mFrames[0])
|
||||
}
|
||||
|
||||
// 当图片大小类型相同时进行复用,避免频繁GC
|
||||
val bmp = (imageView.drawable as BitmapDrawable).bitmap
|
||||
Reference in New Issue
Block a user