Merge branch 'live_anchor_6.4.8'

This commit is contained in:
18401019693 2023-02-27 11:12:45 +08:00
commit a7e6efa0dc
52 changed files with 2710 additions and 355 deletions

View File

@ -0,0 +1,52 @@
package com.yunbao.common.adapter;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.ViewGroup;
import androidx.annotation.NonNull;
import androidx.recyclerview.widget.RecyclerView;
import com.yunbao.common.R;
import com.yunbao.common.bean.ListInfoMessageModel;
import com.yunbao.common.views.LiveSystemMessageViewHolder;
import java.util.ArrayList;
import java.util.List;
/**
* 主播消息中心适配器
*/
public class LiveSystemMessageAdapter extends RecyclerView.Adapter {
private Context mContext;
private LayoutInflater mInflater;
private List<ListInfoMessageModel> listInfoMessageModels = new ArrayList<>();
public LiveSystemMessageAdapter(Context mContext) {
this.mContext = mContext;
mInflater = LayoutInflater.from(mContext);
}
@NonNull
@Override
public RecyclerView.ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
return new LiveSystemMessageViewHolder(mInflater.inflate(R.layout.view_live_system_message, parent, false));
}
@Override
public void onBindViewHolder(@NonNull RecyclerView.ViewHolder holder, int position) {
LiveSystemMessageViewHolder messageViewHolder = (LiveSystemMessageViewHolder) holder;
messageViewHolder.setViewData(listInfoMessageModels.get(position));
}
@Override
public int getItemCount() {
return listInfoMessageModels.size();
}
public void addData(List<ListInfoMessageModel> list) {
listInfoMessageModels.addAll(list);
notifyDataSetChanged();
}
}

View File

@ -0,0 +1,96 @@
package com.yunbao.common.bean;
import android.text.TextUtils;
import com.google.gson.annotations.SerializedName;
import java.text.SimpleDateFormat;
import java.util.Date;
public class ListInfoMessageModel extends BaseModel {
@SerializedName("id")
private int id;
@SerializedName("title")
private String title;
@SerializedName("banner")
private String banner;
@SerializedName("content")
private String content;
@SerializedName("link")
private String link;
@SerializedName("addtime")
private String addtime;
public int getId() {
return id;
}
public ListInfoMessageModel setId(int id) {
this.id = id;
return this;
}
public String getTitle() {
return title;
}
public ListInfoMessageModel setTitle(String title) {
this.title = title;
return this;
}
public String getBanner() {
return banner;
}
public ListInfoMessageModel setBanner(String banner) {
this.banner = banner;
return this;
}
public String getContent() {
return content;
}
public ListInfoMessageModel setContent(String content) {
this.content = content;
return this;
}
public String getLink() {
return link;
}
public ListInfoMessageModel setLink(String link) {
this.link = link;
return this;
}
public String getAddtime() {
return addtime;
}
public ListInfoMessageModel setAddtime(String addtime) {
this.addtime = addtime;
return this;
}
/**
* 会话列表展示时间
*/
public String getLastDate(String type) {
if (!TextUtils.isEmpty(addtime) && !TextUtils.equals(addtime, "0")) {
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm");
Date currenTimeZone;
if (TextUtils.equals(type, "-1")) {
currenTimeZone = new Date(Long.parseLong(addtime));
} else {
currenTimeZone = new Date(Long.parseLong(addtime + "000"));
}
return sdf.format(currenTimeZone);
} else {
return "";
}
}
}

View File

@ -0,0 +1,106 @@
package com.yunbao.common.bean;
import com.google.gson.annotations.SerializedName;
/**
* 直播数据
*/
public class LiveDataInfoModel extends BaseModel{
@SerializedName("totalCoin")
private long totalCoin;//钻石数量
@SerializedName("totalGold")
private long totalGold;//金币数量
@SerializedName("acceptNum")
private long acceptNum;//送礼人数
@SerializedName("enterNum")
private long enterNum;//进场人数
@SerializedName("attentionNum")
private long attentionNum;//关注人数
@SerializedName("fanGroupNum")
private long fanGroupNum;//粉丝团人数
@SerializedName("attentionNumRate")
private double attentionNumRate;//关注转化率
@SerializedName("fanGroupNumRate")
private double fanGroupNumRate;//粉丝团转化率
public LiveDataInfoModel() {
}
public long getTotalCoin() {
return totalCoin;
}
public void setTotalCoin(long totalCoin) {
this.totalCoin = totalCoin;
}
public long getTotalGold() {
return totalGold;
}
public void setTotalGold(long totalGold) {
this.totalGold = totalGold;
}
public long getAcceptNum() {
return acceptNum;
}
public void setAcceptNum(long acceptNum) {
this.acceptNum = acceptNum;
}
public long getEnterNum() {
return enterNum;
}
public void setEnterNum(long enterNum) {
this.enterNum = enterNum;
}
public long getAttentionNum() {
return attentionNum;
}
public void setAttentionNum(long attentionNum) {
this.attentionNum = attentionNum;
}
public long getFanGroupNum() {
return fanGroupNum;
}
public void setFanGroupNum(long fanGroupNum) {
this.fanGroupNum = fanGroupNum;
}
public double getAttentionNumRate() {
return attentionNumRate;
}
public void setAttentionNumRate(double attentionNumRate) {
this.attentionNumRate = attentionNumRate;
}
public double getFanGroupNumRate() {
return fanGroupNumRate;
}
public void setFanGroupNumRate(double fanGroupNumRate) {
this.fanGroupNumRate = fanGroupNumRate;
}
@Override
public String toString() {
return "LiveDataInfoModel{" +
"totalCoin=" + totalCoin +
", totalGold=" + totalGold +
", acceptNum=" + acceptNum +
", enterNum=" + enterNum +
", attentionNum=" + attentionNum +
", fanGroupNum=" + fanGroupNum +
", attentionNumRate=" + attentionNumRate +
", fanGroupNumRate=" + fanGroupNumRate +
'}';
}
}

View File

@ -0,0 +1,259 @@
package com.yunbao.common.bean;
import com.google.gson.annotations.SerializedName;
import com.yunbao.common.R;
import com.yunbao.common.utils.StringUtil;
import com.yunbao.common.utils.WordUtil;
import java.io.Serializable;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;
import java.util.Locale;
/**
* 直播任务
*/
public class LiveTaskModel extends BaseModel {
public static final int TASK_TYPE_TIP = 0;
public static final int TASK_TYPE_ITEM = 1;
int type;
@SerializedName("new")
NewUser user;
@SerializedName("list")
List<List<Task>> list;
public LiveTaskModel() {
}
public int getType() {
return type;
}
public void setType(int type) {
this.type = type;
}
public NewUser getUser() {
return user;
}
public void setUser(NewUser user) {
this.user = user;
}
public List<List<Task>> getList() {
if (user != null && user.isNew()) {
for (List<Task> tasks : list) {
for (Task task : tasks) {
task.isNewUser = true;
}
}
}
return list;
}
public void setList(List<List<Task>> list) {
this.list = list;
}
@Override
public String toString() {
return "LiveTaskModel{" +
"type=" + type +
", user=" + user +
", list=" + list +
'}';
}
public static class NewUser {
@SerializedName("isNew")
private int isNew;
@SerializedName("endTime")
private String endTime;
public NewUser() {
}
public boolean isNew() {
return isNew == 1;
}
public void setNew(int aNew) {
isNew = aNew;
}
public String getEndTime() {
if (!StringUtil.isEmpty(endTime)) {
endTime = WordUtil.getString(R.string.live_task_new_user_timer) + new SimpleDateFormat("yyyy/MM/dd HH:mm", Locale.getDefault()).format(new Date(Long.parseLong(endTime) * 1000));
}
return endTime;
}
public void setEndTime(String endTime) {
this.endTime = endTime;
}
@Override
public String toString() {
return "NewUser{" +
"isNew=" + isNew +
", endTime='" + endTime + '\'' +
'}';
}
}
public static class Task implements Serializable {
@SerializedName("id")
private int id;
@SerializedName("type")
private int type;
@SerializedName("task_type")
private int taskType;
@SerializedName("task_name")
private String taskName;
@SerializedName("task_num")
private int taskNum;
@SerializedName("hot")
private long hot;
@SerializedName("exp")
private long exp;
@SerializedName("new_hot")
private long newUserHot;
@SerializedName("new_exp")
private long newUserExp;
@SerializedName("sort")
private int sort;
@SerializedName("status")
private int status;
@SerializedName("now_num")
private int nowValue;
private boolean isNewUser = false;
public Task() {
}
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public int getType() {
return type;
}
public void setType(int type) {
this.type = type;
}
public int getTaskType() {
return taskType;
}
public void setTaskType(int taskType) {
this.taskType = taskType;
}
public String getTaskName() {
return taskName;
}
public void setTaskName(String taskName) {
this.taskName = taskName;
}
public int getTaskNum() {
return taskNum;
}
public void setTaskNum(int taskNum) {
this.taskNum = taskNum;
}
public long getHot() {
if (isNewUser) {
hot = newUserHot;
}
return hot;
}
public void setHot(long hot) {
this.hot = hot;
}
public long getExp() {
if (isNewUser) {
exp = newUserExp;
}
return exp;
}
public void setExp(long exp) {
this.exp = exp;
}
public long getNewUserHot() {
return newUserHot;
}
public void setNewUserHot(long newUserHot) {
this.newUserHot = newUserHot;
}
public long getNewUserExp() {
return newUserExp;
}
public void setNewUserExp(long newUserExp) {
this.newUserExp = newUserExp;
}
public int getSort() {
return sort;
}
public void setSort(int sort) {
this.sort = sort;
}
public boolean getStatus() {
return status == 1;
}
public void setStatus(int status) {
this.status = status;
}
public int getNowValue() {
return nowValue;
}
public void setNowValue(int nowValue) {
this.nowValue = nowValue;
}
@Override
public String toString() {
return "Task{" +
"id=" + id +
", type=" + type +
", taskType=" + taskType +
", taskName='" + taskName + '\'' +
", taskNum=" + taskNum +
", hot=" + hot +
", exp=" + exp +
", newUserHot=" + newUserHot +
", newUserExp=" + newUserExp +
", sort=" + sort +
", status=" + status +
'}';
}
}
}

