소스 검색

feat: official invite

tongmengxiao 6 달 전
부모
커밋
4e2e866861

+ 1 - 0
app/src/main/AndroidManifest.xml

@@ -24,6 +24,7 @@
     <uses-permission android:name="android.permission.READ_MEDIA_AUDIO"/>
     <uses-permission android:name="android.permission.READ_MEDIA_VIDEO"/>
     <uses-permission android:name="android.permission.POST_NOTIFICATIONS" />
+    <uses-permission android:name="android.permission.BLUETOOTH_CONNECT" />
 
     <application
         android:name=".SwagoApp"

+ 18 - 0
home/src/main/java/com/swago/home/official/OfficialMessageActivity.kt

@@ -1,12 +1,15 @@
 package com.swago.home.official
 
+import android.view.View
 import androidx.activity.viewModels
 import androidx.recyclerview.widget.LinearLayoutManager
 import androidx.recyclerview.widget.RecyclerView
 import com.chad.library.adapter.base.BaseQuickAdapter
 import com.swago.baseswago.activity.BaseListActivity
 import com.swago.baseswago.cusview.SwagoRecyclerView
+import com.swago.baseswago.dialog.InviteBindingDialog
 import com.swago.baseswago.model.home.OfficialMsgModel
+import com.swago.baseswago.model.im.BindAnchorData
 import com.swago.baseswago.util.AppContext
 import com.swago.home.R
 import com.swago.home.databinding.ActivityOfficialMessageBinding
@@ -18,6 +21,7 @@ import com.swago.home.databinding.ActivityOfficialMessageBinding
 class OfficialMessageActivity : BaseListActivity<ActivityOfficialMessageBinding, OfficialMsgModel.ListBean>() {
 
     private val officialVm by viewModels<OfficialVm>()
+    private lateinit var inviteData: BindAnchorData
 
     override val smartRecyclerView: SwagoRecyclerView<OfficialMsgModel.ListBean> by lazy {
         binding.swagoRv as SwagoRecyclerView<OfficialMsgModel.ListBean>
@@ -38,6 +42,7 @@ class OfficialMessageActivity : BaseListActivity<ActivityOfficialMessageBinding,
     }
 
     override fun initLiveData() {
+        officialVm.getInviteLog()
         officialVm.listMsgLiveData.observe(this){
             if (it == null){
                 smartRecyclerView.onFetchDataError()
@@ -45,5 +50,18 @@ class OfficialMessageActivity : BaseListActivity<ActivityOfficialMessageBinding,
                 smartRecyclerView.onFetchDataFinish(it,true)
             }
         }
+        officialVm.inviteLogData.observe(this){
+            if (!it.isNullOrEmpty()){
+                binding.clHead.visibility = View.VISIBLE
+                inviteData = it[0]
+                binding.tvContent.text = AppContext.getContext().resources.getString(R.string.invites_you_to_join_his_guild)
+                    .format(it[0].agentNickName, it[0].agentId, it[0].agentName)
+            }
+        }
+
+        binding.clHead.setOnClickListener {
+            InviteBindingDialog.newInstance(inviteData)
+                .show(supportFragmentManager, "InviteBindingDialog")
+        }
     }
 }

+ 13 - 0
home/src/main/java/com/swago/home/official/OfficialVm.kt

@@ -6,6 +6,7 @@ import androidx.lifecycle.MutableLiveData
 import com.swago.baseswago.inter.ApiManager
 import com.swago.baseswago.model.home.OfficialMsgModel
 import com.swago.baseswago.model.home.OfficialSumModel
+import com.swago.baseswago.model.im.BindAnchorData
 import com.swago.baseswago.util.AppContext
 import com.swago.baseswago.util.BaseViewModel
 
@@ -45,4 +46,16 @@ class OfficialVm(application: Application) : BaseViewModel(application) {
             officialSumLiveData.value = data
         }
     }
+
+    val inviteLogData by lazy {
+        MutableLiveData<List<BindAnchorData>?>()
+    }
+    fun getInviteLog(){
+        requestData2 (false){
+            requestData {
+                val inviteLog = ApiManager.homeApi.getInviteLog()
+                inviteLogData.value = inviteLog.list
+            }
+        }
+    }
 }

+ 38 - 2
home/src/main/res/layout/activity_official_message.xml

@@ -1,6 +1,7 @@
 <?xml version="1.0" encoding="utf-8"?>
 <androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
     xmlns:app="http://schemas.android.com/apk/res-auto"
+    xmlns:tools="http://schemas.android.com/tools"
     android:layout_width="match_parent"
     android:layout_height="match_parent">
 
@@ -19,13 +20,48 @@
         android:layout_marginTop="25dp"
         app:layout_constraintTop_toTopOf="parent" />
 
+    <androidx.constraintlayout.widget.ConstraintLayout
+        android:id="@+id/cl_head"
+        android:layout_width="match_parent"
+        android:layout_height="wrap_content"
+        android:background="#fff"
+        android:visibility="gone"
+        app:layout_constraintTop_toBottomOf="@id/toolbar">
+
+        <com.swago.baseswago.cusview.BoldTextView
+            android:id="@+id/tvTitle"
+            android:textSize="14dp"
+            android:textColor="#000000"
+            android:text="@string/agency_invitation"
+            app:layout_constraintStart_toStartOf="parent"
+            app:layout_constraintTop_toTopOf="parent"
+            android:layout_marginStart="15dp"
+            android:layout_marginTop="15dp"
+            android:layout_marginEnd="15dp"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"/>
+
+        <com.swago.baseswago.cusview.MediumTextView
+            android:id="@+id/tvContent"
+            android:layout_marginTop="10dp"
+            android:layout_marginEnd="15dp"
+            android:layout_marginStart="15dp"
+            android:textSize="12dp"
+            android:textColor="#aaaaaa"
+            tools:text="dsdsd"
+            app:layout_constraintTop_toBottomOf="@+id/tvTitle"
+            app:layout_constraintStart_toStartOf="parent"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"/>
+
+    </androidx.constraintlayout.widget.ConstraintLayout>
+
     <com.swago.baseswago.cusview.SwagoRecyclerView
         android:id="@+id/swagoRv"
         android:layout_width="match_parent"
         android:layout_height="0dp"
-        android:layout_marginTop="81dp"
         app:layout_constraintBottom_toBottomOf="parent"
-        app:layout_constraintTop_toTopOf="parent" />
+        app:layout_constraintTop_toBottomOf="@+id/cl_head" />
 
 
 </androidx.constraintlayout.widget.ConstraintLayout>