Bladeren bron

修改学生端直播间购物车控制字段逻辑

Pq 1 jaar geleden
bovenliggende
commit
34bb8898e8

+ 9 - 0
tclive/src/main/java/com/daya/tclive/bean/LiveRoomInfoBean.java

@@ -48,6 +48,15 @@ public class LiveRoomInfoBean implements Parcelable {
     private LiveRoomConfigBean liveRoomConfig;
     private String userSig;
     private String os;
+    private String roomConfig;
+
+    public String getRoomConfig() {
+        return roomConfig;
+    }
+
+    public void setRoomConfig(String roomConfig) {
+        this.roomConfig = roomConfig;
+    }
 
     public int blacklistFlag;//当前登录人是否是黑名单用户 0否 1是
 

+ 23 - 27
tclive/src/main/java/com/daya/tclive/ui/TCStudentLiveRoomActivity.java

@@ -753,7 +753,7 @@ public class TCStudentLiveRoomActivity extends BaseMVPActivity<AcTtLiveroomLayou
                     if (permission) {
                         handleMicClick();
                     } else {
-                        UiUtils.showPermissionTipDialog(getSupportFragmentManager(),this,"提示","连麦需要麦克风、储存权限,去设置?");
+                        UiUtils.showPermissionTipDialog(getSupportFragmentManager(), this, "提示", "连麦需要麦克风、储存权限,去设置?");
                     }
                 });
     }
@@ -2076,33 +2076,29 @@ public class TCStudentLiveRoomActivity extends BaseMVPActivity<AcTtLiveroomLayou
             mMLivePlayer.setRenderFillMode(isPcClientLive ? V2TXLiveDef.V2TXLiveFillMode.V2TXLiveFillModeFit : V2TXLiveDef.V2TXLiveFillMode.V2TXLiveFillModeFill);
             resetVideoContainer(!isPcClientLive);
 
-//            if (!TextUtils.isEmpty(roomInfo.roomConfig)) {
-//                try {
-//                    JSONObject jsonObject = new JSONObject(roomInfo.roomConfig);
-//                    //聊天模式
-//                    int chatCtrlMode = jsonObject.optInt("whether_chat", 0);
-//                    //连麦模式
-//                    int micCtrlMode = jsonObject.optInt("whether_mic", 0);
-//                    //购物车是否显示
-//                    int shopCarMode = jsonObject.optInt("whether_view_shop_cart", 0);
-//                    isEnableChat = chatCtrlMode == 1;
-//                    isEnableMic = micCtrlMode == 1;
-//
-//
-//                } catch (JSONException e) {
-//                    e.printStackTrace();
-//                }
-//            }
 
-//            if (TextUtils.isEmpty(roomInfo.getShopCarUrl())) {
-//                //隐藏购物车
-//                mViewShopCarAnim.setVisibility(View.GONE);
-//                mIvShopCar.setVisibility(View.GONE);
-//            } else {
-//                //显示购物车
-//                mViewShopCarAnim.setVisibility(View.VISIBLE);
-//                mIvShopCar.setVisibility(View.INVISIBLE);
-//            }
+            boolean isHideShopCar = false;
+            if (!TextUtils.isEmpty(roomInfo.getRoomConfig())) {
+                try {
+                    JSONObject jsonObject = new JSONObject(roomInfo.getRoomConfig());
+                    //购物车是否显示
+                    int shopCarMode = jsonObject.optInt("whether_view_shop_cart", 0);
+                    isHideShopCar = shopCarMode == 1;
+                } catch (Exception e) {
+                    e.printStackTrace();
+                }
+            }
+
+            if (isHideShopCar) {
+                //隐藏购物车
+                mViewShopCarAnim.setVisibility(View.GONE);
+                mIvShopCar.setVisibility(View.GONE);
+            } else {
+                //显示购物车
+                mViewShopCarAnim.setVisibility(View.VISIBLE);
+                mIvShopCar.setVisibility(View.INVISIBLE);
+            }
+
             //黑名单模式
             isEnableAll = roomInfo.blacklistFlag == 1;//1是黑名单 0否
             updateInputTip();

+ 2 - 1
tclive/src/main/res/layout/ac_tt_liveroom_layout.xml

@@ -305,6 +305,7 @@
         app:layout_constraintRight_toRightOf="@+id/iv_shop_car"
         app:lottie_autoPlay="true"
         app:lottie_loop="true"
+        android:visibility="gone"
         app:lottie_rawRes="@raw/tc_live_shop_car_anim" />
 
 
@@ -314,7 +315,7 @@
         android:layout_height="wrap_content"
         android:layout_marginEnd="11dp"
         android:src="@drawable/tc_icon_add_like"
-        android:visibility="invisible"
+        android:visibility="gone"
         app:layout_constraintBottom_toBottomOf="@+id/icon_add_like"
         app:layout_constraintRight_toLeftOf="@+id/icon_add_like"
         app:layout_constraintTop_toTopOf="@+id/icon_add_like" />