diff --git a/.idea/deploymentTargetDropDown.xml b/.idea/deploymentTargetDropDown.xml index 6049e58..91d30d4 100644 --- a/.idea/deploymentTargetDropDown.xml +++ b/.idea/deploymentTargetDropDown.xml @@ -12,6 +12,6 @@ - + \ No newline at end of file diff --git a/app/build.gradle b/app/build.gradle index f3da68e..fe3afa5 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -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" @@ -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 diff --git a/app/release/app-release.apk b/app/release/app-release.apk index ed3600e..7fe97f5 100644 Binary files a/app/release/app-release.apk and b/app/release/app-release.apk differ diff --git a/app/release/output-metadata.json b/app/release/output-metadata.json index 0aa538f..191a901 100644 --- a/app/release/output-metadata.json +++ b/app/release/output-metadata.json @@ -11,8 +11,8 @@ "type": "SINGLE", "filters": [], "attributes": [], - "versionCode": 44, - "versionName": "1.6.4beta", + "versionCode": 45, + "versionName": "1.6.5beta", "outputFile": "app-release.apk" } ], diff --git a/app/src/main/assets/updataLog.html b/app/src/main/assets/updataLog.html index bedf8c0..6f152d2 100644 --- a/app/src/main/assets/updataLog.html +++ b/app/src/main/assets/updataLog.html @@ -19,6 +19,11 @@

因为权限问题,输出路径不能设置为SD卡,缓存文件路径可以设置为SD卡,即SD卡只能读取不能写入

+

1.6.5beta版本(新)

+

更新日期:2023年1月4日

+

----修复播放器闪退问题

+

----细节优化

+

1.6.3 beta版本(新)

更新日期:2023年1月2日

----播放器优化,新增弹幕设置(大小、速度、透明度)

