Commit ddccacbb authored by wanglei's avatar wanglei

...

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