Commit ddccacbb authored by wanglei's avatar wanglei

...

parent f78e32f5
......@@ -174,7 +174,7 @@ object WeatherUtils {
/**
* 同步
*/
fun getWeatherData() {
fun getWeatherData() = runCatching {
val client = OkHttpClient.Builder().apply {
if (BuildConfig.DEBUG) {
addInterceptor(HttpLoggingInterceptor().apply {
......
......@@ -100,7 +100,6 @@ class Splash2Activity : BaseActivity<ActivitySplash2Binding>(),
val weatherCityBean = WeatherUtils.getWeatherEntity()
val weather = weatherCityBean?.list?.random()
if (weather != null) {
launch(Dispatchers.Main) {
LogEx.logDebug(TAG, "weather 开始 ${weather.fxDate}")
......@@ -147,25 +146,27 @@ class Splash2Activity : BaseActivity<ActivitySplash2Binding>(),
}
}
} else {
if (isAgree) {
AnimationUtils.startAlphaAnimation(binding.pb, 400, null) {
callback.invoke()
}
} else {
AnimationUtils.startAlphaAnimation(binding.idTvStart, 400, {
val set1 = AnimatorSet()
// 创建缩放动画的ObjectAnimator
val scaleUpAnimator1 = ObjectAnimator.ofFloat(binding.idTvStart, "scaleX", 1f, 0.95f, 1.05f)
val scaleUpAnimator2 = ObjectAnimator.ofFloat(binding.idTvStart, "scaleY", 1f, 0.95f, 1.05f)
scaleUpAnimator1.duration = 400 // 动画持续500毫秒
scaleUpAnimator1.repeatCount = 1 // 重复次数
scaleUpAnimator1.repeatMode = ValueAnimator.REVERSE // 反向重复,实现缩小效果
scaleUpAnimator2.duration = 400 // 动画持续500毫秒
scaleUpAnimator2.repeatCount = 1 // 重复次数
set1.playTogether(scaleUpAnimator1, scaleUpAnimator2)
set1.start()
}) {
callback.invoke()
launch(Dispatchers.Main) {
if (isAgree) {
AnimationUtils.startAlphaAnimation(binding.pb, 400, null) {
callback.invoke()
}
} else {
AnimationUtils.startAlphaAnimation(binding.idTvStart, 400, {
val set1 = AnimatorSet()
// 创建缩放动画的ObjectAnimator
val scaleUpAnimator1 = ObjectAnimator.ofFloat(binding.idTvStart, "scaleX", 1f, 0.95f, 1.05f)
val scaleUpAnimator2 = ObjectAnimator.ofFloat(binding.idTvStart, "scaleY", 1f, 0.95f, 1.05f)
scaleUpAnimator1.duration = 400 // 动画持续500毫秒
scaleUpAnimator1.repeatCount = 1 // 重复次数
scaleUpAnimator1.repeatMode = ValueAnimator.REVERSE // 反向重复,实现缩小效果
scaleUpAnimator2.duration = 400 // 动画持续500毫秒
scaleUpAnimator2.repeatCount = 1 // 重复次数
set1.playTogether(scaleUpAnimator1, scaleUpAnimator2)
set1.start()
}) {
callback.invoke()
}
}
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment