星级挑战
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();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -91,8 +91,8 @@
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/btn_event2"
|
||||
android:layout_width="58dp"
|
||||
android:layout_height="80dp"
|
||||
android:layout_width="70dp"
|
||||
android:layout_height="93dp"
|
||||
android:layout_gravity="right"
|
||||
android:layout_marginRight="15dp"
|
||||
android:layout_marginBottom="5dp"
|
||||
@@ -102,8 +102,8 @@
|
||||
|
||||
<com.ms.banner.Banner
|
||||
android:id="@+id/banner2"
|
||||
android:layout_width="58dp"
|
||||
android:layout_height="80dp"
|
||||
android:layout_width="70dp"
|
||||
android:layout_height="93dp"
|
||||
android:layout_marginBottom="5dp"
|
||||
app:delay_time="5000"
|
||||
app:indicator_height="8dp"
|
||||
@@ -2010,8 +2010,8 @@
|
||||
android:layout_width="106.67dp"
|
||||
android:layout_height="27.33dp"
|
||||
android:layout_above="@id/new_message"
|
||||
android:layout_marginStart="10dp"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:layout_marginStart="10dp"
|
||||
android:layout_marginBottom="35dp"
|
||||
android:visibility="gone" />
|
||||
|
||||
|
||||
148
live/src/main/res/layout/view_start_level.xml
Normal file
148
live/src/main/res/layout/view_start_level.xml
Normal file
@@ -0,0 +1,148 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="70dp"
|
||||
android:layout_height="93dp">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/banner_back"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:scaleType="fitXY"
|
||||
android:src="@mipmap/start_level" />
|
||||
|
||||
<FrameLayout
|
||||
android:id="@+id/start_context"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_marginBottom="10dp">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_horizontal"
|
||||
android:layout_marginTop="18.33dp"
|
||||
android:text="星级挑战"
|
||||
android:textColor="#C53F4E"
|
||||
android:textSize="6sp" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="5dp"
|
||||
android:layout_marginTop="33dp"
|
||||
android:layout_marginEnd="5.67dp"
|
||||
android:gravity="center_vertical">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/icon_start"
|
||||
android:layout_width="13.33dp"
|
||||
android:layout_height="13.33dp"
|
||||
android:src="@mipmap/icon_start" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="3.33dp"
|
||||
android:orientation="vertical">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/total_star_value"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/total_star_value"
|
||||
android:textColor="#C53F4E"
|
||||
android:textSize="5.33sp" />
|
||||
|
||||
<com.yunbao.common.views.weight.ProgressView
|
||||
android:id="@+id/total_star_progress"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="4.33dp" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="1.67dp">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/current_start"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="0"
|
||||
android:textColor="#FE762A"
|
||||
android:textSize="5.33dp" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/target_start"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="/100"
|
||||
android:textColor="#7A0002"
|
||||
android:textSize="5.33dp" />
|
||||
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="5dp"
|
||||
android:layout_marginTop="58dp"
|
||||
android:layout_marginEnd="5.67dp"
|
||||
android:gravity="center_vertical">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/icon_start_number"
|
||||
android:layout_width="13.33dp"
|
||||
android:layout_height="13.33dp"
|
||||
android:src="@mipmap/icon_start_number" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="3.33dp"
|
||||
android:orientation="vertical">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/number_of_people_assisted"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/number_of_people_assisted"
|
||||
android:textColor="#C53F4E"
|
||||
android:textSize="5.33sp" />
|
||||
|
||||
<com.yunbao.common.views.weight.ProgressView
|
||||
android:id="@+id/assist_progress"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="4.33dp" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="1.67dp">
|
||||
|
||||
<TextView
|
||||
|
||||
android:id="@+id/current_assist_num"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="0"
|
||||
android:textColor="#FE762A"
|
||||
android:textSize="5.33dp" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/target_assist_num"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="/100"
|
||||
android:textColor="#7A0002"
|
||||
android:textSize="5.33dp" />
|
||||
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
</FrameLayout>
|
||||
|
||||
</RelativeLayout>
|
||||
Reference in New Issue
Block a user