update:调整守护逻辑:守护列表为空的情况下,直接打开购买守护界面
update:调整守护icon
This commit is contained in:
parent
f27e21b9ae
commit
4db4fe1301
@ -35,6 +35,7 @@ import com.yunbao.common.utils.ToastUtil;
|
||||
import com.yunbao.common.utils.WordUtil;
|
||||
import com.yunbao.common.utils.formatBigNum;
|
||||
import com.yunbao.live.R;
|
||||
import com.yunbao.live.bean.GuardUserBean;
|
||||
import com.yunbao.live.bean.LiveBean;
|
||||
import com.yunbao.live.bean.LiveBuyGuardMsgBean;
|
||||
import com.yunbao.live.bean.LiveChatBean;
|
||||
@ -86,6 +87,7 @@ import org.greenrobot.eventbus.EventBus;
|
||||
import org.greenrobot.eventbus.Subscribe;
|
||||
import org.greenrobot.eventbus.ThreadMode;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
|
||||
@ -276,9 +278,9 @@ public abstract class LiveActivity extends AbsActivity implements SocketMessageL
|
||||
mLiveLinkMicPresenter.onAudienceLeaveRoom(bean);
|
||||
}
|
||||
try {
|
||||
if (mLiveRoomViewHolder!=null) {
|
||||
if (mLiveRoomViewHolder != null) {
|
||||
if (!"".equals(bean.getHot_num()) && !"0".equals(bean.getHot_num())) {
|
||||
// mLiveRoomViewHolder.room_hot.setText(formatBigNum.formatBigNum(bean.getHot_num()));
|
||||
// mLiveRoomViewHolder.room_hot.setText(formatBigNum.formatBigNum(bean.getHot_num()));
|
||||
mLiveRoomViewHolder.setHotData(formatBigNum.formatBigNum(bean.getHot_num()));
|
||||
}
|
||||
}
|
||||
@ -331,7 +333,6 @@ public abstract class LiveActivity extends AbsActivity implements SocketMessageL
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public void onBuyLiangName(LiveReceiveGiftBean bean) {
|
||||
if (mLiveRoomViewHolder != null) {
|
||||
@ -503,8 +504,8 @@ public abstract class LiveActivity extends AbsActivity implements SocketMessageL
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onHourRank(LiveChatBean bean,JSONObject ranks) {
|
||||
if(mLiveRoomViewHolder!=null){
|
||||
public void onHourRank(LiveChatBean bean, JSONObject ranks) {
|
||||
if (mLiveRoomViewHolder != null) {
|
||||
mLiveRoomViewHolder.setHourRankData(ranks.getInteger(mLiveUid));
|
||||
}
|
||||
}
|
||||
@ -1261,17 +1262,30 @@ public abstract class LiveActivity extends AbsActivity implements SocketMessageL
|
||||
fragment.setArguments(bundle);
|
||||
fragment.show(getSupportFragmentManager(), "LiveGuardDialogFragment");
|
||||
}
|
||||
|
||||
/**
|
||||
* 守护列表弹窗
|
||||
*/
|
||||
public void openNewGuardListWindow() {
|
||||
LiveNewGuardListDialogFragment fragment = new LiveNewGuardListDialogFragment();
|
||||
fragment.setLiveGuardInfo(mLiveGuardInfo);
|
||||
Bundle bundle = new Bundle();
|
||||
bundle.putString(Constants.LIVE_UID, mLiveUid);
|
||||
bundle.putBoolean(Constants.ANCHOR, mIsAnchor);
|
||||
fragment.setArguments(bundle);
|
||||
fragment.show(getSupportFragmentManager(), "LiveGuardDialogFragment");
|
||||
LiveHttpUtil.getGuardList(mLiveUid, 1, new HttpCallback() {
|
||||
@Override
|
||||
public void onSuccess(int code, String msg, String[] info) {
|
||||
List<GuardUserBean> list = JSON.parseArray(Arrays.toString(info), GuardUserBean.class);
|
||||
if(list.isEmpty()){
|
||||
openNewBuyGuardWindow();
|
||||
}else {
|
||||
LiveNewGuardListDialogFragment fragment = new LiveNewGuardListDialogFragment();
|
||||
fragment.setList(list);
|
||||
fragment.setLiveGuardInfo(mLiveGuardInfo);
|
||||
Bundle bundle = new Bundle();
|
||||
bundle.putString(Constants.LIVE_UID, mLiveUid);
|
||||
bundle.putBoolean(Constants.ANCHOR, mIsAnchor);
|
||||
fragment.setArguments(bundle);
|
||||
fragment.show(getSupportFragmentManager(), "LiveGuardDialogFragment");
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@ -1337,11 +1351,12 @@ public abstract class LiveActivity extends AbsActivity implements SocketMessageL
|
||||
bundle.putString(Constants.LIVE_UID, mLiveUid);
|
||||
bundle.putString(Constants.LIVE_ANCHER_NAME, mAncherName);
|
||||
bundle.putString(Constants.STREAM, mStream);
|
||||
bundle.putString(Constants.LIVE_ANCHER_ICON,mAncherIcon);
|
||||
bundle.putString(Constants.USER_ICON,CommonAppConfig.getInstance().getUserBean().getAvatar());
|
||||
bundle.putString(Constants.LIVE_ANCHER_ICON, mAncherIcon);
|
||||
bundle.putString(Constants.USER_ICON, CommonAppConfig.getInstance().getUserBean().getAvatar());
|
||||
fragment.setArguments(bundle);
|
||||
fragment.show(getSupportFragmentManager(), "LiveGuardBuyDialogFragment");
|
||||
}
|
||||
|
||||
/**
|
||||
* 打开购买守护的弹窗
|
||||
*/
|
||||
|
@ -34,6 +34,7 @@ import com.yunbao.live.bean.GuardUserBean;
|
||||
import com.yunbao.live.bean.LiveGuardInfo;
|
||||
import com.yunbao.live.http.LiveHttpUtil;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
@ -52,6 +53,7 @@ public class LiveNewGuardListDialogFragment extends AbsDialogFragment implements
|
||||
private LiveGuardInfo mLiveGuardInfo;
|
||||
private String mLiveUid;
|
||||
private boolean mIsAnchor;//是否是主播
|
||||
private List<GuardUserBean> list=new ArrayList<>();
|
||||
|
||||
@Override
|
||||
protected int getLayoutId() {
|
||||
@ -112,6 +114,9 @@ public class LiveNewGuardListDialogFragment extends AbsDialogFragment implements
|
||||
private void initView() {
|
||||
mRefreshView.setEmptyLayoutId(mIsAnchor ? R.layout.view_no_data_guard_anc : R.layout.view_no_data_guard_aud);
|
||||
mRefreshView.setLayoutManager(new LinearLayoutManager(mContext, LinearLayoutManager.VERTICAL, false));
|
||||
mGuardAdapter = new GuardAdapter(mContext, true, false);
|
||||
mGuardAdapter.setList(list);
|
||||
setAdapterData();
|
||||
mRefreshView.setDataHelper(new CommonRefreshView.DataHelper<GuardUserBean>() {
|
||||
@Override
|
||||
public RefreshAdapter<GuardUserBean> getAdapter() {
|
||||
@ -129,36 +134,9 @@ public class LiveNewGuardListDialogFragment extends AbsDialogFragment implements
|
||||
@Override
|
||||
public List<GuardUserBean> processData(String[] info) {
|
||||
List<GuardUserBean> list = JSON.parseArray(Arrays.toString(info), GuardUserBean.class);
|
||||
if (list.isEmpty()) {
|
||||
userLayout.setVisibility(View.INVISIBLE);
|
||||
}else {
|
||||
GuardUserBean bean = list.get(0);
|
||||
giftSvga.setImageResource(R.drawable.guardian_img_wings_p);
|
||||
ImgLoader.display(mContext, bean.getAvatar(), guardIcon);
|
||||
guardIcon.setVisibility(View.VISIBLE);
|
||||
userName.setText(bean.getUserNiceName());
|
||||
String guardString = WordUtil.getString(R.string.guard_week_con);
|
||||
userGuard.setText(guardString + " " + bean.getContribute());
|
||||
userSex.setImageResource(CommonIconUtil.getSexIcon(bean.getSex()));
|
||||
LevelBean levelBean = CommonAppConfig.getInstance().getLevel(bean.getLevel());
|
||||
if (levelBean != null) {
|
||||
ImgLoader.display(mContext, levelBean.getThumb(), userLevel);
|
||||
}
|
||||
}
|
||||
if (mLiveGuardInfo != null) {
|
||||
int guardType = mLiveGuardInfo.getMyGuardType();
|
||||
if (guardType == Constants.GUARD_TYPE_NONE) {
|
||||
tip1.setText(R.string.guard_tip_0);
|
||||
} else if (guardType == Constants.GUARD_TYPE_DAY) {
|
||||
tip1.setText(WordUtil.getString(R.string.guard_tip_day) + mLiveGuardInfo.getMyGuardEndTime());
|
||||
mBtnBuy.setText(R.string.guard_buy_3);
|
||||
} else if (guardType == Constants.GUARD_TYPE_MONTH) {
|
||||
tip1.setText(WordUtil.getString(R.string.guard_tip_1) + mLiveGuardInfo.getMyGuardEndTime());
|
||||
mBtnBuy.setText(R.string.guard_buy_3);
|
||||
} else if (guardType == Constants.GUARD_TYPE_YEAR) {
|
||||
tip1.setText(WordUtil.getString(R.string.guard_tip_2) + mLiveGuardInfo.getMyGuardEndTime());
|
||||
mBtnBuy.setText(R.string.guard_buy_3);
|
||||
}
|
||||
if(!list.isEmpty()){
|
||||
LiveNewGuardListDialogFragment.this.list=list;
|
||||
setAdapterData();
|
||||
}
|
||||
return list;
|
||||
}
|
||||
@ -183,7 +161,8 @@ public class LiveNewGuardListDialogFragment extends AbsDialogFragment implements
|
||||
|
||||
}
|
||||
});
|
||||
mRefreshView.initData();
|
||||
mRefreshView.setRecyclerViewAdapter(mGuardAdapter);
|
||||
mGuardAdapter.notifyDataSetChanged();
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -198,4 +177,40 @@ public class LiveNewGuardListDialogFragment extends AbsDialogFragment implements
|
||||
initView();
|
||||
return show;
|
||||
}
|
||||
private void setAdapterData(){
|
||||
if (list.isEmpty()) {
|
||||
userLayout.setVisibility(View.INVISIBLE);
|
||||
}else {
|
||||
GuardUserBean bean = list.get(0);
|
||||
giftSvga.setImageResource(R.drawable.guardian_img_wings_p);
|
||||
ImgLoader.display(mContext, bean.getAvatar(), guardIcon);
|
||||
guardIcon.setVisibility(View.VISIBLE);
|
||||
userName.setText(bean.getUserNiceName());
|
||||
String guardString = WordUtil.getString(R.string.guard_week_con);
|
||||
userGuard.setText(guardString + " " + bean.getContribute());
|
||||
userSex.setImageResource(CommonIconUtil.getSexIcon(bean.getSex()));
|
||||
LevelBean levelBean = CommonAppConfig.getInstance().getLevel(bean.getLevel());
|
||||
if (levelBean != null) {
|
||||
ImgLoader.display(mContext, levelBean.getThumb(), userLevel);
|
||||
}
|
||||
}
|
||||
if (mLiveGuardInfo != null) {
|
||||
int guardType = mLiveGuardInfo.getMyGuardType();
|
||||
if (guardType == Constants.GUARD_TYPE_NONE) {
|
||||
tip1.setText(R.string.guard_tip_0);
|
||||
} else if (guardType == Constants.GUARD_TYPE_DAY) {
|
||||
tip1.setText(WordUtil.getString(R.string.guard_tip_day) + mLiveGuardInfo.getMyGuardEndTime());
|
||||
mBtnBuy.setText(R.string.guard_buy_3);
|
||||
} else if (guardType == Constants.GUARD_TYPE_MONTH) {
|
||||
tip1.setText(WordUtil.getString(R.string.guard_tip_1) + mLiveGuardInfo.getMyGuardEndTime());
|
||||
mBtnBuy.setText(R.string.guard_buy_3);
|
||||
} else if (guardType == Constants.GUARD_TYPE_YEAR) {
|
||||
tip1.setText(WordUtil.getString(R.string.guard_tip_2) + mLiveGuardInfo.getMyGuardEndTime());
|
||||
mBtnBuy.setText(R.string.guard_buy_3);
|
||||
}
|
||||
}
|
||||
}
|
||||
public void setList(List<GuardUserBean> list) {
|
||||
this.list=list;
|
||||
}
|
||||
}
|
||||
|
@ -245,8 +245,8 @@
|
||||
android:id="@+id/guard_imageView"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="58dp"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:layout_marginTop="30dp"
|
||||
android:layout_marginStart="125dp"
|
||||
android:scaleType="centerCrop"
|
||||
android:src="@drawable/guardian_img_wings"
|
||||
android:visibility="invisible"
|
||||
@ -257,7 +257,7 @@
|
||||
android:layout_width="65dp"
|
||||
android:layout_height="65dp"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:layout_marginStart="-5dp"
|
||||
android:layout_marginStart="-6dp"
|
||||
android:layout_marginTop="25dp"
|
||||
android:layout_toEndOf="@+id/guard_imageView"
|
||||
android:scaleType="centerCrop"
|
||||
@ -269,9 +269,9 @@
|
||||
android:id="@+id/guard_imageView_one"
|
||||
android:layout_width="65dp"
|
||||
android:layout_height="65dp"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:layout_marginTop="25dp"
|
||||
android:layout_toStartOf="@id/guard_imageView"
|
||||
|
||||
android:layout_toStartOf="@id/guard_imageView_two"
|
||||
android:scaleType="centerCrop"
|
||||
android:src="@drawable/guardian_img_wings"
|
||||
android:visibility="invisible"
|
||||
|
@ -195,8 +195,8 @@
|
||||
|
||||
<com.makeramen.roundedimageview.RoundedImageView
|
||||
android:id="@+id/user_guard"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_centerInParent="true"
|
||||
android:scaleType="centerCrop"
|
||||
android:src="@mipmap/img_guardian_empty"
|
||||
|
Loading…
Reference in New Issue
Block a user