1
0

6 Incheckningar 02c2b2085a ... abaa9c012a

Upphovsman SHA1 Meddelande Datum
  poppin_leaf abaa9c012a c-减肥 1 månad sedan
  jlin 6bcb47eb22 支付协议同意 1 månad sedan
  jlin d85a71906f 卡帧 1 månad sedan
  linjianpeng 674085b666 美颜 1 månad sedan
  linjianpeng fe90668e68 全改成userId 1 månad sedan
  linjianpeng cccd1716b9 靓号分页 1 månad sedan
23 ändrade filer med 257 tillägg och 183 borttagningar
  1. 2 2
      buildSrc/src/main/java/com/yc/buildsrc/ProjectBuildConfig.kt
  2. 18 12
      libBytedance/src/main/java/im/zego/bytedance/beauty/fragment/EffectFragment.java
  3. 1 0
      module_base/src/main/java/com/yc/module_base/Constans.kt
  4. 1 1
      module_base/src/main/java/com/yc/module_base/view/userinfo/UserInfoActivity.kt
  5. 68 55
      module_base/src/main/java/com/yc/module_base/websocket/BaseSocketConnect.java
  6. 1 0
      module_base/src/main/java/com/yc/module_base/websocket/DiaochanSocket.kt
  7. 12 10
      module_base/src/main/java/com/yc/module_base/websocket/OkWebSocket.java
  8. 11 10
      module_home/src/main/res/layout/module_home_fragment_home_content.xml
  9. 8 15
      module_live/src/main/java/com/yc/module_live/view/RoomActivity.kt
  10. 11 8
      module_live/src/main/java/com/yc/module_live/view/live/livetop/TopLiveLayerFragment.kt
  11. 4 2
      module_live/src/main/java/com/yc/module_live/view/video/VideoFragment.kt
  12. 2 2
      module_live/src/main/java/com/yc/module_live/widget/BigGiftBarrageLayout.kt
  13. 27 18
      module_live/src/main/java/com/yc/module_live/widget/BigGiftLayout.kt
  14. 3 0
      module_me/src/main/java/com/mita/module_me/api/UserService.kt
  15. 1 1
      module_me/src/main/java/com/mita/module_me/view/MeFragment.kt
  16. 2 0
      module_me/src/main/java/com/mita/module_me/view/MeRepository.kt
  17. 1 1
      module_me/src/main/java/com/mita/module_me/view/UserInfoView.kt
  18. 17 6
      module_me/src/main/java/com/mita/module_me/view/dressup/shop/ShopVm.kt
  19. 21 29
      module_me/src/main/java/com/mita/module_me/view/dressup/shop/prettyId/PrettyIdListActivity.kt
  20. 27 2
      module_me/src/main/java/com/mita/module_me/view/wallet/WalletActivity.kt
  21. BIN
      module_me/src/main/res/drawable-xxhdpi/icon_pay_not_agree.png
  22. 5 3
      module_me/src/main/res/layout/module_me_activity_wallet.xml
  23. 14 6
      module_me/src/main/res/layout/module_me_more_dress.xml

+ 2 - 2
buildSrc/src/main/java/com/yc/buildsrc/ProjectBuildConfig.kt

@@ -8,8 +8,8 @@ object ProjectBuildConfig {
     const val applicationId = "com.bmkj.tianka"
     const val minSdkVersion = 23
     const val targetSdkVersion = 30
-    const val versionCode = 2026012801
-    const val versionName = "1.0.1"
+    const val versionCode = 2026032101
+    const val versionName = "1.0.3"
     const val isAppMode = false
 
     /**

+ 18 - 12
libBytedance/src/main/java/im/zego/bytedance/beauty/fragment/EffectFragment.java

@@ -25,11 +25,7 @@ import static im.zego.bytedance.beauty.manager.EffectDataManager.TYPE_CLOSE;
 import static im.zego.bytedance.beauty.manager.EffectDataManager.TYPE_FILTER;
 import static im.zego.bytedance.beauty.manager.EffectDataManager.TYPE_FILTER_AMG;
 import static im.zego.bytedance.beauty.manager.EffectDataManager.TYPE_HAIR_DYE;
-import static im.zego.bytedance.beauty.manager.EffectDataManager.TYPE_HAIR_DYE_FULL;
 import static im.zego.bytedance.beauty.manager.EffectDataManager.TYPE_HAIR_DYE_HIGHLIGHT;
-import static im.zego.bytedance.beauty.manager.EffectDataManager.TYPE_LIPSTICK;
-import static im.zego.bytedance.beauty.manager.EffectDataManager.TYPE_LIPSTICK_GLOSSY;
-import static im.zego.bytedance.beauty.manager.EffectDataManager.TYPE_LIPSTICK_MATTE;
 import static im.zego.bytedance.beauty.manager.EffectDataManager.TYPE_MAKEUP_HAIR;
 
 import android.annotation.SuppressLint;
@@ -1207,20 +1203,21 @@ public class EffectFragment extends TabBoardFragment implements View.OnClickList
         if (item == null) {
             return;
         }
-        mEffectCallback.onMakeUpItemSelect(item);
         if (item.getPath() != null && item.getPath().startsWith("stickers/")) { // 是贴纸,不需要显示进度条
+            mEffectCallback.onStickSelect(item);
             pb.setVisibility(View.GONE);
             isShowBeautyProProcessBarRT(false);
         } else { // 风格装要显示进度,并且显示选项
+            mEffectCallback.onMakeUpSelect(item);
             updateProgressWithItem(item);
             mCurrentItem = item;
             mCurrentItem.setSelectedRelation(true);
-            if (item.getId() != EffectDataManager.TYPE_CLOSE) {
-                item.setSelected(true);
-                if (LocalParamDataManager.useLocalParamStorage()) {
-                    LocalParamDataManager.saveComposerNode(item);
-                }
-            }
+//            if (item.getId() != EffectDataManager.TYPE_CLOSE) {
+//                item.setSelected(true);
+//                if (LocalParamDataManager.useLocalParamStorage()) {
+//                    LocalParamDataManager.saveComposerNode(item);
+//                }
+//            }
         }
     }
 
@@ -1360,7 +1357,16 @@ public class EffectFragment extends TabBoardFragment implements View.OnClickList
 
         void updateComposerNodeIntensity(String node, String key, float value);
 
+        /**
+         * 贴纸选择
+         * @param item
+         */
+        void onStickSelect(EffectButtonItem item);
 
-        void onMakeUpItemSelect(EffectButtonItem item);
+        /**
+         * 风格装选择
+         * @param item
+         */
+        void onMakeUpSelect(EffectButtonItem item);
     }
 }

