From 1435848f2a9d32c184f0925b87ad38d57f9bf396 Mon Sep 17 00:00:00 2001 From: zlzw <583819556@qq.com> Date: Mon, 10 Oct 2022 13:44:31 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B0=83=E6=95=B4=E7=A4=BC=E7=89=A9=E5=8C=85?= =?UTF-8?q?=E8=A3=B9UI?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../yunbao/common/manager/IMLoginManager.java | 1 - .../live/activity/LiveAudienceActivity.java | 1 - .../live/dialog/LiveGiftDialogFragment.java | 54 ++++++++++--------- .../main/res/layout/dialog_live_gift_wrap.xml | 4 +- .../com/yunbao/main/http/MainHttpUtil.java | 1 - 5 files changed, 31 insertions(+), 30 deletions(-) diff --git a/common/src/main/java/com/yunbao/common/manager/IMLoginManager.java b/common/src/main/java/com/yunbao/common/manager/IMLoginManager.java index bbe9a4e77..62a343db3 100644 --- a/common/src/main/java/com/yunbao/common/manager/IMLoginManager.java +++ b/common/src/main/java/com/yunbao/common/manager/IMLoginManager.java @@ -291,7 +291,6 @@ public class IMLoginManager extends BaseCacheManager { @Override public void onSuccess(int code, String msg, String[] info) { if (code == 0 && info.length > 0) { - SpUtil.setStringValue("userData",info[0]); userInfo = new Gson().fromJson(info[0], IMLoginModel.class); if (!TextUtils.isEmpty(uidAndToken[1])) { userInfo.setToken(uidAndToken[1]); diff --git a/live/src/main/java/com/yunbao/live/activity/LiveAudienceActivity.java b/live/src/main/java/com/yunbao/live/activity/LiveAudienceActivity.java index 667b116e2..eb9509475 100644 --- a/live/src/main/java/com/yunbao/live/activity/LiveAudienceActivity.java +++ b/live/src/main/java/com/yunbao/live/activity/LiveAudienceActivity.java @@ -977,7 +977,6 @@ public class LiveAudienceActivity extends LiveActivity { } } }); - GiftCacheUtil.getInstance().resetStatus(); GiftCacheUtil.getInstance().downloadAllGift(); } } diff --git a/live/src/main/java/com/yunbao/live/dialog/LiveGiftDialogFragment.java b/live/src/main/java/com/yunbao/live/dialog/LiveGiftDialogFragment.java index 41309cb8b..4f8715c2d 100644 --- a/live/src/main/java/com/yunbao/live/dialog/LiveGiftDialogFragment.java +++ b/live/src/main/java/com/yunbao/live/dialog/LiveGiftDialogFragment.java @@ -1,5 +1,11 @@ package com.yunbao.live.dialog; +import static com.yunbao.common.CommonAppConfig.isGetNewWrap; +import static com.yunbao.common.CommonAppContext.logger; +import static com.yunbao.common.CommonAppContext.mFirebaseAnalytics; +import static com.yunbao.common.utils.RouteUtil.PATH_COIN; +import static com.yunbao.live.views.LiveRoomViewHolder.bean1; + import android.graphics.Color; import android.graphics.drawable.ColorDrawable; import android.graphics.drawable.Drawable; @@ -39,13 +45,13 @@ import com.yunbao.common.bean.LiveGiftBean2; import com.yunbao.common.bean.UserBean; import com.yunbao.common.dialog.AbsDialogFragment; import com.yunbao.common.http.HttpCallback; +import com.yunbao.common.http.HttpClient; import com.yunbao.common.interfaces.OnItemClickListener; import com.yunbao.common.manager.IMLoginManager; import com.yunbao.common.utils.Bus; import com.yunbao.common.utils.DpUtil; import com.yunbao.common.utils.GiftCacheUtil; import com.yunbao.common.utils.NobleUtil; -import com.yunbao.common.utils.SpUtil; import com.yunbao.common.utils.ToastUtil; import com.yunbao.live.R; import com.yunbao.live.activity.LiveActivity; @@ -65,12 +71,6 @@ import org.greenrobot.eventbus.ThreadMode; import java.util.ArrayList; import java.util.List; -import static com.yunbao.common.CommonAppConfig.isGetNewWrap; -import static com.yunbao.common.CommonAppContext.logger; -import static com.yunbao.common.CommonAppContext.mFirebaseAnalytics; -import static com.yunbao.common.utils.RouteUtil.PATH_COIN; -import static com.yunbao.live.views.LiveRoomViewHolder.bean1; - /** * Created by cxf on 2018/10/12. @@ -285,18 +285,24 @@ public class LiveGiftDialogFragment extends AbsDialogFragment implements View.On * 设置贵族状态 */ private void loadUserVip() { - String userData = SpUtil.getStringValue("userData"); - if (userData != null && !userData.isEmpty()) { - JSONObject user = JSONObject.parseObject(userData); - int nobleId = user.getIntValue("noble_id"); - int resId = NobleUtil.nobleIdToImageResId(nobleId); - if(resId!=-1){ - mVipGoldIcon.setImageResource(resId); - mVipGoldTitle.setText(user.getString("noble_name")); - mVipGoldDesc.setText("前往貴族中心"); - } - - } + HttpClient.getInstance().get("User.getBaseInfos", "getBaseInfo") + .params("uid", IMLoginManager.get(mContext).getUserInfo().getId()) + .params("token", IMLoginManager.get(mContext).getUserInfo().getToken()) + .execute(new HttpCallback() { + @Override + public void onSuccess(int code, String msg, String[] info) { + if (code == 0 && info.length > 0) { + JSONObject user = JSONObject.parseObject(info[0]); + int nobleId = user.getIntValue("noble_id"); + int resId = NobleUtil.nobleIdToImageResId(nobleId); + if(resId!=-1){ + mVipGoldIcon.setImageResource(resId); + mVipGoldTitle.setText(user.getString("noble_name")); + mVipGoldDesc.setText("前往貴族中心"); + } + } + } + }); } private void loadGiftListData() { @@ -382,11 +388,8 @@ public class LiveGiftDialogFragment extends AbsDialogFragment implements View.On if(!GiftCacheUtil.getInstance().isDownloading()){ GiftCacheUtil.getInstance().downloadAllGift(); } - int size = list.size(); - if (size <= 0) { - mVPWrapList.setBackground(getResources().getDrawable(R.mipmap.wrap_empty)); - } else { - mVPWrapList.setBackground(getResources().getDrawable(R.mipmap.bg_gift_list)); + if (list.size() == 0) { + mVPWrapList.setBackgroundResource(R.mipmap.wrap_empty); } showWrapList(list); } @@ -520,6 +523,7 @@ public class LiveGiftDialogFragment extends AbsDialogFragment implements View.On mVPWrapList.setVisibility(View.VISIBLE); mRGroupWrap.setVisibility(View.VISIBLE); } + dismiss(); } } @@ -574,7 +578,7 @@ public class LiveGiftDialogFragment extends AbsDialogFragment implements View.On mGiftCountPopupWindow = new PopupWindow(v, ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT, true); mGiftCountPopupWindow.setBackgroundDrawable(new ColorDrawable()); mGiftCountPopupWindow.setOutsideTouchable(true); - mGiftCountPopupWindow.showAtLocation(mBtnChooseCount, Gravity.BOTTOM | Gravity.RIGHT, DpUtil.dp2px(70), DpUtil.dp2px(40)); + mGiftCountPopupWindow.showAtLocation(mBtnChooseCount, Gravity.BOTTOM | Gravity.END, DpUtil.dp2px(70), DpUtil.dp2px(40)); } /** diff --git a/live/src/main/res/layout/dialog_live_gift_wrap.xml b/live/src/main/res/layout/dialog_live_gift_wrap.xml index 2d9d4abe3..6f3e5759c 100644 --- a/live/src/main/res/layout/dialog_live_gift_wrap.xml +++ b/live/src/main/res/layout/dialog_live_gift_wrap.xml @@ -136,7 +136,6 @@ android:layout_height="0dp" android:layout_marginTop="5dp" android:layout_marginBottom="8dp" - android:background="@mipmap/bg_gift_list" android:visibility="gone" /> 0) { IMLoginManager.get(CommonAppContext.sInstance.getApplicationContext()).upDataUserInfo(info[0]); JSONObject obj = JSON.parseObject(info[0]); - SpUtil.setStringValue("userData",info[0]); UserBean bean = JSON.toJavaObject(obj, UserBean.class); bean.setMedalName(obj.getString("medal_name")); bean.setMedalLevel(obj.getIntValue("medal_level"));