直播任务对接接口
This commit is contained in:
parent
1d66a9b7fb
commit
cca8f43f61
@ -1,17 +1,23 @@
|
|||||||
package com.yunbao.common.bean;
|
package com.yunbao.common.bean;
|
||||||
|
|
||||||
|
|
||||||
|
import com.google.gson.annotations.SerializedName;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
public class LiveTaskModel extends BaseModel {
|
public class LiveTaskModel extends BaseModel {
|
||||||
public static final int TASK_TYPE_TIP=0;
|
public static final int TASK_TYPE_TIP = 0;
|
||||||
public static final int TASK_TYPE_ITEM=1;
|
public static final int TASK_TYPE_ITEM = 1;
|
||||||
|
|
||||||
int type;
|
int type;
|
||||||
String title;
|
@SerializedName("new")
|
||||||
int hot;
|
NewUser user;
|
||||||
int xp;
|
@SerializedName("list")
|
||||||
int taskTarget;
|
List<List<Task>> list;
|
||||||
int task;
|
|
||||||
boolean complete;
|
public LiveTaskModel() {
|
||||||
|
}
|
||||||
|
|
||||||
public int getType() {
|
public int getType() {
|
||||||
return type;
|
return type;
|
||||||
@ -21,51 +27,205 @@ public class LiveTaskModel extends BaseModel {
|
|||||||
this.type = type;
|
this.type = type;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getTitle() {
|
public NewUser getUser() {
|
||||||
return title;
|
return user;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setTitle(String title) {
|
public void setUser(NewUser user) {
|
||||||
this.title = title;
|
this.user = user;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getHot() {
|
public List<List<Task>> getList() {
|
||||||
return hot;
|
return list;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setHot(int hot) {
|
public void setList(List<List<Task>> list) {
|
||||||
this.hot = hot;
|
this.list = list;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getXp() {
|
@Override
|
||||||
return xp;
|
public String toString() {
|
||||||
|
return "LiveTaskModel{" +
|
||||||
|
"type=" + type +
|
||||||
|
", user=" + user +
|
||||||
|
", list=" + list +
|
||||||
|
'}';
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setXp(int xp) {
|
public static class NewUser {
|
||||||
this.xp = xp;
|
@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() {
|
||||||
|
return endTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setEndTime(String endTime) {
|
||||||
|
this.endTime = endTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return "NewUser{" +
|
||||||
|
"isNew=" + isNew +
|
||||||
|
", endTime='" + endTime + '\'' +
|
||||||
|
'}';
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getTaskTarget() {
|
public static class Task implements Serializable {
|
||||||
return taskTarget;
|
@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;
|
||||||
|
|
||||||
public void setTaskTarget(int taskTarget) {
|
private int nowValue;
|
||||||
this.taskTarget = taskTarget;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getTask() {
|
public Task() {
|
||||||
return task;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
public void setTask(int task) {
|
public int getId() {
|
||||||
this.task = task;
|
return id;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isComplete() {
|
public void setId(int id) {
|
||||||
return complete;
|
this.id = id;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setComplete(boolean complete) {
|
public int getType() {
|
||||||
this.complete = complete;
|
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() {
|
||||||
|
return hot;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setHot(long hot) {
|
||||||
|
this.hot = hot;
|
||||||
|
}
|
||||||
|
|
||||||
|
public long getExp() {
|
||||||
|
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 +
|
||||||
|
'}';
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -17,6 +17,7 @@ import com.yunbao.common.bean.LiveAiRobotBean;
|
|||||||
import com.yunbao.common.bean.LiveInfoModel;
|
import com.yunbao.common.bean.LiveInfoModel;
|
||||||
import com.yunbao.common.bean.LiveRoomActivityBanner;
|
import com.yunbao.common.bean.LiveRoomActivityBanner;
|
||||||
import com.yunbao.common.bean.LiveStetUpStatusModel;
|
import com.yunbao.common.bean.LiveStetUpStatusModel;
|
||||||
|
import com.yunbao.common.bean.LiveTaskModel;
|
||||||
import com.yunbao.common.bean.MsgSwitchDetailModel;
|
import com.yunbao.common.bean.MsgSwitchDetailModel;
|
||||||
import com.yunbao.common.bean.NewPeopleInfo;
|
import com.yunbao.common.bean.NewPeopleInfo;
|
||||||
import com.yunbao.common.bean.NobleRankHideUserListModel;
|
import com.yunbao.common.bean.NobleRankHideUserListModel;
|
||||||
@ -548,4 +549,13 @@ public interface PDLiveApi {
|
|||||||
Observable<ResponseModel<List<ListInfoMessageModel>>> getListInfo(
|
Observable<ResponseModel<List<ListInfoMessageModel>>> getListInfo(
|
||||||
@Query("type") String type,
|
@Query("type") String type,
|
||||||
@Query("p") int p);
|
@Query("p") int p);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取主播任务列表
|
||||||
|
*/
|
||||||
|
@GET("/api/public/?service=Live.getLiveTaskStatus")
|
||||||
|
Observable<ResponseModel<LiveTaskModel>> getLiveTaskList(
|
||||||
|
@Query("type") int type,
|
||||||
|
@Query("liveuid") String liveUid
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
@ -19,6 +19,7 @@ import com.yunbao.common.bean.LiveAiRobotBean;
|
|||||||
import com.yunbao.common.bean.LiveInfoModel;
|
import com.yunbao.common.bean.LiveInfoModel;
|
||||||
import com.yunbao.common.bean.LiveRoomActivityBanner;
|
import com.yunbao.common.bean.LiveRoomActivityBanner;
|
||||||
import com.yunbao.common.bean.LiveStetUpStatusModel;
|
import com.yunbao.common.bean.LiveStetUpStatusModel;
|
||||||
|
import com.yunbao.common.bean.LiveTaskModel;
|
||||||
import com.yunbao.common.bean.NobleRankHideUserListModel;
|
import com.yunbao.common.bean.NobleRankHideUserListModel;
|
||||||
import com.yunbao.common.bean.NobleTrumpetModel;
|
import com.yunbao.common.bean.NobleTrumpetModel;
|
||||||
import com.yunbao.common.bean.PkRankBean;
|
import com.yunbao.common.bean.PkRankBean;
|
||||||
@ -1088,6 +1089,22 @@ public class LiveNetManager {
|
|||||||
}).isDisposed();
|
}).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();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 直播间取消网络请求
|
* 直播间取消网络请求
|
||||||
*/
|
*/
|
||||||
|
@ -673,6 +673,7 @@ public class LiveRyAnchorActivity extends LiveActivity implements LiveFunctionCl
|
|||||||
}
|
}
|
||||||
bundle.putBoolean(Constants.HAS_GAME, hasGame);
|
bundle.putBoolean(Constants.HAS_GAME, hasGame);
|
||||||
bundle.putInt("leave", leave);
|
bundle.putInt("leave", leave);
|
||||||
|
bundle.putString("liveUid", mLiveUid);
|
||||||
bundle.putBoolean("isPk", isDRPK == 1 || PKing || mLivePushViewHolder.isPking());
|
bundle.putBoolean("isPk", isDRPK == 1 || PKing || mLivePushViewHolder.isPking());
|
||||||
bundle.putLong("liveTime", mLiveAnchorViewHolder.getmAnchorLiveTime());
|
bundle.putLong("liveTime", mLiveAnchorViewHolder.getmAnchorLiveTime());
|
||||||
bundle.putBoolean(Constants.OPEN_FLASH, mLivePushViewHolder != null && mLivePushViewHolder.isFlashOpen());
|
bundle.putBoolean(Constants.OPEN_FLASH, mLivePushViewHolder != null && mLivePushViewHolder.isFlashOpen());
|
||||||
@ -938,9 +939,11 @@ public class LiveRyAnchorActivity extends LiveActivity implements LiveFunctionCl
|
|||||||
if (code == 0) {
|
if (code == 0) {
|
||||||
JSONObject obj = JSON.parseObject(info[0]);
|
JSONObject obj = JSON.parseObject(info[0]);
|
||||||
JSONObject datas = obj.getJSONObject("data");
|
JSONObject datas = obj.getJSONObject("data");
|
||||||
|
try {
|
||||||
SocketRyChatUtil.closeLive(datas.getString("votes"), datas.getString("length"), datas.getString("nums"), mLiveUid, mSocketRyClient);
|
SocketRyChatUtil.closeLive(datas.getString("votes"), datas.getString("length"), datas.getString("nums"), mLiveUid, mSocketRyClient);
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
|
||||||
if (mLiveEndViewHolder == null) {
|
if (mLiveEndViewHolder == null) {
|
||||||
mLiveEndViewHolder = new LiveEndViewHolder(mContext, mRoot, mLiveBean.getUid());
|
mLiveEndViewHolder = new LiveEndViewHolder(mContext, mRoot, mLiveBean.getUid());
|
||||||
|
@ -18,18 +18,19 @@ import com.yunbao.common.utils.DpUtil;
|
|||||||
import com.yunbao.common.utils.WordUtil;
|
import com.yunbao.common.utils.WordUtil;
|
||||||
import com.yunbao.live.R;
|
import com.yunbao.live.R;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
public class LiveTaskRecyclerAdapter extends RecyclerView.Adapter<LiveTaskRecyclerAdapter.TaskHolder> {
|
public class LiveTaskRecyclerAdapter extends RecyclerView.Adapter<LiveTaskRecyclerAdapter.TaskHolder> {
|
||||||
|
|
||||||
private Context mContext;
|
private Context mContext;
|
||||||
private List<LiveTaskModel> tasks;
|
private List<LiveTaskModel.Task> tasks = new ArrayList<>();
|
||||||
|
|
||||||
public LiveTaskRecyclerAdapter(Context mContext) {
|
public LiveTaskRecyclerAdapter(Context mContext) {
|
||||||
this.mContext = mContext;
|
this.mContext = mContext;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setTasks(List<LiveTaskModel> tasks) {
|
public void setTasks(List<LiveTaskModel.Task> tasks) {
|
||||||
this.tasks = tasks;
|
this.tasks = tasks;
|
||||||
notifyDataSetChanged();
|
notifyDataSetChanged();
|
||||||
}
|
}
|
||||||
@ -91,15 +92,26 @@ public class LiveTaskRecyclerAdapter extends RecyclerView.Adapter<LiveTaskRecycl
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setDate(LiveTaskModel task) {
|
public void setDate(LiveTaskModel.Task task) {
|
||||||
title.setText(task.getTitle());
|
title.setText(task.getTaskName());
|
||||||
if (task.getType() == LiveTaskModel.TASK_TYPE_TIP) {
|
if (task.getType() == LiveTaskModel.TASK_TYPE_TIP) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
complete.setText(task.isComplete() ? R.string.live_task_item_complete_true : R.string.live_task_item_complete_false);
|
if (task.getStatus() || task.getNowValue() >= task.getTaskNum()) {
|
||||||
complete.setBackgroundResource(task.isComplete() ? R.drawable.background_6cbe53 : R.drawable.background_595959);
|
task.setNowValue(task.getTaskNum());
|
||||||
hot.setText(Html.fromHtml("<font color='#B3B3B3'>"+ WordUtil.getString(R.string.live_task_item_hot) +"</font>  <font color='#F09FC2'>" + task.getHot() + "</font>"));
|
}
|
||||||
xp.setText(Html.fromHtml("<font color='#B3B3B3'>"+WordUtil.getString(R.string.live_task_item_xp)+"</font>  <font color='#FFF69F'>" + task.getXp() + "</font>"));
|
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>  <font color='#F09FC2'>" + task.getHot() + "</font>"));
|
||||||
|
xp.setText(Html.fromHtml("<font color='#B3B3B3'>" + WordUtil.getString(R.string.live_task_item_xp) + "</font>  <font color='#FFF69F'>" + task.getExp() + "</font>"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -46,6 +46,8 @@ public class LiveNewFunctionDialogFragment extends AbsDialogFragment implements
|
|||||||
private boolean isPk;
|
private boolean isPk;
|
||||||
private TextView mLiveTimeTextView;//主播的直播时长
|
private TextView mLiveTimeTextView;//主播的直播时长
|
||||||
|
|
||||||
|
private String liveUid;
|
||||||
|
|
||||||
// boolean isRy = false;
|
// boolean isRy = false;
|
||||||
@Override
|
@Override
|
||||||
protected int getLayoutId() {
|
protected int getLayoutId() {
|
||||||
@ -86,6 +88,7 @@ public class LiveNewFunctionDialogFragment extends AbsDialogFragment implements
|
|||||||
isPk = bundle.getBoolean("isPk", false);
|
isPk = bundle.getBoolean("isPk", false);
|
||||||
// isRy = bundle.getBoolean("isRy", false);
|
// isRy = bundle.getBoolean("isRy", false);
|
||||||
mAnchorLiveTime = bundle.getLong("liveTime");
|
mAnchorLiveTime = bundle.getLong("liveTime");
|
||||||
|
liveUid = bundle.getString("liveUid");
|
||||||
}
|
}
|
||||||
mWishView = findViewById(R.id.live_tool_wish);
|
mWishView = findViewById(R.id.live_tool_wish);
|
||||||
mPrankView = findViewById(R.id.live_tool_prank);
|
mPrankView = findViewById(R.id.live_tool_prank);
|
||||||
@ -182,13 +185,18 @@ public class LiveNewFunctionDialogFragment extends AbsDialogFragment implements
|
|||||||
dismiss();
|
dismiss();
|
||||||
} else if (id == R.id.anchor_task) {
|
} else if (id == R.id.anchor_task) {
|
||||||
//主播任务
|
//主播任务
|
||||||
new LiveTaskDialog(mContext).showDialog();
|
taskDialog = new LiveTaskDialog(mContext);
|
||||||
|
taskDialog.setLiveUid(liveUid);
|
||||||
|
taskDialog.updateLiveTimer(mAnchorLiveTime);
|
||||||
|
taskDialog.showDialog();
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private final int WHAT_ANCHOR_LIVE_TIME = 3;//直播间主播计时
|
private final int WHAT_ANCHOR_LIVE_TIME = 3;//直播间主播计时
|
||||||
private LiveRoomHandler mLiveRoomHandler;
|
private LiveRoomHandler mLiveRoomHandler;
|
||||||
private long mAnchorLiveTime;//主播直播时间
|
private long mAnchorLiveTime;//主播直播时间
|
||||||
|
private LiveTaskDialog taskDialog;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 主播显示直播时间
|
* 主播显示直播时间
|
||||||
|
@ -2,6 +2,7 @@ package com.yunbao.live.dialog;
|
|||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
|
import android.util.Log;
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
@ -22,6 +23,9 @@ import com.google.android.material.tabs.TabLayoutMediator;
|
|||||||
import com.lxj.xpopup.XPopup;
|
import com.lxj.xpopup.XPopup;
|
||||||
import com.yunbao.common.bean.LiveTaskModel;
|
import com.yunbao.common.bean.LiveTaskModel;
|
||||||
import com.yunbao.common.dialog.AbsDialogPopupWindow;
|
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.ToastUtil;
|
||||||
import com.yunbao.common.utils.WordUtil;
|
import com.yunbao.common.utils.WordUtil;
|
||||||
import com.yunbao.live.R;
|
import com.yunbao.live.R;
|
||||||
import com.yunbao.live.adapter.LiveTaskRecyclerAdapter;
|
import com.yunbao.live.adapter.LiveTaskRecyclerAdapter;
|
||||||
@ -46,11 +50,12 @@ public class LiveTaskDialog extends AbsDialogPopupWindow {
|
|||||||
|
|
||||||
|
|
||||||
private Context mContext;
|
private Context mContext;
|
||||||
|
String liveUid;
|
||||||
|
int liveTimer;
|
||||||
|
|
||||||
public LiveTaskDialog(Context context) {
|
public LiveTaskDialog(Context context) {
|
||||||
super(context);
|
super(context);
|
||||||
this.mContext = context;
|
this.mContext = context;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -69,6 +74,9 @@ public class LiveTaskDialog extends AbsDialogPopupWindow {
|
|||||||
initView();
|
initView();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setLiveUid(String liveUid) {
|
||||||
|
this.liveUid = liveUid;
|
||||||
|
}
|
||||||
|
|
||||||
private void initView() {
|
private void initView() {
|
||||||
newStarTime = findViewById(R.id.task_new_star_time);
|
newStarTime = findViewById(R.id.task_new_star_time);
|
||||||
@ -77,11 +85,8 @@ public class LiveTaskDialog extends AbsDialogPopupWindow {
|
|||||||
tipImg = findViewById(R.id.live_task_tip);
|
tipImg = findViewById(R.id.live_task_tip);
|
||||||
tabLayout = findViewById(R.id.live_task_menu);
|
tabLayout = findViewById(R.id.live_task_menu);
|
||||||
viewPager = findViewById(R.id.live_task_viewpager);
|
viewPager = findViewById(R.id.live_task_viewpager);
|
||||||
|
|
||||||
newStarTime.setText("新秀主播時效截止至 2023/1/01 12:00");
|
|
||||||
|
|
||||||
initImgView();
|
initImgView();
|
||||||
initTabLayout();
|
createTask();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -112,7 +117,9 @@ public class LiveTaskDialog extends AbsDialogPopupWindow {
|
|||||||
public Fragment createFragment(int position) {
|
public Fragment createFragment(int position) {
|
||||||
TaskFragment fragment = new TaskFragment();
|
TaskFragment fragment = new TaskFragment();
|
||||||
Bundle bundle = new Bundle();
|
Bundle bundle = new Bundle();
|
||||||
bundle.putInt("position", position);
|
bundle.putInt("position", position + 1);
|
||||||
|
bundle.putInt("liveTimer", liveTimer);
|
||||||
|
bundle.putString("liveUid", liveUid);
|
||||||
fragment.setArguments(bundle);
|
fragment.setArguments(bundle);
|
||||||
return fragment;
|
return fragment;
|
||||||
}
|
}
|
||||||
@ -133,12 +140,47 @@ public class LiveTaskDialog extends AbsDialogPopupWindow {
|
|||||||
mediator.attach();
|
mediator.attach();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void updateMainUi(LiveTaskModel.NewUser task) {
|
||||||
|
if (task.isNew()) {
|
||||||
|
newStarImg.setVisibility(VISIBLE);
|
||||||
|
newStarTime.setVisibility(VISIBLE);
|
||||||
|
newStarTime.setText(task.getEndTime());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private void createTask() {
|
||||||
|
LiveNetManager.get(getContext())
|
||||||
|
.getLiveTask(1, liveUid, new HttpCallback<LiveTaskModel>() {
|
||||||
|
@Override
|
||||||
|
public void onSuccess(LiveTaskModel data) {
|
||||||
|
Log.i("直播任务", "onSuccess: " + data);
|
||||||
|
updateMainUi(data.getUser());
|
||||||
|
initTabLayout();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onError(String error) {
|
||||||
|
Log.e("直播任务", "onError: " + error);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
public void updateLiveTimer(long time) {
|
||||||
|
liveTimer = (int) ((time % (1000 * 60 * 60)) / (1000 * 60));
|
||||||
|
/*TaskFragment fragment = (TaskFragment) ((AppCompatActivity) mContext).getSupportFragmentManager().findFragmentByTag("f0");
|
||||||
|
if (fragment != null) {
|
||||||
|
fragment.adapter.updateTimer(liveTimer);
|
||||||
|
}*/
|
||||||
|
}
|
||||||
|
|
||||||
public static class TaskFragment extends Fragment {
|
public static class TaskFragment extends Fragment {
|
||||||
private RecyclerView taskList;
|
private RecyclerView taskList;
|
||||||
private LiveTaskRecyclerAdapter adapter;
|
private LiveTaskRecyclerAdapter adapter;
|
||||||
private List<LiveTaskModel> tasks;
|
|
||||||
private int position;
|
private int position;
|
||||||
|
private int liveTimer;
|
||||||
|
private String liveUid;
|
||||||
|
|
||||||
|
|
||||||
@Nullable
|
@Nullable
|
||||||
@Override
|
@Override
|
||||||
@ -150,9 +192,11 @@ public class LiveTaskDialog extends AbsDialogPopupWindow {
|
|||||||
public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
|
public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
|
||||||
super.onViewCreated(view, savedInstanceState);
|
super.onViewCreated(view, savedInstanceState);
|
||||||
this.position = getArguments().getInt("position", -1);
|
this.position = getArguments().getInt("position", -1);
|
||||||
|
this.liveTimer = getArguments().getInt("liveTimer", -1);
|
||||||
|
this.liveUid = getArguments().getString("liveUid", "0");
|
||||||
taskList = (RecyclerView) view;
|
taskList = (RecyclerView) view;
|
||||||
initTaskList();
|
initTaskList();
|
||||||
createTask();
|
createTask(position);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void initTaskList() {
|
private void initTaskList() {
|
||||||
@ -161,39 +205,45 @@ public class LiveTaskDialog extends AbsDialogPopupWindow {
|
|||||||
taskList.setLayoutManager(new LinearLayoutManager(getContext(), RecyclerView.VERTICAL, false));
|
taskList.setLayoutManager(new LinearLayoutManager(getContext(), RecyclerView.VERTICAL, false));
|
||||||
}
|
}
|
||||||
|
|
||||||
private void createTask() {
|
private void createTask(int type) {
|
||||||
tasks = new ArrayList<>();
|
LiveNetManager.get(getContext())
|
||||||
for (int i = 0; i < 4; i++) {
|
.getLiveTask(type, liveUid, new HttpCallback<LiveTaskModel>() {
|
||||||
LiveTaskModel model = new LiveTaskModel();
|
boolean debug = true;
|
||||||
if (i == 0) {
|
|
||||||
model.setType(LiveTaskModel.TASK_TYPE_TIP);
|
|
||||||
model.setTitle(WordUtil.getString(R.string.live_task_no1));
|
|
||||||
} else {
|
|
||||||
model.setType(LiveTaskModel.TASK_TYPE_ITEM);
|
|
||||||
model.setTitle("开播测试标题");
|
|
||||||
}
|
|
||||||
model.setTask(30);
|
|
||||||
model.setXp(3000);
|
|
||||||
model.setHot(5000);
|
|
||||||
tasks.add(model);
|
|
||||||
|
|
||||||
}
|
@Override
|
||||||
for (int i = 0; i < 4; i++) {
|
public void onSuccess(LiveTaskModel data) {
|
||||||
LiveTaskModel model = new LiveTaskModel();
|
Log.i("直播任务", "onSuccess: " + data);
|
||||||
if (i == 0) {
|
LiveTaskModel.Task task = new LiveTaskModel.Task();
|
||||||
model.setType(LiveTaskModel.TASK_TYPE_TIP);
|
LiveTaskModel.Task task2 = new LiveTaskModel.Task();
|
||||||
model.setTitle(WordUtil.getString(R.string.live_task_no2));
|
if (type == 1) {
|
||||||
} else {
|
task.setTaskName(WordUtil.getString(R.string.live_task_no1));
|
||||||
model.setType(LiveTaskModel.TASK_TYPE_ITEM);
|
task2.setTaskName(WordUtil.getString(R.string.live_task_no2));
|
||||||
model.setTitle("PK测试标题");
|
} else {
|
||||||
}
|
task.setTaskName(WordUtil.getString(R.string.live_task_fans_no1));
|
||||||
model.setTask(30);
|
task2.setTaskName(WordUtil.getString(R.string.live_task_fans_no2));
|
||||||
model.setXp(3000);
|
}
|
||||||
model.setHot(5000);
|
task.setType(LiveTaskModel.TASK_TYPE_TIP);
|
||||||
tasks.add(model);
|
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.get(1).setTaskNum(3);
|
||||||
|
task1.get(1).setTaskName("*" + task1.get(1).getTaskName());
|
||||||
|
}
|
||||||
|
task1.add(task2);
|
||||||
|
task1.addAll(data.getList().get(1));
|
||||||
|
adapter.setTasks(task1);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
@Override
|
||||||
adapter.setTasks(tasks);
|
public void onError(String error) {
|
||||||
|
Log.e("直播任务", "onError: " + error);
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -23,10 +23,11 @@
|
|||||||
android:id="@+id/task_new_star_time"
|
android:id="@+id/task_new_star_time"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginEnd="14dp"
|
|
||||||
android:layout_marginTop="5dp"
|
android:layout_marginTop="5dp"
|
||||||
|
android:layout_marginEnd="14dp"
|
||||||
android:textColor="#FFFFFF"
|
android:textColor="#FFFFFF"
|
||||||
android:textSize="12sp"
|
android:textSize="12sp"
|
||||||
|
android:visibility="invisible"
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
app:layout_constraintTop_toTopOf="parent" />
|
app:layout_constraintTop_toTopOf="parent" />
|
||||||
|
|
||||||
@ -37,6 +38,7 @@
|
|||||||
android:layout_marginTop="5dp"
|
android:layout_marginTop="5dp"
|
||||||
android:paddingTop="5dp"
|
android:paddingTop="5dp"
|
||||||
android:scaleType="centerCrop"
|
android:scaleType="centerCrop"
|
||||||
|
android:visibility="gone"
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
app:layout_constraintTop_toBottomOf="@+id/task_new_star_time"
|
app:layout_constraintTop_toBottomOf="@+id/task_new_star_time"
|
||||||
@ -78,6 +80,7 @@
|
|||||||
app:layout_constraintEnd_toEndOf="parent"
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
app:layout_constraintTop_toBottomOf="@+id/live_task_banner2"
|
app:layout_constraintTop_toBottomOf="@+id/live_task_banner2"
|
||||||
tools:srcCompat="@mipmap/icon_guize" />
|
tools:srcCompat="@mipmap/icon_guize" />
|
||||||
|
|
||||||
<androidx.viewpager2.widget.ViewPager2
|
<androidx.viewpager2.widget.ViewPager2
|
||||||
android:id="@+id/live_task_viewpager"
|
android:id="@+id/live_task_viewpager"
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
@ -85,7 +88,7 @@
|
|||||||
app:layout_constraintBottom_toBottomOf="parent"
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
app:layout_constraintTop_toBottomOf="@+id/live_task_menu"/>
|
app:layout_constraintTop_toBottomOf="@+id/live_task_menu" />
|
||||||
|
|
||||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
@ -20,6 +20,8 @@
|
|||||||
<string name="live_mic_max">The number of voices has reached 3, and no more can be added.</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">當日連續開播時長(分鐘)</string>
|
<string name="live_task_no1">當日連續開播時長(分鐘)</string>
|
||||||
<string name="live_task_no2">當日累計PK次數(不限模式)</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_tab1">直播互動</string>
|
||||||
<string name="live_task_tab2">粉絲增漲</string>
|
<string name="live_task_tab2">粉絲增漲</string>
|
||||||
<string name="live_task_info_title">主播任務特別說明</string>
|
<string name="live_task_info_title">主播任務特別說明</string>
|
||||||
|
@ -51,6 +51,8 @@
|
|||||||
<string name="free_pk_num_null" translatable="false">PK次數已用完</string>
|
<string name="free_pk_num_null" translatable="false">PK次數已用完</string>
|
||||||
<string name="live_task_no1">當日連續開播時長(分鐘)</string>
|
<string name="live_task_no1">當日連續開播時長(分鐘)</string>
|
||||||
<string name="live_task_no2">當日累計PK次數(不限模式)</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_tab1">直播互動</string>
|
||||||
<string name="live_task_tab2">粉絲增漲</string>
|
<string name="live_task_tab2">粉絲增漲</string>
|
||||||
<string name="live_task_info_title">主播任務特別說明</string>
|
<string name="live_task_info_title">主播任務特別說明</string>
|
||||||
|
Loading…
Reference in New Issue
Block a user