+ 1 - 0
module_base/src/main/java/com/yc/module_base/Constans.kt

@@ -29,3 +29,4 @@ const val IS_HOME_ACTIVITY= "is_home_activity"
 const val KEY_HAS_GET_INSTALL_PARAMS= "key_Has_Get_Install_Params"
 const val KEY_NIGHT_MODE= "key_night_mode"
 const val ANCHOR_PK_TIME_SETTING= "anchor_pk_time_setting"
+const val PAY_AGREE= "pay_agree"

+ 1 - 1
module_base/src/main/java/com/yc/module_base/view/userinfo/UserInfoActivity.kt

@@ -297,7 +297,7 @@ class UserInfoActivity : BaseActivity<UserInfoVM>() {
             tvFollowCount.text = NumString.convertIntLive(user.followNum?.toLong() ?: 0L)
             tvFansCount.text = NumString.convertIntLive(user.fanNum?.toLong() ?: 0L)
             userCopy.setOnClickListener {
-                if (ComponentUtil.copyStr(this, user.prettyId.toString())) {
+                if (ComponentUtil.copyStr(this, user.userId.toString())) {
                     toast("复制成功")
                 }
             }

+ 68 - 55
module_base/src/main/java/com/yc/module_base/websocket/BaseSocketConnect.java

@@ -1,6 +1,8 @@
 package com.yc.module_base.websocket;
 
 import android.content.Context;
+import android.os.Handler;
+import android.os.Looper;
 import android.util.Log;
 
 
@@ -26,13 +28,6 @@ import rx.Subscriber;
 import rx.Subscription;
 import rx.schedulers.Schedulers;
 
-
-/**
- * 基础socket
- *
- * @author chen_bin
- * @date 20-6-2
- */
 public abstract class BaseSocketConnect implements BaseWebSocket.MessageCallback {
 
     /**
@@ -121,7 +116,7 @@ public abstract class BaseSocketConnect implements BaseWebSocket.MessageCallback
     public synchronized void resetConnect(Context context) {
         if (isConnected()) {
             onDisconnect();
-            connect(context);
+            onStart(context);
         }
     }
 
@@ -149,52 +144,54 @@ public abstract class BaseSocketConnect implements BaseWebSocket.MessageCallback
         //        }
         connectSubscription =
                 getConnectObb(getContext()).subscribe(new Subscriber<BaseWebSocket>() {
-            @Override
-            public void onStart() {
-                super.onStart();
-                log("connect");
-                onDisconnect();
-            }
-
-            @Override
-            public void onCompleted() {
-                log("connected");
-                CommonUtil.unSubscribeSubs(pingCounterSubscription);
-                pingCounterSubscription = Observable.interval(10,
-                        10,
-                        TimeUnit.SECONDS,
-                        Schedulers.io())
-                        .subscribe(new EmptySubscriber<Long>() {
-                            @Override
-                            public void onNext(Long pingCount) {
-                                if (pongCount > 4) {
-                                    Log.e("socketMessage", "pong超过了");
-                                    onDisconnect();
-                                    onSocketError();
-                                }
-                                sendPing();
-                            }
-                        });
-            }
+                    @Override
+                    public void onStart() {
+                        super.onStart();
+                        log("connect");
+                        onDisconnect();
+                    }
 
-            @Override
-            public void onError(Throwable e) {
+                    @Override
+                    public void onCompleted() {
+                        log("connected");
+                        //心跳
+                        CommonUtil.unSubscribeSubs(pingCounterSubscription);
+                        pingCounterSubscription = Observable.interval(10,
+                                        10,
+                                        TimeUnit.SECONDS,
+                                        Schedulers.io())
+                                .subscribe(new EmptySubscriber<Long>() {
+                                    @Override
+                                    public void onNext(Long pingCount) {
+                                        if (pongCount > 4) {
+                                            Log.e("socketMessage", "pong超过了");
+                                            onDisconnect();
+                                            onSocketError();
+                                        }
+                                        sendPing();
+                                    }
+                                });
+                    }
 
-            }
+                    @Override
+                    public void onError(Throwable e) {
+                        Log.e("socketMessage","BaseSocket"+e.toString());
+                    }
 
-            @Override
-            public void onNext(BaseWebSocket webSocket) {
-                BaseSocketConnect.this.webSocket = webSocket;
-                if (errorCount > 0) {
-                    onSocketReConnected();
-                } else {
-                    onSocketConnected();
-                }
+                    @Override
+                    public void onNext(BaseWebSocket webSocket) {
+                        BaseSocketConnect.this.webSocket = webSocket;
+                        Log.e("socketMessage","onNext");
+                        if (errorCount > 0) {
+                            onSocketReConnected();
+                        } else {
+                            onSocketConnected();
+                        }
 
-                errorCount = 0;
-                addWebSocketCallback(webSocket);
-            }
-        });
+                        errorCount = 0;
+                        addWebSocketCallback(webSocket);
+                    }
+                });
     }
 
     /**
@@ -254,21 +251,37 @@ public abstract class BaseSocketConnect implements BaseWebSocket.MessageCallback
                 public void onCompleted(BaseWebSocket webSocket) {
                     subscriber.onNext(webSocket);
                     subscriber.onCompleted();
+                    errorCount = 0;
                 }
 
                 @Override
                 public void onError(Throwable ex) {
 //                    subscriber.onError(ex);
-                    errorCount++;
-                    if (errorCount > maxReConnect) {
-                        onSocketError();
-                        return;
-                    }
+                    checkReconnect(context);
                 }
             });
         });
     }
 
+    //重连判断
+    private void checkReconnect(final Context context) {
+        if (errorCount >= 5) {
+            // 重连次数超过5次,不再重连
+            onSocketError();
+            webSocket.close();
+            return;
+        }
+        errorCount++;
+        int delaySeconds = 5000 * errorCount;
+        new Handler(Looper.getMainLooper()).postDelayed(new Runnable() {
+            @Override
+            public void run() {
+                reConnect(context);
+                Log.e("socketMessage","断线重连开始");
+            }
+        }, delaySeconds);
+    }
+
     public void reConnect(final Context context) {
         onDestroy();
         onStart(context);

+ 1 - 0
module_base/src/main/java/com/yc/module_base/websocket/DiaochanSocket.kt

@@ -106,6 +106,7 @@ class DiaochanSocket : BaseSocketConnect() {
                                 canCancelOutSide(false)
                                 cancelAble(false)
                                 confirm {
+                                    LiveSession.quitLogin()
                                     Cache.clear()
                                     ActivityManager.finishAll()
                                 }

+ 12 - 10
module_base/src/main/java/com/yc/module_base/websocket/OkWebSocket.java

@@ -4,8 +4,6 @@ import android.content.Context;
 import android.util.Log;
 
 
-import com.yc.networklibrary.utils.SSLContextUtil;
-
 import java.util.concurrent.TimeUnit;
 
 import okhttp3.OkHttpClient;
@@ -33,9 +31,7 @@ public class OkWebSocket extends BaseWebSocket {
 
     @Override
     public void connect(Context context, String url, final ConnectCallback connectCallback) {
-        SSLContextUtil.SSLParams sslParams = SSLContextUtil.getSslSocketFactory();
         OkHttpClient client = new OkHttpClient.Builder().writeTimeout(60, TimeUnit.SECONDS)
-                .sslSocketFactory(sslParams.sSLSocketFactory, sslParams.trustManager)
                 .readTimeout(60, TimeUnit.SECONDS)
                 .connectTimeout(60, TimeUnit.SECONDS)
                 .build();
@@ -44,7 +40,6 @@ public class OkWebSocket extends BaseWebSocket {
             public void onOpen(WebSocket webSocket, Response response) {
                 isOpen = true;
                 Log.e("socketMessage", "连接上了");
-                OkWebSocket.this.webSocket = webSocket;
                 if (connectCallback != null) {
                     connectCallback.onCompleted(OkWebSocket.this);
                 }
@@ -58,22 +53,29 @@ public class OkWebSocket extends BaseWebSocket {
             }
 
             @Override
-            public void onMessage(WebSocket webSocket, ByteString bytes) {
+            public void onMessage(WebSocket socket, ByteString bytes) {
                 if (messageCallback != null) {
                     messageCallback.onMessage(bytes);
                 }
             }
 
             @Override
-            public void onClosing(WebSocket webSocket, int code, String reason) {
+            public void onClosing(WebSocket socket, int code, String reason) {
+                if (webSocket == null)return;
+                if (!webSocket.equals(socket)) return;
                 webSocket.close(1000, null);
-
+                isOpen = false;
+                if (closedCallback != null) {
+                    closedCallback.onClosed(null);
+                }
             }
 
             @Override
-            public void onClosed(WebSocket webSocket, int code, String reason) {
+            public void onClosed(WebSocket socket, int code, String reason) {
                 Log.e("socketMessage", "断了,原因:"+"WebSocket closed. Code: "
                         + code + "Reason: " + reason + "code:"+code);
+                if (webSocket == null)return;
+                if (!webSocket.equals(socket)) return;
                 isOpen = false;
                 if (closedCallback != null) {
                     closedCallback.onClosed(null);
@@ -83,7 +85,7 @@ public class OkWebSocket extends BaseWebSocket {
             @Override
             public void onFailure(
                     WebSocket webSocket, Throwable t, Response response) {
-                Log.e("socketMessage", "连接失败了,"+"原因:");
+                Log.e("socketMessage", "连接失败了,"+"原因:"+t.getMessage());
                 isOpen = false;
                 if (connectCallback != null) {
                     connectCallback.onError(t);

+ 11 - 10
module_home/src/main/res/layout/module_home_fragment_home_content.xml

@@ -1,7 +1,7 @@
 <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
+    xmlns:app="http://schemas.android.com/apk/res-auto"
     android:layout_width="match_parent"
-    android:layout_height="match_parent"
-    xmlns:app="http://schemas.android.com/apk/res-auto">
+    android:layout_height="match_parent">
 
     <com.scwang.smart.refresh.layout.SmartRefreshLayout
         android:id="@+id/refreshLayout"
@@ -9,14 +9,15 @@
         android:layout_height="match_parent"
         app:srlEnableAutoLoadMore="false"
         app:srlEnableLoadMore="false">
-    <androidx.recyclerview.widget.RecyclerView
-        android:id="@+id/recyclerView"
-        android:layout_width="match_parent"
-        android:layout_height="match_parent"
-        android:overScrollMode="never"
-        android:paddingLeft="@dimen/dp_9"
-        android:paddingRight="@dimen/dp_9"
-        android:clipToPadding="false"/>
+
+        <androidx.recyclerview.widget.RecyclerView
+            android:id="@+id/recyclerView"
+            android:layout_width="match_parent"
+            android:layout_height="match_parent"
+            android:clipToPadding="false"
+            android:overScrollMode="never"
+            android:paddingLeft="@dimen/dp_9"
+            android:paddingRight="@dimen/dp_9" />
     </com.scwang.smart.refresh.layout.SmartRefreshLayout>
 
 </RelativeLayout>

+ 8 - 15
module_live/src/main/java/com/yc/module_live/view/RoomActivity.kt

@@ -2752,25 +2752,22 @@ class RoomActivity : BaseActivity<RoomVm>(), LiveDialogFragmentListener, VoicePr
         LogUtils.d("3. updateComposerNodeIntensity +$node  $key $value")
     }
 
-    // 风格装使用
-    private var mSelected: EffectButtonItem? = null
-
-    override fun onMakeUpItemSelect(item: EffectButtonItem?) {
+    override fun onStickSelect(item: EffectButtonItem?) {
         if (!item?.path.isNullOrEmpty() && item?.path?.startsWith("stickers/") == true) {
             if (item?.path == "stickers/close") {
                 mEffectManager?.setSticker("")
                 return
             }
             mEffectManager?.setSticker(item?.path)
-            return
         }
+    }
+
+    // 风格装使用
+    private var mSelected: EffectButtonItem? = null
+    override fun onMakeUpSelect(item: EffectButtonItem?) {
         if (mSelected != null && mSelected?.id != TYPE_CLOSE) {
             if (mSelected?.node != null) {
-                mEffectManager!!.removeComposeNodes(
-                    arrayOf(
-                        mSelected?.node?.path!!
-                    )
-                )
+                mEffectManager!!.removeComposeNodes(arrayOf(mSelected?.node?.path!!))
                 if (item!!.id == TYPE_CLOSE) {
                     //  {zh} 重置强度值  {en} Reset strength value
                     if (!LocalParamDataManager.useLocalParamStorage()) {
@@ -2786,11 +2783,7 @@ class RoomActivity : BaseActivity<RoomVm>(), LiveDialogFragmentListener, VoicePr
         if (mSelected?.node == null) {
             return
         }
-        mEffectManager!!.appendComposeNodes(
-            arrayOf(
-                mSelected?.node?.path!!
-            )
-        )
+        mEffectManager!!.appendComposeNodes(arrayOf(mSelected?.node?.path!!))
         if (item!!.node != null) {
             for (i in 0 until mSelected?.node?.keyArray?.size!!) {
                 mEffectManager!!.updateComposerNodeIntensity(

+ 11 - 8
module_live/src/main/java/com/yc/module_live/view/live/livetop/TopLiveLayerFragment.kt

@@ -571,12 +571,11 @@ class TopLiveLayerFragment : TopLiveLayerClickFragment<TopLayerVm>(),
                 val barrage = data as Barrage
                 viewModel.insertBigGiftMsg(barrage)
                 scrollToBottom(barrage.fromUser?.userId)
-                showBigGiftBarrage(barrage)
             }
 
             BaseRoomVm.RECEIVE_AMOUNT_GIFT_BARRAGE -> {
-                val barrage = data as Barrage
-                showBigGiftBarrage(barrage)
+//                val barrage = data as Barrage
+//                showBigGiftBarrage(barrage)
             }
 
             BaseRoomVm.SWITCH_ROOM -> {//切换房间前执行,通过传送门
@@ -843,10 +842,14 @@ class TopLiveLayerFragment : TopLiveLayerClickFragment<TopLayerVm>(),
             it.giftId == gift.giftId
         }
         gift.giftName = curGift?.giftName
-        smallBarrageLayout?.startBarrage(barrage)
-        if (gift.roomId != viewModel.room?.roomId) {
-            startVideoAnimation(gift)//播放特效的,全站,或者大礼物有中奖动画的
+        if ((curGift?.price ?: 0) >= 5000){
+            showBigGiftBarrage(barrage)
+        }else{
+            smallBarrageLayout?.startBarrage(barrage)
         }
+//        if (gift.roomId == viewModel.room?.roomId) {
+//            startVideoAnimation(gift)//播放特效的,全站,或者大礼物有中奖动画的
+//        }
     }
 
     fun showNotibilyBarrage(notifyNotifyPlatBarrage: NotibilyUserData) {
@@ -939,7 +942,7 @@ class TopLiveLayerFragment : TopLiveLayerClickFragment<TopLayerVm>(),
 
     fun startVideoAnimation(gift: Gift?) {
         gift?.let {
-            if (it.giftType == GiftType.LUXURY_GIFT.type && LiveSession.getIsOpenSpecial()) {
+            if (it.giftType == GiftType.LUXURY_GIFT.type && gift.roomId == viewModel.room?.roomId && LiveSession.getIsOpenSpecial()) {
                 bigGiftView.addGiftList(it)
             } else if (it.luckyMulti >= 500 && gift.roomId == viewModel.room?.roomId && LiveSession.getIsOpenSpecial()) {
                 val luckyGift: Gift? = GiftManager.allGiftList.find {
@@ -948,7 +951,7 @@ class TopLiveLayerFragment : TopLiveLayerClickFragment<TopLayerVm>(),
                 if (luckyGift != null) {
                     bigGiftView.addGiftList(it)
                 }
-            } else if (it.giftType == GiftType.BIG_GIFT.type && LiveSession.getIsOpenSpecial()) {
+            } else if (it.giftType == GiftType.BIG_GIFT.type && gift.roomId == viewModel.room?.roomId && LiveSession.getIsOpenSpecial()) {
                 Log.e("socketMessage", "大礼物")
                 val barrage = Barrage()
                 barrage.giftToBarrage(gift)

+ 4 - 2
module_live/src/main/java/com/yc/module_live/view/video/VideoFragment.kt

@@ -106,6 +106,7 @@ class VideoFragment : BaseFragment<VideoVm>() {
 
         val engineConfig = ZegoEngineConfig()
         engineConfig.advancedConfig["video_render_backend"] = "opengl3"
+        engineConfig.advancedConfig["play_clear_last_frame"] = "true"
         ZegoExpressEngine.setEngineConfig(engineConfig)
 
         engine = ZegoExpressEngine.createEngine(profile, null)
@@ -181,12 +182,13 @@ class VideoFragment : BaseFragment<VideoVm>() {
     }
 
     fun leaveChannel() {
-        // 退出房间
-        engine?.logoutRoom()
         // 停止本地预览
         engine?.stopPreview()
+        engine?.stopPlayingStream(viewModel.room?.anchorId.toString())
         // 停止推流
         engine?.stopPublishingStream()
+        // 退出房间
+        engine?.logoutRoom()
     }
 
     /******************** 连麦 *****************/

+ 2 - 2
module_live/src/main/java/com/yc/module_live/widget/BigGiftBarrageLayout.kt

@@ -90,7 +90,7 @@ class BigGiftBarrageLayout @JvmOverloads constructor(
 
     private fun addBarrageView(barrage: Barrage): Boolean {
         val type = barrage.type
-        if (type == BarrageType.LUXURY_GIFT_BARRAGE.type) {
+        if (type == BarrageType.LUCKY_WIN_BARRAGE.type) {
             if (amountGiftLayout == null) {
                 amountGiftLayout = inflate(
                     context,
@@ -130,7 +130,7 @@ class BigGiftBarrageLayout @JvmOverloads constructor(
     private fun getContentWidth(type: Int): Float {
         var barrageInterface: BarrageInterface?=null
         when (type) {
-            BarrageType.LUXURY_GIFT_BARRAGE.type -> barrageInterface = amountGiftLayout
+            BarrageType.LUCKY_WIN_BARRAGE.type -> barrageInterface = amountGiftLayout
         }
         return barrageInterface?.contentWidth() ?: 0f
     }

+ 27 - 18
module_live/src/main/java/com/yc/module_live/widget/BigGiftLayout.kt

@@ -6,6 +6,7 @@ import android.graphics.Paint
 import android.text.SpannableStringBuilder
 import android.text.TextUtils
 import android.util.AttributeSet
+import android.util.Log
 import android.view.View
 import android.widget.RelativeLayout
 import com.xueyu.kotlinextlibrary.*
@@ -38,32 +39,40 @@ class BigGiftLayout @JvmOverloads constructor(
     override fun updateInfo(barrage: Barrage?) {
         if (barrage == null) return
         this.barrage = barrage
-            val allGiftList = GiftManager.allGiftList
-            var giftName = ""
-            allGiftList.forEach {
-                if (it.giftId == barrage.giftId){
-                    giftName = it.giftName.toString()
-
-                }
-
-            tvWinInfo.text = getBigGiftInfoText(barrage.fromUser?.nickName?.replaceBlank(),barrage.toUser?.nickName?.replaceBlank(),giftName).toString()
+        val allGiftList = GiftManager.allGiftList
+        Log.e("aappqqpp", allGiftList.size.toString())
+        var giftName: String? = ""
+        var price: Long = 0
+        allGiftList.forEach {
+            if (it.giftId == barrage.giftId) {
+                giftName = it.giftName
+                price = it.price
+            }
         }
+        tvWinInfo.text = getBigGiftInfoText(
+            barrage.fromUser?.nickName?.replaceBlank(),
+            barrage.luckyMulti,
+            giftName,
+            price
+        ).toString()
     }
 
-    private fun getBigGiftInfoText(fromUserName: String?,toUserName: String?,giftName: String?): CharSequence? {
+    private fun getBigGiftInfoText(fromUserName: String?,
+                                   luckyMulti: Int,
+                                   giftName: String?,
+                                   price: Long = 0): CharSequence? {
         val builder = SpannableStringBuilder("")
-        builder.append("$fromUserName".spannable {
-            setForeground(color = color(R.color.barrage_big_content))
+        builder.append(" ${fromUserName}".spannable {
+            setForeground(color = color(R.color.room_voice_boss_color))
         })
         builder.append(" 送 ")
-        builder.append("$toUserName".spannable {
-            setForeground(color = color(R.color.barrage_big_content))
+        builder.append("$giftName".spannable {
+            setForeground(color = color(R.color.room_voice_boss_color))
         })
-        builder.append("1个 ")
-        builder.append("${giftName} ".spannable {
-            setForeground(color = color(R.color.barrage_big_content))
+        builder.append(" 礼物中奖 ")
+        builder.append("${luckyMulti} 倍".spannable {
+            setForeground(color = color(R.color.room_voice_boss_color))
         })
-        builder.append("礼物")
         return builder
     }
 

+ 3 - 0
module_me/src/main/java/com/mita/module_me/api/UserService.kt

@@ -142,6 +142,9 @@ interface UserService {
     @POST("api/market/dressUp/prettyIDList")
     suspend fun getPrettyIDList(@Body body: PostPrettyIdListBody): Response<PrettyIdListResponse>
 
+    @POST("api/market/dressUp/prettyIDList")
+    suspend fun getPrettyIDListForActivity(@Body body: PostPrettyIdListBody): Response<ListResponse<List<PrettyId>>>
+
     @POST("api/market/dressUp/userPrettyIDList")
     suspend fun getUserPrettyIdList(): Response<List<PrettyId>>
 

+ 1 - 1
module_me/src/main/java/com/mita/module_me/view/MeFragment.kt

@@ -149,7 +149,7 @@ class MeFragment : BaseFragment<MeViewModel>() {
             ivFrame.toGone()
         }
         userCopy.setOnClickListener {
-            if (ComponentUtil.copyStr(context, user.prettyId.toString())) {
+            if (ComponentUtil.copyStr(context, user.userId.toString())) {
                 toast("复制成功")
 //                    ThirdAppNavigator.startWeChatApp(context)
             }

+ 2 - 0
module_me/src/main/java/com/mita/module_me/view/MeRepository.kt

@@ -66,6 +66,8 @@ class MeRepository: BaseRepository(){
     suspend fun getHeadFrameList() = retrofit.getHeadFrameList()
     suspend fun getUserHeadFrameList() = retrofit.getUserHeadFrameList()
     suspend fun getPrettyIDList(body: PostPrettyIdListBody) = retrofit.getPrettyIDList(body)
+    suspend fun getPrettyIDListForActivity(body: PostPrettyIdListBody) = retrofit.getPrettyIDListForActivity(body)
+
     suspend fun getUserPrettyIdList() = retrofit.getUserPrettyIdList()
     suspend fun buyPrettyId(body: PostShopBody) = retrofit.buyPrettyId(body)
     suspend fun getUserNameplateList() = retrofit.getUserNameplateList()

+ 1 - 1
module_me/src/main/java/com/mita/module_me/view/UserInfoView.kt

@@ -87,7 +87,7 @@ class UserInfoView @JvmOverloads constructor(
             ivFrame.toGone()
         }
         userCopy.setOnClickListener {
-            if (ComponentUtil.copyStr(context, user.prettyId.toString())) {
+            if (ComponentUtil.copyStr(context, user.userId.toString())) {
                 toast("复制成功")
 //                    ThirdAppNavigator.startWeChatApp(context)
             }

+ 17 - 6
module_me/src/main/java/com/mita/module_me/view/dressup/shop/ShopVm.kt

@@ -14,6 +14,7 @@ import com.yc.baselibrary.adapter.observable.ObservableAdapterList
 import com.yc.baselibrary.models.Zip5
 import com.yc.baselibrary.net.exception.LoadingType
 import com.yc.baselibrary.net.exception.check
+import com.yc.baselibrary.net.exception.checkAndRefresh
 import com.yc.baselibrary.net.exception.checkError
 import com.yc.baselibrary.view.base.BaseVm
 import com.yc.module_base.model.PostPrettyIdListBody
@@ -212,18 +213,28 @@ class ShopVm(
         }
     }
 
-    fun loadPrettyIdList() {
-        val requestPrettyIdListReq = PostPrettyIdListBody()
+    fun loadPrettyIdList(normal: Boolean, refresh: Boolean) {
+        val reqPage = if (refresh) 1 else page + 1
+        val requestPrettyIdListReq = PostPrettyIdListBody(pageIndex = reqPage)
         requestMix({
-            meRepository.getPrettyIDList(requestPrettyIdListReq).check()
+            meRepository.getPrettyIDListForActivity(requestPrettyIdListReq).checkAndRefresh(refresh, this@ShopVm)
         }) {
+            setRefresh(refresh)
+            setNormal(normal)
             success {
-                if (it.list.isEmpty()) {
+                page = reqPage
+                if (it.data?.isEmpty() == true && refresh) {
                     showEmpty()
                     return@success
                 }
-                list.setNewData(it.list)
-                listState.postValue(RefreshType.REFRESH_FINISH)
+                it.data?.let { list1 ->
+                    if (refresh) {
+                        page = 1
+                        list.setNewData(list1)
+                    } else {
+                        list.addData(list1)
+                    }
+                }
             }
         }
     }

+ 21 - 29
module_me/src/main/java/com/mita/module_me/view/dressup/shop/prettyId/PrettyIdListActivity.kt

@@ -11,15 +11,18 @@ import com.mita.module_me.view.dressup.shop.ShopVm
 import com.mita.module_me.view.dressup.shop.chat.dialog.PrettyIdBuySuccessDialog
 import com.mita.module_me.view.dressup.shop.chat.dialog.PrettyIdDialog
 import com.mita.module_me.view.dressup.shop.prettyId.cell.PrettyIdVH
+import com.scwang.smart.refresh.layout.SmartRefreshLayout
 import com.xueyu.kotlinextlibrary.toGone
 import com.xueyu.kotlinextlibrary.toVisible
 import com.yc.baselibrary.adapter.viewHolder.MutableAdapter
 import com.yc.baselibrary.ext.bind
 import com.yc.baselibrary.ext.threadUnsafeLazy
 import com.yc.baselibrary.view.base.BaseActivity
+import com.yc.refreshlibrary.annotation.RefreshType
 import kotlinx.android.synthetic.main.module_me_more_dress.ivDressImage
 import kotlinx.android.synthetic.main.module_me_more_dress.llPretty
 import kotlinx.android.synthetic.main.module_me_more_dress.recyclerView
+import kotlinx.android.synthetic.main.module_me_more_dress.refreshLayout
 import kotlinx.android.synthetic.main.module_me_more_dress.titleBar
 import kotlinx.android.synthetic.main.module_me_more_dress.tvBuy
 import kotlinx.android.synthetic.main.module_me_more_dress.tvCoin
@@ -28,6 +31,9 @@ import kotlinx.android.synthetic.main.module_me_more_dress.tvPretty
 class PrettyIdListActivity : BaseActivity<ShopVm>() {
     override fun getLayoutId() = R.layout.module_me_more_dress
     override fun isSupportLoading() = false
+    override fun getRegisterLoading(): Any = refreshLayout
+    override fun getLoadMoreAble() = adapter
+    override fun getRefreshLayout(): SmartRefreshLayout? = refreshLayout
 
     private var selectItem: PrettyId? = null
 
@@ -41,8 +47,7 @@ class PrettyIdListActivity : BaseActivity<ShopVm>() {
         tvBuy.setOnClickListener {
             wantBuy()
         }
-
-        viewModel.loadPrettyIdList()
+        viewModel.loadPrettyIdList(normal = true, refresh = true)
     }
 
     /**
@@ -82,35 +87,18 @@ class PrettyIdListActivity : BaseActivity<ShopVm>() {
 
     override fun observe() {
         viewModel.listState.observe(this) {
-            adapter.selectedItemPosition = 0
-            adapter.notifyItemChanged(0)
-            selectItem = viewModel.list[0] as PrettyId?
-            ivDressImage.toGone()
-            llPretty.toVisible()
-            tvPretty.text = selectItem?.prettyId.toString()
-            tvCoin.text = selectItem?.coin.toString()
+            if (viewModel.listState.value == RefreshType.REFRESH_FINISH) {
+                adapter.selectedItemPosition = 0
+                adapter.notifyItemChanged(0)
+                selectItem = viewModel.list[0] as PrettyId?
+                ivDressImage.toGone()
+                llPretty.toVisible()
+                tvPretty.text = selectItem?.prettyId.toString()
+                tvCoin.text = selectItem?.coin.toString()
+            }
         }
         viewModel.buyPrettyIdSuccess.observe(this) {
-//            val position = viewModel.list.indexOf(viewModel.buyPrettyId)
-//            if (position != -1) {
-//                viewModel.list.removeAt(position)
-//                adapter.notifyItemRemoved(position)
-//
-//                // 如果移除的是当前选中的项,重置选择状态
-//                if (position > 0) {
-//                    adapter.selectedItemPosition = position - 1
-//                } else {
-//                    adapter.selectedItemPosition = 0
-//                }
-//                adapter.notifyItemChanged(adapter.selectedItemPosition)
-//                selectItem = viewModel.list[adapter.selectedItemPosition] as PrettyId?
-//                ivDressImage.toGone()
-//                llPretty.toVisible()
-//                tvPretty.text = selectItem?.prettyId.toString()
-//                tvCoin.text = selectItem?.coin.toString()
-//            }
-            viewModel.loadPrettyIdList()
-
+            viewModel.loadPrettyIdList(normal = true, refresh = true)
             val bugPrettyIdSuccessDialog =
                 PrettyIdBuySuccessDialog(this, viewModel.buyPrettyId)
             showDialogBottom(
@@ -127,4 +115,8 @@ class PrettyIdListActivity : BaseActivity<ShopVm>() {
             infoDialog
         )
     }
+
+    override fun loadData(isNormal: Boolean, isRefresh: Boolean) {
+        viewModel.loadPrettyIdList(normal = isNormal, refresh = isRefresh)
+    }
 }

+ 27 - 2
module_me/src/main/java/com/mita/module_me/view/wallet/WalletActivity.kt

@@ -26,6 +26,7 @@ import com.tencent.mm.opensdk.openapi.WXAPIFactory
 import com.umeng.commonsdk.UMConfigure
 import com.xueyu.kotlinextlibrary.launchActivity
 import com.yc.baselibrary.adapter.viewHolder.MutableAdapter
+import com.yc.baselibrary.cache.Cache
 import com.yc.baselibrary.ext.bind
 import com.yc.baselibrary.ext.setSafeListener
 import com.yc.baselibrary.ext.toast
@@ -34,12 +35,14 @@ import com.yc.baselibrary.view.webview.WebViewActivity
 import com.yc.baselibrary.view.webview.WebViewVm
 import com.yc.commonlibrary.RECHARGE
 import com.yc.commonlibrary.SERVICE
+import com.yc.module_base.PAY_AGREE
 import com.yc.module_base.arouter.MeRouter
 import com.yc.module_base.arouter.RoomLibRouter
 import com.yc.module_base.ext.inject
 import com.yc.module_base.ext.navigationTo
 import kotlinx.android.synthetic.main.module_me_activity_wallet.cv_pay_ali
 import kotlinx.android.synthetic.main.module_me_activity_wallet.cv_pay_wechat
+import kotlinx.android.synthetic.main.module_me_activity_wallet.ivPayAgree
 import kotlinx.android.synthetic.main.module_me_activity_wallet.recyclerView
 import kotlinx.android.synthetic.main.module_me_activity_wallet.scroll
 import kotlinx.android.synthetic.main.module_me_activity_wallet.titleBar
@@ -68,14 +71,28 @@ class WalletActivity : BaseActivity<WalletVm>() {
     }
 
     private var product: Product? = null
+    private var isPayAgree: Boolean = false
 
     override fun initView() {
         this.window.decorView.systemUiVisibility = View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR or
                 View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
+        isPayAgree = Cache.getBoolean(PAY_AGREE) ?: false
+
         scroll.setOnClickListener {
             hideKeyboard(it)
         }
 
+        ivPayAgree.setSafeListener {
+            if (isPayAgree) {
+                Cache.put(PAY_AGREE, false)
+                ivPayAgree.setImageResource(R.drawable.icon_pay_not_agree)
+            } else {
+                Cache.put(PAY_AGREE, true)
+                ivPayAgree.setImageResource(R.drawable.icon_pay_agree)
+            }
+            isPayAgree = !isPayAgree
+        }
+
         recyclerView.bind(
             adapter = adapter,
             layoutManager = GridLayoutManager(
@@ -84,14 +101,22 @@ class WalletActivity : BaseActivity<WalletVm>() {
             )
         )
 
-        cv_pay_ali.setOnClickListener {
+        cv_pay_ali.setSafeListener {
+            if (!isPayAgree) {
+                toast("同意《用户充值协议》")
+                return@setSafeListener
+            }
             product?.let {
                 viewModel.payType = PayType.ALI_PAY.type
                 viewModel.pay(it)
             }
         }
 
-        cv_pay_wechat.setOnClickListener {
+        cv_pay_wechat.setSafeListener {
+            if (!isPayAgree) {
+                toast("同意《用户充值协议》")
+                return@setSafeListener
+            }
             product?.let {
                 viewModel.payType = PayType.WECHAT_PAY.type
                 viewModel.pay(it)

BIN
module_me/src/main/res/drawable-xxhdpi/icon_pay_not_agree.png


+ 5 - 3
module_me/src/main/res/layout/module_me_activity_wallet.xml

@@ -141,9 +141,11 @@
                 app:layout_constraintTop_toBottomOf="@id/recyclerView">
 
                 <ImageView
-                    android:layout_width="@dimen/dp_14"
-                    android:layout_height="@dimen/dp_14"
-                    android:src="@drawable/icon_pay_agree" />
+                    android:id="@+id/ivPayAgree"
+                    android:layout_width="@dimen/dp_24"
+                    android:layout_height="@dimen/dp_24"
+                    android:padding="@dimen/dp_5"
+                    android:src="@drawable/icon_pay_not_agree" />
 
                 <TextView
                     android:layout_width="wrap_content"

+ 14 - 6
module_me/src/main/res/layout/module_me_more_dress.xml

@@ -100,16 +100,24 @@
         </androidx.constraintlayout.widget.ConstraintLayout>
     </androidx.constraintlayout.widget.ConstraintLayout>
 
-    <androidx.recyclerview.widget.RecyclerView
-        android:id="@+id/recyclerView"
+    <com.scwang.smart.refresh.layout.SmartRefreshLayout
+        android:id="@+id/refreshLayout"
         android:layout_width="match_parent"
         android:layout_height="0dp"
         android:layout_marginTop="@dimen/dp_280"
-        android:overScrollMode="never"
-        android:paddingTop="@dimen/dp_14"
-        android:background="@drawable/bg_base_top"
         app:layout_constraintBottom_toTopOf="@id/bottomView"
-        app:layout_constraintTop_toTopOf="parent" />
+        app:layout_constraintTop_toTopOf="parent"
+        app:srlEnableAutoLoadMore="false"
+        app:srlEnableLoadMore="false">
+
+        <androidx.recyclerview.widget.RecyclerView
+            android:id="@+id/recyclerView"
+            android:layout_width="match_parent"
+            android:layout_height="match_parent"
+            android:background="@drawable/bg_base_top"
+            android:overScrollMode="never"
+            android:paddingTop="@dimen/dp_14" />
+    </com.scwang.smart.refresh.layout.SmartRefreshLayout>
 
     <androidx.cardview.widget.CardView
         android:id="@+id/bottomView"