Browse Source

feat: splash

tongmengxiao 5 months ago
parent
commit
24fbbe0648

+ 17 - 0
app/src/main/res/layout/activity_splash.xml

@@ -3,10 +3,27 @@
     xmlns:tools="http://schemas.android.com/tools"
     android:layout_width="match_parent"
     android:layout_height="match_parent"
+    xmlns:app="http://schemas.android.com/apk/res-auto"
     tools:context=".SplashActivity">
 
     <ImageView
+        android:id="@+id/iv_splash"
         android:layout_width="match_parent"
         android:layout_height="match_parent"/>
 
+    <TextView
+        android:id="@+id/skip_time"
+        android:layout_width="60dp"
+        android:layout_height="23dp"
+        app:layout_constraintTop_toTopOf="parent"
+        app:layout_constraintEnd_toEndOf="parent"
+        android:textColor="@color/_ffffff"
+        android:textSize="@dimen/sp_14"
+        android:text="Skip"
+        android:gravity="center"
+        android:layout_marginEnd="16dp"
+        android:layout_marginTop="37dp"
+        android:visibility="gone"
+        android:background="@drawable/shape_66000000_28"/>
+
 </androidx.constraintlayout.widget.ConstraintLayout>

+ 9 - 0
baseswago/src/main/java/com/swago/glide.kt

@@ -48,6 +48,15 @@ fun ImageView.loadUrl(context: Context,url:String){
         .into(this)
 }
 
+fun ImageView.loadUrl(context: Context,url:String,resourceId: Int){
+    Glide.with(context)
+        .load(url)
+        .centerCrop()
+        .placeholder(resourceId)
+        .error(resourceId)
+        .into(this)
+}
+
 fun ImageView.loadUrlCache(context: Context,url:String){
     Glide.with(context)
         .load(url)

+ 5 - 0
baseswago/src/main/res/drawable/shape_66000000_28.xml

@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="utf-8"?>
+<shape xmlns:android="http://schemas.android.com/apk/res/android">
+    <solid android:color="#66000000"/>
+    <corners android:radius="28dp"/>
+</shape>

+ 4 - 2
room/src/main/java/com/swago/room/pk/PKInviteDialog.kt

@@ -72,13 +72,13 @@ class PKInviteDialog : BaseXDFragment<DialogPkInviteBinding>(), RoomTimer.TimeTi
     }
 
     override fun initLiveData() {
-        pkVm.inviteSuccessLiveData.observe(this){
+        pkVm.inviteSuccessLiveData.observe(viewLifecycleOwner){
             timeCount = 30
             binding.tvTimeCount.visibility = View.VISIBLE
             binding.tvTimeCount.text = AppContext.getContext().resources.getString(R.string.inviting_time).format(timeCount)
         }
 
-        pkVm.cancelPKSuccessLiveData.observe(this){
+        pkVm.cancelPKSuccessLiveData.observe(viewLifecycleOwner){
             binding.tvInvite.visibility = View.VISIBLE
             binding.tvCancel.visibility = View.GONE
             binding.tvTimeCount.visibility = View.GONE
@@ -88,6 +88,8 @@ class PKInviteDialog : BaseXDFragment<DialogPkInviteBinding>(), RoomTimer.TimeTi
     override fun onDestroyView() {
         PKStateManager.removePKListener(this)
         RoomTimer.timeTickList.remove(this)
+        pkVm.inviteSuccessLiveData.removeObservers(viewLifecycleOwner)
+        pkVm.cancelPKSuccessLiveData.removeObservers(viewLifecycleOwner)
         super.onDestroyView()
     }