Commit dfd3860c authored by zhaozw's avatar zhaozw
Browse files

3.17.0: 1.增加三倍速支持

		2.demo新增自定义打卡
		3.bug fix
parent fcf26c9a
No preview for this file type
...@@ -8,18 +8,27 @@ android { ...@@ -8,18 +8,27 @@ android {
minSdkVersion 17 minSdkVersion 17
targetSdkVersion 29 targetSdkVersion 29
versionCode 1 versionCode 1
versionName "1.0" versionName AppVersion
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
multiDexEnabled true multiDexEnabled true
} }
buildTypes { buildTypes {
debug { debug {
minifyEnabled false minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
buildConfigField("String","videoId","\"${videoId}\"")
buildConfigField("String","userId","\"${USER_ID}\"")
buildConfigField("String","key","\"${API_KEY}\"")
buildConfigField("Boolean","isDefault","${isDefault}")
} }
release { release {
minifyEnabled false minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
buildConfigField("String","videoId","\"${videoId}\"")
buildConfigField("String","userId","\"${USER_ID}\"")
buildConfigField("String","key","\"${API_KEY}\"")
buildConfigField("Boolean","isDefault","${isDefault}")
} }
} }
...@@ -50,6 +59,16 @@ dependencies { ...@@ -50,6 +59,16 @@ dependencies {
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2' androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
implementation "androidx.multidex:multidex:2.0.1" implementation "androidx.multidex:multidex:2.0.1"
implementation 'androidx.legacy:legacy-support-v4:1.0.0' implementation 'androidx.legacy:legacy-support-v4:1.0.0'
implementation 'com.github.bumptech.glide:glide:4.9.0'
implementation 'com.squareup.picasso:picasso:2.5.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'
//以上为界面使用的相关库和sdk无关
//使用投屏功能需要引用 //使用投屏功能需要引用
implementation 'com.bokecc:ProjectionLib:1.7.0' implementation 'com.bokecc:ProjectionLib:1.7.0'
//使用Vr播放功能时需要引入 //使用Vr播放功能时需要引入
...@@ -58,15 +77,7 @@ dependencies { ...@@ -58,15 +77,7 @@ dependencies {
implementation 'com.bokecc:CompressVideoLib:1.0.0' implementation 'com.bokecc:CompressVideoLib:1.0.0'
//弹幕 //弹幕
implementation 'com.github.ctiao:DanmakuFlameMaster:0.9.25' implementation 'com.github.ctiao:DanmakuFlameMaster:0.9.25'
//SDK
implementation 'com.bokecc:CCVOD:3.17.0'
implementation 'com.github.bumptech.glide:glide:4.9.0'
implementation 'com.squareup.picasso:picasso:2.5.2'
implementation 'com.bokecc:CCVOD:3.16.7'
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'
} }
This diff is collapsed.
[{"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":{}}] [{"outputType":{"type":"APK"},"apkData":{"type":"MAIN","splits":[],"versionCode":1,"versionName":"3.17.0","enabled":true,"outputFile":"VOD_Demo3.17.0_release.apk","fullName":"release","baseName":"release"},"path":"VOD_Demo3.17.0_release.apk","properties":{}}]
\ No newline at end of file \ No newline at end of file
...@@ -10,13 +10,13 @@ public class ConfigUtil { ...@@ -10,13 +10,13 @@ public class ConfigUtil {
* 账号ID 可以替换为自己的USER_ID * 账号ID 可以替换为自己的USER_ID
* 391E6E3340A00767 * 391E6E3340A00767
*/ */
public static final String USER_ID = "391E6E3340A00767"; public static final String USER_ID = BuildConfig.userId;
/** /**
* 可以替换为自己的API_KEY * 可以替换为自己的API_KEY
* T8WdOUuvFEiOsou1xjDr4U73v12M7iNa * T8WdOUuvFEiOsou1xjDr4U73v12M7iNa
*/ */
public static final String API_KEY = "T8WdOUuvFEiOsou1xjDr4U73v12M7iNa"; public static final String API_KEY = BuildConfig.key;
/** /**
* 获取视频信息的地址 * 获取视频信息的地址
*/ */
......
...@@ -109,8 +109,10 @@ public class MainActivity extends AppCompatActivity { ...@@ -109,8 +109,10 @@ public class MainActivity extends AppCompatActivity {
ivMainImg = headView.findViewById(R.id.iv_main_img); ivMainImg = headView.findViewById(R.id.iv_main_img);
gvVideoList.addHeaderView(headView); gvVideoList.addHeaderView(headView);
videoDatas = new ArrayList<>(); videoDatas = new ArrayList<>();
//TODO 配置自己的视频时取消这行注释 //TODO 配置自己的视频时将gradle.properties的isDefault改为false
// videoDatas = DataUtil.getVideoList(); if (!BuildConfig.isDefault){
videoDatas = DataUtil.getVideoList();
}
playVideoAdapter = new PlayVideoAdapter(MainActivity.this, videoDatas); playVideoAdapter = new PlayVideoAdapter(MainActivity.this, videoDatas);
gvVideoList.setAdapter(playVideoAdapter); gvVideoList.setAdapter(playVideoAdapter);
ivMainImg.setImageResource(R.mipmap.iv_default_img); ivMainImg.setImageResource(R.mipmap.iv_default_img);
...@@ -205,16 +207,17 @@ public class MainActivity extends AppCompatActivity { ...@@ -205,16 +207,17 @@ public class MainActivity extends AppCompatActivity {
private void initData() { private void initData() {
//TODO 配置自己的视频时取消这行注释 //TODO 配置自己的视频时将gradle.properties的isDefault改为true
// videoDatas = DataUtil.getVideoList(); if (BuildConfig.isDefault){
Core.getInstance().getExecutorSupplier() Core.getInstance().getExecutorSupplier()
.forBackgroundTasks() .forBackgroundTasks()
.execute(new Runnable() { .execute(new Runnable() {
@Override @Override
public void run() { public void run() {
request(); request();
} }
}); });
}
} }
private void request() { private void request() {
......
package com.bokecc.vod.data; package com.bokecc.vod.data;
import android.text.TextUtils;
import com.bokecc.vod.BuildConfig;
import com.bokecc.vod.R;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List;
/** /**
* DataUtil * DataUtil
...@@ -8,17 +14,34 @@ import java.util.ArrayList; ...@@ -8,17 +14,34 @@ import java.util.ArrayList;
* @author xxx * @author xxx
*/ */
public class DataUtil { public class DataUtil {
/**
* 配置自己的视频ID
*/
static String[] videoIds = new String[]{};
public static ArrayList<HuodeVideoInfo> getVideoList() { public static ArrayList<HuodeVideoInfo> getVideoList() {
ArrayList<HuodeVideoInfo> data = new ArrayList<>(); ArrayList<HuodeVideoInfo> data = new ArrayList<>();
for (String videoId : videoIds) { if (!TextUtils.isEmpty(BuildConfig.videoId)){
HuodeVideoInfo videoInfo = new HuodeVideoInfo(videoId, videoId); String[] split = BuildConfig.videoId.split(",");
data.add(videoInfo); if (split.length>0){
for (int i =0;i<split.length;i++){
HuodeVideoInfo videoInfo = new HuodeVideoInfo(split[i], split[i]);
data.add(videoInfo);
}
}
} }
return data; return data;
} }
public static SignInBean getSignInList() {
SignInBean signInBean = new SignInBean();
signInBean.setResImg(R.mipmap.sign_in);
signInBean.setTitle("标题");
signInBean.setContent("签到内容");
signInBean.setBtnText("签到");
List<Long> seconds = new ArrayList<>();
seconds.add(10000L);
seconds.add(20000L);
seconds.add(30000L);
seconds.add(40000L);
signInBean.setSeconds(seconds);
return signInBean;
}
} }
package com.bokecc.vod.data;
import java.util.List;
/**
* KnowledgeBean
*
* @author Zhang
*/
public class KnowledgeBean {
private String title;
private boolean pauseStatus;
private List<Category> category;
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
public boolean isPauseStatus() {
return pauseStatus;
}
public void setPauseStatus(boolean pauseStatus) {
this.pauseStatus = pauseStatus;
}
public List<Category> getCategory() {
return category;
}
public void setCategory(List<Category> category) {
this.category = category;
}
public static class Category {
private int cateId;
private String name;
private List<Info> info;
public int getCateId() {
return cateId;
}
public void setCateId(int cateId) {
this.cateId = cateId;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public List<Info> getInfo() {
return info;
}
public void setInfo(List<Info> info) {
this.info = info;
}
public static class Info {
private int id;
private int startTime;
private int endTime;
private String desc;
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public int getStartTime() {
return startTime;
}
public void setStartTime(int startTime) {
this.startTime = startTime;
}
public int getEndTime() {
return endTime;
}
public void setEndTime(int endTime) {
this.endTime = endTime;
}
public String getDesc() {
return desc;
}
public void setDesc(String desc) {
this.desc = desc;
}
}
}
}
package com.bokecc.vod.data;
import android.os.Parcel;
import android.os.Parcelable;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
public class SignInBean implements Serializable, Parcelable {
private int resImg;
private String title;
private String content;
private String btnText;
private List<Long> seconds;
public SignInBean(){}
protected SignInBean(Parcel in) {
resImg = in.readInt();
title = in.readString();
content = in.readString();
btnText = in.readString();
seconds = new ArrayList();
in.readList(seconds,Long.class.getClassLoader());
}
public static final Creator<SignInBean> CREATOR = new Creator<SignInBean>() {
@Override
public SignInBean createFromParcel(Parcel in) {
return new SignInBean(in);
}
@Override
public SignInBean[] newArray(int size) {
return new SignInBean[size];
}
};
public int getResImg() {
return resImg;
}
public void setResImg(int resImg) {
this.resImg = resImg;
}
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
public String getContent() {
return content;
}
public void setContent(String content) {
this.content = content;
}
public String getBtnText() {
return btnText;
}
public void setBtnText(String btnText) {
this.btnText = btnText;
}
public List<Long> getSeconds() {
return seconds;
}
public void setSeconds(List<Long> seconds) {
this.seconds = seconds;
}
@Override
public int describeContents() {
return 0;
}
@Override
public void writeToParcel(Parcel dest, int flags) {
dest.writeInt(resImg);
dest.writeString(title);
dest.writeString(content);
dest.writeString(btnText);
dest.writeList(seconds);
}
}
package com.bokecc.vod.data; package com.bokecc.vod.data;
import android.text.TextUtils;
import io.objectbox.Box; import io.objectbox.Box;
import io.objectbox.BoxStore; import io.objectbox.BoxStore;
import io.objectbox.query.Query; import io.objectbox.query.Query;
...@@ -13,6 +15,9 @@ public class VideoPositionDBHelper { ...@@ -13,6 +15,9 @@ public class VideoPositionDBHelper {
} }
public VideoPosition getVideoPosition(String videoId) { public VideoPosition getVideoPosition(String videoId) {
if (TextUtils.isEmpty(videoId)){
return null;
}
Query<VideoPosition> query = box.query().equal(VideoPosition_.videoId, videoId).build(); Query<VideoPosition> query = box.query().equal(VideoPosition_.videoId, videoId).build();
VideoPosition videoPosition = query.findFirst(); VideoPosition videoPosition = query.findFirst();
return videoPosition; return videoPosition;
......
...@@ -34,7 +34,8 @@ public class DownloadService extends Service { ...@@ -34,7 +34,8 @@ public class DownloadService extends Service {
*/ */
private final boolean isUseMobileNetwork = true; private final boolean isUseMobileNetwork = true;
private boolean isPaused = false; private boolean isPaused = false;
Timer timer = new Timer(); Timer timer ;
private TimerTask task;
@Override @Override
public void onCreate() { public void onCreate() {
...@@ -46,7 +47,7 @@ public class DownloadService extends Service { ...@@ -46,7 +47,7 @@ public class DownloadService extends Service {
filter.addAction(ConnectivityManager.CONNECTIVITY_ACTION); filter.addAction(ConnectivityManager.CONNECTIVITY_ACTION);
registerReceiver(netReceiver, filter); registerReceiver(netReceiver, filter);
timer.schedule(new TimerTask() { task = new TimerTask() {
@Override @Override
public void run() { public void run() {
if (isUseMobileNetwork) { if (isUseMobileNetwork) {
...@@ -66,7 +67,9 @@ public class DownloadService extends Service { ...@@ -66,7 +67,9 @@ public class DownloadService extends Service {
} }
} }
}, 1 * 1000, 1 * 1000); };
timer = new Timer();
timer.schedule(task, 1 * 1000, 1 * 1000);
//监听下载完成的文件 //监听下载完成的文件
VodDownloadManager.getInstance().setOnDownloadFinishListener(new VodDownloadManager.OnDownloadFinishListener() { VodDownloadManager.getInstance().setOnDownloadFinishListener(new VodDownloadManager.OnDownloadFinishListener() {
...@@ -117,7 +120,14 @@ public class DownloadService extends Service { ...@@ -117,7 +120,14 @@ public class DownloadService extends Service {
@Override @Override
public void onDestroy() { public void onDestroy() {
timer.cancel(); if (task!=null){
task.cancel();
task = null;
}
if (timer!=null){
timer.cancel();
timer = null;
}
VodDownloadManager.getInstance().pauseAllDownload(); VodDownloadManager.getInstance().pauseAllDownload();
if (netReceiver != null) { if (netReceiver != null) {
unregisterReceiver(netReceiver); unregisterReceiver(netReceiver);
......
package com.bokecc.vod.function;
import android.content.Context;
import android.graphics.drawable.ColorDrawable;
import android.view.Gravity;
import android.view.KeyEvent;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.view.WindowManager;
import android.view.animation.Animation;
import android.widget.PopupWindow;
import androidx.core.widget.PopupWindowCompat;
import com.bokecc.vod.R;
public abstract class BasePopupWindow implements View.OnClickListener {
protected Context mContext;
View mOutsideView;
View mAnimView;
protected PopupWindow mPopupWindow;
private boolean isOutsideCancel = false;
private boolean isDismissing = false; // 正在dismiss
private boolean isKeyBackCancel = false;
private OnPopupDismissListener mOnPopupDismissListener;
protected View mPopContentView;
protected View rootView;
/**
* @param context 上下文
*/
public BasePopupWindow(Context context) {
this(context, 0, 0);
}
/**
* @param context 上下文
* @param width 可见区域的宽度 单位dp
* @param height 可见区域的高度
*/
public BasePopupWindow(Context context, int width, int height) {
mContext = context;
mPopContentView = LayoutInflater.from(mContext).inflate(getContentView(), null);
mOutsideView = findViewById(R.id.id_popup_window_outside_view);
mAnimView = findViewById(R.id.id_popup_window_anim_view);
mOutsideView.setClickable(true);