View File

@ -0,0 +1,33 @@
package com.yunbao.common.dialog;
import android.content.Context;
import androidx.annotation.NonNull;
import com.lxj.xpopup.XPopup;
import com.lxj.xpopup.core.BottomPopupView;
public abstract class AbsDialogPopupWindow extends BottomPopupView {
private final Context mContext;
public AbsDialogPopupWindow(@NonNull Context context) {
super(context);
this.mContext = context;
}
public abstract void buildDialog(XPopup.Builder builder);
public abstract int bindLayoutId();
@Override
protected int getImplLayoutId() {
return bindLayoutId();
}
public void showDialog() {
XPopup.Builder builder = new XPopup.Builder(mContext);
builder.isDestroyOnDismiss(true);
buildDialog(builder);
builder.asCustom(this).show();
}
}

View File

@ -12,10 +12,13 @@ import com.yunbao.common.bean.HourRank;
import com.yunbao.common.bean.HttpCallbackModel;
import com.yunbao.common.bean.IMLoginModel;
import com.yunbao.common.bean.LinkMicUserBeanV2;
import com.yunbao.common.bean.ListInfoMessageModel;
import com.yunbao.common.bean.LiveAiRobotBean;
import com.yunbao.common.bean.LiveDataInfoModel;
import com.yunbao.common.bean.LiveInfoModel;
import com.yunbao.common.bean.LiveRoomActivityBanner;
import com.yunbao.common.bean.LiveStetUpStatusModel;
import com.yunbao.common.bean.LiveTaskModel;
import com.yunbao.common.bean.MsgSwitchDetailModel;
import com.yunbao.common.bean.NewPeopleInfo;
import com.yunbao.common.bean.NobleRankHideUserListModel;
@ -542,4 +545,34 @@ public interface PDLiveApi {
Observable<ResponseModel<BaseModel>> jieshuDRPK(
@Query("roomid") String roomId,
@Query("uid") String uid);
@GET("/api/public/?service=Message.getListInfo")
Observable<ResponseModel<List<ListInfoMessageModel>>> getListInfo(
@Query("type") String type,
@Query("p") int p);
/**
* 获取主播任务列表
*/
@GET("/api/public/?service=Live.getLiveTaskStatus")
Observable<ResponseModel<LiveTaskModel>> getLiveTaskList(
@Query("type") int type,
@Query("liveuid") String liveUid
);
/**
* 获取直播数据
*/
@GET("/api/public/?service=Live.getLiveStatisticalData")
Observable<ResponseModel<LiveDataInfoModel>> getLiveDataInfo(
@Query("liveuid") String liveUid
);
/**
* 获取直播数据
*/
@GET("/api/public/?service=Message.getAnchorMsg")
Observable<ResponseModel<List<ListInfoMessageModel>>> getAnchorMsg(
@Query("liveuid") String liveUid, @Query("page") int page, @Query("limit") int limit
);
}

View File

@ -14,10 +14,13 @@ import com.yunbao.common.bean.EnterRoomNewModel;
import com.yunbao.common.bean.HttpCallbackModel;
import com.yunbao.common.bean.LinkMicUserBean;
import com.yunbao.common.bean.LinkMicUserBeanV2;
import com.yunbao.common.bean.ListInfoMessageModel;
import com.yunbao.common.bean.LiveAiRobotBean;
import com.yunbao.common.bean.LiveDataInfoModel;
import com.yunbao.common.bean.LiveInfoModel;
import com.yunbao.common.bean.LiveRoomActivityBanner;
import com.yunbao.common.bean.LiveStetUpStatusModel;
import com.yunbao.common.bean.LiveTaskModel;
import com.yunbao.common.bean.NobleRankHideUserListModel;
import com.yunbao.common.bean.NobleTrumpetModel;
import com.yunbao.common.bean.PkRankBean;
@ -1075,6 +1078,73 @@ public class LiveNetManager {
}).isDisposed();
}
public void getListInfo(String type, int p, HttpCallback<List<ListInfoMessageModel>> callback) {
API.get().pdLiveApi(mContext)
.getListInfo(type, p)
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(listResponseModel -> {
callback.onSuccess(listResponseModel.getData().getInfo());
}, throwable -> {
callback.onError(throwable.getMessage());
}).isDisposed();
}
/**
* 获取直播任务
*
* @param type 1 直播任务 2粉丝任务
*/
public void getLiveTask(int type, String liveUid, HttpCallback<LiveTaskModel> callback) {
API.get().pdLiveApi(mContext)
.getLiveTaskList(type, liveUid)
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(listResponseModel -> {
callback.onSuccess(listResponseModel.getData().getInfo());
}, throwable -> {
callback.onError(throwable.getMessage());
}).isDisposed();
}
/**
* 获取直播数据
*/
public void getLiveData(String liveUid, HttpCallback<LiveDataInfoModel> callback) {
API.get().pdLiveApi(mContext)
.getLiveDataInfo(liveUid)
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(listResponseModel -> {
callback.onSuccess(listResponseModel.getData().getInfo());
}, throwable -> {
callback.onError(throwable.getMessage());
}).isDisposed();
}
/**
* 获取主播消息
*
* @param liveUid 直播间id
* @param page 页码
* @param callback 回调
*/
public void getAnchorMsg(String liveUid, int page, HttpCallback<List<ListInfoMessageModel>> callback) {
API.get().pdLiveApi(mContext)
.getAnchorMsg(liveUid, page, 10)
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(listResponseModel -> {
if (callback != null) {
callback.onSuccess(listResponseModel.getData().getInfo());
}
}, throwable -> {
if (callback != null) {
callback.onError(throwable.getMessage());
}
}).isDisposed();
}
/**
* 直播间取消网络请求
*/

View File

@ -0,0 +1,91 @@
package com.yunbao.common.views;
import android.content.Context;
import androidx.annotation.NonNull;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import com.lxj.xpopup.core.BottomPopupView;
import com.yunbao.common.R;
import com.yunbao.common.adapter.LiveSystemMessageAdapter;
import com.yunbao.common.bean.ListInfoMessageModel;
import com.yunbao.common.http.base.HttpCallback;
import com.yunbao.common.http.live.LiveNetManager;
import com.yunbao.common.utils.ToastUtil;
import com.yunbao.common.views.weight.OnRecyclerViewScrollListener;
import java.util.List;
/**
* 主播消息中心
*/
public class LiveAnchorMessageCustomPopup extends BottomPopupView {
private LiveSystemMessageAdapter adapter;
private RecyclerView liveMessage;
private String liveUid;
private int page = 1, size = 0;
public LiveAnchorMessageCustomPopup(@NonNull Context context, String liveUid) {
super(context);
this.liveUid = liveUid;
}
public LiveAnchorMessageCustomPopup(@NonNull Context context) {
super(context);
}
// 返回自定义弹窗的布局
@Override
protected int getImplLayoutId() {
return R.layout.dialog_live_anchor_message;
}
// 执行初始化操作比如findView设置点击或者任何你弹窗内的业务逻辑
@Override
protected void onCreate() {
super.onCreate();
initView();
initDate();
}
private void initDate() {
LiveNetManager.get(getContext())
.getAnchorMsg(liveUid, page, new HttpCallback<List<ListInfoMessageModel>>() {
@Override
public void onSuccess(List<ListInfoMessageModel> data) {
size = data.size();
adapter.addData(data);
}
@Override
public void onError(String error) {
ToastUtil.show(error);
}
});
}
private void initView() {
liveMessage = findViewById(R.id.live_message);
liveMessage.setHasFixedSize(false);
liveMessage.setLayoutManager(new LinearLayoutManager(getContext(), LinearLayoutManager.VERTICAL, false));
adapter = new LiveSystemMessageAdapter(getContext());
liveMessage.setAdapter(adapter);
liveMessage.addOnScrollListener(new OnRecyclerViewScrollListener() {
@Override
public void onBottom() {
if (size > 0) {
page = page + 1;
initDate();
}
}
});
}
@Override
public void onDestroy() {
super.onDestroy();
}
}

View File

@ -0,0 +1,54 @@
package com.yunbao.common.views;
import android.text.TextUtils;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.cardview.widget.CardView;
import androidx.recyclerview.widget.RecyclerView;
import com.yunbao.common.R;
import com.yunbao.common.bean.ListInfoMessageModel;
import com.yunbao.common.glide.ImgLoader;
import com.yunbao.common.utils.RouteUtil;
public class LiveSystemMessageViewHolder extends RecyclerView.ViewHolder {
private TextView titleText, timeText, contextLayout, toView;
private CardView bannerCard;
private ImageView bannerImage;
public LiveSystemMessageViewHolder(@NonNull View itemView) {
super(itemView);
titleText = itemView.findViewById(R.id.title_text);
timeText = itemView.findViewById(R.id.time_text);
contextLayout = itemView.findViewById(R.id.context_layout);
toView = itemView.findViewById(R.id.to_view);
bannerCard = itemView.findViewById(R.id.banner_card);
bannerImage = itemView.findViewById(R.id.banner_image);
}
public void setViewData(ListInfoMessageModel model) {
titleText.setText(model.getTitle());
timeText.setText(model.getLastDate("1"));
if (TextUtils.isEmpty(model.getBanner())) {
bannerCard.setVisibility(View.GONE);
} else {
bannerCard.setVisibility(View.VISIBLE);
ImgLoader.display(itemView.getContext(), model.getBanner(), bannerImage);
}
contextLayout.setText(model.getContent());
if (TextUtils.isEmpty(model.getLink())) {
toView.setVisibility(View.GONE);
} else {
toView.setVisibility(View.VISIBLE);
toView.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
RouteUtil.forwardLiveZhuangBanActivity(model.getLink(), false);
}
});
}
}
}

