星级挑战
This commit is contained in:
@@ -173,7 +173,7 @@ public class LiveChatAdapter extends RecyclerView.Adapter {
|
||||
|
||||
itemView.setTag(bean);
|
||||
LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT);
|
||||
params.setMargins(0, 0, DpUtil.dp2px(80), 12);
|
||||
params.setMargins(0, 0, DpUtil.dp2px(95), 12);
|
||||
mBg.setLayoutParams(params);
|
||||
if (bean.getType() == 6) {//大作战活动
|
||||
view_action_game.setVisibility(View.VISIBLE);
|
||||
|
||||
@@ -1,28 +1,72 @@
|
||||
package com.yunbao.live.views;
|
||||
|
||||
import android.content.Context;
|
||||
import android.text.TextUtils;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.FrameLayout;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.bumptech.glide.Glide;
|
||||
import com.ms.banner.holder.BannerViewHolder;
|
||||
import com.yunbao.common.bean.BannerBean;
|
||||
import com.yunbao.common.views.weight.ProgressView;
|
||||
import com.yunbao.live.R;
|
||||
|
||||
public class CustomViewHolder implements BannerViewHolder<BannerBean> {
|
||||
|
||||
@Override
|
||||
public View createView(Context context, int position, BannerBean data) {
|
||||
// 返回mImageView页面布局
|
||||
ImageView imageView = new ImageView(context);
|
||||
ViewGroup.LayoutParams params = new ViewGroup.LayoutParams(
|
||||
ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT
|
||||
);
|
||||
imageView.setLayoutParams(params);
|
||||
imageView.setScaleType(ImageView.ScaleType.FIT_XY);
|
||||
Glide.with(context).load(data.getImageUrl()).into(imageView);
|
||||
LayoutInflater inflater = LayoutInflater.from(context);
|
||||
|
||||
return imageView;
|
||||
View contextView = inflater.inflate(R.layout.view_start_level, null);
|
||||
|
||||
FrameLayout startContext = contextView.findViewById(R.id.start_context);
|
||||
ImageView bannerBack = contextView.findViewById(R.id.banner_back);
|
||||
ImageView iconStart = contextView.findViewById(R.id.icon_start);
|
||||
ImageView iconStartNumber = contextView.findViewById(R.id.icon_start_number);
|
||||
ProgressView totalStarProgress = contextView.findViewById(R.id.total_star_progress);
|
||||
ProgressView assistProgress = contextView.findViewById(R.id.assist_progress);
|
||||
TextView currentStart = contextView.findViewById(R.id.current_start);
|
||||
TextView targetStart = contextView.findViewById(R.id.target_start);
|
||||
TextView totalStarValue = contextView.findViewById(R.id.total_star_value);
|
||||
TextView numberOfPeopleAssisted = contextView.findViewById(R.id.number_of_people_assisted);
|
||||
TextView targetAssist = contextView.findViewById(R.id.target_assist_num);
|
||||
TextView currentAssist = contextView.findViewById(R.id.current_assist_num);
|
||||
if (data.isStart()) {
|
||||
startContext.setVisibility(View.VISIBLE);
|
||||
Glide.with(context).load(R.mipmap.start_level).into(bannerBack);
|
||||
Glide.with(context)
|
||||
.load(data.getModel().getStarSrc())
|
||||
.error(R.mipmap.icon_start)
|
||||
.into(iconStart);
|
||||
Glide.with(context)
|
||||
.load(data.getModel().getAssistSrc())
|
||||
.error(R.mipmap.icon_start_number)
|
||||
.into(iconStartNumber);
|
||||
int targetStarVal = TextUtils.isEmpty(data.getModel().getTargetStarVal()) ? 100 : Integer.parseInt(data.getModel().getTargetStarVal());
|
||||
int currentStarVal = TextUtils.isEmpty(data.getModel().getCurrentStarVal()) ? 0 : Integer.parseInt(data.getModel().getCurrentStarVal());
|
||||
int targetAssistNum = TextUtils.isEmpty(data.getModel().getTargetAssistNum()) ? 0 : Integer.parseInt(data.getModel().getTargetAssistNum());
|
||||
int currentAssistNum = TextUtils.isEmpty(data.getModel().getCurrentAssistNum()) ? 0 : Integer.parseInt(data.getModel().getCurrentAssistNum());
|
||||
totalStarProgress.setMaxCount(targetStarVal);
|
||||
assistProgress.setMaxCount(targetAssistNum);
|
||||
totalStarProgress.setCurrentCount(currentStarVal);
|
||||
assistProgress.setCurrentCount(currentAssistNum);
|
||||
currentStart.setText(String.valueOf(currentStarVal));
|
||||
targetStart.setText("/" + targetStarVal);
|
||||
totalStarValue.setText(TextUtils.isEmpty(data.getModel().getTaskName1()) ? context.getString(R.string.total_star_value) : data.getModel().getTaskName1());
|
||||
numberOfPeopleAssisted.setText(TextUtils.isEmpty(data.getModel().getTaskName2()) ? context.getString(R.string.total_star_value) : data.getModel().getTaskName2());
|
||||
targetAssist.setText("/" + targetAssistNum);
|
||||
currentAssist.setText(String.valueOf(currentAssistNum));
|
||||
} else {
|
||||
String imagerUrl = data.getImageUrl().replace("qny", "downs");
|
||||
Glide.with(context).load(imagerUrl).into(bannerBack);
|
||||
startContext.setVisibility(View.GONE);
|
||||
}
|
||||
|
||||
return contextView;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -65,6 +65,7 @@ import com.yunbao.common.bean.HourRank;
|
||||
import com.yunbao.common.bean.LevelBean;
|
||||
import com.yunbao.common.bean.LiveGiftBean;
|
||||
import com.yunbao.common.bean.MsgModel;
|
||||
import com.yunbao.common.bean.StarChallengeStatusModel;
|
||||
import com.yunbao.common.bean.UserBean;
|
||||
import com.yunbao.common.glide.ImgLoader;
|
||||
import com.yunbao.common.http.API;
|
||||
@@ -1024,6 +1025,17 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
|
||||
reloadIM();
|
||||
}
|
||||
|
||||
public void showStart(StarChallengeStatusModel data) {
|
||||
if (mBannerList2 == null) {
|
||||
mBannerList2 = new ArrayList<>();
|
||||
}
|
||||
BannerBean bannerBean = new BannerBean();
|
||||
bannerBean.setStart(true);
|
||||
bannerBean.setModel(data);
|
||||
mBannerList2.add(bannerBean);
|
||||
showBanner2();
|
||||
}
|
||||
|
||||
public void hideFloatMsg() {
|
||||
msgLayout.setVisibility(View.GONE);
|
||||
}
|
||||
|
||||
@@ -37,6 +37,7 @@ import com.yunbao.common.CommonAppConfig;
|
||||
import com.yunbao.common.CommonAppContext;
|
||||
import com.yunbao.common.Constants;
|
||||
import com.yunbao.common.bean.MsgModel;
|
||||
import com.yunbao.common.bean.StarChallengeStatusModel;
|
||||
import com.yunbao.common.bean.UserBean;
|
||||
import com.yunbao.common.custom.MyViewPager;
|
||||
import com.yunbao.common.event.FollowEvent;
|
||||
@@ -45,6 +46,7 @@ import com.yunbao.common.http.CommonHttpConsts;
|
||||
import com.yunbao.common.http.CommonHttpUtil;
|
||||
import com.yunbao.common.http.HttpCallback;
|
||||
import com.yunbao.common.http.HttpClient;
|
||||
import com.yunbao.common.http.live.LiveNetManager;
|
||||
import com.yunbao.common.manager.IMLoginManager;
|
||||
import com.yunbao.common.utils.Bus;
|
||||
import com.yunbao.common.utils.DialogUitl;
|
||||
@@ -284,7 +286,23 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe
|
||||
mLiveRoomViewHolder.initHourRankList();
|
||||
}
|
||||
});
|
||||
/**
|
||||
* 获取当前直播间星级
|
||||
*/
|
||||
LiveNetManager.get(mContext)
|
||||
.getStarChallengeStatus(mLiveBean.getUid(), new com.yunbao.common.http.base.HttpCallback<StarChallengeStatusModel>() {
|
||||
@Override
|
||||
public void onSuccess(StarChallengeStatusModel data) {
|
||||
if (mLiveRoomViewHolder != null) {
|
||||
mLiveRoomViewHolder.showStart(data);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(String error) {
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -1531,11 +1549,12 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe
|
||||
*/
|
||||
public void showNewMessage() {
|
||||
if (mLiveRoomViewHolder != null) {
|
||||
mLiveRoomViewHolder.showNewMessage( );
|
||||
mLiveRoomViewHolder.showNewMessage();
|
||||
}
|
||||
}
|
||||
public void showAtMessage(){
|
||||
if (mLiveRoomViewHolder!=null){
|
||||
|
||||
public void showAtMessage() {
|
||||
if (mLiveRoomViewHolder != null) {
|
||||
mLiveRoomViewHolder.showAtMessage();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user