调整礼物包裹UI

This commit is contained in:
zlzw 2022-10-10 13:44:31 +08:00
parent 06bc518372
commit 1435848f2a
5 changed files with 31 additions and 30 deletions

View File

@ -291,7 +291,6 @@ public class IMLoginManager extends BaseCacheManager {
@Override @Override
public void onSuccess(int code, String msg, String[] info) { public void onSuccess(int code, String msg, String[] info) {
if (code == 0 && info.length > 0) { if (code == 0 && info.length > 0) {
SpUtil.setStringValue("userData",info[0]);
userInfo = new Gson().fromJson(info[0], IMLoginModel.class); userInfo = new Gson().fromJson(info[0], IMLoginModel.class);
if (!TextUtils.isEmpty(uidAndToken[1])) { if (!TextUtils.isEmpty(uidAndToken[1])) {
userInfo.setToken(uidAndToken[1]); userInfo.setToken(uidAndToken[1]);

View File

@ -977,7 +977,6 @@ public class LiveAudienceActivity extends LiveActivity {
} }
} }
}); });
GiftCacheUtil.getInstance().resetStatus();
GiftCacheUtil.getInstance().downloadAllGift(); GiftCacheUtil.getInstance().downloadAllGift();
} }
} }

View File

@ -1,5 +1,11 @@
package com.yunbao.live.dialog; 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.Color;
import android.graphics.drawable.ColorDrawable; import android.graphics.drawable.ColorDrawable;
import android.graphics.drawable.Drawable; 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.bean.UserBean;
import com.yunbao.common.dialog.AbsDialogFragment; import com.yunbao.common.dialog.AbsDialogFragment;
import com.yunbao.common.http.HttpCallback; import com.yunbao.common.http.HttpCallback;
import com.yunbao.common.http.HttpClient;
import com.yunbao.common.interfaces.OnItemClickListener; import com.yunbao.common.interfaces.OnItemClickListener;
import com.yunbao.common.manager.IMLoginManager; import com.yunbao.common.manager.IMLoginManager;
import com.yunbao.common.utils.Bus; import com.yunbao.common.utils.Bus;
import com.yunbao.common.utils.DpUtil; import com.yunbao.common.utils.DpUtil;
import com.yunbao.common.utils.GiftCacheUtil; import com.yunbao.common.utils.GiftCacheUtil;
import com.yunbao.common.utils.NobleUtil; import com.yunbao.common.utils.NobleUtil;
import com.yunbao.common.utils.SpUtil;
import com.yunbao.common.utils.ToastUtil; import com.yunbao.common.utils.ToastUtil;
import com.yunbao.live.R; import com.yunbao.live.R;
import com.yunbao.live.activity.LiveActivity; import com.yunbao.live.activity.LiveActivity;
@ -65,12 +71,6 @@ import org.greenrobot.eventbus.ThreadMode;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; 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. * Created by cxf on 2018/10/12.
@ -285,9 +285,14 @@ public class LiveGiftDialogFragment extends AbsDialogFragment implements View.On
* 设置贵族状态 * 设置贵族状态
*/ */
private void loadUserVip() { private void loadUserVip() {
String userData = SpUtil.getStringValue("userData"); HttpClient.getInstance().get("User.getBaseInfos", "getBaseInfo")
if (userData != null && !userData.isEmpty()) { .params("uid", IMLoginManager.get(mContext).getUserInfo().getId())
JSONObject user = JSONObject.parseObject(userData); .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 nobleId = user.getIntValue("noble_id");
int resId = NobleUtil.nobleIdToImageResId(nobleId); int resId = NobleUtil.nobleIdToImageResId(nobleId);
if(resId!=-1){ if(resId!=-1){
@ -295,9 +300,10 @@ public class LiveGiftDialogFragment extends AbsDialogFragment implements View.On
mVipGoldTitle.setText(user.getString("noble_name")); mVipGoldTitle.setText(user.getString("noble_name"));
mVipGoldDesc.setText("前往貴族中心"); mVipGoldDesc.setText("前往貴族中心");
} }
} }
} }
});
}
private void loadGiftListData() { private void loadGiftListData() {
//根据变量判断是否取缓存 //根据变量判断是否取缓存
@ -382,11 +388,8 @@ public class LiveGiftDialogFragment extends AbsDialogFragment implements View.On
if(!GiftCacheUtil.getInstance().isDownloading()){ if(!GiftCacheUtil.getInstance().isDownloading()){
GiftCacheUtil.getInstance().downloadAllGift(); GiftCacheUtil.getInstance().downloadAllGift();
} }
int size = list.size(); if (list.size() == 0) {
if (size <= 0) { mVPWrapList.setBackgroundResource(R.mipmap.wrap_empty);
mVPWrapList.setBackground(getResources().getDrawable(R.mipmap.wrap_empty));
} else {
mVPWrapList.setBackground(getResources().getDrawable(R.mipmap.bg_gift_list));
} }
showWrapList(list); showWrapList(list);
} }
@ -520,6 +523,7 @@ public class LiveGiftDialogFragment extends AbsDialogFragment implements View.On
mVPWrapList.setVisibility(View.VISIBLE); mVPWrapList.setVisibility(View.VISIBLE);
mRGroupWrap.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 = new PopupWindow(v, ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT, true);
mGiftCountPopupWindow.setBackgroundDrawable(new ColorDrawable()); mGiftCountPopupWindow.setBackgroundDrawable(new ColorDrawable());
mGiftCountPopupWindow.setOutsideTouchable(true); 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));
} }
/** /**

View File

@ -136,7 +136,6 @@
android:layout_height="0dp" android:layout_height="0dp"
android:layout_marginTop="5dp" android:layout_marginTop="5dp"
android:layout_marginBottom="8dp" android:layout_marginBottom="8dp"
android:background="@mipmap/bg_gift_list"
android:visibility="gone" /> android:visibility="gone" />
<RadioGroup <RadioGroup
@ -242,6 +241,7 @@
android:gravity="center_vertical" android:gravity="center_vertical"
android:textColor="@color/white" android:textColor="@color/white"
android:textSize="12sp" android:textSize="12sp"
android:text="123"
app:dt_left_drawable="@mipmap/diamond" app:dt_left_drawable="@mipmap/diamond"
app:dt_left_height="20dp" app:dt_left_height="20dp"
app:dt_left_width="20dp" app:dt_left_width="20dp"
@ -254,7 +254,7 @@
android:layout_width="42dp" android:layout_width="42dp"
android:layout_height="22dp" android:layout_height="22dp"
android:layout_marginStart="10dp" android:layout_marginStart="10dp"
android:layout_marginBottom="5dp" android:layout_marginBottom="3dp"
android:drawablePadding="4dp" android:drawablePadding="4dp"
android:gravity="center" android:gravity="center"
android:text="@string/charge" android:text="@string/charge"

View File

@ -237,7 +237,6 @@ public class MainHttpUtil {
if (code == 0 && info.length > 0) { if (code == 0 && info.length > 0) {
IMLoginManager.get(CommonAppContext.sInstance.getApplicationContext()).upDataUserInfo(info[0]); IMLoginManager.get(CommonAppContext.sInstance.getApplicationContext()).upDataUserInfo(info[0]);
JSONObject obj = JSON.parseObject(info[0]); JSONObject obj = JSON.parseObject(info[0]);
SpUtil.setStringValue("userData",info[0]);
UserBean bean = JSON.toJavaObject(obj, UserBean.class); UserBean bean = JSON.toJavaObject(obj, UserBean.class);
bean.setMedalName(obj.getString("medal_name")); bean.setMedalName(obj.getString("medal_name"));
bean.setMedalLevel(obj.getIntValue("medal_level")); bean.setMedalLevel(obj.getIntValue("medal_level"));