新增一个动画

This commit is contained in:
level 2025-05-14 17:36:12 +08:00
parent 954ccfad39
commit 37e76ac5b9
3 changed files with 6761 additions and 3 deletions

View File

@ -23,6 +23,7 @@ import androidx.appcompat.widget.AppCompatImageView
import androidx.constraintlayout.widget.ConstraintLayout
import androidx.lifecycle.ViewModelProvider
import androidx.lifecycle.lifecycleScope
import com.airbnb.lottie.LottieAnimationView
import com.cncat.vpn.common.constants.Intents
import com.cncat.vpn.common.log.Log
import com.cncat.vpn.core.Clash
@ -88,6 +89,8 @@ class NewAccFragment : BaseFragment(), CoroutineScope by CoroutineScope(Dispatch
private lateinit var clickOnLink: ConstraintLayout
private lateinit var InTheLink: AppCompatImageView
private lateinit var ClickTheLink: TextView
private lateinit var lottieView: LottieAnimationView
override fun init(
titleBarRl: RelativeLayout,
backIv: ImageView,
@ -147,7 +150,9 @@ class NewAccFragment : BaseFragment(), CoroutineScope by CoroutineScope(Dispatch
clickOnLink=view.findViewById(R.id.clickOnLink)
InTheLink=view.findViewById(R.id.InTheLink)
ClickTheLink=view.findViewById(R.id.ClickTheLink)
lottieView=view.findViewById(R.id.lottieView)
lottieView.setAnimation(R.raw.mylinek)
lottieView.pauseAnimation()
clickOnLink.setOnClickListener {
if (clashRunning) {
val rxDialogSureCancel = RxDialogSureCancel(activity)
@ -169,7 +174,7 @@ class NewAccFragment : BaseFragment(), CoroutineScope by CoroutineScope(Dispatch
if(connectId!=-1){
accelerateViewModel.appStopStatus(connectId)
}
lottieView.pauseAnimation()
}
rxDialogSureCancel.show()
@ -247,11 +252,18 @@ class NewAccFragment : BaseFragment(), CoroutineScope by CoroutineScope(Dispatch
InTheLink.setImageResource(R.mipmap.ic_click)
ClickTheLink.text=requireActivity().resources.getString(R.string.CloseConnection)
}
launch(Dispatchers.Main){
lottieView.playAnimation()
}
}else{
clickOnLink.setBackgroundResource(R.drawable.home_circle_connecting)
InTheLink.setImageResource(R.mipmap.ic_click)
ClickTheLink.text=requireActivity().resources.getString(R.string.CloseConnection)
accelerateViewModel.appStartupStatus()
launch(Dispatchers.Main){
lottieView.playAnimation()
}
}
} catch (e: Exception) {
stop_u_timer()
@ -264,6 +276,9 @@ class NewAccFragment : BaseFragment(), CoroutineScope by CoroutineScope(Dispatch
InTheLink.setImageResource(R.mipmap.ic_click)
ClickTheLink.text=requireActivity().resources.getString(R.string.CloseConnection)
clickOnLink.setBackgroundResource(R.drawable.home_circle_connecting)
launch(Dispatchers.Main){
lottieView.playAnimation()
}
}
}

View File

@ -21,7 +21,13 @@
android:layout_marginStart="50dp"
android:layout_marginEnd="50dp"
>
<com.airbnb.lottie.LottieAnimationView
android:id="@+id/lottieView"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:lottie_autoPlay="true"
app:lottie_loop="true"
/>
<TextView
android:id="@+id/ClickTheLink"

File diff suppressed because it is too large Load Diff