View File

@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<corners android:radius="13dp"/>
<solid android:color="#b3000000"/>
</shape>

View File

@ -0,0 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<corners
android:topLeftRadius="8dp"
android:topRightRadius="8dp" />
<solid android:color="#F4F7FC" />
</shape>

View File

@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="@mipmap/icon_protocol_check" android:state_selected="true" />
<item android:drawable="@mipmap/icon_protocol_uncheck" android:state_selected="false" />
</selector>

View File

@ -0,0 +1,21 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="400dp"
android:background="@drawable/bg_live_anchor_message"
android:orientation="vertical">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="18dp"
android:text="@string/message"
android:textColor="@color/black3"
android:textSize="24sp"
android:textStyle="bold" />
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/live_message"
android:layout_width="match_parent"
android:layout_height="match_parent" />
</LinearLayout>

View File

@ -1,11 +1,112 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="8dp"
android:orientation="horizontal">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="10dp"
android:background="@drawable/bg_live_anchor"
android:gravity="center"
android:paddingStart="6dp"
android:paddingTop="4dp"
android:paddingEnd="6dp"
android:paddingBottom="4dp">
<androidx.cardview.widget.CardView
android:layout_width="6dp"
android:layout_height="6dp"
app:cardBackgroundColor="#FF4E4E"
app:cardCornerRadius="8dp"
app:cardElevation="0dp" />
<TextView
android:id="@+id/live_time"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="5dp"
android:text="00:00"
android:textColor="@color/white"
android:textSize="12sp" />
</LinearLayout>
<View
android:layout_width="0dp"
android:layout_height="1dp"
android:layout_weight="1" />
<LinearLayout
android:id="@+id/broadcast_data"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="10dp"
android:background="@drawable/bg_live_anchor"
android:gravity="center_vertical"
android:paddingStart="6dp"
android:paddingTop="4dp"
android:paddingEnd="6dp"
android:paddingBottom="4dp">
<ImageView
android:layout_width="14dp"
android:layout_height="14dp"
android:src="@mipmap/live_icon_data" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="6dp"
android:text="@string/broadcast_data"
android:textColor="@color/white"
android:textSize="10sp" />
</LinearLayout>
<LinearLayout
android:id="@+id/message_linear"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="10dp"
android:layout_marginEnd="10dp"
android:background="@drawable/bg_live_anchor"
android:gravity="center_vertical"
android:paddingStart="6dp"
android:paddingTop="4dp"
android:paddingEnd="6dp"
android:paddingBottom="4dp">
<ImageView
android:layout_width="14dp"
android:layout_height="14dp"
android:src="@mipmap/live_icon_news" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="6dp"
android:text="@string/message"
android:textColor="@color/white"
android:textSize="10sp" />
</LinearLayout>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/bg_live_tota"
android:orientation="vertical">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
@ -28,10 +129,33 @@
android:layout_marginTop="10dp"
android:paddingEnd="16dp">
<LinearLayout
android:id="@+id/anchor_task"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"
android:orientation="vertical">
<ImageView
android:layout_width="40dp"
android:layout_height="40dp"
android:src="@mipmap/live_more_icon_task" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="6dp"
android:text="@string/anchor_task"
android:textColor="#FF9A9A9A"
android:textSize="12sp" />
</LinearLayout>
<LinearLayout
android:id="@+id/live_tool_wish"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="28dp"
android:gravity="center"
android:orientation="vertical">
@ -95,6 +219,7 @@
android:textSize="12sp" />
</LinearLayout>
<LinearLayout
android:id="@+id/live_tool_robot"
android:layout_width="wrap_content"
@ -213,6 +338,7 @@
</LinearLayout>
</HorizontalScrollView>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
@ -278,6 +404,7 @@
android:textColor="#FF9A9A9A"
android:textSize="12sp" />
</LinearLayout>
<LinearLayout
android:id="@+id/live_tool_random_pk"
android:layout_width="wrap_content"
@ -325,5 +452,7 @@
</LinearLayout>
</HorizontalScrollView>
</LinearLayout>
</LinearLayout>

View File

@ -0,0 +1,94 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.cardview.widget.CardView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="10dp"
app:cardBackgroundColor="@color/white"
app:cardCornerRadius="15dp"
app:cardElevation="0dp">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<FrameLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<TextView
android:id="@+id/title_text"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="12dp"
android:layout_marginTop="16dp"
android:text="通知標題標題通知標題標題"
android:textColor="#ff161616"
android:textSize="17sp" />
<TextView
android:id="@+id/time_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="end"
android:layout_marginTop="19dp"
android:layout_marginEnd="12dp"
android:text="2-24 17:00"
android:textColor="#ff8c8c8c"
android:textSize="13sp" />
</FrameLayout>
<androidx.cardview.widget.CardView
android:id="@+id/banner_card"
android:layout_width="match_parent"
android:layout_height="102dp"
android:layout_marginStart="12dp"
android:layout_marginTop="6dp"
android:layout_marginEnd="12dp"
app:cardCornerRadius="8dp"
app:cardElevation="0dp">
<ImageView
android:id="@+id/banner_image"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scaleType="centerCrop" />
</androidx.cardview.widget.CardView>
<TextView
android:id="@+id/context_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="12dp"
android:layout_marginTop="8dp"
android:layout_marginEnd="12dp"
android:text="內容內容內容內容內容內容內容內容內容內容內容
內容內容內容內容內容內容內容內容內容內容內容內容內容內容內容
內容內容內容內容內容內容內容內容內容內容內容內容
內容內容內容內容內容內容內容。"
android:textColor="#B1B1B1"
android:textSize="13sp" />
<FrameLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:layout_marginBottom="20dp">
<TextView
android:id="@+id/to_view"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="end"
android:layout_marginEnd="12dp"
android:drawablePadding="4dp"
android:drawableEnd="@mipmap/icon_more"
android:gravity="center_vertical"
android:text="@string/click_to_view"
android:textColor="#ff8c8c8c"
android:textSize="13sp" />
</FrameLayout>
</LinearLayout>
</androidx.cardview.widget.CardView>

View File

Before

Width:  |  Height:  |  Size: 603 B

After

Width:  |  Height:  |  Size: 603 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB

View File

@ -1003,4 +1003,20 @@ Limited ride And limited avatar frame</string>
<string name="live_user_ban_hd">There is no choice, the anchor is not turned on HD live.</string>
<string name="function_is_suspended">Sorry, this feature is on hold.</string>
<string name="phone_number">phone</string>
<string name="broadcast_data">Broadcast</string>
<string name="click_to_view">Click To View</string>
<string name="anchor_task">Anchor Task</string>
<string name="anchor_agreement">I have read and agreed to the </string>
<string name="anchor_agreement_hint">Please read and agree to the PDLIVE Host Agreement</string>
<string name="anchor_hint">PDLIVE Host Agreement</string>
<string name="live_task_new_user_timer">The statute of limitations for new anchors expires</string>
<string name="live_data_coin">coin</string>
<string name="live_data_gold">gold</string>
<string name="live_data_accept">Number of gifts</string>
<string name="live_data_enter">Number of entry</string>
<string name="live_data_attention">New attention</string>
<string name="live_data_attention_rate">Follow the conversion rate</string>
<string name="live_data_fan_group">New fan group</string>
<string name="live_data_fan_group_rate">Fan group conversion rate</string>
<string name="live_data_loading">loading…</string>
</resources>

View File

@ -785,6 +785,7 @@
<string name="encourage_list_nodata">暫時還沒有人給予作者鼓勵T_T</string>
<string name="click_moer">點擊查看更多</string>
<string name="customer_service">客服</string>
<string name="set_up">設定</string>
<string name="kefu_time">每日13:00PM-1:00AM</string>
@ -1023,4 +1024,20 @@
<string name="live_user_ban_hd" >無法選擇,該主播未開啟高清直播。</string>
<string name="function_is_suspended" >抱歉,該功能暫停使用中。</string>
<string name="phone_number" >手機號</string>
<string name="broadcast_data" >開播數據</string>
<string name="click_to_view">點擊查看</string>
<string name="anchor_task">主播任務</string>
<string name="anchor_agreement">我已閱讀並同意</string>
<string name="anchor_agreement_hint">請閱讀並同意《PDLIVE主播協議》</string>
<string name="anchor_hint">《PDLIVE主播協議》</string>
<string name="live_task_new_user_timer">新秀主播時效截止至 </string>
<string name="live_data_coin">鑽石收禮</string>
<string name="live_data_gold">金豆收禮</string>
<string name="live_data_accept">收禮人數</string>
<string name="live_data_enter">進場人數</string>
<string name="live_data_attention">新增關注</string>
<string name="live_data_attention_rate">關注轉化率</string>
<string name="live_data_fan_group">新增粉絲團</string>
<string name="live_data_fan_group_rate">粉絲團轉化率</string>
<string name="live_data_loading">加载中…</string>
</resources>

