|
@@ -1,6 +1,7 @@
|
|
|
package com.cooleshow.teacher.ui.live;
|
|
|
|
|
|
import android.os.Bundle;
|
|
|
+import android.text.TextUtils;
|
|
|
import android.view.View;
|
|
|
|
|
|
import com.chad.library.adapter.base.BaseQuickAdapter;
|
|
@@ -9,17 +10,21 @@ import com.chad.library.adapter.base.listener.OnLoadMoreListener;
|
|
|
import com.cooleshow.base.constanst.Constants;
|
|
|
import com.cooleshow.base.ui.fragment.BaseFragment;
|
|
|
import com.cooleshow.base.ui.fragment.BaseMVPFragment;
|
|
|
+import com.cooleshow.base.utils.ToastUtil;
|
|
|
import com.cooleshow.base.widgets.EmptyViewLayout;
|
|
|
import com.cooleshow.teacher.R;
|
|
|
import com.cooleshow.teacher.adapter.LiveListAdapter;
|
|
|
import com.cooleshow.teacher.bean.LiveListBean;
|
|
|
+import com.cooleshow.teacher.bean.LivePlayBackDataBean;
|
|
|
import com.cooleshow.teacher.contract.LiveListContract;
|
|
|
import com.cooleshow.teacher.databinding.FragmentLiveListOnLayoutBinding;
|
|
|
import com.cooleshow.teacher.presenter.live.LiveListPresenter;
|
|
|
import com.cooleshow.teacher.ui.work.HomeWorkFragment;
|
|
|
+import com.cooleshow.teacher.widgets.dialog.LivePlaybackDialog;
|
|
|
import com.scwang.smart.refresh.layout.api.RefreshLayout;
|
|
|
import com.scwang.smart.refresh.layout.listener.OnRefreshListener;
|
|
|
|
|
|
+import java.util.ArrayList;
|
|
|
import java.util.List;
|
|
|
|
|
|
import androidx.annotation.NonNull;
|
|
@@ -36,6 +41,7 @@ public class LiveListFragment extends BaseMVPFragment<FragmentLiveListOnLayoutBi
|
|
|
private LiveListAdapter mLiveListAdapter;
|
|
|
private boolean hasNext = true;
|
|
|
private EmptyViewLayout mEmptyView;
|
|
|
+ private LivePlaybackDialog mLivePlaybackDialog;
|
|
|
|
|
|
public static LiveListFragment newInstance(String liveStatusTag) {
|
|
|
Bundle args = new Bundle();
|
|
@@ -83,6 +89,7 @@ public class LiveListFragment extends BaseMVPFragment<FragmentLiveListOnLayoutBi
|
|
|
}
|
|
|
if (view.getId() == R.id.tv_look_playback) {
|
|
|
//查看回放
|
|
|
+ getLivePlaybackData(rowsBean.roomUid);
|
|
|
return;
|
|
|
}
|
|
|
}
|
|
@@ -116,12 +123,31 @@ public class LiveListFragment extends BaseMVPFragment<FragmentLiveListOnLayoutBi
|
|
|
getData(true);
|
|
|
}
|
|
|
|
|
|
+ private void showPlayBackDialog(ArrayList<LivePlayBackDataBean> datas) {
|
|
|
+ if (mLivePlaybackDialog == null) {
|
|
|
+ mLivePlaybackDialog = new LivePlaybackDialog(getContext());
|
|
|
+ }
|
|
|
+ if (!mLivePlaybackDialog.isShowing()) {
|
|
|
+ mLivePlaybackDialog.show();
|
|
|
+ mLivePlaybackDialog.setData(datas);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
private void getData(boolean isShowLoading) {
|
|
|
if (presenter != null) {
|
|
|
presenter.getLiveListData(isShowLoading, mLiveTag, currentPage);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ private void getLivePlaybackData(String roomId) {
|
|
|
+ if (TextUtils.isEmpty(roomId)) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ if (presenter != null) {
|
|
|
+ presenter.getLivePlaybackData(roomId);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
@Override
|
|
|
public void getListDataSuccess(int page, LiveListBean liveListBean) {
|
|
|
if (isDetached()) {
|
|
@@ -154,6 +180,18 @@ public class LiveListFragment extends BaseMVPFragment<FragmentLiveListOnLayoutBi
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ @Override
|
|
|
+ public void getPlaybackDataSuccess(ArrayList<LivePlayBackDataBean> datas) {
|
|
|
+ if (isDetached()) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ if (datas != null && datas.size() > 0) {
|
|
|
+ showPlayBackDialog(datas);
|
|
|
+ } else {
|
|
|
+ ToastUtil.getInstance().showShort("暂无回放");
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
|
|
|
/**
|
|
|
* 显示空视图
|