diff --git a/OCH/mogo-och-bus-passenger/src/m1/java/com/mogo/och/bus/passenger/ui/BusPassengerFunctionSoftFragment.kt b/OCH/mogo-och-bus-passenger/src/m1/java/com/mogo/och/bus/passenger/ui/BusPassengerFunctionSoftFragment.kt index 7609d3c5b6..c68675ac85 100644 --- a/OCH/mogo-och-bus-passenger/src/m1/java/com/mogo/och/bus/passenger/ui/BusPassengerFunctionSoftFragment.kt +++ b/OCH/mogo-och-bus-passenger/src/m1/java/com/mogo/och/bus/passenger/ui/BusPassengerFunctionSoftFragment.kt @@ -10,6 +10,9 @@ import android.media.AudioManager import android.os.Bundle import android.view.Gravity import android.view.View +import android.view.animation.Animation +import android.view.animation.AnimationUtils +import android.view.animation.LinearInterpolator import android.widget.RadioButton import android.widget.SeekBar import android.widget.SeekBar.OnSeekBarChangeListener @@ -39,6 +42,7 @@ import kotlinx.android.synthetic.m1.bus_p_function_setting_soft_fragment.* import me.jessyan.autosize.utils.AutoSizeUtils import java.util.concurrent.TimeUnit + /** * @author: yangyakun * @date: 2023/1/28 @@ -55,8 +59,14 @@ class BusPassengerFunctionSoftFragment : private var subscribeLightTop1: Disposable? = null private var subscribeLightTop2: Disposable? = null private var subscribeAtmosphere: Disposable? = null + private var subscribeAnimator: Disposable? = null private var animator1: ObjectAnimator? = null + private val loadingAni = ObjectAnimator.ofFloat(iv_loading, "rotation", 0f, 90f ,180f, 270f, 360f).apply { + repeatCount = -1 + interpolator = LinearInterpolator() + duration = 1000 + } override fun initViews() { @@ -66,16 +76,21 @@ class BusPassengerFunctionSoftFragment : g_aircondition_setting.visibility = View.VISIBLE g_light_setting.visibility = View.GONE g_voice_setting.visibility = View.GONE + if(loadingAni.isRunning){ + iv_loading.visibility = View.VISIBLE + } } R.id.tv_setting_lighting -> { g_light_setting.visibility = View.VISIBLE g_voice_setting.visibility = View.GONE g_aircondition_setting.visibility = View.GONE + iv_loading.visibility = View.GONE } R.id.tv_setting_voice -> { g_voice_setting.visibility = View.VISIBLE g_aircondition_setting.visibility = View.GONE g_light_setting.visibility = View.GONE + iv_loading.visibility = View.GONE } else -> {} } @@ -100,6 +115,18 @@ class BusPassengerFunctionSoftFragment : } } + fun showAni(){ + iv_loading.visibility = View.VISIBLE + loadingAni.start() + g_aircondition_setting.visibility = View.GONE + subscribeAnimator = Observable.timer(5000, TimeUnit.MILLISECONDS) + .observeOn(AndroidSchedulers.mainThread()) + .subscribe { + loadingAni.cancel() + iv_loading.visibility = View.GONE + g_aircondition_setting.visibility = View.VISIBLE + } + } private fun setAirconditionListener() { // 开关空调或暖风机 tv_aircondition_switch.setOnCheckedChangeListener { buttonView, isChecked -> @@ -114,6 +141,7 @@ class BusPassengerFunctionSoftFragment : } else { openAircondition()// 打开空调 } + showAni() }else{// 关闭 tv_aircondition_switch.setText("打开空调") closeHeater()// 关闭暖风机 diff --git a/OCH/mogo-och-bus-passenger/src/m1/res/anim/bus_p_loading_rotate.xml b/OCH/mogo-och-bus-passenger/src/m1/res/anim/bus_p_loading_rotate.xml new file mode 100644 index 0000000000..a0d7903789 --- /dev/null +++ b/OCH/mogo-och-bus-passenger/src/m1/res/anim/bus_p_loading_rotate.xml @@ -0,0 +1,8 @@ + + \ No newline at end of file diff --git a/OCH/mogo-och-bus-passenger/src/m1/res/drawable-nodpi/bus_p_loading.png b/OCH/mogo-och-bus-passenger/src/m1/res/drawable-nodpi/bus_p_loading.png new file mode 100644 index 0000000000..ca42ea6abb Binary files /dev/null and b/OCH/mogo-och-bus-passenger/src/m1/res/drawable-nodpi/bus_p_loading.png differ