View File

@ -9,10 +9,9 @@ ext {
]
manifestPlaceholders = [
//
serverHost : "https://napi.yaoulive.com",
//
// serverHost : "https://ceshi.yaoulive.com",
// serverHost : "https://napi.yaoulive.com",
//
serverHost : "https://ceshi.yaoulive.com",
//
txMapAppKey : "EOZBZ-ASLCU-4XPV3-BDCHZ-4E3Q7-H4BWB",

View File

@ -866,7 +866,7 @@ public abstract class LiveActivity extends AbsActivity implements SocketMessageL
private void showTaskDialog() {
final Dialog dialog = new Dialog(LiveActivity.this, com.yunbao.live.R.style.dialog);
dialog.setContentView(R.layout.dialog_task);
dialog.setContentView(R.layout.dialog_live_task);
dialog.setCancelable(true);
dialog.setCanceledOnTouchOutside(true);

View File

@ -673,7 +673,9 @@ public class LiveRyAnchorActivity extends LiveActivity implements LiveFunctionCl
}
bundle.putBoolean(Constants.HAS_GAME, hasGame);
bundle.putInt("leave", leave);
bundle.putString("liveUid", mLiveUid);
bundle.putBoolean("isPk", isDRPK == 1 || PKing || mLivePushViewHolder.isPking());
bundle.putLong("liveTime", mLiveAnchorViewHolder.getmAnchorLiveTime());
bundle.putBoolean(Constants.OPEN_FLASH, mLivePushViewHolder != null && mLivePushViewHolder.isFlashOpen());
fragment.setArguments(bundle);
fragment.setFunctionClickListener(this);
@ -937,9 +939,11 @@ public class LiveRyAnchorActivity extends LiveActivity implements LiveFunctionCl
if (code == 0) {
JSONObject obj = JSON.parseObject(info[0]);
JSONObject datas = obj.getJSONObject("data");
try {
SocketRyChatUtil.closeLive(datas.getString("votes"), datas.getString("length"), datas.getString("nums"), mLiveUid, mSocketRyClient);
} catch (Exception e) {
e.printStackTrace();
}
if (mLiveEndViewHolder == null) {
mLiveEndViewHolder = new LiveEndViewHolder(mContext, mRoot, mLiveBean.getUid());

View File

@ -0,0 +1,67 @@
package com.yunbao.live.adapter;
import android.content.Context;
import android.text.Html;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.recyclerview.widget.RecyclerView;
import com.yunbao.live.R;
import com.yunbao.live.bean.LiveDataInfoModel;
import java.util.ArrayList;
import java.util.List;
public class LiveDataInfoRecyclerAdapter extends RecyclerView.Adapter<LiveDataInfoRecyclerAdapter.LiveDataHolder> {
private Context mContext;
private List<LiveDataInfoModel> list=new ArrayList<>();
public LiveDataInfoRecyclerAdapter(Context mContext) {
this.mContext = mContext;
}
public void setList(List<LiveDataInfoModel> list) {
this.list = list;
notifyDataSetChanged();
}
@NonNull
@Override
public LiveDataHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
return new LiveDataHolder(LayoutInflater.from(mContext).inflate(R.layout.item_live_data, parent, false));
}
@Override
public void onBindViewHolder(@NonNull LiveDataHolder holder, int position) {
holder.setData(list.get(position));
}
@Override
public int getItemCount() {
return list.size();
}
public static class LiveDataHolder extends RecyclerView.ViewHolder {
private TextView title, data;
public LiveDataHolder(@NonNull View itemView) {
super(itemView);
title = itemView.findViewById(R.id.item_title);
data = itemView.findViewById(R.id.item_data);
}
public void setData(LiveDataInfoModel model) {
if (model.getColor() != null) {
data.setText(Html.fromHtml("<font color='" + model.getColor() + "'>" + model.getData() + "</font>"));
} else {
data.setText(model.getData());
}
title.setText(model.getTitle());
}
}
}

View File

@ -0,0 +1,117 @@
package com.yunbao.live.adapter;
import android.content.Context;
import android.graphics.Color;
import android.text.Html;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.recyclerview.widget.RecyclerView;
import com.yunbao.common.bean.LiveTaskModel;
import com.yunbao.common.utils.DpUtil;
import com.yunbao.common.utils.WordUtil;
import com.yunbao.live.R;
import java.util.ArrayList;
import java.util.List;
public class LiveTaskRecyclerAdapter extends RecyclerView.Adapter<LiveTaskRecyclerAdapter.TaskHolder> {
private Context mContext;
private List<LiveTaskModel.Task> tasks = new ArrayList<>();
public LiveTaskRecyclerAdapter(Context mContext) {
this.mContext = mContext;
}
public void setTasks(List<LiveTaskModel.Task> tasks) {
this.tasks = tasks;
notifyDataSetChanged();
}
@NonNull
@Override
public TaskHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
if (viewType == LiveTaskModel.TASK_TYPE_TIP) {
return new TaskHolder(new TextView(mContext));
} else {
return new TaskHolder(LayoutInflater.from(mContext).inflate(R.layout.item_live_task, parent, false));
}
}
@Override
public int getItemViewType(int position) {
return tasks.get(position).getType();
}
@Override
public void onBindViewHolder(@NonNull TaskHolder holder, int position) {
holder.setDate(tasks.get(position));
}
@Override
public int getItemCount() {
return tasks.size();
}
public static class TaskHolder extends RecyclerView.ViewHolder {
private TextView title;
private TextView complete;
private TextView hot;
private TextView xp;
private ImageView hotIcon;
private ImageView xpIcon;
public TaskHolder(@NonNull View itemView) {
super(itemView);
if (itemView instanceof TextView) {
title = (TextView) itemView;
title.setTextColor(Color.parseColor("#B3B3B3"));
title.setTextSize(12);
LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);
params.setMarginStart(DpUtil.dp2px(27));
params.setMargins(DpUtil.dp2px(27), DpUtil.dp2px(16), 0, DpUtil.dp2px(16));
title.setLayoutParams(params);
} else {
title = itemView.findViewById(R.id.item_task_title);
complete = itemView.findViewById(R.id.item_task_complete);
hot = itemView.findViewById(R.id.item_task_hot);
xp = itemView.findViewById(R.id.item_task_xp);
hotIcon = itemView.findViewById(R.id.item_task_hot_img);
xpIcon = itemView.findViewById(R.id.item_task_xp_img);
hotIcon.setImageResource(R.mipmap.dialog_task_hot);
xpIcon.setImageResource(R.mipmap.dialog_task_star);
}
}
public void setDate(LiveTaskModel.Task task) {
title.setText(task.getTaskName());
if (task.getType() == LiveTaskModel.TASK_TYPE_TIP) {
return;
}
if (task.getStatus() || task.getNowValue() >= task.getTaskNum()) {
task.setNowValue(task.getTaskNum());
}
title.setText(String.format("%s (%s/%s)",
task.getTaskName(),
task.getNowValue(),
task.getTaskNum())
);
if (task.getNowValue() == task.getTaskNum()) {
task.setStatus(1);
}
complete.setText(task.getStatus() ? R.string.live_task_item_complete_true : R.string.live_task_item_complete_false);
complete.setBackgroundResource(task.getStatus() ? R.drawable.background_6cbe53 : R.drawable.background_595959);
hot.setText(Html.fromHtml("<font color='#B3B3B3'>" + WordUtil.getString(R.string.live_task_item_hot) + "</font>&nbsp&nbsp<font color='#F09FC2'>" + task.getHot() + "</font>"));
xp.setText(Html.fromHtml("<font color='#B3B3B3'>" + WordUtil.getString(R.string.live_task_item_xp) + "</font>&nbsp&nbsp<font color='#FFF69F'>" + task.getExp() + "</font>"));
}
}
}

View File

@ -0,0 +1,47 @@
package com.yunbao.live.bean;
import com.yunbao.common.bean.BaseModel;
public class LiveDataInfoModel extends BaseModel {
private String color;
private String title;
private String data;
public LiveDataInfoModel(String color, String title, String data) {
this.color = color;
this.title = title;
this.data = data;
}
public LiveDataInfoModel(String title, String data) {
this.title = title;
this.data = data;
}
public LiveDataInfoModel() {
}
public String getColor() {
return color;
}
public void setColor(String color) {
this.color = color;
}
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
public String getData() {
return data;
}
public void setData(String data) {
this.data = data;
}
}

View File