diff --git a/app/src/main/java/com/molihua/hlbmerge/App.java b/app/src/main/java/com/molihua/hlbmerge/App.java index d2d4ffb..1915833 100644 --- a/app/src/main/java/com/molihua/hlbmerge/App.java +++ b/app/src/main/java/com/molihua/hlbmerge/App.java @@ -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()); } } diff --git a/app/src/main/java/com/molihua/hlbmerge/activity/BaseActivity.java b/app/src/main/java/com/molihua/hlbmerge/activity/BaseActivity.java index b7460d3..22fb4fc 100644 --- a/app/src/main/java/com/molihua/hlbmerge/activity/BaseActivity.java +++ b/app/src/main/java/com/molihua/hlbmerge/activity/BaseActivity.java @@ -5,6 +5,7 @@ import androidx.annotation.LayoutRes; import androidx.appcompat.app.AppCompatActivity; +import com.umeng.analytics.MobclickAgent; import com.xuexiang.xui.XUI; @@ -47,5 +48,12 @@ public void initView() { public void setListeners() { } + @Override + protected void onDestroy() { + //友盟保存数据 + MobclickAgent.onKillProcess(this); + super.onDestroy(); + } + } diff --git a/app/src/main/java/com/molihua/hlbmerge/activity/impl/MainActivity.java b/app/src/main/java/com/molihua/hlbmerge/activity/impl/MainActivity.java index c9ab560..160cbea 100644 --- a/app/src/main/java/com/molihua/hlbmerge/activity/impl/MainActivity.java +++ b/app/src/main/java/com/molihua/hlbmerge/activity/impl/MainActivity.java @@ -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 diff --git a/app/src/main/java/com/molihua/hlbmerge/activity/impl/PlayVideoActivity.java b/app/src/main/java/com/molihua/hlbmerge/activity/impl/PlayVideoActivity.java index cb44767..f81ed7e 100644 --- a/app/src/main/java/com/molihua/hlbmerge/activity/impl/PlayVideoActivity.java +++ b/app/src/main/java/com/molihua/hlbmerge/activity/impl/PlayVideoActivity.java @@ -128,9 +128,9 @@ public void onPause() { @Override public void onDestroy() { - super.onDestroy(); //销毁播放器 releaseVideoViewDanmakuView(); + super.onDestroy(); } /** diff --git a/app/src/main/java/com/molihua/hlbmerge/activity/impl/SettingsActivity.java b/app/src/main/java/com/molihua/hlbmerge/activity/impl/SettingsActivity.java index b7d285e..a88ab90 100644 --- a/app/src/main/java/com/molihua/hlbmerge/activity/impl/SettingsActivity.java +++ b/app/src/main/java/com/molihua/hlbmerge/activity/impl/SettingsActivity.java @@ -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("恢复默认成功"); } @@ -164,6 +167,7 @@ public boolean onClick(View v, TextView tv, List 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) diff --git a/app/src/main/java/com/molihua/hlbmerge/adapter/CacheFileListAdapter.java b/app/src/main/java/com/molihua/hlbmerge/adapter/CacheFileListAdapter.java index 7d6ad6d..3727c17 100644 --- a/app/src/main/java/com/molihua/hlbmerge/adapter/CacheFileListAdapter.java +++ b/app/src/main/java/com/molihua/hlbmerge/adapter/CacheFileListAdapter.java @@ -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()); diff --git a/app/src/main/java/com/molihua/hlbmerge/controller/videocontroller/DKVideoController.java b/app/src/main/java/com/molihua/hlbmerge/controller/videocontroller/DKVideoController.java index 10ce8b5..398b7d7 100644 --- a/app/src/main/java/com/molihua/hlbmerge/controller/videocontroller/DKVideoController.java +++ b/app/src/main/java/com/molihua/hlbmerge/controller/videocontroller/DKVideoController.java @@ -65,6 +65,10 @@ public DanmakuContext getDanmakuContext() { return videoDanmakuView.getDanmakuContext(); } + public boolean isLocalXmlExists() { + return videoDanmakuView.isLocalXmlExists(); + } + public VideoSettingView getVideoSettingView() { return videoSettingView; } diff --git a/app/src/main/java/com/molihua/hlbmerge/controller/videocontroller/component/VideoBottomControlView.java b/app/src/main/java/com/molihua/hlbmerge/controller/videocontroller/component/VideoBottomControlView.java index 872d19f..f4f3d0a 100644 --- a/app/src/main/java/com/molihua/hlbmerge/controller/videocontroller/component/VideoBottomControlView.java +++ b/app/src/main/java/com/molihua/hlbmerge/controller/videocontroller/component/VideoBottomControlView.java @@ -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 diff --git a/app/src/main/java/com/molihua/hlbmerge/controller/videocontroller/component/VideoDanmakuView.java b/app/src/main/java/com/molihua/hlbmerge/controller/videocontroller/component/VideoDanmakuView.java index 3f9b443..79db08c 100644 --- a/app/src/main/java/com/molihua/hlbmerge/controller/videocontroller/component/VideoDanmakuView.java +++ b/app/src/main/java/com/molihua/hlbmerge/controller/videocontroller/component/VideoDanmakuView.java @@ -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; @@ -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; @@ -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); //获取组件 @@ -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"; @@ -134,6 +150,7 @@ public void drawingFinished() { //danmakuView.showFPS(true); //开启绘制缓存 danmakuView.enableDanmakuDrawingCache(true); + localXmlExists = true; } } diff --git a/app/src/main/java/com/molihua/hlbmerge/dao/ConfigData.java b/app/src/main/java/com/molihua/hlbmerge/dao/ConfigData.java index cb47e9e..2fe011f 100644 --- a/app/src/main/java/com/molihua/hlbmerge/dao/ConfigData.java +++ b/app/src/main/java/com/molihua/hlbmerge/dao/ConfigData.java @@ -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(); @@ -48,7 +50,7 @@ public class ConfigData { //导出类型,0有声音视频,1无声音视频,2仅仅音频 private int exportType; //是否同意条款 - private boolean agreeTerms; + private boolean agreeTerm; //是否开启弹幕 private boolean openBarrage; //弹幕大小 @@ -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 @@ -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() { diff --git a/app/src/main/java/com/molihua/hlbmerge/dialog/impl/StatementDialog.java b/app/src/main/java/com/molihua/hlbmerge/dialog/impl/StatementDialog.java index 19b3cfc..e6933ad 100644 --- a/app/src/main/java/com/molihua/hlbmerge/dialog/impl/StatementDialog.java +++ b/app/src/main/java/com/molihua/hlbmerge/dialog/impl/StatementDialog.java @@ -65,7 +65,7 @@ public void onClick(@NonNull MaterialDialog dialog, @NonNull DialogAction which) if (positiveCallback != null) { positiveCallback.onClick(dialog, which); } - ConfigData.setAgreeTerms(true); + ConfigData.setAgreeTerm(true); dialog.dismiss(); } }) @@ -73,7 +73,7 @@ public void onClick(@NonNull MaterialDialog dialog, @NonNull DialogAction which) .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);//退出应用 } diff --git a/app/src/main/java/com/molihua/hlbmerge/fragment/impl/MainCompleteFragment.java b/app/src/main/java/com/molihua/hlbmerge/fragment/impl/MainCompleteFragment.java index 8a4ca01..b31e2a3 100644 --- a/app/src/main/java/com/molihua/hlbmerge/fragment/impl/MainCompleteFragment.java +++ b/app/src/main/java/com/molihua/hlbmerge/fragment/impl/MainCompleteFragment.java @@ -3,11 +3,13 @@ import android.content.Intent; import android.view.View; import android.widget.TextView; +import android.widget.Toast; import androidx.annotation.NonNull; import com.blankj.molihuan.utilcode.util.FileUtils; import com.blankj.molihuan.utilcode.util.ToastUtils; +import com.blankj.molihuan.utilcode.util.ZipUtils; import com.molihua.hlbmerge.R; import com.molihua.hlbmerge.activity.impl.PlayVideoActivity; import com.molihua.hlbmerge.dao.ConfigData; @@ -19,11 +21,20 @@ import com.molihuan.pathselector.fragment.impl.PathSelectFragment; import com.molihuan.pathselector.listener.CommonItemListener; import com.molihuan.pathselector.listener.FileItemListener; +import com.molihuan.pathselector.utils.FileTools; import com.molihuan.pathselector.utils.MConstants; import com.molihuan.pathselector.utils.Mtools; +import com.xuexiang.xtask.XTask; +import com.xuexiang.xtask.core.ITaskChainEngine; +import com.xuexiang.xtask.core.param.ITaskResult; +import com.xuexiang.xtask.core.step.impl.TaskChainCallbackAdapter; +import com.xuexiang.xtask.core.step.impl.TaskCommand; +import com.xuexiang.xui.widget.dialog.MiniLoadingDialog; import com.xuexiang.xui.widget.dialog.materialdialog.DialogAction; import com.xuexiang.xui.widget.dialog.materialdialog.MaterialDialog; +import java.io.File; +import java.io.IOException; import java.util.ArrayList; import java.util.List; @@ -79,7 +90,6 @@ public void refreshFileList() { private void openFileChoose() { pathSelectFragment = PathSelector.build(this, MConstants.BUILD_FRAGMENT) - .setShowTabbarFragment(false) .setRootPath(ConfigData.getOutputFilePath()) .setFrameLayoutId(R.id.main_complete_view) .setShowTitlebarFragment(false) @@ -103,18 +113,69 @@ public boolean onClick(View v, FileBean file, String currentPath, BasePathSelect } }) .setHandleItemListeners( - new CommonItemListener("全选") { + new CommonItemListener("压缩") { @Override public boolean onClick(View v, TextView tv, List selectedFiles, String currentPath, BasePathSelectFragment pathSelectFragment) { - pathSelectFragment.openCloseMultipleMode(true); - if (tv.getText().equals("全选")) { - pathSelectFragment.selectAllFile(true); - tv.setText("全不选"); - } else { - pathSelectFragment.selectAllFile(false); - tv.setText("全选"); + + + if (selectedFiles == null || selectedFiles.size() == 0) { + Mtools.toast("你还没有选择文件捏!(长按进行选择)"); + return false; } - pathSelectFragment.refreshFileList(); + + List pathList = new ArrayList<>(); + + + MiniLoadingDialog miniLoadingDialog = new MiniLoadingDialog(mActivity, "压缩处理中"); + miniLoadingDialog.setCancelable(false); + miniLoadingDialog.show(); + + + XTask.getTaskChain() + .addTask(XTask.getTask(new TaskCommand() { + @Override + public void run() throws Exception { + String zipPath; + for (int i = 0; i < selectedFiles.size(); i++) { + zipPath = selectedFiles.get(i).getPath(); + if (FileTools.underAndroidDataUseUri(zipPath)) { + throw new RuntimeException("Files cannot be compressed under Android/data"); + } + pathList.add(zipPath); + } + + if (FileUtils.createOrExistsDir(ConfigData.TYPE_OUTPUT_FILE_PATH_ZIP)) { + try { + ZipUtils.zipFiles(pathList, ConfigData.TYPE_OUTPUT_FILE_PATH_ZIP + File.separator + "video.zip"); + } catch (IOException e) { + e.printStackTrace(); + } + } + + + } + })) + .setTaskChainCallback(new TaskChainCallbackAdapter() { + @Override + public void onTaskChainCompleted(@NonNull ITaskChainEngine engine, @NonNull ITaskResult result) { + //更新ui + miniLoadingDialog.dismiss(); + Mtools.toast("压缩成功,压缩文件保存在" + ConfigData.TYPE_OUTPUT_FILE_PATH_ZIP + File.separator + "video.zip"); + pathSelectFragment.updateFileList(); + pathSelectFragment.openCloseMultipleMode(false); + } + + @Override + public void onTaskChainError(@NonNull ITaskChainEngine engine, @NonNull ITaskResult result) { + miniLoadingDialog.dismiss(); + Mtools.toast("压缩失败,如果你的手机为Android 11及以上,则不支持直接压缩Android/data下的文件,请先将文件或文件夹复制出Android/data再进行压缩", Toast.LENGTH_LONG); + pathSelectFragment.updateFileList(); + pathSelectFragment.openCloseMultipleMode(false); + super.onTaskChainError(engine, result); + } + }) + .start(); + return false; } @@ -129,16 +190,6 @@ public boolean onClick(View v, TextView tv, List selectedFiles, String Mtools.toast("你还没有选择文件捏!(长按进行选择)"); return false; } -//TODO 设置取消复制 - -// List handleItemListeners = pathSelectFragment.getHandleItemListeners(); -// for (CommonItemListener handleItemListener : handleItemListeners) { -// if ("取消".equals(handleItemListener.getFontBean().getText())) { -// handleItemListener.getFontBean().setText("取消复制"); -// pathSelectFragment.refreshHandleList(); -// break; -// } -// } tv.setText("粘贴"); diff --git a/app/src/main/java/com/molihua/hlbmerge/fragment/impl/MainHandleFragment.java b/app/src/main/java/com/molihua/hlbmerge/fragment/impl/MainHandleFragment.java index 90c9128..127f5ca 100644 --- a/app/src/main/java/com/molihua/hlbmerge/fragment/impl/MainHandleFragment.java +++ b/app/src/main/java/com/molihua/hlbmerge/fragment/impl/MainHandleFragment.java @@ -3,9 +3,15 @@ import android.view.View; import android.widget.TextView; +import com.blankj.molihuan.utilcode.util.ClipboardUtils; import com.molihua.hlbmerge.R; import com.molihua.hlbmerge.dialog.impl.MergeOptionDialog; +import com.molihua.hlbmerge.entity.CacheFile; import com.molihua.hlbmerge.fragment.AbstractMainHandleFragment; +import com.molihua.hlbmerge.service.BaseCacheFileManager; +import com.molihuan.pathselector.utils.Mtools; + +import java.util.List; /** * @ClassName: MainHandleFragment @@ -14,9 +20,10 @@ * @Description: */ public class MainHandleFragment extends AbstractMainHandleFragment implements View.OnClickListener { - private TextView leftTv; - private TextView centerTv; - private TextView rightTv; + private TextView selectAllTv; + private TextView copyPathTv; + private TextView mergeTv; + private TextView cancelTv; @Override public int setFragmentViewId() { @@ -25,9 +32,10 @@ public int setFragmentViewId() { @Override public void getComponents(View view) { - leftTv = view.findViewById(R.id.left_tv); - centerTv = view.findViewById(R.id.center_tv); - rightTv = view.findViewById(R.id.right_tv); + selectAllTv = view.findViewById(R.id.tv_select_all); + copyPathTv = view.findViewById(R.id.tv_copy_path); + mergeTv = view.findViewById(R.id.tv_merge); + cancelTv = view.findViewById(R.id.tv_cancel); } @Override @@ -37,22 +45,24 @@ public void initData() { @Override public void initView() { - leftTv.setText("全选"); - centerTv.setText("合并"); - rightTv.setText("取消"); + selectAllTv.setText("全选"); + copyPathTv.setText("复制路径"); + mergeTv.setText("合并"); + cancelTv.setText("取消"); } @Override public void setListeners() { - leftTv.setOnClickListener(this); - centerTv.setOnClickListener(this); - rightTv.setOnClickListener(this); + selectAllTv.setOnClickListener(this); + copyPathTv.setOnClickListener(this); + mergeTv.setOnClickListener(this); + cancelTv.setOnClickListener(this); } @Override public void onClick(View v) { int id = v.getId(); - if (id == R.id.left_tv) { + if (id == R.id.tv_select_all) { TextView tv = (TextView) v; if ("全选".equals(tv.getText())) { @@ -63,9 +73,51 @@ public void onClick(View v) { tv.setText("全选"); } - } else if (id == R.id.center_tv) { + } else if (id == R.id.tv_copy_path) { + List selectedCacheFileList = abstractMainActivity.getSelectedCacheFileList(); + String toastText; + //是否需要将信息复制到粘贴板上 + boolean isCopy; + + switch (selectedCacheFileList.size()) { + case 0: + toastText = "你还没有选择捏"; + isCopy = false; + break; + case 1: + CacheFile cacheFile = selectedCacheFileList.get(0); + switch (cacheFile.getFlag()) { + case BaseCacheFileManager.FLAG_CACHE_FILE_COLLECTION: + toastText = cacheFile.getCollectionPath(); + isCopy = true; + break; + case BaseCacheFileManager.FLAG_CACHE_FILE_CHAPTER: + toastText = cacheFile.getChapterPath(); + isCopy = true; + break; + case BaseCacheFileManager.FLAG_CACHE_FILE_BACK: + default: + toastText = "选择错误"; + isCopy = false; + } + break; + default: + toastText = "只能选择一个"; + isCopy = false; + } + + + if (isCopy) { + ClipboardUtils.copyText(toastText); + Mtools.toast("复制成功"); + } else { + Mtools.toast(toastText); + } + + + } else if (id == R.id.tv_merge) { MergeOptionDialog.showMergeOptionDialog(abstractMainActivity.getSelectedCacheFileList(), abstractMainActivity.getMainFileShowFragment()); - } else if (id == R.id.right_tv) { + } else if (id == R.id.tv_cancel) { abstractMainActivity.openCloseMultipleMode(false); } } diff --git a/app/src/main/java/com/molihua/hlbmerge/utils/UMTools.java b/app/src/main/java/com/molihua/hlbmerge/utils/UMTools.java index 2c51df9..98c9340 100644 --- a/app/src/main/java/com/molihua/hlbmerge/utils/UMTools.java +++ b/app/src/main/java/com/molihua/hlbmerge/utils/UMTools.java @@ -30,6 +30,7 @@ public class UMTools { */ public static void setDebug(boolean isDebug) { UMConfigure.setLogEnabled(isDebug); + } public static void setChannel(String channel) { @@ -53,7 +54,7 @@ public static void preInit(Context context) { */ public static void init(Context context) { //是否同意用户协议 - if (ConfigData.isAgreeTerms()) { + if (ConfigData.isAgreeTerm()) { //友盟初始化 //初始化组件化基础库, 所有友盟业务SDK都必须调用此初始化接口。 UMConfigure.init(context, APP_KEY, APP_CHANNEL, UMConfigure.DEVICE_TYPE_PHONE, ""); diff --git a/app/src/main/res/layout/activity_settings.xml b/app/src/main/res/layout/activity_settings.xml index 6d7f048..5e96ebf 100644 --- a/app/src/main/res/layout/activity_settings.xml +++ b/app/src/main/res/layout/activity_settings.xml @@ -46,7 +46,7 @@ android:id="@+id/tv_cache_path_show" android:layout_width="wrap_content" android:layout_height="wrap_content" - android:text="@string/test_text" + android:text="@string/test_text_mlh" android:textColor="@color/grey500_mlh" android:textSize="16dp" android:layout_toRightOf="@id/tv_cache_path_tip" @@ -152,7 +152,7 @@ android:id="@+id/tv_output_path_show" android:layout_width="wrap_content" android:layout_height="wrap_content" - android:text="@string/test_text" + android:text="@string/test_text_mlh" android:textColor="@color/grey500_mlh" android:textSize="16dp" android:layout_toRightOf="@id/tv_output_path_tip" diff --git a/app/src/main/res/layout/fragment_back_titlebar.xml b/app/src/main/res/layout/fragment_back_titlebar.xml index ae46972..eefd19e 100644 --- a/app/src/main/res/layout/fragment_back_titlebar.xml +++ b/app/src/main/res/layout/fragment_back_titlebar.xml @@ -28,7 +28,7 @@ android:id="@+id/main_title_toolbar" android:layout_width="wrap_content" android:layout_height="wrap_content" - android:text="@string/test_text" + android:text="@string/test_text_mlh" android:textSize="21dp" android:textColor="@color/white" /> @@ -47,7 +47,7 @@ android:id="@+id/tv_right_option" android:layout_width="wrap_content" android:layout_height="wrap_content" - android:text="@string/test_text" + android:text="@string/test_text_mlh" android:textColor="@color/white_mlh" android:layout_centerVertical="true" android:layout_alignParentRight="true" diff --git a/app/src/main/res/layout/fragment_main_handle.xml b/app/src/main/res/layout/fragment_main_handle.xml index 677bc4c..2bd3ac4 100644 --- a/app/src/main/res/layout/fragment_main_handle.xml +++ b/app/src/main/res/layout/fragment_main_handle.xml @@ -5,30 +5,40 @@ android:orientation="horizontal"> + + diff --git a/app/src/main/res/layout/item_cache_file.xml b/app/src/main/res/layout/item_cache_file.xml index c0e4eff..d697527 100644 --- a/app/src/main/res/layout/item_cache_file.xml +++ b/app/src/main/res/layout/item_cache_file.xml @@ -1,7 +1,8 @@ + android:layout_width="wrap_content" + xmlns:tools="http://schemas.android.com/tools"> @@ -32,8 +33,8 @@ @@ -41,12 +42,24 @@ android:id="@+id/tv_item_file_name" android:layout_width="wrap_content" android:layout_height="wrap_content" - android:layout_weight="4" + android:layout_weight="9" android:maxLines="1" android:ellipsize="end" android:gravity="center_vertical" android:textColor="@color/black_mlh" - android:textSize="20sp" /> + android:textSize="20sp" + tools:text="@string/test_text_mlh" /> + + diff --git a/app/src/main/res/menu/menu_bottom_navigationview_body_viewpager.xml b/app/src/main/res/menu/menu_bottom_navigationview_body_viewpager.xml index 0879e3f..b5af9dc 100644 --- a/app/src/main/res/menu/menu_bottom_navigationview_body_viewpager.xml +++ b/app/src/main/res/menu/menu_bottom_navigationview_body_viewpager.xml @@ -13,5 +13,5 @@ + android:title="小工具" /> \ No newline at end of file diff --git a/jsonapi/update_release.json b/jsonapi/update_release.json index 15f8ca9..53d1736 100644 --- a/jsonapi/update_release.json +++ b/jsonapi/update_release.json @@ -2,11 +2,11 @@ "Code": 0, "Msg": "", "UpdateStatus": 1, - "VersionCode": 44, - "VersionName": "1.6.4beta", - "UploadTime": "2023-01-3", - "ModifyContent": "\r\n1、增加稳定性。\r\n2、优化播放器。", + "VersionCode": 45, + "VersionName": "1.6.5beta", + "UploadTime": "2023-01-4", + "ModifyContent": "\r\n1、修复播放器闪退问题。\r\n2、细节优化。", "DownloadUrl": "https://gitee.com/molihuan/BilibiliCacheVideoMergeAndroid/raw/master/app/release/app-release.apk", - "ApkSize": 23460, + "ApkSize": 23462, "ApkMd5": "" } \ No newline at end of file