Commit 1f651ced authored by wanglei's avatar wanglei

Merge remote-tracking branch 'origin/master'

parents d5f23876 506dfa5e
......@@ -165,7 +165,7 @@ object NotificationUiUtil {
bigRemoteViews.setTextViewText(R.id.tv_wendu_now, Random.nextInt(min, max).toString())
bigRemoteViews.setTextViewText(R.id.tv_day_desc, if (isDayOrNight()) subBean.textDay else subBean.textNight)
bigRemoteViews.setTextViewText(R.id.tv_weather_info, "$min℃/$max℃ ${formatATime()}")
sendNotificationUI(context, actionId, bigRemoteViews, bigRemoteViews)
sendNotificationUI(context, actionId, bigRemoteViews, smallRemoteViews)
}
else -> {
......
......@@ -3,12 +3,14 @@ package com.base.browserwhite.ui.activity.webbrowser
import android.animation.Animator
import android.animation.AnimatorSet
import android.animation.ObjectAnimator
import android.animation.ValueAnimator
import android.annotation.SuppressLint
import android.app.Dialog
import android.content.Context
import android.net.Uri
import android.net.http.SslError
import android.view.View
import android.view.animation.AccelerateDecelerateInterpolator
import android.view.animation.AccelerateInterpolator
import android.view.animation.DecelerateInterpolator
import android.view.animation.LinearInterpolator
......@@ -124,100 +126,20 @@ class WebViewFragment : BaseFragment<FragmentWebViewBinding>() {
// 掉落位置
val dropTranslationY = (-button.height * 3).toFloat()
val dropTranslationY1 = (-button.height * 2).toFloat()
// 回弹高度
val bounceHeight = -30f
button.isVisible = downloadList.isNotEmpty()
val animator = ValueAnimator.ofFloat(dropTranslationY, startTranslationY, dropTranslationY1 ,startTranslationY)
animator.interpolator = AccelerateDecelerateInterpolator()
animator.duration = 3000
animator.addUpdateListener { animation ->
// 更新按钮的位置
button.translationY = animation.animatedValue as Float
}
animator.start()
// 创建掉落动画
val dropAnimator =
ObjectAnimator.ofFloat(button, "translationY", startTranslationY, dropTranslationY)
dropAnimator.setDuration(1000)
dropAnimator.interpolator = LinearInterpolator()
// 创建第一次回弹动画
val bounceUpAnimator = ObjectAnimator.ofFloat(
button,
"translationY",
dropTranslationY,
dropTranslationY + bounceHeight
)
bounceUpAnimator.setDuration(600)
bounceUpAnimator.interpolator = DecelerateInterpolator()
// 创建第一次回弹后下落动画
val bounceDownAnimator = ObjectAnimator.ofFloat(
button,
"translationY",
dropTranslationY + bounceHeight,
dropTranslationY
)
bounceDownAnimator.setDuration(600)
bounceDownAnimator.interpolator = AccelerateInterpolator()
// 创建第二次回弹动画
val secondBounceUpAnimator = ObjectAnimator.ofFloat(
button,
"translationY",
dropTranslationY,
startTranslationY + bounceHeight
)
secondBounceUpAnimator.setDuration(600)
secondBounceUpAnimator.interpolator = DecelerateInterpolator()
// 创建第二次回弹后下落动画
val secondBounceDownAnimator = ObjectAnimator.ofFloat(
button,
"translationY",
startTranslationY + bounceHeight,
startTranslationY
)
secondBounceDownAnimator.setDuration(600)
secondBounceDownAnimator.interpolator = LinearInterpolator()
// 创建动画集合
val bounceSet = AnimatorSet()
bounceSet.playSequentially(
bounceUpAnimator,
bounceDownAnimator,
secondBounceUpAnimator,
secondBounceDownAnimator
)
// 监听第一次回弹动画结束,开始第二次回弹动画
bounceUpAnimator.addListener(object : Animator.AnimatorListener {
override fun onAnimationStart(animation: Animator) {
binding.flDownload.isVisible = downloadList.isNotEmpty()
}
override fun onAnimationEnd(animation: Animator) {
secondBounceUpAnimator.start()
}
override fun onAnimationCancel(animation: Animator) {
}
override fun onAnimationRepeat(animation: Animator) {
}
})
// 启动掉落动画,然后开始回弹动画
dropAnimator.addListener(object : Animator.AnimatorListener {
override fun onAnimationStart(animation: Animator) {
}
override fun onAnimationEnd(animation: Animator) {
bounceUpAnimator.start()
}
override fun onAnimationCancel(animation: Animator) {
}
override fun onAnimationRepeat(animation: Animator) {
}
})
// 启动动画
dropAnimator.start()
}
fun reloadWebView() {
......@@ -422,7 +344,6 @@ class WebViewFragment : BaseFragment<FragmentWebViewBinding>() {
downloadAdapter?.notifyDataSetChanged()
}
}
}
......
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