@ -0,0 +1,96 @@
package com.yunbao.live.dialog;
import android.content.Context;
import android.widget.ImageView;
import androidx.annotation.NonNull;
import androidx.recyclerview.widget.RecyclerView;
import com.lxj.xpopup.XPopup;
import com.yunbao.common.dialog.AbsDialogPopupWindow;
import com.yunbao.common.http.base.HttpCallback;
import com.yunbao.common.http.live.LiveNetManager;
import com.yunbao.common.utils.WordUtil;
import com.yunbao.live.R;
import com.yunbao.live.adapter.LiveDataInfoRecyclerAdapter;
import com.yunbao.live.bean.LiveDataInfoModel;
import java.util.ArrayList;
import java.util.List;
public class LiveDataInfoDialog extends AbsDialogPopupWindow {
private ImageView img;
private RecyclerView recyclerView;
private LiveDataInfoRecyclerAdapter adapter;
private List<LiveDataInfoModel> list;
private String liveUid;
public LiveDataInfoDialog(@NonNull Context context) {
super(context);
}
public LiveDataInfoDialog(@NonNull Context context, String liveUid) {
super(context);
this.liveUid = liveUid;
}
public void setLiveUid(String liveUid) {
this.liveUid = liveUid;
}
@Override
public void buildDialog(XPopup.Builder builder) {
}
@Override
public int bindLayoutId() {
return R.layout.dialog_live_data;
}
@Override
protected void onCreate() {
super.onCreate();
img = findViewById(R.id.live_data_img);
img.setImageResource(R.mipmap.icon_free_pk_waring);
recyclerView = findViewById(R.id.live_data_list);
adapter = new LiveDataInfoRecyclerAdapter(getContext());
recyclerView.setAdapter(adapter);
initData();
}
private void initData() {
list = new ArrayList<>();
list.add(new LiveDataInfoModel("#00FFFF", WordUtil.getString(R.string.live_data_coin), WordUtil.getString(R.string.live_data_loading)));
list.add(new LiveDataInfoModel("#FFF69F", WordUtil.getString(R.string.live_data_gold), WordUtil.getString(R.string.live_data_loading)));
list.add(new LiveDataInfoModel(WordUtil.getString(R.string.live_data_accept), WordUtil.getString(R.string.live_data_loading)));
list.add(new LiveDataInfoModel(WordUtil.getString(R.string.live_data_enter), WordUtil.getString(R.string.live_data_loading)));
list.add(new LiveDataInfoModel(WordUtil.getString(R.string.live_data_attention), WordUtil.getString(R.string.live_data_loading)));
list.add(new LiveDataInfoModel(WordUtil.getString(R.string.live_data_attention_rate), WordUtil.getString(R.string.live_data_loading)));
list.add(new LiveDataInfoModel(WordUtil.getString(R.string.live_data_fan_group), WordUtil.getString(R.string.live_data_loading)));
list.add(new LiveDataInfoModel(WordUtil.getString(R.string.live_data_fan_group_rate), WordUtil.getString(R.string.live_data_loading)));
adapter.setList(list);
LiveNetManager.get(getContext())
.getLiveData(liveUid, new HttpCallback<com.yunbao.common.bean.LiveDataInfoModel>() {
@Override
public void onSuccess(com.yunbao.common.bean.LiveDataInfoModel data) {
list.clear();
list.add(new LiveDataInfoModel("#00FFFF", WordUtil.getString(R.string.live_data_coin), data.getTotalCoin() + ""));
list.add(new LiveDataInfoModel("#FFF69F", WordUtil.getString(R.string.live_data_gold), data.getTotalGold() + ""));
list.add(new LiveDataInfoModel(WordUtil.getString(R.string.live_data_accept), data.getAcceptNum() + ""));
list.add(new LiveDataInfoModel(WordUtil.getString(R.string.live_data_enter), data.getEnterNum() + ""));
list.add(new LiveDataInfoModel(WordUtil.getString(R.string.live_data_attention), data.getAttentionNum() + ""));
list.add(new LiveDataInfoModel(WordUtil.getString(R.string.live_data_attention_rate), data.getAttentionNumRate() + ""));
list.add(new LiveDataInfoModel(WordUtil.getString(R.string.live_data_fan_group), data.getFanGroupNum() + ""));
list.add(new LiveDataInfoModel(WordUtil.getString(R.string.live_data_fan_group_rate), data.getFanGroupNumRate() + ""));
adapter.setList(list);
}
@Override
public void onError(String error) {
}
});
}
}

View File

@ -1,8 +1,21 @@
package com.yunbao.live.dialog;
import static com.yunbao.common.Constants.*;
import static com.yunbao.common.Constants.LIVE_FUNC_BEAUTY;
import static com.yunbao.common.Constants.LIVE_FUNC_CAMERA;
import static com.yunbao.common.Constants.LIVE_FUNC_DR;
import static com.yunbao.common.Constants.LIVE_FUNC_LINK_MIC;
import static com.yunbao.common.Constants.LIVE_FUNC_MIC;
import static com.yunbao.common.Constants.LIVE_FUNC_RANDOM_PK;
import static com.yunbao.common.Constants.LIVE_FUNC_WISHLIST;
import static com.yunbao.common.Constants.LIVE_FUNC_WKS;
import static com.yunbao.common.Constants.LIVE_FUNC_ZG;
import static com.yunbao.common.Constants.LIVE_FUNC_ZSLK;
import static com.yunbao.common.Constants.LIVE_ROBOT;
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
import android.os.SystemClock;
import android.view.Gravity;
import android.view.View;
import android.view.Window;
@ -10,10 +23,12 @@ import android.view.WindowManager;
import android.widget.ImageView;
import android.widget.TextView;
import com.lxj.xpopup.XPopup;
import com.yunbao.common.Constants;
import com.yunbao.common.dialog.AbsDialogFragment;
import com.yunbao.common.utils.DpUtil;
import com.yunbao.common.utils.StringUtil;
import com.yunbao.common.utils.ToastUtil;
import com.yunbao.common.views.LiveAnchorMessageCustomPopup;
import com.yunbao.live.R;
import com.yunbao.live.activity.LiveRyAnchorActivity;
import com.yunbao.live.interfaces.LiveFunctionClickListener;
@ -29,7 +44,9 @@ public class LiveNewFunctionDialogFragment extends AbsDialogFragment implements
private LiveFunctionClickListener mFunctionClickListener;
private int leave = 0;
private boolean isPk;
private TextView mLiveTimeTextView;//主播的直播时长
private String liveUid;
// boolean isRy = false;
@Override
@ -70,6 +87,8 @@ public class LiveNewFunctionDialogFragment extends AbsDialogFragment implements
leave = bundle.getInt("leave", 0);
isPk = bundle.getBoolean("isPk", false);
// isRy = bundle.getBoolean("isRy", false);
mAnchorLiveTime = bundle.getLong("liveTime");
liveUid = bundle.getString("liveUid");
}
mWishView = findViewById(R.id.live_tool_wish);
mPrankView = findViewById(R.id.live_tool_prank);
@ -81,7 +100,7 @@ public class LiveNewFunctionDialogFragment extends AbsDialogFragment implements
mMultiPkView = findViewById(R.id.live_tool_multi_pk);
mMicView = findViewById(R.id.live_tool_mic);
mRandomPk = findViewById(R.id.live_tool_random_pk);
mLiveTimeTextView = (TextView) findViewById(R.id.live_time);
mWishView.setOnClickListener(this);
mPrankView.setOnClickListener(this);
mWksView.setOnClickListener(this);
@ -92,6 +111,10 @@ public class LiveNewFunctionDialogFragment extends AbsDialogFragment implements
mMultiPkView.setOnClickListener(this);
mMicView.setOnClickListener(this);
mRandomPk.setOnClickListener(this);
findViewById(R.id.message_linear).setOnClickListener(this);
findViewById(R.id.broadcast_data).setOnClickListener(this);
findViewById(R.id.anchor_task).setOnClickListener(this);
findViewById(R.id.live_tool_robot).setOnClickListener(this);
if (leave == 0) {
@ -101,7 +124,9 @@ public class LiveNewFunctionDialogFragment extends AbsDialogFragment implements
((ImageView) mLeaveView.findViewById(R.id.live_tool_leave_img)).setImageResource(R.mipmap.icon_leave_p);
((TextView) mLeaveView.findViewById(R.id.live_tool_leave_text)).setText(R.string.live_zslk1);
}
mLiveRoomHandler = new LiveRoomHandler();
mLiveTimeTextView.setText(StringUtil.getDurationText(mAnchorLiveTime));
startAnchorLiveTime();
}
public void setFunctionClickListener(LiveFunctionClickListener functionClickListener) {
@ -149,6 +174,71 @@ public class LiveNewFunctionDialogFragment extends AbsDialogFragment implements
} else if (id == R.id.live_tool_robot) {
mFunctionClickListener.onClick(LIVE_ROBOT);
dismiss();
} else if (id == R.id.message_linear) {
new XPopup.Builder(getContext())
.asCustom(new LiveAnchorMessageCustomPopup(getContext(), liveUid))
.show();
dismiss();
} else if (id == R.id.broadcast_data) {
//主播数据
new LiveDataInfoDialog(mContext, liveUid).showDialog();
dismiss();
} else if (id == R.id.anchor_task) {
//主播任务
taskDialog = new LiveTaskDialog(mContext);
taskDialog.setLiveUid(liveUid);
taskDialog.updateLiveTimer(mAnchorLiveTime);
taskDialog.showDialog();
}
}
private final int WHAT_ANCHOR_LIVE_TIME = 3;//直播间主播计时
private LiveRoomHandler mLiveRoomHandler;
private long mAnchorLiveTime;//主播直播时间
private LiveTaskDialog taskDialog;
/**
* 主播显示直播时间
*/
private void showAnchorLiveTime() {
if (mLiveTimeTextView != null) {
mAnchorLiveTime += 1000;
mLiveTimeTextView.setText(StringUtil.getDurationText(mAnchorLiveTime));
startAnchorLiveTime();
}
}
public void startAnchorLiveTime() {
if (mLiveRoomHandler != null) {
mLiveRoomHandler.sendEmptyMessageAtTime(WHAT_ANCHOR_LIVE_TIME, getNextTime(1000));
}
}
private class LiveRoomHandler extends Handler {
@Override
public void handleMessage(Message msg) {
switch (msg.what) {
case WHAT_ANCHOR_LIVE_TIME:
showAnchorLiveTime();
break;
}
}
public void release() {
removeCallbacksAndMessages(null);
}
}
private long getNextTime(int time) {
long now = SystemClock.uptimeMillis();
if (time < 1000) {
return now + time;
}
return now + time + -now % 1000;
}
}

View File

