Commit 84001da1 authored by zhangww's avatar zhangww
Browse files

1.知识点

parent 9df78b65
......@@ -23,6 +23,19 @@ android {
}
}
android.applicationVariants.all {
variant ->
def fileName
variant.outputs.all {
if (variant.buildType.name == 'debug') {
fileName = "VOD_Demo${variant.versionName}_debug.apk"
} else {
fileName = "VOD_Demo${variant.versionName}_release.apk"
}
outputFileName = fileName
}
}
packagingOptions {
exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/beans.xml'
......@@ -48,11 +61,12 @@ dependencies {
implementation 'com.github.bumptech.glide:glide:4.9.0'
implementation 'com.squareup.picasso:picasso:2.5.2'
implementation 'com.bokecc:CCVOD:3.16.1-20210906.024705-1'
implementation 'com.bokecc:CCVOD:3.16.2-20211015.032854-2'
implementation 'androidx.recyclerview:recyclerview:1.2.1'
implementation 'com.umeng.umsdk:common:9.4.0'
implementation 'com.umeng.umsdk:asms:1.2.3'
implementation 'com.umeng.umsdk:apm:1.3.1'
implementation 'com.google.code.gson:gson:2.8.5'
}
[{"outputType":{"type":"APK"},"apkData":{"type":"MAIN","splits":[],"versionCode":1,"versionName":"1.0","enabled":true,"outputFile":"app-release.apk","fullName":"release","baseName":"release"},"path":"app-release.apk","properties":{}}]
\ No newline at end of file
[{"outputType":{"type":"APK"},"apkData":{"type":"MAIN","splits":[],"versionCode":1,"versionName":"1.0","enabled":true,"outputFile":"VOD_Demo1.0_release.apk","fullName":"release","baseName":"release"},"path":"VOD_Demo1.0_release.apk","properties":{}}]
\ No newline at end of file
{
"title": "知识点",
"pauseStatus": true,
"category": [
{
"cateId": 1,
"name": "获得发展史",
"info": [
{
"id": 1,
"startTime": 17,
"endTime": 35,
"desc": "发展史"
}
]
},
{
"cateId": 2,
"name": "品牌升级",
"info": [
{
"id": 1,
"startTime": 35,
"endTime": 50,
"desc": "品牌升级"
}
]
},
{
"cateId": 3,
"name": "产品介绍",
"info": [
{
"id": 1,
"startTime": 50,
"endTime": 63,
"desc": "产品简介"
},
{
"id": 2,
"startTime": 64,
"endTime": 68,
"desc": "数说获得"
},
{
"id": 3,
"startTime": 68,
"endTime": 83,
"desc": "应用场景"
}
]
},
{
"cateId": 4,
"name": "领导风采",
"info": [
{
"id": 1,
"startTime": 84,
"endTime": 96,
"desc": "CEO"
},
{
"id": 2,
"startTime": 223,
"endTime": 265,
"desc": "CEO"
}
]
},
{
"cateId": 5,
"name": "客户案例",
"info": [
{
"id": 1,
"startTime": 100,
"endTime": 108,
"desc": "北京四中网校"
},
{
"id": 2,
"startTime": 108,
"endTime": 112,
"desc": "环球优学"
},
{
"id": 3,
"startTime": 112,
"endTime": 120,
"desc": "结构思考力学院"
},
{
"id": 4,
"startTime": 121,
"endTime": 130,
"desc": "馒头商学院"
},
{
"id": 4,
"startTime": 130,
"endTime": 138,
"desc": "点掌财经"
},
{
"id": 5,
"startTime": 139,
"endTime": 146,
"desc": "云朵课堂"
}
]
},
{
"cateId": 6,
"name": "员工风采",
"info": [
{
"id": 1,
"startTime": 148,
"endTime": 208,
"desc": "员工风采集锦"
}
]
}
]
}
\ No newline at end of file
......@@ -16,7 +16,6 @@ import com.bokecc.vod.utils.MultiUtils;
/**
* AccountInfoActivity
*
* @author CC
*/
public class AccountInfoActivity extends AppCompatActivity implements View.OnClickListener {
......@@ -54,6 +53,16 @@ public class AccountInfoActivity extends AppCompatActivity implements View.OnCli
finish();
}
});
final Button forceSheet = findViewById(R.id.forceSheet);
forceSheet.setText("当前强制:" + ConfigUtil.FORCE_ANSWER_SHEET);
findViewById(R.id.forceSheet).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
ConfigUtil.FORCE_ANSWER_SHEET = !ConfigUtil.FORCE_ANSWER_SHEET;
forceSheet.setText("当前强制:" + ConfigUtil.FORCE_ANSWER_SHEET);
}
});
}
@Override
......
......@@ -18,13 +18,8 @@ import androidx.appcompat.app.AppCompatActivity;
import androidx.core.app.ActivityCompat;
import androidx.core.content.ContextCompat;
import com.bokecc.sdk.mobile.download.DownloadOperator;
import com.bokecc.sdk.mobile.download.VodDownloadBean;
import com.bokecc.sdk.mobile.download.VodDownloadManager;
import com.bokecc.sdk.mobile.util.HttpUtil;
import com.bokecc.vod.adapter.PlayVideoAdapter;
import com.bokecc.vod.data.DataSet;
import com.bokecc.vod.data.DataUtil;
import com.bokecc.vod.data.HuodeVideoInfo;
import com.bokecc.vod.download.DownloadListActivity;
import com.bokecc.vod.download.DownloadService;
......@@ -62,6 +57,7 @@ public class MainActivity extends AppCompatActivity {
Manifest.permission.READ_EXTERNAL_STORAGE,
Manifest.permission.WRITE_EXTERNAL_STORAGE};
private ArrayList<HuodeVideoInfo> videoDatas;
private boolean showKnowledge;
@Override
protected void onCreate(Bundle savedInstanceState) {
......@@ -125,6 +121,7 @@ public class MainActivity extends AppCompatActivity {
gv_video_list.setOnItemClickListener(new AdapterView.OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
showKnowledge = position == 0;
final HuodeVideoInfo item = (HuodeVideoInfo) playVideoAdapter.getItem(position);
selectPlayer(item);
}
......@@ -134,6 +131,7 @@ public class MainActivity extends AppCompatActivity {
@Override
public void onClick(View v) {
if (videoDatas != null && videoDatas.size() > 0) {
showKnowledge = true;
HuodeVideoInfo huodeVideoInfo = videoDatas.get(0);
selectPlayer(huodeVideoInfo);
}
......@@ -185,6 +183,7 @@ public class MainActivity extends AppCompatActivity {
playIntent.putExtra("videoId", item.getVideoId());
playIntent.putExtra("videoTitle", item.getVideoTitle());
playIntent.putExtra("videoCover", item.getVideoCover());
playIntent.putExtra("showKnowledge", showKnowledge);
playIntent.putParcelableArrayListExtra("videoDatas", videoDatas);
startActivity(playIntent);
}
......@@ -196,6 +195,7 @@ public class MainActivity extends AppCompatActivity {
playIntent.putExtra("videoId", item.getVideoId());
playIntent.putExtra("videoTitle", item.getVideoTitle());
playIntent.putExtra("videoCover", item.getVideoCover());
playIntent.putExtra("showKnowledge", showKnowledge);
playIntent.putParcelableArrayListExtra("videoDatas", videoDatas);
startActivity(playIntent);
}
......
......@@ -17,7 +17,7 @@ public class DanmuColorAdapter extends RecyclerView.Adapter<DanmuColorAdapter.Vi
private List<DanmuColorInfo> mData;
private boolean isPortrait = false;
private DanmuColorAdapter.OnItemClickListener onItemClickListener;
private OnItemClickListener onItemClickListener;
public DanmuColorAdapter(List<DanmuColorInfo> mData, boolean isPortrait) {
this.mData = mData;
......
......@@ -15,103 +15,98 @@ import com.bokecc.vod.utils.MultiUtils;
import java.util.List;
public class DownloadViewAdapter extends BaseAdapter{
private List<DownloadOperator> downloadInfos;
private Context context;
public DownloadViewAdapter(Context context, List<DownloadOperator> downloadInfos){
this.context = context;
this.downloadInfos = downloadInfos;
}
@Override
public int getCount() {
return downloadInfos.size();
}
@Override
public Object getItem(int position) {
return downloadInfos.get(position);
}
@Override
public long getItemId(int position) {
return position;
}
@Override
public View getView(int position, View convertView, ViewGroup parent) {
DownloadOperator downloadOperator = downloadInfos.get(position);
ViewHolder holder = null;
if (convertView == null) {
convertView = View.inflate(context, R.layout.item_downloading, null);
TextView titleView = convertView.findViewById(R.id.download_title);
TextView statusView = convertView.findViewById(R.id.download_status);
TextView speedView = convertView.findViewById(R.id.download_speed);
ImageView iv_video_cover = convertView.findViewById(R.id.iv_video_cover);
TextView progressView = convertView.findViewById(R.id.download_progress);
ProgressBar downloadProgressBar = convertView.findViewById(R.id.download_progressBar);
downloadProgressBar.setMax(100);
holder = new ViewHolder();
holder.downloadProgressBar = downloadProgressBar;
holder.progressView = progressView;
holder.speedView = speedView;
holder.statusView = statusView;
holder.titleView = titleView;
holder.iv_video_cover = iv_video_cover;
convertView.setTag(holder);
} else {
holder = (ViewHolder) convertView.getTag();
}
holder.titleView.setText(downloadOperator.getVodDownloadBean().getFileName());
holder.statusView.setText(getStatusStr(downloadOperator.getStatus()) + "");
MultiUtils.showVideoCover(holder.iv_video_cover,downloadOperator.getVodDownloadBean().getVideoCover());
if (downloadOperator.getStatus() == Downloader.DOWNLOAD) {
holder.speedView.setText(downloadOperator.getSpeed(context));
holder.progressView.setText(downloadOperator.getDownloadProgressText(context));
holder.downloadProgressBar.setProgress((int)downloadOperator.getDownloadProgressBarValue());
} else {
holder.speedView.setText("");
holder.progressView.setText(downloadOperator.getDownloadProgressText(context));
holder.downloadProgressBar.setProgress((int)downloadOperator.getDownloadProgressBarValue());
}
return convertView;
}
private String getStatusStr(int status) {
String statusStr = null;
switch (status) {
case Downloader.WAIT:
statusStr = "等待中";
break;
case Downloader.DOWNLOAD:
statusStr = "下载中";
break;
case Downloader.PAUSE:
statusStr = "已暂停";
break;
case Downloader.FINISH:
statusStr = "已完成";
break;
}
return statusStr;
}
public class ViewHolder {
public TextView titleView;
public ImageView iv_video_cover;
public TextView statusView;
public TextView speedView;
public TextView progressView;
public ProgressBar downloadProgressBar;
}
public class DownloadViewAdapter extends BaseAdapter {
private final List<DownloadOperator> downloadInfo;
private final Context context;
public DownloadViewAdapter(Context context, List<DownloadOperator> downloadInfo) {
this.context = context;
this.downloadInfo = downloadInfo;
}
@Override
public int getCount() {
return downloadInfo.size();
}
@Override
public Object getItem(int position) {
return downloadInfo.get(position);
}
@Override
public long getItemId(int position) {
return position;
}
@Override
public View getView(int position, View convertView, ViewGroup parent) {
DownloadOperator downloadOperator = downloadInfo.get(position);
ViewHolder holder;
if (convertView == null) {
convertView = View.inflate(context, R.layout.item_downloading, null);
TextView titleView = convertView.findViewById(R.id.download_title);
TextView statusView = convertView.findViewById(R.id.download_status);
TextView speedView = convertView.findViewById(R.id.download_speed);
ImageView ivVideoCover = convertView.findViewById(R.id.iv_video_cover);
TextView progressView = convertView.findViewById(R.id.download_progress);
ProgressBar downloadProgressBar = convertView.findViewById(R.id.download_progressBar);
downloadProgressBar.setMax(100);
holder = new ViewHolder();
holder.downloadProgressBar = downloadProgressBar;
holder.progressView = progressView;
holder.speedView = speedView;
holder.statusView = statusView;
holder.titleView = titleView;
holder.ivVideoCover = ivVideoCover;
convertView.setTag(holder);
} else {
holder = (ViewHolder) convertView.getTag();
}
holder.titleView.setText(downloadOperator.getVodDownloadBean().getFileName());
holder.statusView.setText(getStatusStr(downloadOperator.getStatus()));
MultiUtils.showVideoCover(holder.ivVideoCover, downloadOperator.getVodDownloadBean().getVideoCover());
if (downloadOperator.getStatus() == Downloader.DOWNLOAD) {
holder.speedView.setText(downloadOperator.getSpeed(context));
} else {
holder.speedView.setText("");
}
holder.progressView.setText(downloadOperator.getDownloadProgressText(context));
holder.downloadProgressBar.setProgress((int) downloadOperator.getDownloadProgressBarValue());
return convertView;
}
private String getStatusStr(int status) {
String statusStr = "";
switch (status) {
case Downloader.WAIT:
statusStr = "等待中";
break;
case Downloader.DOWNLOAD:
statusStr = "下载中";
break;
case Downloader.PAUSE:
statusStr = "已暂停";
break;
case Downloader.FINISH:
statusStr = "已完成";
break;
default:
break;
}
return statusStr;
}
public static class ViewHolder {
public TextView titleView;
public ImageView ivVideoCover;
public TextView statusView;
public TextView speedView;
public TextView progressView;
public ProgressBar downloadProgressBar;
}
}
package com.bokecc.vod.adapter;
import android.annotation.SuppressLint;
import android.content.Context;
import android.graphics.Color;
import android.text.Layout;
import android.text.TextUtils;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseExpandableListAdapter;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;
import androidx.annotation.NonNull;
import com.bokecc.vod.R;
import com.bokecc.vod.data.KnowledgeBean;
import java.util.List;
/**
* KnowledgeExpandableAdapter
*
* @author Zhang
*/
@SuppressLint("DefaultLocale")
public class KnowledgeExpandableAdapter extends BaseExpandableListAdapter {
private final Context context;
private final KnowledgeBean bean;
private int selectGroupPosition = -1, selectChildPosition = -1;
public KnowledgeExpandableAdapter(Context context, @NonNull KnowledgeBean bean) {
this.context = context;
this.bean = bean;
}
@Override
public int getGroupCount() {
return bean.getCategory().size();
}
@Override
public int getChildrenCount(int groupPosition) {
return bean.getCategory().get(groupPosition).getInfo().size();
}
@Override
public Object getGroup(int groupPosition) {
return bean.getCategory().get(groupPosition);
}
@Override
public Object getChild(int groupPosition, int childPosition) {
return bean.getCategory().get(groupPosition).getInfo().get(childPosition);
}
@Override
public long getGroupId(int groupPosition) {
return groupPosition;
}
@Override
public long getChildId(int groupPosition, int childPosition) {
return childPosition;
}
@Override
public boolean hasStableIds() {
return true;
}
public void setSelectGroupPosition(int selectGroupPosition) {
this.selectGroupPosition = selectGroupPosition;
}
public void setSelectChildPosition(int selectChildPosition) {
this.selectChildPosition = selectChildPosition;
}
@Override
public View getGroupView(int groupPosition, boolean isExpanded, View convertView, ViewGroup parent) {
ParentHolder parentHolder;
if (convertView == null) {
parentHolder = new ParentHolder();
convertView = LayoutInflater.from(context).inflate(R.layout.item_knowledge_parent, parent, false);
parentHolder.parentName = convertView.findViewById(R.id.parentName);
parentHolder.expandableStatue = convertView.findViewById(R.id.expandableStatue);
convertView.setTag(parentHolder);
} else {
parentHolder = (ParentHolder) convertView.getTag();
}
parentHolder.expandableStatue.setImageResource(isExpanded ? R.mipmap.collapse_knowledge : R.mipmap.expand_knowledge);
List<KnowledgeBean.Category.Info> info = bean.getCategory().get(groupPosition).getInfo();
if (info==null||info.isEmpty()){
parentHolder.expandableStatue.setVisibility(View.GONE);
}else {
parentHolder.expandableStatue.setVisibility(info.size()==1?View.GONE:View.VISIBLE);
}
String name = bean.getCategory().get(groupPosition).getName();
int size = bean.getCategory().get(groupPosition).getInfo().size();
parentHolder.parentName.setText(String.format("%s(%d)", name, size));
return convertView;
}
@Override
public View getChildView(int groupPosition, int childPosition, boolean isLastChild, View convertView, ViewGroup parent) {
ChildHolder childHolder;
List<KnowledgeBean.Category.Info> infoList = bean.getCategory().get(groupPosition).getInfo();
boolean hasDesc = !TextUtils.isEmpty(infoList.get(childPosition).getDesc()) && infoList.get(childPosition).getDesc() != null;
if (convertView == null) {