Skip to content

Commit

Permalink
Merge pull request #3 from molihuan/dev
Browse files Browse the repository at this point in the history
fix bug
  • Loading branch information
molihuan committed Jan 4, 2023
2 parents 0d1214f + 1282705 commit 03009ac
Show file tree
Hide file tree
Showing 26 changed files with 262 additions and 88 deletions.
2 changes: 1 addition & 1 deletion .idea/deploymentTargetDropDown.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ android {
applicationId "com.molihua.hlbmerge"
minSdk 21
targetSdk 33
versionCode 44
versionName "1.6.4beta"
versionCode 45
versionName "1.6.5beta"

testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"

Expand All @@ -36,7 +36,7 @@ android {
dependencies {
implementation fileTree(dir: "libs", includes: ["*.aar", "*.jar"])
//文件选择器(包含权限请求)
implementation 'io.github.molihuan:pathselector:1.1.13'
implementation 'io.github.molihuan:pathselector:1.1.14'
//RxFFmpeg依赖
implementation 'com.github.microshow:RxFFmpeg:4.9.0-lite'
// 腾讯的键值对存储mmkv
Expand Down
Binary file modified app/release/app-release.apk
Binary file not shown.
4 changes: 2 additions & 2 deletions app/release/output-metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@
"type": "SINGLE",
"filters": [],
"attributes": [],
"versionCode": 44,
"versionName": "1.6.4beta",
"versionCode": 45,
"versionName": "1.6.5beta",
"outputFile": "app-release.apk"
}
],
Expand Down
5 changes: 5 additions & 0 deletions app/src/main/assets/updataLog.html
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,11 @@ <h2>
<h3><span>因为权限问题,输出路径不能设置为SD卡,缓存文件路径可以设置为SD卡,即SD卡只能读取不能写入</span></h3>


<h3><span>1.6.5beta版本(新)</span></h3>
<h4><span>更新日期:2023年1月4日</span></h4>
<p><span>----修复播放器闪退问题</span></p>
<p><span>----细节优化</span></p>

<h3><span>1.6.3 beta版本(新)</span></h3>
<h4><span>更新日期:2023年1月2日</span></h4>
<p><span>----播放器优化,新增弹幕设置(大小、速度、透明度)</span></p>
Expand Down
19 changes: 11 additions & 8 deletions app/src/main/java/com/molihua/hlbmerge/App.java
Original file line number Diff line number Diff line change
Expand Up @@ -63,14 +63,17 @@ private void initXUpdate() {
.setOnUpdateFailureListener(new OnUpdateFailureListener() { //设置版本更新出错的监听
@Override
public void onFailure(UpdateError error) {

int errorCode = error.getCode();
if (errorCode == UpdateError.ERROR.CHECK_NO_NEW_VERSION) {
Mtools.toast("未发现新版本!");
} else {
Mtools.toast("更新失败!正在尝试使用备用链接 或 自行进入下载:" + LConstants.PROJECT_ADDRESS, Toast.LENGTH_LONG);
//启用备用检测更新
UpdataTools.checkUpdataByGitlink(getApplicationContext());
switch (error.getCode()) {
case UpdateError.ERROR.CHECK_NO_NEW_VERSION:
Mtools.toast("未发现新版本!");
break;
case UpdateError.ERROR.CHECK_NO_NETWORK:
case UpdateError.ERROR.CHECK_NO_WIFI:
break;
default:
Mtools.toast("更新失败!正在尝试使用备用链接 或 自行进入下载:" + LConstants.PROJECT_ADDRESS, Toast.LENGTH_LONG);
//启用备用检测更新
UpdataTools.checkUpdataByGitlink(getApplicationContext());
}

}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import androidx.annotation.LayoutRes;
import androidx.appcompat.app.AppCompatActivity;

import com.umeng.analytics.MobclickAgent;
import com.xuexiang.xui.XUI;


Expand Down Expand Up @@ -47,5 +48,12 @@ public void initView() {
public void setListeners() {
}

@Override
protected void onDestroy() {
//友盟保存数据
MobclickAgent.onKillProcess(this);
super.onDestroy();
}


}
Original file line number Diff line number Diff line change
Expand Up @@ -215,12 +215,6 @@ public void onBackPressed() {
super.onBackPressed();
}

@Override
protected void onDestroy() {
MobclickAgent.onKillProcess(this);
super.onDestroy();
}

@Override
public void handleShowHide(boolean isShow) {
//加载handle
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -128,9 +128,9 @@ public void onPause() {

@Override
public void onDestroy() {
super.onDestroy();
//销毁播放器
releaseVideoViewDanmakuView();
super.onDestroy();
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,9 @@ public void onClick(View v) {
String path = MConstants.DEFAULT_ROOTPATH + ConfigData.TYPE_OUTPUT_FILE_PATH_COMPLETE;
ConfigData.setOutputFilePath(path);
outputPathShowTv.setText(path);
//默认更新设置
autoUpdataFrequencyMs.setSelectedIndex(1);
onItemSelected(autoUpdataFrequencyMs, 1, autoUpdataFrequencyMs.getId(), null);

Mtools.toast("恢复默认成功");
}
Expand Down Expand Up @@ -164,6 +167,7 @@ public boolean onClick(View v, TextView tv, List<FileBean> selectedFiles, String
} else if (id == R.id.rela_custom_output_path) {
PathSelector.build(this, MConstants.BUILD_ACTIVITY)
.setRequestCode(3660)
.setShowSelectStorageBtn(false)
.setTitlebarMainTitle(new FontBean("选择输出路径"))
.setAlwaysShowHandleFragment(true)
.setMaxCount(1)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,19 +36,24 @@ protected void convert(@NonNull BaseViewHolder holder, CacheFile cacheFile) {
switch (cacheFile.getFlag()) {
case BaseCacheFileManager.FLAG_CACHE_FILE_COLLECTION:
holder.setText(R.id.tv_item_file_name, cacheFile.getCollectionName());
holder.setVisible(R.id.tv_item_file_describe, true);
holder.setText(R.id.tv_item_file_describe, cacheFile.getCollectionPath());
break;
case BaseCacheFileManager.FLAG_CACHE_FILE_CHAPTER:
holder.setText(R.id.tv_item_file_name, cacheFile.getChapterName());
holder.setVisible(R.id.tv_item_file_describe, true);
holder.setText(R.id.tv_item_file_describe, cacheFile.getChapterPath());
break;
case BaseCacheFileManager.FLAG_CACHE_FILE_BACK:
holder.setText(R.id.tv_item_file_name, cacheFile.getChapterName());
holder.setVisible(R.id.tv_item_file_describe, false);
break;
default:
}

checkBox.setVisibility(cacheFile.getBoxVisibility());
checkBox.setChecked(cacheFile.getBoxCheck());

container.setVisibility(cacheFile.getWholeVisibility());


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,10 @@ public DanmakuContext getDanmakuContext() {
return videoDanmakuView.getDanmakuContext();
}

public boolean isLocalXmlExists() {
return videoDanmakuView.isLocalXmlExists();
}

public VideoSettingView getVideoSettingView() {
return videoSettingView;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -362,12 +362,17 @@ public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
//获取进度
long duration = mControlWrapper.getDuration();
long newPosition = (duration * progress) / progressSb.getMax();


if (!danmakuView.isPaused()) {
currTimeTv.setText(stringForTime((int) newPosition));
totalTimeTv.setText(stringForTime((int) duration));
}


danmakuView.seekTo(newPosition);
mControlWrapper.seekTo((int) newPosition);

}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,9 @@
import master.flame.danmaku.controller.DrawHandler;
import master.flame.danmaku.danmaku.model.BaseDanmaku;
import master.flame.danmaku.danmaku.model.DanmakuTimer;
import master.flame.danmaku.danmaku.model.IDanmakus;
import master.flame.danmaku.danmaku.model.android.DanmakuContext;
import master.flame.danmaku.danmaku.model.android.Danmakus;
import master.flame.danmaku.danmaku.parser.BaseDanmakuParser;
import master.flame.danmaku.danmaku.parser.IDataSource;
import master.flame.danmaku.danmaku.parser.android.AndroidFileSource;
Expand All @@ -44,6 +46,8 @@ public class VideoDanmakuView extends FrameLayout implements IGestureComponent {
private String videoPath;
private Context mContext;
private DKVideoController dkVideoController;
//本地弹幕文件是否存在
private boolean localXmlExists = false;

public DanmakuView getDanmakuView() {
return danmakuView;
Expand All @@ -53,6 +57,10 @@ public DanmakuContext getDanmakuContext() {
return danmakuContext;
}

public boolean isLocalXmlExists() {
return localXmlExists;
}

public VideoDanmakuView(@NonNull Context context, String videoPath, DKVideoController dkVideoController) {
super(context);
//获取组件
Expand Down Expand Up @@ -94,7 +102,15 @@ private void initDanmakuView() {

if (danmakuView != null) {
String localXmlPath = videoPath.replace(FileUtils.getFileExtension(videoPath), "xml");

if (!FileUtils.isFileExists(localXmlPath)) {
localXmlExists = false;
danmakuView.prepare(new BaseDanmakuParser() {
@Override
protected IDanmakus parse() {
return new Danmakus();
}
}, danmakuContext);
return;
}
//String localXmlPath="https://comment.bilibili.com/367013145.xml";
Expand Down Expand Up @@ -134,6 +150,7 @@ public void drawingFinished() {
//danmakuView.showFPS(true);
//开启绘制缓存
danmakuView.enableDanmakuDrawingCache(true);
localXmlExists = true;
}

}
Expand Down
14 changes: 8 additions & 6 deletions app/src/main/java/com/molihua/hlbmerge/dao/ConfigData.java
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ public class ConfigData {
public final static String TYPE_OUTPUT_FILE_PATH_COMPLETE = "/bilibili视频合并/complete";
//临时文件路径
public final static String TYPE_OUTPUT_FILE_PATH_TEMP = MConstants.DEFAULT_ROOTPATH + "/bilibili视频合并/temp";
//输出压缩文件路径
public final static String TYPE_OUTPUT_FILE_PATH_ZIP = MConstants.DEFAULT_ROOTPATH + "/bilibili视频合并/zip";

private final static MMKV kv = MMKV.defaultMMKV();

Expand All @@ -48,7 +50,7 @@ public class ConfigData {
//导出类型,0有声音视频,1无声音视频,2仅仅音频
private int exportType;
//是否同意条款
private boolean agreeTerms;
private boolean agreeTerm;
//是否开启弹幕
private boolean openBarrage;
//弹幕大小
Expand Down Expand Up @@ -76,7 +78,7 @@ public static void init() {
setOutputFilePath(MConstants.DEFAULT_ROOTPATH + TYPE_OUTPUT_FILE_PATH_COMPLETE);
setExportDanmaku(false);
setExportType(0);
setAgreeTerms(false);
setAgreeTerm(false);
setOpenBarrage(true);
}
//新增配置1
Expand Down Expand Up @@ -153,12 +155,12 @@ public static boolean setExportType(int exportType) {
return kv.encode("exportType", exportType);
}

public static boolean isAgreeTerms() {
return kv.decodeBool("agreeTerms");
public static boolean isAgreeTerm() {
return kv.decodeBool("agreeTerm");
}

public static boolean setAgreeTerms(boolean agreeTerms) {
return kv.encode("agreeTerms", agreeTerms);
public static boolean setAgreeTerm(boolean agreeTerm) {
return kv.encode("agreeTerm", agreeTerm);
}

public static boolean isOpenBarrage() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,15 +65,15 @@ public void onClick(@NonNull MaterialDialog dialog, @NonNull DialogAction which)
if (positiveCallback != null) {
positiveCallback.onClick(dialog, which);
}
ConfigData.setAgreeTerms(true);
ConfigData.setAgreeTerm(true);
dialog.dismiss();
}
})
.negativeText("不同意")
.onNegative(new MaterialDialog.SingleButtonCallback() {
@Override
public void onClick(@NonNull MaterialDialog dialog, @NonNull DialogAction which) {
ConfigData.setAgreeTerms(false);
ConfigData.setAgreeTerm(false);
ActivityUtils.finishAllActivities(); //退出所有activity
System.exit(0);//退出应用
}
Expand Down
Loading

0 comments on commit 03009ac

Please sign in to comment.