@ -0,0 +1,267 @@
package com.yunbao.live.dialog;
import android.app.Dialog;
import android.content.Context;
import android.os.Bundle;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.appcompat.app.AppCompatActivity;
import androidx.fragment.app.Fragment;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import androidx.viewpager2.adapter.FragmentStateAdapter;
import androidx.viewpager2.widget.ViewPager2;
import com.google.android.material.tabs.TabLayout;
import com.google.android.material.tabs.TabLayoutMediator;
import com.lxj.xpopup.XPopup;
import com.yunbao.common.bean.LiveTaskModel;
import com.yunbao.common.dialog.AbsDialogPopupWindow;
import com.yunbao.common.http.base.HttpCallback;
import com.yunbao.common.http.live.LiveNetManager;
import com.yunbao.common.utils.DialogUitl;
import com.yunbao.common.utils.WordUtil;
import com.yunbao.live.R;
import com.yunbao.live.adapter.LiveTaskRecyclerAdapter;
import java.util.ArrayList;
import java.util.List;
/**
* 主播直播任务弹框
*/
public class LiveTaskDialog extends AbsDialogPopupWindow {
private TextView newStarTime;
private ImageView newStarImg;
private ImageView taskInfoImg;
private ImageView tipImg;
private TabLayout tabLayout;
private ViewPager2 viewPager;
private TabLayoutMediator mediator;
private Context mContext;
String liveUid;
int liveTimer;
public LiveTaskDialog(Context context) {
super(context);
this.mContext = context;
}
@Override
public void buildDialog(XPopup.Builder builder) {
builder.enableDrag(false);
}
@Override
public int bindLayoutId() {
return R.layout.dialog_live_task;
}
@Override
protected void onCreate() {
super.onCreate();
initView();
}
public void setLiveUid(String liveUid) {
this.liveUid = liveUid;
}
private void initView() {
newStarTime = findViewById(R.id.task_new_star_time);
newStarImg = findViewById(R.id.live_task_banner1);
taskInfoImg = findViewById(R.id.live_task_banner2);
tipImg = findViewById(R.id.live_task_tip);
tabLayout = findViewById(R.id.live_task_menu);
viewPager = findViewById(R.id.live_task_viewpager);
initImgView();
createTask();
}
private void initImgView() {
newStarImg.setImageResource(R.mipmap.dialog_task_new_star);
taskInfoImg.setImageResource(R.mipmap.dialog_task_info);
tipImg.setImageResource(R.mipmap.icon_guize);
tipImg.setOnClickListener(v -> new LiveTaskInfoDialog(mContext).showDialog());
}
private void initTabLayout(LiveTaskModel model) {
TabLayout.Tab liveTaskTag = tabLayout.newTab();
TabLayout.Tab userTaskTag = tabLayout.newTab();
liveTaskTag.setText(R.string.live_task_tab1);
userTaskTag.setText(R.string.live_task_tab2);
tabLayout.addTab(liveTaskTag);
tabLayout.addTab(userTaskTag);
viewPager.setAdapter(new FragmentStateAdapter(((AppCompatActivity) mContext).getSupportFragmentManager(), getLifecycle()) {
@Override
public int getItemCount() {
return 2;
}
@NonNull
@Override
public Fragment createFragment(int position) {
TaskFragment fragment = new TaskFragment();
Bundle bundle = new Bundle();
bundle.putInt("position", position + 1);
bundle.putInt("liveTimer", liveTimer);
bundle.putString("liveUid", liveUid);
bundle.putSerializable("data", model);
fragment.setArguments(bundle);
return fragment;
}
});
mediator = new TabLayoutMediator(tabLayout, viewPager, true, new TabLayoutMediator.TabConfigurationStrategy() {
@Override
public void onConfigureTab(@NonNull TabLayout.Tab tab, int position) {
if (position == 0) {
tab.setText(R.string.live_task_tab1);
} else {
tab.setText(R.string.live_task_tab2);
}
}
});
mediator.attach();
}
private void updateMainUi(LiveTaskModel.NewUser task) {
if (task.isNew()) {
newStarImg.setVisibility(VISIBLE);
newStarTime.setVisibility(VISIBLE);
newStarTime.setText(task.getEndTime());
}
}
private Dialog loadDialog;
private void createTask() {
loadDialog = DialogUitl.loadingDialog(getContext());
loadDialog.show();
LiveNetManager.get(getContext())
.getLiveTask(1, liveUid, new HttpCallback<LiveTaskModel>() {
@Override
public void onSuccess(LiveTaskModel data) {
Log.i("直播任务", "onSuccess: " + data);
updateMainUi(data.getUser());
initTabLayout(data);
if (loadDialog != null) {
loadDialog.dismiss();
}
}
@Override
public void onError(String error) {
Log.e("直播任务", "onError: " + error);
if (loadDialog != null) {
loadDialog.dismiss();
}
}
});
}
public void updateLiveTimer(long time) {
liveTimer = (int) time / (1000 * 60);
/*TaskFragment fragment = (TaskFragment) ((AppCompatActivity) mContext).getSupportFragmentManager().findFragmentByTag("f0");
if (fragment != null) {
fragment.adapter.updateTimer(liveTimer);
}*/
}
public static class TaskFragment extends Fragment {
private RecyclerView taskList;
private LiveTaskRecyclerAdapter adapter;
private int position;
private int liveTimer;
private String liveUid;
@Nullable
@Override
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
return new RecyclerView(getActivity());
}
@Override
public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
this.position = getArguments().getInt("position", -1);
this.liveTimer = getArguments().getInt("liveTimer", -1);
this.liveUid = getArguments().getString("liveUid", "0");
taskList = (RecyclerView) view;
initTaskList();
if (position == 2) {
createTask(position);
} else {
update((LiveTaskModel) getArguments().getSerializable("data"), 1);
}
}
private void initTaskList() {
adapter = new LiveTaskRecyclerAdapter(getContext());
taskList.setAdapter(adapter);
taskList.setLayoutManager(new LinearLayoutManager(getContext(), RecyclerView.VERTICAL, false));
}
private void createTask(int type) {
LiveNetManager.get(getContext())
.getLiveTask(type, liveUid, new HttpCallback<LiveTaskModel>() {
@Override
public void onSuccess(LiveTaskModel data) {
Log.i("直播任务", "onSuccess: " + data);
update(data, type);
}
@Override
public void onError(String error) {
Log.e("直播任务", "onError: " + error);
}
});
}
private void update(LiveTaskModel data, int type) {
LiveTaskModel.Task task = new LiveTaskModel.Task();
LiveTaskModel.Task task2 = new LiveTaskModel.Task();
if (type == 1) {
task.setTaskName(WordUtil.getString(R.string.live_task_no1));
task2.setTaskName(WordUtil.getString(R.string.live_task_no2));
} else {
task.setTaskName(WordUtil.getString(R.string.live_task_fans_no1));
task2.setTaskName(WordUtil.getString(R.string.live_task_fans_no2));
}
task.setType(LiveTaskModel.TASK_TYPE_TIP);
task2.setType(LiveTaskModel.TASK_TYPE_TIP);
List<LiveTaskModel.Task> task1 = new ArrayList<>();
task1.add(task);
task1.addAll(data.getList().get(0));
if (type == 1) {
for (LiveTaskModel.Task tk : task1) {
tk.setNowValue(liveTimer);
}
}
task1.add(task2);
task1.addAll(data.getList().get(1));
adapter.setTasks(task1);
}
}
}

View File

@ -0,0 +1,34 @@
package com.yunbao.live.dialog;
import android.content.Context;
import android.widget.ImageView;
import androidx.annotation.NonNull;
import com.lxj.xpopup.XPopup;
import com.yunbao.common.dialog.AbsDialogPopupWindow;
import com.yunbao.live.R;
public class LiveTaskInfoDialog extends AbsDialogPopupWindow {
public LiveTaskInfoDialog(@NonNull Context context) {
super(context);
}
@Override
public void buildDialog(XPopup.Builder builder) {
}
@Override
public int bindLayoutId() {
return R.layout.dialog_live_task_info;
}
@Override
protected void onCreate() {
super.onCreate();
ImageView back = findViewById(R.id.live_task_info_back);
back.setImageResource(R.mipmap.icon_back);
back.setOnClickListener(v -> dismiss());
}
}

View File

@ -8,6 +8,7 @@ import android.graphics.drawable.Drawable;
import android.os.Bundle;
import android.os.Handler;
import android.os.Looper;
import android.text.Html;
import android.text.TextUtils;
import android.util.Log;
import android.view.View;
@ -25,6 +26,7 @@ import com.lxj.xpopup.core.BasePopupView;
import com.lxj.xpopup.interfaces.XPopupCallback;
import com.yunbao.common.CommonAppConfig;
import com.yunbao.common.Constants;
import com.yunbao.common.bean.IMLoginModel;
import com.yunbao.common.bean.LiveClassBean;
import com.yunbao.common.bean.LiveRoomTypeBean;
import com.yunbao.common.bean.UserBean;
@ -38,6 +40,7 @@ import com.yunbao.common.utils.Bus;
import com.yunbao.common.utils.DialogUitl;
import com.yunbao.common.utils.L;
import com.yunbao.common.utils.ProcessImageUtil;
import com.yunbao.common.utils.RouteUtil;
import com.yunbao.common.utils.StringUtil;
import com.yunbao.common.utils.ToastUtil;
import com.yunbao.common.utils.WordUtil;
@ -63,6 +66,7 @@ import org.greenrobot.eventbus.Subscribe;
import org.greenrobot.eventbus.ThreadMode;
import java.io.File;
import java.util.Locale;
import cn.rongcloud.rtc.api.RCRTCEngine;
import cn.rongcloud.rtc.api.stream.RCRTCCameraOutputStream;
@ -76,7 +80,7 @@ public class LiveNewReadyRyViewHolder extends AbsViewHolder implements View.OnCl
private EditText mEditTitle;
private ProcessImageUtil mImageUtil;
private File mAvatarFile;
private TextView mLiveClass;
private TextView mLiveClass, anchorAgreement;
private TextView mLiveTypeTextView, liveClarity;//房间类型TextView
private TextView mLiveWishListTextView;//心愿单TextView
private int mLiveClassID;//直播频道id
@ -88,9 +92,10 @@ public class LiveNewReadyRyViewHolder extends AbsViewHolder implements View.OnCl
private LiveClassBean classBean;
private FaceManager manager;
private TextView faceTextView;//提示人脸未检测到的TextView
private ImageView imgClarity;
private ImageView imgClarity, selectorProtocol;
private int selectClarity = 1;
private LiveOpenCustomPopup liveOpenCustomPopup;
private boolean selector = true;
public LiveNewReadyRyViewHolder(Context context, ViewGroup parentView, int liveSdk) {
super(context, parentView, liveSdk);
@ -112,7 +117,9 @@ public class LiveNewReadyRyViewHolder extends AbsViewHolder implements View.OnCl
public void init() {
mRootView = (ConstraintLayout) findViewById(R.id.traceroute_rootview);
imgClarity = (ImageView) findViewById(R.id.img_clarity);
selectorProtocol = (ImageView) findViewById(R.id.selector_protocol);
liveClarity = (TextView) findViewById(R.id.live_clarity);
anchorAgreement = (TextView) findViewById(R.id.anchor_agreement);
mRootView.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
@ -121,6 +128,7 @@ public class LiveNewReadyRyViewHolder extends AbsViewHolder implements View.OnCl
imm.hideSoftInputFromWindow(view.getWindowToken(), 0);
}
});
mAvatar = (ConstraintLayout) findViewById(R.id.avatar);
mAvatar.setOnClickListener(this);
UserBean u = CommonAppConfig.getInstance().getUserBean();
@ -186,6 +194,7 @@ public class LiveNewReadyRyViewHolder extends AbsViewHolder implements View.OnCl
findViewById(R.id.btn_start_live).setOnClickListener(this);
findViewById(R.id.btn_wishlist).setOnClickListener(this);
findViewById(R.id.btn_horizontally).setOnClickListener(this);
findViewById(R.id.anchor_agreement_layout).setOnClickListener(this);
if (manager != null) {
manager.setFaceStatusChanged(new FaceManager.FaceStatusChanged() {
@ -271,6 +280,19 @@ public class LiveNewReadyRyViewHolder extends AbsViewHolder implements View.OnCl
.asCustom(liveClarityCustomPopup)
.show();
});
String keywordHtml2 = "</font><font color='#FF8D41'size='42px'>" + mContext.getString(R.string.anchor_hint) + "</font>";
String contextHtml = "<font color='#ffffff'size='42px'>" + mContext.getString(R.string.anchor_agreement) + "</font>";
anchorAgreement.setText(Html.fromHtml(contextHtml + keywordHtml2));
selectorProtocol.setPressed(true);
selectorProtocol.setSelected(true);
selector = selectorProtocol.isSelected();
selectorProtocol.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
selector = !selector;
selectorProtocol.setSelected(selector);
}
});
}
private void setSelectClarity(int selectClarity) {
@ -357,6 +379,10 @@ public class LiveNewReadyRyViewHolder extends AbsViewHolder implements View.OnCl
} else if (i == R.id.btn_room_type) {
chooseLiveType();
} else if (i == R.id.btn_start_live) {
if (!selector) {
ToastUtil.show(R.string.anchor_agreement_hint);
return;
}
if (mLiveClassID == 0) {
ToastUtil.show(R.string.live_choose_live_class);
return;
@ -524,6 +550,21 @@ public class LiveNewReadyRyViewHolder extends AbsViewHolder implements View.OnCl
new XPopup.Builder(mContext)
.asCustom(new LiveRobotSettingCustomPopup(mContext))
.show();
} else if (i == R.id.anchor_agreement_layout) {
String ct = Locale.getDefault().getLanguage();
IMLoginModel model = IMLoginManager.get(mContext).getUserInfo();
StringBuffer url = new StringBuffer();
url.append(CommonAppConfig.HOST);
if (TextUtils.equals(ct, "zh")) {
url.append("/index.php?g=portal&m=page&a=index&id=66");
} else {
url.append("/index.php?g=portal&m=page&a=index&id=67");
}
url.append("&uid=")
.append(model.getId())
.append("&token=")
.append(model.getToken());
RouteUtil.forwardLiveZhuangBanActivity(url.toString(), false);
}
}

View File

