From 3bdee0940226918e016acf85ec61440492f1ca76 Mon Sep 17 00:00:00 2001 From: 18401019693 Date: Sat, 26 Nov 2022 16:12:22 +0800 Subject: [PATCH] =?UTF-8?q?=E5=90=88=E5=B9=B6=E6=8E=A5=E5=8F=A3=E7=AC=AC?= =?UTF-8?q?=E4=BA=94=E6=AC=A1=E6=AC=A1=E4=B8=8A=E4=BC=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/yunbao/common/utils/GiftCacheUtil.java | 3 ++- common/src/main/res/values/strings.xml | 1 + .../yunbao/live/views/LiveRoomViewHolder.java | 15 +++++++++------ .../main/dialog/MainStartDialogFragment.java | 18 ++++++++++++------ 4 files changed, 24 insertions(+), 13 deletions(-) diff --git a/common/src/main/java/com/yunbao/common/utils/GiftCacheUtil.java b/common/src/main/java/com/yunbao/common/utils/GiftCacheUtil.java index 23557d78e..207accd38 100644 --- a/common/src/main/java/com/yunbao/common/utils/GiftCacheUtil.java +++ b/common/src/main/java/com/yunbao/common/utils/GiftCacheUtil.java @@ -6,6 +6,7 @@ import android.util.Log; import com.yunbao.common.CommonAppConfig; import com.yunbao.common.Constants; +import com.yunbao.common.R; import com.yunbao.common.bean.LiveGiftBean; import com.yunbao.common.http.CommonHttpConsts; import com.yunbao.common.interfaces.CommonCallback; @@ -59,7 +60,7 @@ public class GiftCacheUtil { } else { DownloadUtil downloadUtil = new DownloadUtil(); if (forwhat.equals("1")) { - ToastUtil.show("礼物正在获取中..."); + ToastUtil.show(R.string.gift_way); } downloadUtil.download(CommonHttpConsts.DOWNLOAD_GIF, dir, fileName, url, new DownloadUtil.Callback() { String TAG="下载"; diff --git a/common/src/main/res/values/strings.xml b/common/src/main/res/values/strings.xml index 96b1d70fb..800292db6 100644 --- a/common/src/main/res/values/strings.xml +++ b/common/src/main/res/values/strings.xml @@ -964,4 +964,5 @@ 畫質選擇 更多設置 查看更多 + 礼物正在获取中... diff --git a/live/src/main/java/com/yunbao/live/views/LiveRoomViewHolder.java b/live/src/main/java/com/yunbao/live/views/LiveRoomViewHolder.java index 696f41a63..f2e4b922f 100644 --- a/live/src/main/java/com/yunbao/live/views/LiveRoomViewHolder.java +++ b/live/src/main/java/com/yunbao/live/views/LiveRoomViewHolder.java @@ -319,7 +319,7 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis //接口整合新加参数 private GuardUserModel guardUserModel; - + private ViewFlipper flipper; public LiveRoomViewHolder(boolean isRys, int forActivity, Context context, ViewGroup parentView, GifImageView gifImageView, SVGAImageView svgaImageView, ViewGroup liveGiftPrizePoolContainer, WindowManager windowManager) { super(context, parentView); Contexts = context; @@ -694,7 +694,7 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis mic_view = (RelativeLayout) findViewById(R.id.mic_view); mic_view1 = (RelativeLayout) findViewById(R.id.mic_view1); mic_view2 = (RelativeLayout) findViewById(R.id.mic_view2); - + flipper = (ViewFlipper) findViewById(R.id.hour_rank_list); mic_ico = (ImageView) findViewById(R.id.mic_ico); newMessage = (ImageView) findViewById(R.id.new_message); atMessage = (ImageView) findViewById(R.id.at_message); @@ -1488,7 +1488,9 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis } public void initHourRank(RankHourModel model) { - ViewFlipper flipper = (ViewFlipper) findViewById(R.id.hour_rank_list); + if (flipper.getChildCount()>0){ + flipper.removeAllViews(); + } LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(DpUtil.dp2px(44), DpUtil.dp2px(16)); LinearLayout.LayoutParams textParams = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT); textParams.leftMargin = DpUtil.dp2px(5); @@ -1534,7 +1536,9 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis * 初始化小时榜 */ public void initHourRankList() { - ViewFlipper flipper = (ViewFlipper) findViewById(R.id.hour_rank_list); + if (flipper.getChildCount()>0){ + flipper.removeAllViews(); + } LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(DpUtil.dp2px(44), DpUtil.dp2px(16)); LinearLayout.LayoutParams textParams = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT); textParams.leftMargin = DpUtil.dp2px(5); @@ -2475,8 +2479,7 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis * 刷新用户列表 */ public void refreshUserList(JSONObject obj) { - List list = GsonUtils.fromJson(obj.getString("userlist"), new TypeToken>() { - }.getType()); + List list = JSON.parseArray(obj.getString("userlist"), LiveUserGiftBean.class); mLiveUserAdapter.refreshList(list); } diff --git a/main/src/main/java/com/yunbao/main/dialog/MainStartDialogFragment.java b/main/src/main/java/com/yunbao/main/dialog/MainStartDialogFragment.java index 7d598b45a..e7b0d026a 100644 --- a/main/src/main/java/com/yunbao/main/dialog/MainStartDialogFragment.java +++ b/main/src/main/java/com/yunbao/main/dialog/MainStartDialogFragment.java @@ -154,12 +154,18 @@ public class MainStartDialogFragment extends AbsDialogFragment implements View.O private MainStartChooseCallback mMainStartChooseCallback = new MainStartChooseCallback() { @Override public void onLiveClick() { - mProcessResultUtil.requestPermissions(new String[]{ - Manifest.permission.READ_EXTERNAL_STORAGE, - Manifest.permission.WRITE_EXTERNAL_STORAGE, - Manifest.permission.CAMERA, - Manifest.permission.RECORD_AUDIO - }, mStartLiveRunnable); + boolean isAnchor = IMLoginManager.get(mContext).getUserInfo().anchorUserType(); + if (isAnchor) { + mProcessResultUtil.requestPermissions(new String[]{ + Manifest.permission.READ_EXTERNAL_STORAGE, + Manifest.permission.WRITE_EXTERNAL_STORAGE, + Manifest.permission.CAMERA, + Manifest.permission.RECORD_AUDIO + }, mStartLiveRunnable); + } else { + ToastUtil.show(getString(R.string.only_open_anchor)); + } + } @Override