[m1]
[1.0.2] [添加loading]
This commit is contained in:
@@ -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()// 关闭暖风机
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<rotate xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:duration="1000"
|
||||
android:fromDegrees="0"
|
||||
android:pivotX="50%"
|
||||
android:pivotY="50%"
|
||||
android:repeatCount="-1"
|
||||
android:toDegrees="360" />
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 2.5 KiB |
Reference in New Issue
Block a user