@ -87,6 +87,9 @@ public class LiveRyAnchorViewHolder extends AbsLiveViewHolder {
super(context, parentView);
}
public long getmAnchorLiveTime() {
return mAnchorLiveTime;
}
@Override
protected int getLayoutId() {

View File

@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item>
<shape android:shape="rectangle">
<corners android:radius="8dp" />
<solid android:color="#1A1A1A" />
</shape>
</item>
</selector>

View File

@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item>
<shape android:shape="rectangle">
<corners android:radius="20dp" />
<solid android:color="#595959" />
</shape>
</item>
</selector>

View File

@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item>
<shape android:shape="rectangle">
<corners android:radius="20dp" />
<solid android:color="#6CBE53" />
</shape>
</item>
</selector>

View File

@ -0,0 +1,81 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#000002">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginStart="13dp"
android:layout_marginTop="8dp"
android:layout_marginEnd="13dp"
android:orientation="vertical"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
android:gravity="center"
android:orientation="horizontal">
<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="@string/live_data_msg1"
android:textColor="#808080"
android:textSize="16sp" />
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="0.1"
android:gravity="end|center"
android:orientation="horizontal">
<ImageView
android:id="@+id/live_data_img"
android:layout_width="13dp"
android:layout_height="13dp"
android:layout_marginEnd="10dp"
tools:srcCompat="@mipmap/icon_free_pk_waring" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/live_data_msg2"
android:textColor="#595959" />
</LinearLayout>
</LinearLayout>
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/live_data_list"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginTop="10dp"
android:layout_marginBottom="15dp"
android:overScrollMode="never"
app:layoutManager="androidx.recyclerview.widget.GridLayoutManager"
app:spanCount="2"
tools:listitem="@layout/item_live_data" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginBottom="20dp"
android:gravity="center"
android:text="@string/live_data_tip"
android:textColor="#808080" />
</LinearLayout>
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@ -0,0 +1,95 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="600dp"
android:background="#000002">
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginStart="13dp"
android:layout_marginTop="8dp"
android:layout_marginEnd="13dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent">
<TextView
android:id="@+id/task_new_star_time"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
android:layout_marginEnd="14dp"
android:textColor="#FFFFFF"
android:textSize="12sp"
android:visibility="invisible"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<ImageView
android:id="@+id/live_task_banner1"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
android:paddingTop="5dp"
android:scaleType="centerCrop"
android:visibility="gone"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/task_new_star_time"
tools:srcCompat="@mipmap/dialog_task_new_star" />
<ImageView
android:id="@+id/live_task_banner2"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:scaleType="centerCrop"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/live_task_banner1"
tools:srcCompat="@mipmap/dialog_task_info" />
<com.google.android.material.tabs.TabLayout
android:id="@+id/live_task_menu"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:layout_marginTop="8dp"
android:layout_marginEnd="16dp"
app:layout_constraintEnd_toStartOf="@+id/live_task_tip"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/live_task_banner2"
app:tabIndicatorColor="#F6F7FB"
app:tabIndicatorFullWidth="false"
app:tabMaxWidth="100dp"
app:tabMode="scrollable"
app:tabSelectedTextColor="#F6F7FB"
app:tabTextColor="#9A9A9A" />
<ImageView
android:id="@+id/live_task_tip"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="20dp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toBottomOf="@+id/live_task_banner2"
tools:srcCompat="@mipmap/icon_guize" />
<androidx.viewpager2.widget.ViewPager2
android:id="@+id/live_task_viewpager"
android:layout_width="0dp"
android:layout_height="0dp"
android:layout_marginTop="5dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/live_task_menu" />
</androidx.constraintlayout.widget.ConstraintLayout>
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@ -0,0 +1,66 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#000002">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginStart="13dp"
android:layout_marginTop="8dp"
android:layout_marginEnd="13dp"
android:orientation="vertical"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
android:gravity="center"
android:orientation="horizontal">
<ImageView
android:id="@+id/live_task_info_back"
android:layout_width="24dp"
android:layout_height="24dp"
android:layout_weight="1"
tools:srcCompat="@mipmap/icon_back" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="@string/live_task_info_title"
android:textColor="#808080"
android:textSize="16sp" />
</LinearLayout>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="20dp"
android:background="@drawable/background_151515"
android:padding="15dp"
android:text="@string/live_task_info_msg1"
android:textColor="#80CEF2" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="5dp"
android:layout_marginTop="20dp"
android:layout_marginEnd="5dp"
android:layout_marginBottom="50dp"
android:text="@string/live_task_info_msg2"
android:textColor="#CCCCCC" />
</LinearLayout>
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@ -0,0 +1,44 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="10dp"
android:layout_marginTop="10dp"
android:layout_marginEnd="10dp"
android:layout_marginBottom="10dp"
android:background="@drawable/background_151515">
<TextView
android:id="@+id/item_data"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="11dp"
android:text="111"
android:textColor="#FFFFFF"
android:textSize="16sp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="@+id/item_title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingStart="14dp"
android:paddingTop="5dp"
android:paddingEnd="14dp"
android:paddingBottom="10dp"
android:text="222"
android:textColor="#808080"
android:textSize="14sp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/item_data" />
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@ -0,0 +1,89 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="10dp"
android:background="@drawable/background_151515">
<TextView
android:id="@+id/item_task_title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:layout_marginTop="11dp"
android:textSize="14sp"
android:textColor="#FFFFFF"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="@+id/item_task_complete"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="8dp"
android:background="@drawable/background_6cbe53"
android:paddingStart="14dp"
android:paddingTop="4dp"
android:paddingEnd="14dp"
android:paddingBottom="4dp"
android:textColor="#FFFFFF"
android:textSize="10sp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="@+id/item_task_title" />
<LinearLayout
android:id="@+id/item_task_layout"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:layout_marginTop="8dp"
android:layout_marginBottom="10dp"
android:gravity="center"
android:orientation="horizontal"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/item_task_title">
<ImageView
android:id="@+id/item_task_hot_img"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
tools:srcCompat="@mipmap/dialog_task_hot" />
<TextView
android:id="@+id/item_task_hot"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="#B3B3B3"
android:textSize="10sp" />
</LinearLayout>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="12dp"
android:layout_marginTop="8dp"
android:gravity="center"
android:orientation="horizontal"
app:layout_constraintStart_toEndOf="@+id/item_task_layout"
app:layout_constraintTop_toBottomOf="@+id/item_task_title">
<ImageView
android:id="@+id/item_task_xp_img"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
tools:srcCompat="@mipmap/dialog_task_star" />
<TextView
android:id="@+id/item_task_xp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="#B3B3B3"
android:textSize="10sp" />
</LinearLayout>
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@ -267,7 +267,7 @@
android:layout_width="30dp"
android:layout_height="30dp"
android:layout_marginStart="50dp"
android:layout_marginBottom="53dp"
android:layout_marginBottom="83dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:srcCompat="@mipmap/icon_beauty" />
@ -276,7 +276,7 @@
android:id="@+id/btn_start_live"
android:layout_width="189dp"
android:layout_height="42dp"
android:layout_marginBottom="47dp"
android:layout_marginBottom="77dp"
android:background="@drawable/bg_live_ready_btn"
android:text="@string/live_start"
android:textColor="@color/white"
@ -303,9 +303,36 @@
android:layout_width="30dp"
android:layout_height="30dp"
android:layout_marginEnd="50dp"
android:layout_marginBottom="53dp"
android:layout_marginBottom="83dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:srcCompat="@mipmap/icon_robot" />
<LinearLayout
android:id="@+id/anchor_agreement_layout"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="50dp"
android:gravity="center_vertical"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent">
<ImageView
android:id="@+id/selector_protocol"
android:layout_width="14dp"
android:layout_height="14dp"
android:src="@drawable/selector_protocol_check"
app:layout_constraintStart_toStartOf="parent" />
<TextView
android:id="@+id/anchor_agreement"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="4dp"
android:text="@string/anchor_agreement"
android:textColor="@color/white"
android:textSize="12sp" />
</LinearLayout>
</androidx.constraintlayout.widget.ConstraintLayout>

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 24 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 28 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

View File

@ -18,4 +18,20 @@
<string name="live_room_private_des">Only those who have the room code can watch</string>
<string name="live_room_type_submit">Submit</string>
<string name="live_mic_max">The number of voices has reached 3, and no more can be added.</string>
<string name="live_task_no1">Consecutive broadcast duration of the day (minutes)</string>
<string name="live_task_no2">PK count on the day (unlimited mode)</string>
<string name="live_task_fans_no1">Accumulated new followers on that day</string>
<string name="live_task_fans_no2">Cumulative new fan group members on that day</string>
<string name="live_task_tab1">Live interaction</string>
<string name="live_task_tab2">Fan growth</string>
<string name="live_task_info_title">Special instructions for anchor tasks</string>
<string name="live_task_info_msg1">After the broadcast, all anchors can get a series of tasks of the day. After completing the tasks according to the corresponding requirements, anchors can get the task reward of the previous day after the broadcast of the next day.</string>
<string name="live_task_info_msg2">● All task values will be calculated by the system in real time. If data errors occur due to personal, mobile, computer equipment problems, network problems or no normal downcasting, relevant anchors can contact relevant platform staff or online customer service for feedback. After confirmation by relevant part, compensation will be processed.\n● The normal settlement period of all mission data will be settled at 6:00 am every day. If the broadcast time is longer than 6:00 AM, the reward cannot be settled normally, please be noted.\n● When the anchor standard score is lower than 90, the anchor task center can only get 50% of all rewards. When the anchor standard score is lower than 80, the anchor task reward cannot be obtained.</string>
<string name="live_task_item_complete_true">success</string>
<string name="live_task_item_complete_false">incomplete</string>
<string name="live_task_item_hot">hot</string>
<string name="live_task_item_xp">exp</string>
<string name="live_data_msg1">This live data statistics</string>
<string name="live_data_msg2">Historical data can be viewed in the anchor center</string>
<string name="live_data_tip">* Non-real-time calculation of data</string>
</resources>

View File

@ -49,6 +49,20 @@
<string name="random_pk_search_hint" translatable="false">請輸入您要pk的主播昵稱或id</string>
<string name="free_pk_user_pking" translatable="false">對方正在PK中</string>
<string name="free_pk_num_null" translatable="false">PK次數已用完</string>
<string name="live_task_no1">當日連續開播時長(分鐘)</string>
<string name="live_task_no2">當日累計PK次數(不限模式)</string>
<string name="live_task_fans_no1">當日累積新增關註粉絲</string>
<string name="live_task_fans_no2">當日累積新增粉絲團成員</string>
<string name="live_task_tab1">直播互動</string>
<string name="live_task_tab2">粉絲增漲</string>
<string name="live_task_info_title">主播任務特別說明</string>
<string name="live_task_info_msg1">所有主播在開播後,即可獲得一系列的當日任務,當根據相應的要求完成任務後,主播即可在第二天開播後,獲得前一天的任務獎勵。</string>
<string name="live_task_info_msg2">● 所有任務數值將由系統進行實時計算,如因個人手機電腦設備問題、網絡問題或是沒有正常進行下播導致數據出現錯誤等問題,為此相關主播可進行聯系相關平臺工作人員或是在線客服,進行反饋,待相關部分確認後,將會再進行補償處理。\n● 所有任務數據的正常結算周期將會在每日的淩晨6點進行結算若開播時間超過淩晨6點將會出現獎勵無法正常結算的情況請知悉。\n● 當主播規範分低於90時主播任務中心的所有獎勵將僅能獲得50%的當主播規範分低於80以下時將無法獲得主播任務獎勵。</string>
<string name="live_task_item_complete_true">已完成</string>
<string name="live_task_item_complete_false">未完成</string>
<string name="live_task_item_hot">直播熱度</string>
<string name="live_task_item_xp">主播經驗</string>
<string name="live_data_msg1">本場直播數據統計</string>
<string name="live_data_msg2">歷史數據可在主播中心查看</string>
<string name="live_data_tip">* 人數及新增相關數據非实时计算</string>
</resources>

View File

@ -1,23 +1,60 @@
package com.yunbao.main.activity;
import android.content.Intent;
import android.os.Bundle;
import android.os.Environment;
import android.text.SpannableStringBuilder;
import android.util.Log;
import android.view.View;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.ListView;
import android.widget.TextView;
import androidx.appcompat.app.AppCompatActivity;
import com.yunbao.main.R;
import com.yunbao.common.utils.ToastUtil;
import com.yunbao.live.dialog.LiveDataInfoDialog;
import com.yunbao.live.dialog.LiveTaskDialog;
import java.io.File;
public class TestActivity extends AppCompatActivity {
private TextView contextLayout;
private ListView listView;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_test);
contextLayout = findViewById(R.id.context_layout);
SpannableStringBuilder builder = new SpannableStringBuilder();
listView = new ListView(this);
setContentView(listView);
String[] strs = new String[]{
"弹出主播任务",
"直播數據"
};
listView.setAdapter(new ArrayAdapter<String>(this, android.R.layout.simple_expandable_list_item_1, strs));
listView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
switch (position) {
case 0:
new LiveTaskDialog(TestActivity.this).showDialog();
break;
case 1:
new LiveDataInfoDialog(TestActivity.this).showDialog();
break;
}
}
});
}
@Override
protected void onActivityResult(final int requestCode, final int resultCode, final Intent data) {
super.onActivityResult(requestCode, resultCode, data);
}
}

View File

@ -1,6 +1,7 @@
package com.yunbao.main.views;
import android.content.Context;
import android.content.Intent;
import android.view.View;
import android.view.ViewGroup;
import android.widget.FrameLayout;
@ -11,6 +12,7 @@ import com.yunbao.common.utils.WordUtil;
import com.yunbao.live.dialog.LiveRobotSettingDialogFragment;
import com.yunbao.main.R;
import com.yunbao.main.activity.MainActivity;
import com.yunbao.main.activity.TestActivity;
/**
* Created by cxf on 2018/9/22.
@ -38,6 +40,10 @@ public class MainHomeViewHolder extends AbsMainHomeParentViewHolder {
super.init();
img_trophy = (ImageView) findViewById(R.id.img_trophy);
img_trophy.setOnLongClickListener(v -> {
mContext.startActivity(new Intent(mContext, TestActivity.class));
return true;
});
ImgLoader.display(mContext, "https://downs.yaoulive.com/gif_trophy.gif", img_trophy);