4 Commits 8cffdb2b89 ... 419ce5c3dd

Author SHA1 Message Date
  tongmengxiao 419ce5c3dd feat: 头像框 4 months ago
  tongmengxiao b87204c958 feat: 聊天气泡 4 months ago
  tongmengxiao cefc28baa3 feat: glide 4 months ago
  tongmengxiao 2ac0b9dd58 feat: 选中装扮 4 months ago
25 changed files with 561 additions and 130 deletions
  1. BIN
      baseswago/src/main/assets/avatar.svga
  2. 10 0
      baseswago/src/main/java/com/swago/baseswago/PersonDataDFragment.kt
  3. 2 0
      baseswago/src/main/java/com/swago/baseswago/UserVm.kt
  4. 2 0
      baseswago/src/main/java/com/swago/baseswago/constant/UrlConstant.kt
  5. 12 0
      baseswago/src/main/java/com/swago/baseswago/inter/UserApi.kt
  6. 36 0
      baseswago/src/main/java/com/swago/baseswago/model/UserInfoModel.java
  7. 7 1
      baseswago/src/main/java/com/swago/baseswago/model/mine/StoreProductModel.kt
  8. 88 0
      baseswago/src/main/java/com/swago/baseswago/util/BitmapUtils.kt
  9. 44 0
      baseswago/src/main/java/com/swago/baseswago/util/DianJiuUtil.kt
  10. 0 47
      baseswago/src/main/java/com/swago/glide.kt
  11. 43 14
      baseswago/src/main/res/layout/dialog_person_data.xml
  12. 23 3
      home/src/main/java/com/swago/home/ChatDetailActivity.kt
  13. 36 14
      home/src/main/res/layout/fragment_mine.xml
  14. 38 1
      room/src/main/java/com/swago/room/adapter/RoomChatAdapter.kt
  15. 31 8
      room/src/main/res/layout/item_audio_seat.xml
  16. 34 9
      room/src/main/res/layout/item_dialog_audience.xml
  17. 19 2
      room/src/main/res/layout/item_room_user.xml
  18. 31 8
      room/src/main/res/layout/layout_user_header_view.xml
  19. BIN
      user/src/main/assets/jojo_audio.svga
  20. 5 13
      user/src/main/java/com/swago/user/store/StoreBuyDialog.kt
  21. 7 2
      user/src/main/java/com/swago/user/store/StoreItemAdapter.kt
  22. 59 5
      user/src/main/java/com/swago/user/store/StoreListActivity.kt
  23. 10 1
      user/src/main/java/com/swago/user/vm/StoreVm.kt
  24. 11 2
      user/src/main/res/layout/dialog_store_detail.xml
  25. 13 0
      user/src/main/res/layout/item_store.xml

BIN
baseswago/src/main/assets/avatar.svga


+ 10 - 0
baseswago/src/main/java/com/swago/baseswago/PersonDataDFragment.kt

@@ -17,6 +17,7 @@ import com.swago.baseswago.dialog.BaseXDFragment
 import com.swago.baseswago.dialog.HandleDialogFragment
 import com.swago.baseswago.dialog.ReportDialog
 import com.swago.baseswago.util.AppContext
+import com.swago.baseswago.util.BitmapUtils
 import com.swago.baseswago.util.IMUtil
 import com.swago.baseswago.util.NoDoubleClickListener
 import com.swago.baseswago.util.UserInfo
