直播任务对接接口
This commit is contained in:
parent
cca8f43f61
commit
5d2a246916
@ -110,6 +110,7 @@ public class LiveTaskModel extends BaseModel {
|
||||
@SerializedName("status")
|
||||
private int status;
|
||||
|
||||
@SerializedName("now_num")
|
||||
private int nowValue;
|
||||
|
||||
public Task() {
|
||||
|
@ -9,9 +9,9 @@ ext {
|
||||
]
|
||||
manifestPlaceholders = [
|
||||
//正式
|
||||
serverHost : "https://napi.yaoulive.com",
|
||||
// serverHost : "https://napi.yaoulive.com",
|
||||
//测试
|
||||
// serverHost : "https://ceshi.yaoulive.com",
|
||||
serverHost : "https://ceshi.yaoulive.com",
|
||||
|
||||
//腾讯地图
|
||||
txMapAppKey : "EOZBZ-ASLCU-4XPV3-BDCHZ-4E3Q7-H4BWB",
|
||||
|
@ -1,5 +1,6 @@
|
||||
package com.yunbao.live.dialog;
|
||||
|
||||
import android.app.Dialog;
|
||||
import android.content.Context;
|
||||
import android.os.Bundle;
|
||||
import android.util.Log;
|
||||
@ -25,7 +26,7 @@ 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.ToastUtil;
|
||||
import com.yunbao.common.utils.DialogUitl;
|
||||
import com.yunbao.common.utils.WordUtil;
|
||||
import com.yunbao.live.R;
|
||||
import com.yunbao.live.adapter.LiveTaskRecyclerAdapter;
|
||||
@ -97,7 +98,7 @@ public class LiveTaskDialog extends AbsDialogPopupWindow {
|
||||
tipImg.setOnClickListener(v -> new LiveTaskInfoDialog(mContext).showDialog());
|
||||
}
|
||||
|
||||
private void initTabLayout() {
|
||||
private void initTabLayout(LiveTaskModel model) {
|
||||
TabLayout.Tab liveTaskTag = tabLayout.newTab();
|
||||
TabLayout.Tab userTaskTag = tabLayout.newTab();
|
||||
liveTaskTag.setText(R.string.live_task_tab1);
|
||||
@ -120,6 +121,7 @@ public class LiveTaskDialog extends AbsDialogPopupWindow {
|
||||
bundle.putInt("position", position + 1);
|
||||
bundle.putInt("liveTimer", liveTimer);
|
||||
bundle.putString("liveUid", liveUid);
|
||||
bundle.putSerializable("data", model);
|
||||
fragment.setArguments(bundle);
|
||||
return fragment;
|
||||
}
|
||||
@ -148,20 +150,28 @@ public class LiveTaskDialog extends AbsDialogPopupWindow {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
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();
|
||||
initTabLayout(data);
|
||||
if(loadDialog!=null){
|
||||
loadDialog.dismiss();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(String error) {
|
||||
Log.e("直播任务", "onError: " + error);
|
||||
if(loadDialog!=null){
|
||||
loadDialog.dismiss();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
@ -196,7 +206,11 @@ public class LiveTaskDialog extends AbsDialogPopupWindow {
|
||||
this.liveUid = getArguments().getString("liveUid", "0");
|
||||
taskList = (RecyclerView) view;
|
||||
initTaskList();
|
||||
createTask(position);
|
||||
if(position==2) {
|
||||
createTask(position);
|
||||
}else{
|
||||
update((LiveTaskModel) getArguments().getSerializable("data"),1);
|
||||
}
|
||||
}
|
||||
|
||||
private void initTaskList() {
|
||||
@ -208,35 +222,11 @@ public class LiveTaskDialog extends AbsDialogPopupWindow {
|
||||
private void createTask(int type) {
|
||||
LiveNetManager.get(getContext())
|
||||
.getLiveTask(type, liveUid, new HttpCallback<LiveTaskModel>() {
|
||||
boolean debug = true;
|
||||
|
||||
@Override
|
||||
public void onSuccess(LiveTaskModel data) {
|
||||
Log.i("直播任务", "onSuccess: " + data);
|
||||
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.get(1).setTaskNum(3);
|
||||
task1.get(1).setTaskName("*" + task1.get(1).getTaskName());
|
||||
}
|
||||
task1.add(task2);
|
||||
task1.addAll(data.getList().get(1));
|
||||
adapter.setTasks(task1);
|
||||
update(data, type);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -246,6 +236,33 @@ public class LiveTaskDialog extends AbsDialogPopupWindow {
|
||||
});
|
||||
}
|
||||
|
||||
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.get(1).setTaskNum(3);
|
||||
task1.get(1).setTaskName("*" + task1.get(1).getTaskName());
|
||||
}
|
||||
task1.add(task2);
|
||||
task1.addAll(data.getList().get(1));
|
||||
adapter.setTasks(task1);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -85,6 +85,7 @@
|
||||
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"
|
||||
|
Loading…
Reference in New Issue
Block a user