|
@@ -3,8 +3,11 @@ package com.cooleshow.teacher.ui.live;
|
|
import android.os.Bundle;
|
|
import android.os.Bundle;
|
|
import android.text.TextUtils;
|
|
import android.text.TextUtils;
|
|
import android.view.View;
|
|
import android.view.View;
|
|
|
|
+import android.widget.TextView;
|
|
|
|
|
|
import com.alibaba.android.arouter.facade.annotation.Route;
|
|
import com.alibaba.android.arouter.facade.annotation.Route;
|
|
|
|
+import com.bigkoo.pickerview.builder.OptionsPickerBuilder;
|
|
|
|
+import com.bigkoo.pickerview.view.OptionsPickerView;
|
|
import com.cooleshow.base.router.RouterPath;
|
|
import com.cooleshow.base.router.RouterPath;
|
|
import com.cooleshow.base.ui.activity.BaseMVPActivity;
|
|
import com.cooleshow.base.ui.activity.BaseMVPActivity;
|
|
import com.cooleshow.base.utils.ToastUtils;
|
|
import com.cooleshow.base.utils.ToastUtils;
|
|
@@ -14,6 +17,10 @@ import com.cooleshow.teacher.contract.CreateLiveContract;
|
|
import com.cooleshow.teacher.databinding.ActivityCreateLiveBinding;
|
|
import com.cooleshow.teacher.databinding.ActivityCreateLiveBinding;
|
|
import com.cooleshow.teacher.presenter.live.CreateLivePresenter;
|
|
import com.cooleshow.teacher.presenter.live.CreateLivePresenter;
|
|
|
|
|
|
|
|
+import java.util.ArrayList;
|
|
|
|
+import java.util.Arrays;
|
|
|
|
+import java.util.List;
|
|
|
|
+
|
|
import androidx.annotation.Nullable;
|
|
import androidx.annotation.Nullable;
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -24,6 +31,10 @@ import androidx.annotation.Nullable;
|
|
*/
|
|
*/
|
|
@Route(path = RouterPath.LiveCenter.TEACHER_MINE_CREATE_COURSE)
|
|
@Route(path = RouterPath.LiveCenter.TEACHER_MINE_CREATE_COURSE)
|
|
public class CreateLiveActivity extends BaseMVPActivity<ActivityCreateLiveBinding, CreateLivePresenter> implements CreateLiveContract.CreateLiveView, View.OnClickListener {
|
|
public class CreateLiveActivity extends BaseMVPActivity<ActivityCreateLiveBinding, CreateLivePresenter> implements CreateLiveContract.CreateLiveView, View.OnClickListener {
|
|
|
|
+ public static final String[] LIVE_TIMES_LIMIT = new String[]{"30", "45", "60", "90"};
|
|
|
|
+ private OptionsPickerView pvOptions;
|
|
|
|
+ private List<String> mTimes;
|
|
|
|
+ private String currentLimitTime = LIVE_TIMES_LIMIT[0];
|
|
|
|
|
|
@Override
|
|
@Override
|
|
protected void onCreate(@Nullable Bundle savedInstanceState) {
|
|
protected void onCreate(@Nullable Bundle savedInstanceState) {
|
|
@@ -35,6 +46,14 @@ public class CreateLiveActivity extends BaseMVPActivity<ActivityCreateLiveBindin
|
|
protected void initView() {
|
|
protected void initView() {
|
|
initMidTitleToolBar(viewBinding.toolbarInclude.toolbar, "创建直播");
|
|
initMidTitleToolBar(viewBinding.toolbarInclude.toolbar, "创建直播");
|
|
viewBinding.tvConfirm.setOnClickListener(this);
|
|
viewBinding.tvConfirm.setOnClickListener(this);
|
|
|
|
+ viewBinding.csLiveDuration.setOnClickListener(this);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ public void initData() {
|
|
|
|
+ super.initData();
|
|
|
|
+ mTimes = Arrays.asList(LIVE_TIMES_LIMIT);
|
|
|
|
+
|
|
}
|
|
}
|
|
|
|
|
|
@Override
|
|
@Override
|
|
@@ -61,10 +80,40 @@ public class CreateLiveActivity extends BaseMVPActivity<ActivityCreateLiveBindin
|
|
ToastUtils.showShort("请输入直播间内容");
|
|
ToastUtils.showShort("请输入直播间内容");
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
- presenter.createTempLive(liveContent, liveTitle);
|
|
|
|
|
|
+ presenter.createTempLive(liveContent, liveTitle,currentLimitTime);
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if (view.getId() == R.id.cs_live_duration) {
|
|
|
|
+ showTimeSelect();
|
|
|
|
+ return;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+
|
|
|
|
+ private void showTimeSelect() {
|
|
|
|
+ if (pvOptions == null) {
|
|
|
|
+ pvOptions = new OptionsPickerBuilder(this, (options1, options2, options3, v) -> {
|
|
|
|
+ currentLimitTime = mTimes.get(options1);
|
|
|
|
+ viewBinding.tvLiveTime.setText(currentLimitTime + "分钟");
|
|
|
|
+ viewBinding.tvLiveTime.setTextColor(getResources().getColor(com.cooleshow.base.R.color.color_333333));
|
|
|
|
+ }).setLayoutRes(R.layout.pickerview_live_time_layout, v -> {
|
|
|
|
+ //自定义布局中的控件初始化及事件处理
|
|
|
|
+ final TextView tvSubmit = (TextView) v.findViewById(com.cooleshow.base.R.id.tv_finish);
|
|
|
|
+ TextView ivCancel = (TextView) v.findViewById(com.cooleshow.base.R.id.tv_cancel);
|
|
|
|
+ tvSubmit.setOnClickListener(v12 -> {
|
|
|
|
+ pvOptions.returnData();
|
|
|
|
+ pvOptions.dismiss();
|
|
|
|
+ });
|
|
|
|
+ ivCancel.setOnClickListener(v1 -> pvOptions.dismiss());
|
|
|
|
+
|
|
|
|
+ }).isDialog(false).build();
|
|
|
|
+ }
|
|
|
|
+ pvOptions.setPicker(mTimes);
|
|
|
|
+ pvOptions.show();
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+
|
|
/**
|
|
/**
|
|
* 创建直播间成功,返回直播间id
|
|
* 创建直播间成功,返回直播间id
|
|
*
|
|
*
|