@@ -44,6 +45,9 @@ class PersonDataDFragment : BaseXDFragment<DialogPersonDataBinding>() {
     var openGiftDialog:((nickName:String,userId:String)->Unit)? = null
     var openGiftIconDialog:((nickName:String,userId:String,nickIcon:String)->Unit)? = null
     var sendMsgInRoom:((nickName:String)->Unit)? = null
+    private val badgeBitmap by lazy {
+        BitmapUtils.getBitmapFromPath(UserInfo.getUserInfo()?.badge_special)
+    }
 
     companion object{
         fun newInstance(uid:String,isAnchor:Boolean=false,inRoom:Boolean=false,roomId:String="",isMessage:Boolean=false): PersonDataDFragment {
@@ -237,6 +241,12 @@ class PersonDataDFragment : BaseXDFragment<DialogPersonDataBinding>() {
             isAdmin = it.is_room_admin == 1
         }
 
+        if (badgeBitmap == null){
+            binding.ivBadge.visibility = View.GONE
+        } else {
+            binding.ivBadge.setImageBitmap(badgeBitmap)
+            binding.ivBadge.visibility = View.VISIBLE
+        }
 
         userVm.followStateLiveData.observe(this) {
             if (isFollow == 0) {

+ 2 - 0
baseswago/src/main/java/com/swago/baseswago/UserVm.kt

@@ -46,6 +46,8 @@ class UserVm(application: Application) : BaseViewModel(application) {
         requestData {
             val data = ApiManager.userApi.getUserInfo()
             userInfoLiveData.value = data
+            BitmapUtils.loadFile(AppContext.getContext() , data.badge_special)
+            BitmapUtils.loadFile(AppContext.getContext() , data.chat_special)
         }
     }
 

+ 2 - 0
baseswago/src/main/java/com/swago/baseswago/constant/UrlConstant.kt

@@ -91,4 +91,6 @@ object UrlConstant {
     var lottieResourcePath =
         AppContext.getContext().getExternalFilesDir("")?.absolutePath + File.separator + "lottie"
     var lottieDownloadUrl = ""
+    var specialResourcePath =
+        AppContext.getContext().getExternalFilesDir("")?.absolutePath + File.separator + "swagoFile"
 }

+ 12 - 0
baseswago/src/main/java/com/swago/baseswago/inter/UserApi.kt

@@ -131,12 +131,24 @@ interface UserApi {
     @POST("/v1/user/coin/product/list")
     suspend fun getProductList(): StoreProductModel
 
+    /**
+     * 购买
+     * */
     @FormUrlEncoded
     @POST("/v1/user/buy/product")
     suspend fun buyProduct(@Field("product_id") product_id: Long):Any
 
+    /**
+     * 装扮列表
+     * */
     @POST("/v1/user/exist/product/list")
     suspend fun exitProductList():StoreProductModel
 
+    /**
+     * 选中装扮
+     * */
+    @FormUrlEncoded
+    @POST("/v1/user/exist/product/chose")
+    suspend fun choseProduct(@Field("product_id") product_id: Long):Any
 
 }

+ 36 - 0
baseswago/src/main/java/com/swago/baseswago/model/UserInfoModel.java

@@ -98,6 +98,10 @@ public class UserInfoModel {
      * 是否充值用户
      */
     private int is_recharge;
+    private String join_special;
+    private String head_special;
+    private String badge_special;
+    private String chat_special;
 
     public String getUser_constellation() {
         return user_constellation;
@@ -394,4 +398,36 @@ public class UserInfoModel {
     public void setIs_recharge(int is_recharge) {
         this.is_recharge = is_recharge;
     }
+
+    public String getJoin_special() {
+        return join_special;
+    }
+
+    public void setJoin_special(String join_special) {
+        this.join_special = join_special;
+    }
+
+    public String getHead_special() {
+        return head_special;
+    }
+
+    public void setHead_special(String head_special) {
+        this.head_special = head_special;
+    }
+
+    public String getBadge_special() {
+        return badge_special;
+    }
+
+    public void setBadge_special(String badge_special) {
+        this.badge_special = badge_special;
+    }
+
+    public String getChat_special() {
+        return chat_special;
+    }
+
+    public void setChat_special(String chat_special) {
+        this.chat_special = chat_special;
+    }
 }

+ 7 - 1
baseswago/src/main/java/com/swago/baseswago/model/mine/StoreProductModel.kt

@@ -10,25 +10,31 @@ data class StoreProductModel(
 data class StoreItemBean (
     val product_name: String?,
     val product_url: String?,
+    val product_svg_url: String?,
     val product_category: Int,
     val product_coin: Long,
+    val expire_at: Long,
     val id: Long,
-    val product_status: Int
+    var product_status: Int
 ) :Parcelable{
     constructor(parcel: Parcel) : this(
+        parcel.readString(),
         parcel.readString(),
         parcel.readString(),
         parcel.readInt(),
         parcel.readLong(),
         parcel.readLong(),
+        parcel.readLong(),
         parcel.readInt()
     )
 
     override fun writeToParcel(parcel: Parcel, flags: Int) {
         parcel.writeString(product_name)
         parcel.writeString(product_url)
+        parcel.writeString(product_svg_url)
         parcel.writeInt(product_category)
         parcel.writeLong(product_coin)
+        parcel.writeLong(expire_at)
         parcel.writeLong(id)
         parcel.writeInt(product_status)
     }

+ 88 - 0
baseswago/src/main/java/com/swago/baseswago/util/BitmapUtils.kt

@@ -0,0 +1,88 @@
+package com.swago.baseswago.util
+
+import android.app.Activity
+import android.content.Context
+import android.graphics.Bitmap
+import android.graphics.BitmapFactory
+import android.graphics.drawable.Drawable
+import com.bumptech.glide.Glide
+import com.bumptech.glide.request.target.CustomTarget
+import com.bumptech.glide.request.transition.Transition
+import com.swago.baseswago.constant.UrlConstant
+import com.swago.baseswago.inter.ApiManager
+import kotlinx.coroutines.Dispatchers
+import kotlinx.coroutines.GlobalScope
+import kotlinx.coroutines.launch
+import java.io.File
+import java.io.FileOutputStream
+import java.io.IOException
+
+object BitmapUtils {
+
+    fun getBitmapFromPath(url:String?):Bitmap?{
+            val path = "${AppContext.getContext().getExternalFilesDir(null)!!.path}/swagoFile"
+            val pathFile = File("$path/${url?.substring(url.lastIndexOf("/"))}")
+            return if (pathFile.exists()) {
+                BitmapFactory.decodeFile(pathFile.absolutePath)
+            } else {
+                null
+            }
+
+    }
+
+    fun loadFile(context: Context, url: String) {
+        if (context is Activity){
+            if (context.isDestroyed)
+                return
+        }
+        Glide.with(context)
+            .asBitmap()
+            .load(url)
+            .into(object : CustomTarget<Bitmap>() {
+                override fun onResourceReady(resource: Bitmap, transition: Transition<in Bitmap>?) {
+                    val pathFile = File("${UrlConstant.specialResourcePath}/${url.substring(url.lastIndexOf("/"))}")
+                    var outputStream: FileOutputStream? = null
+                    try {
+                        outputStream = FileOutputStream(pathFile)
+                        resource.compress(Bitmap.CompressFormat.PNG, 100, outputStream)
+                        outputStream.flush()
+                    } catch (e: IOException) {
+                        e.printStackTrace()
+                    } finally {
+                        outputStream?.close()
+                    }
+                }
+
+                override fun onLoadCleared(placeholder: Drawable?) {
+
+                }
+            })
+    }
+
+     fun downLoadLottie(downloadUrl: String, name: String) {
+         val pathFile = File(UrlConstant.specialResourcePath)
+         pathFile.mkdirs()
+        GlobalScope.launch {
+            try {
+                val responseBody = ApiManager.homeApi.downFile(downloadUrl)
+                dowload(AppContext.getContext(), responseBody) {
+                    hasSelfPath = {
+                        UrlConstant.specialResourcePath
+                    }
+                    setFileName = {
+                        File.separator + name
+                    }
+                    success {
+                        LogUtil.d("资源","下载成功")
+                    }
+                    error {
+                        LogUtil.d("资源","下载失败")
+                    }
+
+                }.startDowload()
+            } catch (e: Exception) {
+                LogUtil.d("资源","下载失败")
+            }
+        }
+    }
+}

+ 44 - 0
baseswago/src/main/java/com/swago/baseswago/util/DianJiuUtil.kt

@@ -0,0 +1,44 @@
+package com.swago.baseswago.util
+
+import android.app.Activity
+import android.content.Context
+import android.graphics.Bitmap
+import android.graphics.NinePatch
+import android.graphics.drawable.Drawable
+import android.graphics.drawable.NinePatchDrawable
+import android.widget.Toast
+import com.bumptech.glide.Glide
+import com.bumptech.glide.request.target.CustomTarget
+import com.bumptech.glide.request.transition.Transition
+import java.io.File
+import java.io.FileOutputStream
+import java.io.IOException
+
+object DianJiuUtil {
+    fun loadDian9Tu(context: Context, url: String, drawable: (e: Drawable?) -> Unit){
+        if (context is Activity){
+            if (context.isDestroyed)
+                return
+        }
+        Glide.with(context)
+            .asBitmap()
+            .load(url)
+            .into(object : CustomTarget<Bitmap>() {
+                override fun onResourceReady(resource: Bitmap, transition: Transition<in Bitmap>?) {
+                    drawable.invoke(setNinePatchImage(context , resource))
+                }
+
+                override fun onLoadCleared(placeholder: Drawable?) {
+
+                }
+            })
+    }
+
+    fun setNinePatchImage(context: Context, bitmap: Bitmap): NinePatchDrawable? {
+        val chunk = bitmap.ninePatchChunk
+        if (NinePatch.isNinePatchChunk(chunk)){
+            return NinePatchDrawable(context.resources,bitmap,chunk,NinePatchChunk.deserialize(chunk)?.mPaddings,null)
+        }
+        return null
+    }
+}

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

@@ -1,12 +1,6 @@
 package com.swago
 
-import android.app.Activity
 import android.content.Context
-import android.graphics.Bitmap
-import android.graphics.BitmapFactory
-import android.graphics.NinePatch
-import android.graphics.drawable.Drawable
-import android.graphics.drawable.NinePatchDrawable
 import android.os.Build
 import android.text.BidiFormatter
 import android.text.TextDirectionHeuristics
@@ -15,14 +9,8 @@ import androidx.annotation.DrawableRes
 import androidx.annotation.RequiresApi
 import com.bumptech.glide.Glide
 import com.bumptech.glide.request.RequestOptions
-import com.bumptech.glide.request.target.CustomTarget
-import com.bumptech.glide.request.transition.Transition
 import com.swago.baseswago.R
 import jp.wasabeef.glide.transformations.BlurTransformation
-import java.io.File
-import java.io.FileInputStream
-import java.io.FileNotFoundException
-import java.io.IOException
 import java.util.*
 
 /**
@@ -84,39 +72,4 @@ fun CharSequence.formatAr(): CharSequence {
         this,
         TextDirectionHeuristics.LOCALE
     )
-}
-
-fun loadDian9Tu(context: Context, imageView: ImageView, url: String){
-    if (context is Activity){
-        if (context.isDestroyed)
-            return
-    }
-    Glide.with(context)
-        .asFile()
-        .load(url)
-        .into(object : CustomTarget<File>() {
-            override fun onResourceReady(resource: File, transition: Transition<in File>?) {
-                try {
-                    FileInputStream(resource).use { inputStream ->
-                        val bitmap = BitmapFactory.decodeStream(inputStream)
-                        imageView.setNinePatchImage(context , bitmap)
-                    }
-                } catch (e: FileNotFoundException) {
-                    e.printStackTrace()
-                } catch (e: IOException) {
-                    e.printStackTrace()
-                }
-            }
-
-            override fun onLoadCleared(placeholder: Drawable?) {
-
-            }
-        })
-}
-
-fun ImageView.setNinePatchImage(context: Context, bitmap: Bitmap) {
-    val chunk = bitmap.ninePatchChunk
-    val ninePatch = NinePatch(bitmap, chunk, null)
-    val ninePatchDrawable = NinePatchDrawable(context.resources, ninePatch)
-    this.setImageDrawable(ninePatchDrawable)
 }

+ 43 - 14
baseswago/src/main/res/layout/dialog_person_data.xml

@@ -176,11 +176,22 @@
                 app:layout_constraintBottom_toBottomOf="@+id/tvLevelView"
                 app:layout_constraintTop_toTopOf="@+id/tvLevelView"
                 app:layout_constraintStart_toEndOf="@+id/tvAgent"
-               app:layout_constraintEnd_toEndOf="parent"
+                app:layout_constraintEnd_toStartOf="@+id/ivBadge"
                 android:layout_width="wrap_content"
                 android:layout_height="wrap_content"/>
 
-
+            <ImageView
+                android:id="@+id/ivBadge"
+                android:textColor="#fff"
+                android:layout_marginStart="5dp"
+                android:visibility="gone"
+                tools:visibility="visible"
+                app:layout_constraintBottom_toBottomOf="@+id/tvLevelView"
+                app:layout_constraintTop_toTopOf="@+id/tvLevelView"
+                app:layout_constraintStart_toEndOf="@+id/tvOfficial"
+                app:layout_constraintEnd_toEndOf="parent"
+                android:layout_width="wrap_content"
+                android:layout_height="wrap_content"/>
             <LinearLayout
                 android:id="@+id/llFollow"
                 android:layout_width="wrap_content"
@@ -329,15 +340,36 @@
 
         </androidx.constraintlayout.widget.ConstraintLayout>
 
-
-        <de.hdodenhof.circleimageview.CircleImageView
-            android:id="@+id/ivAvatar"
+        <androidx.constraintlayout.widget.ConstraintLayout
+            android:id="@+id/clAvatar"
             android:layout_width="80dp"
             android:layout_height="80dp"
-            android:src="@mipmap/default_avatar"
             app:layout_constraintEnd_toEndOf="parent"
             app:layout_constraintStart_toStartOf="parent"
-            app:layout_constraintTop_toTopOf="parent" />
+            app:layout_constraintTop_toTopOf="parent" >
+            <de.hdodenhof.circleimageview.CircleImageView
+                android:id="@+id/ivAvatar"
+                android:layout_width="60dp"
+                android:layout_height="60dp"
+                android:src="@mipmap/default_avatar"
+                app:layout_constraintEnd_toEndOf="parent"
+                app:layout_constraintStart_toStartOf="parent"
+                app:layout_constraintTop_toTopOf="parent"
+                app:layout_constraintBottom_toBottomOf="parent"/>
+
+            <com.opensource.svgaplayer.SVGAImageView
+                android:id="@+id/svgAvatar"
+                android:layout_width="80dp"
+                android:layout_height="80dp"
+                android:visibility="visible"
+                app:source="avatar.svga"
+                app:autoPlay="true"
+                app:loopCount="0"
+                app:layout_constraintStart_toStartOf="parent"
+                app:layout_constraintTop_toTopOf="parent"
+                app:layout_constraintEnd_toEndOf="parent"
+                app:layout_constraintBottom_toBottomOf="parent"/>
+        </androidx.constraintlayout.widget.ConstraintLayout>
 
         <ImageView
             android:id="@+id/ivSex"
@@ -346,8 +378,8 @@
             android:layout_marginStart="10dp"
             android:layout_marginTop="5dp"
             tools:src="@mipmap/info_female"
-            app:layout_constraintBottom_toBottomOf="@+id/ivAvatar"
-            app:layout_constraintEnd_toEndOf="@+id/ivAvatar" />
+            app:layout_constraintBottom_toBottomOf="@+id/clAvatar"
+            app:layout_constraintEnd_toEndOf="@+id/clAvatar" />
 
 
         <ImageView
@@ -356,13 +388,10 @@
             android:layout_height="wrap_content"
             android:src="@mipmap/onlive"
             android:visibility="gone"
-            app:layout_constraintBottom_toBottomOf="@+id/ivAvatar"
-            app:layout_constraintStart_toStartOf="@+id/ivAvatar"
+            app:layout_constraintBottom_toBottomOf="@+id/clAvatar"
+            app:layout_constraintStart_toStartOf="@+id/clAvatar"
             tools:visibility="visible" />
 
-
-
-
     </androidx.constraintlayout.widget.ConstraintLayout>
 
 </androidx.constraintlayout.widget.ConstraintLayout>

+ 23 - 3
home/src/main/java/com/swago/home/ChatDetailActivity.kt

@@ -1,10 +1,14 @@
 package com.swago.home
 
+import android.graphics.BitmapFactory
+import android.graphics.NinePatch
+import android.graphics.drawable.BitmapDrawable
+import android.graphics.drawable.Drawable
+import android.graphics.drawable.NinePatchDrawable
 import android.os.Bundle
 import android.view.View
 import androidx.activity.viewModels
 import androidx.core.content.ContextCompat
-import androidx.fragment.app.viewModels
 import com.alibaba.android.arouter.facade.annotation.Autowired
 import com.alibaba.android.arouter.facade.annotation.Route
 import com.alibaba.android.arouter.launcher.ARouter
@@ -12,9 +16,12 @@ import com.google.gson.Gson
 import com.gyf.immersionbar.ImmersionBar
 import com.swago.baseswago.PersonDataDFragment
 import com.swago.baseswago.UserVm
-import com.swago.baseswago.dialog.ReportBlockDialogFragment
 import com.swago.baseswago.activity.BaseXActivity
 import com.swago.baseswago.constant.ARouteConstant
+import com.swago.baseswago.dialog.ReportBlockDialogFragment
+import com.swago.baseswago.util.AppContext
+import com.swago.baseswago.util.DianJiuUtil
+import com.swago.baseswago.util.NinePatchChunk
 import com.swago.baseswago.util.NoDoubleClickListener
 import com.swago.baseswago.util.SpUtil
 import com.swago.baseswago.util.UserInfo
@@ -23,7 +30,8 @@ import com.tencent.imsdk.v2.V2TIMConversation
 import com.tencent.qcloud.tim.uikit.modules.chat.base.ChatInfo
 import com.tencent.qcloud.tim.uikit.modules.chat.layout.message.MessageLayout
 import com.tencent.qcloud.tim.uikit.modules.message.MessageInfo
-import com.tencent.qcloud.tim.uikit.utils.ToastUtil
+import java.io.FileInputStream
+
 
 /**
  *@date 2021/8/24 15:01
@@ -111,6 +119,18 @@ class ChatDetailActivity  : BaseXActivity<ActivityChatDetailBinding>() {
 
             }
         })
+//        val path = "${AppContext.getContext().getExternalFilesDir(null)!!.path}/swagoFile/mmexport1718256766828.png"
+//        val bitmap = BitmapFactory.decodeStream(FileInputStream(path))
+//        val chunk = bitmap.ninePatchChunk
+//        if (NinePatch.isNinePatchChunk(chunk)){
+//            val patchy = NinePatchDrawable(resources,bitmap,chunk,NinePatchChunk.deserialize(chunk)?.mPaddings,null)
+//            messageRecyclerView.rightBubble = patchy
+//        }
+//        DianJiuUtil.loadDian9Tu(this ,"https://apple-1304432552.cos.ap-shanghai.myqcloud.com/android.png") {
+//            messageRecyclerView.rightBubble = it
+//        }
+
+
     }
 
     override fun initLiveData() {

+ 36 - 14
home/src/main/res/layout/fragment_mine.xml

@@ -19,7 +19,7 @@
         android:layout_marginEnd="16dp"
         android:src="@mipmap/bg_edit"
         app:layout_constraintEnd_toEndOf="parent"
-        app:layout_constraintTop_toTopOf="@+id/ivAvatar" />
+        app:layout_constraintTop_toTopOf="@+id/clAvatar" />
 
     <com.swago.baseswago.cusview.MediumTextView
         android:id="@+id/tvEdit"
@@ -37,16 +37,38 @@
         app:layout_constraintEnd_toEndOf="parent"
         app:layout_constraintTop_toBottomOf="@+id/ivEditBg" />
 
-
-    <de.hdodenhof.circleimageview.CircleImageView
-        android:id="@+id/ivAvatar"
+    <androidx.constraintlayout.widget.ConstraintLayout
+        android:id="@+id/clAvatar"
         android:layout_width="50dp"
         android:layout_height="50dp"
         android:layout_marginStart="16dp"
         android:layout_marginTop="66dp"
-        android:src="@mipmap/default_avatar"
         app:layout_constraintStart_toStartOf="parent"
-        app:layout_constraintTop_toTopOf="parent" />
+        app:layout_constraintTop_toTopOf="parent" >
+        <de.hdodenhof.circleimageview.CircleImageView
+            android:id="@+id/ivAvatar"
+            android:layout_width="40dp"
+            android:layout_height="40dp"
+            android:src="@mipmap/default_avatar"
+            app:layout_constraintStart_toStartOf="parent"
+            app:layout_constraintTop_toTopOf="parent"
+            app:layout_constraintEnd_toEndOf="parent"
+            app:layout_constraintBottom_toBottomOf="parent"/>
+
+        <com.opensource.svgaplayer.SVGAImageView
+            android:id="@+id/svgAvatar"
+            android:layout_width="50dp"
+            android:layout_height="50dp"
+            android:visibility="visible"
+            app:source="avatar.svga"
+            app:autoPlay="true"
+            app:loopCount="0"
+            app:layout_constraintStart_toStartOf="parent"
+            app:layout_constraintTop_toTopOf="parent"
+            app:layout_constraintEnd_toEndOf="parent"
+            app:layout_constraintBottom_toBottomOf="parent"/>
+    </androidx.constraintlayout.widget.ConstraintLayout>
+
 
     <com.swago.baseswago.cusview.BoldTextView
         android:id="@+id/tvName"
@@ -57,8 +79,8 @@
         android:maxLines="1"
         android:textColor="#435568"
         android:textSize="20dp"
-        app:layout_constraintStart_toEndOf="@+id/ivAvatar"
-        app:layout_constraintTop_toTopOf="@+id/ivAvatar"
+        app:layout_constraintStart_toEndOf="@+id/clAvatar"
+        app:layout_constraintTop_toTopOf="@+id/clAvatar"
         tools:text="NickName" />
 
     <com.swago.baseswago.cusview.SwagoLevelView
@@ -145,8 +167,8 @@
         android:maxLines="1"
         android:textColor="#868686"
         android:textSize="12dp"
-        app:layout_constraintBottom_toBottomOf="@+id/ivAvatar"
-        app:layout_constraintStart_toEndOf="@+id/ivAvatar"
+        app:layout_constraintBottom_toBottomOf="@+id/clAvatar"
+        app:layout_constraintStart_toEndOf="@+id/clAvatar"
         tools:text="ID:12030747" />
 
 
@@ -160,7 +182,7 @@
         app:layout_constraintEnd_toStartOf="@+id/llFans"
         app:layout_constraintHorizontal_chainStyle="spread"
         app:layout_constraintStart_toStartOf="parent"
-        app:layout_constraintTop_toBottomOf="@+id/ivAvatar">
+        app:layout_constraintTop_toBottomOf="@+id/clAvatar">
 
         <com.swago.baseswago.cusview.MediumTextView
             android:id="@+id/tvFollowNum"
@@ -189,7 +211,7 @@
         android:orientation="vertical"
         app:layout_constraintEnd_toStartOf="@+id/llCoin"
         app:layout_constraintStart_toEndOf="@+id/llFollow"
-        app:layout_constraintTop_toBottomOf="@+id/ivAvatar">
+        app:layout_constraintTop_toBottomOf="@+id/clAvatar">
 
         <com.swago.baseswago.cusview.MediumTextView
             android:id="@+id/tvFansNum"
@@ -218,7 +240,7 @@
         android:orientation="vertical"
         app:layout_constraintEnd_toStartOf="@+id/llDiamonds"
         app:layout_constraintStart_toEndOf="@+id/llFans"
-        app:layout_constraintTop_toBottomOf="@+id/ivAvatar">
+        app:layout_constraintTop_toBottomOf="@+id/clAvatar">
 
         <com.swago.baseswago.cusview.MediumTextView
             android:id="@+id/tvCoin"
@@ -247,7 +269,7 @@
         android:orientation="vertical"
         app:layout_constraintEnd_toEndOf="parent"
         app:layout_constraintStart_toEndOf="@+id/llCoin"
-        app:layout_constraintTop_toBottomOf="@+id/ivAvatar">
+        app:layout_constraintTop_toBottomOf="@+id/clAvatar">
 
         <com.swago.baseswago.cusview.MediumTextView
             android:id="@+id/tvDiamonds"

+ 38 - 1
room/src/main/java/com/swago/room/adapter/RoomChatAdapter.kt

@@ -2,6 +2,7 @@ package com.swago.room.adapter
 
 import android.graphics.Bitmap
 import android.graphics.Color
+import android.graphics.drawable.BitmapDrawable
 import android.os.Build
 import android.text.*
 import android.text.method.LinkMovementMethod
@@ -11,6 +12,7 @@ import android.text.style.ImageSpan
 import android.view.LayoutInflater
 import android.view.View
 import android.view.ViewGroup
+import android.widget.ImageView
 import android.widget.TextView
 import androidx.constraintlayout.widget.ConstraintLayout
 import androidx.core.content.ContextCompat
@@ -25,6 +27,8 @@ import com.swago.baseswago.model.im.FollowSuccessMsgBean
 import com.swago.baseswago.model.im.IMLevelUpMsgBean
 import com.swago.baseswago.model.im.RoomChatMsgBean
 import com.swago.baseswago.model.im.UserJoinRoomBean
+import com.swago.baseswago.util.BitmapUtils
+import com.swago.baseswago.util.UserInfo
 import com.swago.formatAr
 import com.swago.room.R
 import com.swago.room.adapter.bitmap.CenterAlignImageSpan
@@ -45,9 +49,19 @@ class RoomChatAdapter :
      */
     private val iconBitmapCachePool: HashMap<String, Bitmap> = HashMap()
     private val localImageKey = ArrayList<String>()
+    private val badgeBitmap by lazy {
+        BitmapUtils.getBitmapFromPath(UserInfo.getUserInfo()?.badge_special)
+    }
+    private val bubbleChat by lazy {
+       BitmapUtils.getBitmapFromPath(UserInfo.getUserInfo()?.chat_special)
+    }
+    private val userid by lazy {
+        UserInfo.getUserInfo()?.id
+    }
 
     companion object {
         const val LEVEL_KEY = "level"
+        const val BADGE_KEY = "badge"
         const val PRETTY_KEY = "pretty"//靓号
         const val VIP_KEY = "vip"//每日首冲
         const val IS_OFFICIAL = "official"
@@ -60,6 +74,7 @@ class RoomChatAdapter :
 
     init {
         localImageKey.add(LEVEL_KEY)
+        localImageKey.add(BADGE_KEY)
         localImageKey.add(PRETTY_KEY)
         localImageKey.add(VIP_KEY)
         localImageKey.add(IS_OFFICIAL)
@@ -366,6 +381,13 @@ class RoomChatAdapter :
                             .append("'> ")
                     }
 
+                    if (item is UserJoinRoomBean && badgeBitmap != null) {
+                        count++
+                        sb.append("<img src='" + "file:///xx/")
+                            .append(BADGE_KEY).append(".png")
+                            .append("'> ")
+                    }
+
                     count++
                     sb.append("<img src='" + "file:///xx/")
                         .append(LEVEL_KEY).append(".png")
@@ -434,6 +456,9 @@ class RoomChatAdapter :
 
                 }
             }
+            if (bubbleChat != null && item.getSenderId() == userid){
+                tvContent.background =  BitmapDrawable(mContext.resources , bubbleChat)
+            }
             tvContent.movementMethod = LinkMovementMethod.getInstance()
             tvContent.highlightColor = Color.TRANSPARENT
             if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
@@ -526,7 +551,14 @@ class RoomChatAdapter :
                         end,
                         Spanned.SPAN_EXCLUSIVE_EXCLUSIVE
                     )
-                }else {
+                }else if (imageSpan.source != null && imageSpan!!.source!!.contains(BADGE_KEY)) {
+                span.setSpan(
+                    setBadge(helper.itemView as ViewGroup),
+                    start,
+                    end,
+                    Spanned.SPAN_EXCLUSIVE_EXCLUSIVE
+                )
+            }else {
                     span.setSpan(newImageSpan, start, end, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE)
                 }
                 span.removeSpan(imageSpan)
@@ -723,6 +755,11 @@ class RoomChatAdapter :
         return CustomImageSpan(mContext, bm, CustomImageSpan.ALIGN_FONTCENTER)
     }
 
+    private fun setBadge(viewGroup: ViewGroup): CustomImageSpan {
+        val imageView = ImageView(mContext)
+        viewGroup.addView(imageView)
+        return CustomImageSpan(mContext, badgeBitmap, CustomImageSpan.ALIGN_FONTCENTER)
+    }
 
     private fun setLevel(iSenderLevel: Int, viewGroup: ViewGroup): CustomImageSpan {
         var level = iSenderLevel.toString()

+ 31 - 8
room/src/main/res/layout/item_audio_seat.xml

@@ -6,17 +6,40 @@
     tools:background="#000"
     xmlns:app="http://schemas.android.com/apk/res-auto">
 
-    <com.swago.baseswago.cusview.SwagoImageView
-        android:id="@+id/ivImageView"
+    <androidx.constraintlayout.widget.ConstraintLayout
+        android:id="@+id/clAvatar"
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
         app:layout_constraintStart_toStartOf="parent"
-        app:layout_constraintTop_toTopOf="parent"
-        android:layout_width="68dp"
-        android:layout_height="68dp"/>
+        app:layout_constraintTop_toTopOf="parent">
+        <com.swago.baseswago.cusview.SwagoImageView
+            android:id="@+id/ivImageView"
+            android:layout_width="68dp"
+            android:layout_height="68dp"
+            app:layout_constraintStart_toStartOf="parent"
+            app:layout_constraintTop_toTopOf="parent"
+            app:layout_constraintEnd_toEndOf="parent"
+            app:layout_constraintBottom_toBottomOf="parent"/>
+
+        <com.opensource.svgaplayer.SVGAImageView
+            android:id="@+id/svgAvatar"
+            android:layout_width="68dp"
+            android:layout_height="68dp"
+            android:visibility="visible"
+            app:source="avatar.svga"
+            app:autoPlay="true"
+            app:loopCount="0"
+            app:layout_constraintStart_toStartOf="parent"
+            app:layout_constraintTop_toTopOf="parent"
+            app:layout_constraintEnd_toEndOf="parent"
+            app:layout_constraintBottom_toBottomOf="parent"/>
+    </androidx.constraintlayout.widget.ConstraintLayout>
+
 
     <ImageView
         android:id="@+id/ivAudioState"
-        app:layout_constraintEnd_toEndOf="@+id/ivImageView"
-        app:layout_constraintBottom_toBottomOf="@+id/ivImageView"
+        app:layout_constraintEnd_toEndOf="@+id/clAvatar"
+        app:layout_constraintBottom_toBottomOf="@+id/clAvatar"
         android:src="@mipmap/live_mute"
         android:visibility="invisible"
         tools:visibility="visible"
@@ -34,7 +57,7 @@
         android:ellipsize="end"
         app:layout_constraintStart_toStartOf="parent"
         app:layout_constraintEnd_toEndOf="parent"
-        app:layout_constraintTop_toBottomOf="@+id/ivImageView"
+        app:layout_constraintTop_toBottomOf="@+id/clAvatar"
         android:layout_width="wrap_content"
         android:layout_height="wrap_content"/>
 

+ 34 - 9
room/src/main/res/layout/item_dialog_audience.xml

@@ -5,18 +5,43 @@
     xmlns:tools="http://schemas.android.com/tools"
     xmlns:app="http://schemas.android.com/apk/res-auto">
 
-    <de.hdodenhof.circleimageview.CircleImageView
+    <androidx.constraintlayout.widget.ConstraintLayout
+        android:id="@+id/clAvatar"
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
         app:layout_constraintStart_toStartOf="parent"
         app:layout_constraintTop_toTopOf="parent"
         app:layout_constraintBottom_toBottomOf="parent"
-        android:layout_marginStart="16dp"
-        android:id="@+id/ivAvatar"
-        android:layout_width="50dp"
-        android:layout_height="50dp"/>
+        android:layout_marginStart="16dp">
+
+        <de.hdodenhof.circleimageview.CircleImageView
+            app:layout_constraintStart_toStartOf="parent"
+            app:layout_constraintTop_toTopOf="parent"
+            app:layout_constraintBottom_toBottomOf="parent"
+            app:layout_constraintEnd_toEndOf="parent"
+            android:id="@+id/ivAvatar"
+            android:layout_width="40dp"
+            android:layout_height="40dp"/>
+
+        <com.opensource.svgaplayer.SVGAImageView
+            android:id="@+id/svgAvatar"
+            android:layout_width="50dp"
+            android:layout_height="50dp"
+            android:visibility="visible"
+            app:source="avatar.svga"
+            app:autoPlay="true"
+            app:loopCount="0"
+            app:layout_constraintStart_toStartOf="parent"
+            app:layout_constraintTop_toTopOf="parent"
+            app:layout_constraintEnd_toEndOf="parent"
+            app:layout_constraintBottom_toBottomOf="parent"/>
+    </androidx.constraintlayout.widget.ConstraintLayout>
+
+
 
     <com.swago.baseswago.cusview.MediumTextView
         android:id="@+id/tvName"
-        app:layout_constraintStart_toEndOf="@+id/ivAvatar"
+        app:layout_constraintStart_toEndOf="@+id/clAvatar"
         android:layout_marginStart="8dp"
         android:layout_marginTop="4dp"
         android:textSize="18dp"
@@ -24,15 +49,15 @@
         tools:text="Chridfsfdsfdfs"
         android:maxLines="1"
         android:maxWidth="150dp"
-        app:layout_constraintTop_toTopOf="@+id/ivAvatar"
+        app:layout_constraintTop_toTopOf="@+id/clAvatar"
         android:layout_width="wrap_content"
         android:layout_height="wrap_content"/>
 
     <com.swago.baseswago.cusview.SwagoLevelView
         android:id="@+id/tvLevel"
         android:layout_marginStart="8dp"
-        app:layout_constraintStart_toEndOf="@+id/ivAvatar"
-        app:layout_constraintBottom_toBottomOf="@+id/ivAvatar"
+        app:layout_constraintStart_toEndOf="@+id/clAvatar"
+        app:layout_constraintBottom_toBottomOf="@+id/clAvatar"
         android:layout_width="wrap_content"
         android:layout_height="wrap_content"/>
 

+ 19 - 2
room/src/main/res/layout/item_room_user.xml

@@ -1,5 +1,6 @@
 <?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"
     android:layout_width="40dp"
     android:layout_height="30dp">
 
@@ -7,7 +8,23 @@
         android:id="@+id/ivAvatar"
         android:layout_marginStart="5dp"
         android:layout_marginEnd="5dp"
-        android:layout_width="match_parent"
-        android:layout_height="match_parent"/>
+        android:layout_width="22dp"
+        android:layout_height="22dp"
+        app:layout_constraintStart_toStartOf="parent"
+        app:layout_constraintTop_toTopOf="parent"
+        app:layout_constraintEnd_toEndOf="parent"
+        app:layout_constraintBottom_toBottomOf="parent"/>
 
+    <com.opensource.svgaplayer.SVGAImageView
+        android:id="@+id/svgAvatar"
+        android:layout_width="30dp"
+        android:layout_height="30dp"
+        android:visibility="visible"
+        app:source="avatar.svga"
+        app:autoPlay="true"
+        app:loopCount="0"
+        app:layout_constraintStart_toStartOf="parent"
+        app:layout_constraintTop_toTopOf="parent"
+        app:layout_constraintEnd_toEndOf="parent"
+        app:layout_constraintBottom_toBottomOf="parent"/>
 </androidx.constraintlayout.widget.ConstraintLayout>

+ 31 - 8
room/src/main/res/layout/layout_user_header_view.xml

@@ -18,19 +18,42 @@
         android:background="@drawable/shape_20000000_41"
         android:layout_height="34dp">
 
-        <de.hdodenhof.circleimageview.CircleImageView
-            android:id="@+id/ivAvatar"
+        <androidx.constraintlayout.widget.ConstraintLayout
+            android:id="@+id/clAvatar"
+            android:layout_width="30dp"
+            android:layout_height="30dp"
             android:layout_marginStart="2dp"
             app:layout_constraintStart_toStartOf="parent"
             app:layout_constraintTop_toTopOf="parent"
-            app:layout_constraintBottom_toBottomOf="parent"
-            android:layout_width="30dp"
-            android:layout_height="30dp"/>
+            app:layout_constraintBottom_toBottomOf="parent">
+
+            <de.hdodenhof.circleimageview.CircleImageView
+                android:id="@+id/ivAvatar"
+                app:layout_constraintStart_toStartOf="parent"
+                app:layout_constraintTop_toTopOf="parent"
+                app:layout_constraintBottom_toBottomOf="parent"
+                app:layout_constraintEnd_toEndOf="parent"
+                android:layout_width="22dp"
+                android:layout_height="22dp"/>
+            <com.opensource.svgaplayer.SVGAImageView
+                android:id="@+id/svgAvatar"
+                android:layout_width="30dp"
+                android:layout_height="30dp"
+                android:visibility="visible"
+                app:source="avatar.svga"
+                app:autoPlay="true"
+                app:loopCount="0"
+                app:layout_constraintStart_toStartOf="parent"
+                app:layout_constraintTop_toTopOf="parent"
+                app:layout_constraintEnd_toEndOf="parent"
+                app:layout_constraintBottom_toBottomOf="parent"/>
+        </androidx.constraintlayout.widget.ConstraintLayout>
+
 
         <LinearLayout
             android:id="@+id/ll"
             android:orientation="vertical"
-            app:layout_constraintStart_toEndOf="@+id/ivAvatar"
+            app:layout_constraintStart_toEndOf="@+id/clAvatar"
             android:layout_width="wrap_content"
             android:layout_height="match_parent">
 
@@ -45,7 +68,7 @@
                 android:maxLines="1"
                 android:maxWidth="120dp"
                 app:layout_constraintEnd_toEndOf="parent"
-                app:layout_constraintStart_toEndOf="@+id/ivAvatar"
+                app:layout_constraintStart_toEndOf="@+id/clAvatar"
                 tools:text="NickNamed"
                 app:layout_constraintHorizontal_bias="0"
                 android:layout_width="wrap_content"
@@ -61,7 +84,7 @@
                 android:layout_marginEnd="8dp"
                 android:maxWidth="120dp"
                 app:layout_constraintEnd_toEndOf="parent"
-                app:layout_constraintStart_toEndOf="@+id/ivAvatar"
+                app:layout_constraintStart_toEndOf="@+id/clAvatar"
                 app:layout_constraintHorizontal_bias="0"
                 tools:text="ID:dddddddddd"
                 android:maxLines="1"

BIN
user/src/main/assets/jojo_audio.svga


+ 5 - 13
user/src/main/java/com/swago/user/store/StoreBuyDialog.kt

@@ -10,7 +10,9 @@ import com.opensource.svgaplayer.SVGAParser
 import com.opensource.svgaplayer.SVGAVideoEntity
 import com.swago.baseswago.dialog.BaseXDFragment
 import com.swago.baseswago.model.mine.StoreItemBean
+import com.swago.baseswago.util.AppContext
 import com.swago.baseswago.util.NoDoubleClickListener
+import com.swago.loadUrl
 import com.swago.user.databinding.DialogStoreDetailBinding
 import com.swago.user.vm.StoreVm
 import java.io.File
@@ -46,6 +48,8 @@ class StoreBuyDialog : BaseXDFragment<DialogStoreDetailBinding>(){
         storeBean?.let {
             binding.tvName.text = it.product_name
             binding.tvCoin.text = "${it.product_coin}"
+            binding.ivIcon.visibility = if (it.product_url?.endsWith("svga") == true) View.GONE else View.VISIBLE
+            binding.ivIcon.loadUrl(AppContext.getContext(),it.product_url?:"")
             svgaParser?.let { svgaParser ->
                 svgaParser.decodeFromURL(URL(it.product_url), object : SVGAParser.ParseCompletion{
                     override fun onComplete(videoItem: SVGAVideoEntity) {
@@ -61,19 +65,6 @@ class StoreBuyDialog : BaseXDFragment<DialogStoreDetailBinding>(){
 
             }
         }
-        svgaParser?.let {
-            it.decodeFromAssets("jojo_audio.svga",object : SVGAParser.ParseCompletion{
-                override fun onComplete(videoItem: SVGAVideoEntity) {
-                    val drawable = SVGADrawable(videoItem)
-                    binding.svgContent.setImageDrawable(drawable)
-                    binding.svgContent.startAnimation()
-                }
-
-                override fun onError() {
-
-                }
-            })
-        }
     }
 
     override fun initLiveData() {
@@ -81,6 +72,7 @@ class StoreBuyDialog : BaseXDFragment<DialogStoreDetailBinding>(){
             override fun onClick() {
                 storeBean?.let {
                     storeVm.buyProduct(it.id)
+                    dismissAllowingStateLoss()
                 }
 
             }

+ 7 - 2
user/src/main/java/com/swago/user/store/StoreItemAdapter.kt

@@ -13,12 +13,17 @@ class StoreItemAdapter(private val type: Int) : BaseQuickAdapter<StoreItemBean,
 
     override fun convert(helper: BaseViewHolder?, item: StoreItemBean?) {
         helper?.apply {
-            setVisible(R.id.tvUsing , type != 1)
             setVisible(R.id.tv_coin , type == 1)
+            setVisible(R.id.tv_time , type == 2)
 
             item?.let {
+                setVisible(R.id.tvUsing , type ==2 && item.product_status == 1)
                 setText(R.id.tv_name ,item.product_name)
-                setText(R.id.tv_coin ,"${item.product_coin}")
+                if (type == 1){
+                    setText(R.id.tv_coin ,"${item.product_coin}")
+                } else if (type == 2){
+                    setText(R.id.tv_time ,if (item.expire_at == 0L)"Unlimited time" else "${item.expire_at}days")
+                }
                 itemView.findViewById<CircleImageView>(R.id.iv_svg).loadUrl(mContext,item.product_url?: "")
             }
 

+ 59 - 5
user/src/main/java/com/swago/user/store/StoreListActivity.kt

@@ -14,6 +14,7 @@ import com.swago.baseswago.constant.ARouteConstant
 import com.swago.baseswago.model.live.audio.PositionBean
 import com.swago.baseswago.model.mine.StoreItemBean
 import com.swago.baseswago.util.AppContext
+import com.swago.baseswago.util.SpUtil
 import com.swago.user.R
 import com.swago.user.databinding.ActivityStoreListBinding
 import com.swago.user.vm.StoreVm
@@ -178,6 +179,10 @@ class StoreListActivity : BaseXActivity<ActivityStoreListBinding>() {
             if (it.isNullOrEmpty()){
                 binding.clEmpty.visibility = View.VISIBLE
             } else {
+                enterList.clear()
+                avatarList.clear()
+                badgeList.clear()
+                bubbleList.clear()
                 it.forEach { item ->
                     when (item.product_category){
                         1 -> {
@@ -217,6 +222,7 @@ class StoreListActivity : BaseXActivity<ActivityStoreListBinding>() {
         binding.clEnterMore.setOnClickListener {
             if (type == 2)
                 return@setOnClickListener
+            isEnterExpanded = !isEnterExpanded
             if (isEnterExpanded) {
                 enterAdapter.setNewData(enterList)
                 binding.tvEnterMore.text = "Show Less"
@@ -226,12 +232,12 @@ class StoreListActivity : BaseXActivity<ActivityStoreListBinding>() {
                 binding.tvEnterMore.text = "Show More"
                 binding.ivEnterMore.setImageResource(R.mipmap.ic_show_more)
             }
-            isEnterExpanded = !isEnterExpanded
         }
 
         binding.clAvatarMore.setOnClickListener {
             if (type == 2)
                 return@setOnClickListener
+            isAvatarExpanded = !isAvatarExpanded
             if (isAvatarExpanded) {
                 avatarAdapter.setNewData(avatarList)
                 binding.tvAvatarMore.text = "Show Less"
@@ -241,12 +247,12 @@ class StoreListActivity : BaseXActivity<ActivityStoreListBinding>() {
                 binding.tvAvatarMore.text = "Show More"
                 binding.ivAvatarMore.setImageResource(R.mipmap.ic_show_more)
             }
-            isAvatarExpanded = !isAvatarExpanded
         }
 
         binding.clBadgeMore.setOnClickListener {
             if (type == 2)
                 return@setOnClickListener
+            isBadgeExpanded = !isBadgeExpanded
             if (isBadgeExpanded) {
                 badgeAdapter.setNewData(badgeList)
                 binding.tvBadgeMore.text = "Show Less"
@@ -256,12 +262,12 @@ class StoreListActivity : BaseXActivity<ActivityStoreListBinding>() {
                 binding.tvBadgeMore.text = "Show More"
                 binding.ivBadgeMore.setImageResource(R.mipmap.ic_show_more)
             }
-            isBadgeExpanded = !isBadgeExpanded
         }
 
         binding.clBubbleMore.setOnClickListener {
             if (type == 2)
                 return@setOnClickListener
+            isBubbleExpanded = !isBubbleExpanded
             if (isBubbleExpanded) {
                 bubbleAdapter.setNewData(bubbleList)
                 binding.tvBubbleMore.text = "Show Less"
@@ -271,10 +277,58 @@ class StoreListActivity : BaseXActivity<ActivityStoreListBinding>() {
                 binding.tvBubbleMore.text = "Show More"
                 binding.ivBubbleMore.setImageResource(R.mipmap.ic_show_more)
             }
-            isBubbleExpanded = !isBubbleExpanded
         }
         enterAdapter.setOnItemClickListener { _, _, position ->
-            StoreBuyDialog.newInstance(enterAdapter.data[position]).show(supportFragmentManager ,"StoreBuyDialog")
+            if (type == 1){
+                StoreBuyDialog.newInstance(enterAdapter.data[position]).show(supportFragmentManager ,"StoreBuyDialog")
+            } else if (type == 2){
+                storeVm.chooseProduct(enterAdapter.data[position].id)
+                enterList.forEachIndexed { index, storeItemBean ->
+                    enterList[index].product_status = 0
+                    return@forEachIndexed
+                }
+                enterList[position].product_status = 1
+                enterAdapter.notifyDataSetChanged()
+            }
+        }
+        avatarAdapter.setOnItemClickListener { _, _, position ->
+            if (type == 1){
+                StoreBuyDialog.newInstance(avatarAdapter.data[position]).show(supportFragmentManager ,"StoreBuyDialog")
+            } else if (type == 2){
+                storeVm.chooseProduct(avatarAdapter.data[position].id)
+                avatarList.forEachIndexed { index, storeItemBean ->
+                    avatarList[index].product_status = 0
+                    return@forEachIndexed
+                }
+                avatarList[position].product_status = 1
+                avatarAdapter.notifyDataSetChanged()
+            }
+        }
+        badgeAdapter.setOnItemClickListener { _, _, position ->
+            if (type == 1){
+                StoreBuyDialog.newInstance(badgeAdapter.data[position]).show(supportFragmentManager ,"StoreBuyDialog")
+            } else if (type == 2){
+                storeVm.chooseProduct(badgeAdapter.data[position].id)
+                badgeList.forEachIndexed { index, storeItemBean ->
+                    badgeList[index].product_status = 0
+                    return@forEachIndexed
+                }
+                badgeList[position].product_status = 1
+                badgeAdapter.notifyDataSetChanged()
+            }
+        }
+        bubbleAdapter.setOnItemClickListener { _, _, position ->
+            if (type == 1){
+                StoreBuyDialog.newInstance(bubbleAdapter.data[position]).show(supportFragmentManager ,"StoreBuyDialog")
+            } else if (type == 2){
+                storeVm.chooseProduct(bubbleAdapter.data[position].id)
+                bubbleList.forEachIndexed { index, storeItemBean ->
+                    bubbleList[index].product_status = 0
+                    return@forEachIndexed
+                }
+                bubbleList[position].product_status = 1
+                bubbleAdapter.notifyDataSetChanged()
+            }
         }
     }
 

+ 10 - 1
user/src/main/java/com/swago/user/vm/StoreVm.kt

@@ -28,7 +28,7 @@ class StoreVm(application: Application) : BaseViewModel(application){
     }
 
     fun buyProduct(productId:Long){
-        requestData2 (){
+        requestData2 {
             requestData {
                 ApiManager.userApi.buyProduct(productId)
             }
@@ -51,4 +51,13 @@ class StoreVm(application: Application) : BaseViewModel(application){
             }
         }
     }
+
+    fun chooseProduct(productId:Long){
+        requestData2 {
+            requestData {
+                ApiManager.userApi.choseProduct(productId)
+            }
+
+        }
+    }
 }

+ 11 - 2
user/src/main/res/layout/dialog_store_detail.xml

@@ -24,17 +24,26 @@
             android:paddingBottom="24dp"
             app:layout_constraintBottom_toBottomOf="parent">
 
+            <ImageView
+                android:id="@+id/ivIcon"
+                android:layout_width="wrap_content"
+                android:layout_height="wrap_content"
+                app:layout_constraintEnd_toEndOf="parent"
+                app:layout_constraintStart_toStartOf="parent"
+                android:layout_marginTop="12dp"
+                app:layout_constraintTop_toTopOf="parent"/>
+
             <com.swago.baseswago.cusview.MediumTextView
                 android:id="@+id/tv_name"
                 android:layout_width="wrap_content"
                 android:layout_height="wrap_content"
-                android:layout_marginTop="18dp"
                 android:maxWidth="120dp"
                 android:textColor="#ffffff"
                 android:textSize="16sp"
+                android:layout_marginTop="@dimen/dp_4"
                 app:layout_constraintEnd_toEndOf="parent"
                 app:layout_constraintStart_toStartOf="parent"
-                app:layout_constraintTop_toTopOf="parent"
+                app:layout_constraintTop_toBottomOf="@+id/ivIcon"
                 tools:text="fgg" />
 
             <com.swago.baseswago.cusview.MediumTextView

+ 13 - 0
user/src/main/res/layout/item_store.xml

@@ -49,6 +49,19 @@
             android:drawableStart="@mipmap/ic_coin_store"
             android:textSize="10sp"
             android:textColor="#A3FFFFFF"/>
+        <com.swago.baseswago.cusview.MediumTextView
+            android:id="@+id/tv_time"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:layout_marginTop="2dp"
+            android:drawablePadding="2dp"
+            app:layout_constraintStart_toStartOf="parent"
+            app:layout_constraintEnd_toEndOf="parent"
+            app:layout_constraintTop_toBottomOf="@+id/tv_name"
+            android:visibility="gone"
+            tools:text="fgg"
+            android:textSize="10sp"
+            android:textColor="#A3FFFFFF"/>
         <TextView
             android:id="@+id/tvUsing"
             android:layout_width="51dp"