Commit a83f42eb authored by wangyue's avatar wangyue
Browse files

Merge branch 'develop' into 'master'

3.17.0

See merge request !4
parents fcf26c9a dfd3860c
No preview for this file type
......@@ -8,18 +8,27 @@ android {
minSdkVersion 17
targetSdkVersion 29
versionCode 1
versionName "1.0"
versionName AppVersion
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
multiDexEnabled true
}
buildTypes {
debug {
minifyEnabled false
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 {
minifyEnabled false
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 {
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
implementation "androidx.multidex:multidex:2.0.1"
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'
//使用Vr播放功能时需要引入
......@@ -58,15 +77,7 @@ dependencies {
implementation 'com.bokecc:CompressVideoLib:1.0.0'
//弹幕
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":{}}]
\ No newline at end of file
[{"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
......@@ -10,13 +10,13 @@ public class ConfigUtil {
* 账号ID 可以替换为自己的USER_ID
* 391E6E3340A00767
*/
public static final String USER_ID = "391E6E3340A00767";
public static final String USER_ID = BuildConfig.userId;
/**
* 可以替换为自己的API_KEY
* 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 {
ivMainImg = headView.findViewById(R.id.iv_main_img);
gvVideoList.addHeaderView(headView);
videoDatas = new ArrayList<>();
//TODO 配置自己的视频时取消这行注释
// videoDatas = DataUtil.getVideoList();
//TODO 配置自己的视频时将gradle.properties的isDefault改为false
if (!BuildConfig.isDefault){
videoDatas = DataUtil.getVideoList();
}
playVideoAdapter = new PlayVideoAdapter(MainActivity.this, videoDatas);
gvVideoList.setAdapter(playVideoAdapter);
ivMainImg.setImageResource(R.mipmap.iv_default_img);
......@@ -205,8 +207,8 @@ public class MainActivity extends AppCompatActivity {
private void initData() {
//TODO 配置自己的视频时取消这行注释
// videoDatas = DataUtil.getVideoList();
//TODO 配置自己的视频时将gradle.properties的isDefault改为true
if (BuildConfig.isDefault){
Core.getInstance().getExecutorSupplier()
.forBackgroundTasks()
.execute(new Runnable() {
......@@ -216,6 +218,7 @@ public class MainActivity extends AppCompatActivity {
}
});
}
}
private void request() {
HttpURLConnection connection = null;
......
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.List;
/**
* DataUtil
......@@ -8,17 +14,34 @@ import java.util.ArrayList;
* @author xxx
*/
public class DataUtil {
/**
* 配置自己的视频ID
*/
static String[] videoIds = new String[]{};
public static ArrayList<HuodeVideoInfo> getVideoList() {
ArrayList<HuodeVideoInfo> data = new ArrayList<>();
for (String videoId : videoIds) {
HuodeVideoInfo videoInfo = new HuodeVideoInfo(videoId, videoId);
if (!TextUtils.isEmpty(BuildConfig.videoId)){
String[] split = BuildConfig.videoId.split(",");
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;
}
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;
import android.text.TextUtils;
import io.objectbox.Box;
import io.objectbox.BoxStore;
import io.objectbox.query.Query;
......@@ -13,6 +15,9 @@ public class VideoPositionDBHelper {
}
public VideoPosition getVideoPosition(String videoId) {
if (TextUtils.isEmpty(videoId)){
return null;
}
Query<VideoPosition> query = box.query().equal(VideoPosition_.videoId, videoId).build();
VideoPosition videoPosition = query.findFirst();
return videoPosition;
......
......@@ -34,7 +34,8 @@ public class DownloadService extends Service {
*/
private final boolean isUseMobileNetwork = true;
private boolean isPaused = false;
Timer timer = new Timer();
Timer timer ;
private TimerTask task;
@Override
public void onCreate() {
......@@ -46,7 +47,7 @@ public class DownloadService extends Service {
filter.addAction(ConnectivityManager.CONNECTIVITY_ACTION);
registerReceiver(netReceiver, filter);
timer.schedule(new TimerTask() {
task = new TimerTask() {
@Override
public void run() {
if (isUseMobileNetwork) {
......@@ -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() {
......@@ -117,7 +120,14 @@ public class DownloadService extends Service {
@Override
public void onDestroy() {
if (task!=null){
task.cancel();
task = null;
}
if (timer!=null){
timer.cancel();
timer = null;
}
VodDownloadManager.getInstance().pauseAllDownload();
if (netReceiver != null) {
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);
mOutsideView.setOnClickListener(this);
mAnimView.setOnClickListener(this); // 主要作用是拦截内容区域点击事件
mPopupWindow = new PopupWindow(mPopContentView,
ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT);
// mPopupWindow.setClippingEnabled(false);
PopupWindowCompat.setWindowLayoutType(mPopupWindow, WindowManager.LayoutParams.TYPE_APPLICATION_SUB_PANEL + 100);
configPopupWindow();
onViewCreated();
}
/**
* 配置PopupWindow
*/
private void configPopupWindow() {
// mPopupWindow.setFocusable(false);
mPopupWindow.setFocusable(true);
// 点击空白区域
mPopupWindow.setOutsideTouchable(false);
//无需动画
mPopupWindow.setAnimationStyle(0);
// 拦截返回键
mPopContentView.setFocusable(true);
mPopContentView.setFocusableInTouchMode(true);
mPopContentView.setOnKeyListener(new View.OnKeyListener() {
@Override
public boolean onKey(View v, int keyCode, KeyEvent event) {
if (event.getAction() == KeyEvent.ACTION_DOWN && keyCode == KeyEvent.KEYCODE_BACK) {
if (isKeyBackCancel) {
dismiss();
return true;
}
}
return false;
}
});
}
protected <T extends View> T findViewById(int id) {
return (T) mPopContentView.findViewById(id);
}
/**
* 设置点击popupwindow外部是否可以取消
*/
public void setOutsideCancel(boolean flag) {
isOutsideCancel = flag;
}
/**
* 设置popupwindow外部背景颜色
*/
public void setOutsideBackgroundColor(int color) {
mOutsideView.setBackgroundColor(color);
}
/**
* 设置点击返回键是否可以消失
*/
public void setBackPressedCancel(boolean flag) {
if (flag) {
mPopupWindow.setBackgroundDrawable(new ColorDrawable());
} else {
mPopupWindow.setBackgroundDrawable(null);
}
}
public void setKeyBackCancel(boolean flag) {
isKeyBackCancel = flag;
}
/**
* 返回按钮点击事件, 针对6.0以上不生效问题,需要拦截Activity onKeyDown事件
* @param canCancel
*/
public void setBackPressCancel(boolean canCancel){
isKeyBackCancel = canCancel;
mPopupWindow.setFocusable(canCancel);
}
public boolean getKeyBackCancel(){
return isKeyBackCancel;
}
/**
* 是否显示
*/
public boolean isShowing() {