diff --git a/.idea/deploymentTargetDropDown.xml b/.idea/deploymentTargetDropDown.xml
new file mode 100644
index 0000000..09f782e
--- /dev/null
+++ b/.idea/deploymentTargetDropDown.xml
@@ -0,0 +1,17 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/build.gradle b/app/build.gradle
index 17dba27..36bf743 100644
--- a/app/build.gradle
+++ b/app/build.gradle
@@ -39,8 +39,8 @@ android {
applicationId "com.molihua.hlbmerge"
minSdk 21
targetSdk 33
- versionCode 49
- versionName "1.6.8"
+ versionCode 51
+ versionName "1.6.9.1beta"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
@@ -124,6 +124,8 @@ dependencies {
implementation 'com.umeng.umsdk:common:9.5.4'// (必选)
implementation 'com.umeng.umsdk:asms:1.6.3'// 必选
implementation 'com.umeng.umsdk:apm:1.8.0'// U-APM产品包依赖(必选)
+ //bugly依赖
+ implementation 'com.tencent.bugly:crashreport:latest.release'
implementation 'androidx.appcompat:appcompat:1.4.1'
diff --git a/app/proguard-rules.pro b/app/proguard-rules.pro
index df66f8b..18bdce1 100644
--- a/app/proguard-rules.pro
+++ b/app/proguard-rules.pro
@@ -26,3 +26,6 @@
#FFmpegCommand混淆
-keep class com.coder.ffmpeg.** {*;}
-dontwarn com.coder.ffmpeg.**
+#bugly混淆
+-dontwarn com.tencent.bugly.**
+-keep public class com.tencent.bugly.**{*;}
diff --git a/app/release/app-release.apk b/app/release/app-release.apk
index 4b0822a..304b090 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 268f0ba..4f20fe0 100644
--- a/app/release/output-metadata.json
+++ b/app/release/output-metadata.json
@@ -11,8 +11,8 @@
"type": "SINGLE",
"filters": [],
"attributes": [],
- "versionCode": 49,
- "versionName": "1.6.8",
+ "versionCode": 51,
+ "versionName": "1.6.9.1beta",
"outputFile": "app-release.apk"
}
],
diff --git a/app/src/main/assets/privacy.html b/app/src/main/assets/privacy.html
index bc6df51..fc4e8ce 100644
--- a/app/src/main/assets/privacy.html
+++ b/app/src/main/assets/privacy.html
@@ -58,6 +58,7 @@
+
@@ -89,7 +90,13 @@ 第三方SDK
友盟SDK统计分析,收集个人信息类型:设备信息(IMEI/MAC/Android ID/IDFA/OpenUDID/GUID/IP地址/SIM 卡 IMSI
信息等),用于帮助开发者排查崩溃问题,提升APP稳定性
- 友盟SDK隐私权政策链接:https://www.umeng.com/page/policy
+ 友盟SDK隐私权政策链接:跳转
+
+ 腾讯BuglySDK
+ 腾讯BuglySDK获取了设备品牌、型号、软件系统版本等等相关信息,用于帮助开发者排查崩溃问题,帮助APP提升稳定性
+
+ 腾讯BuglySDK隐私政策地址:跳转
隐私问题
如果你对我们的隐私政策或数据处理有任何问题或顾虑,请联系我们(邮箱:1492906929@qq.com)。
diff --git a/app/src/main/assets/statement.txt b/app/src/main/assets/statement.txt
index eb17bc4..6741b6d 100644
--- a/app/src/main/assets/statement.txt
+++ b/app/src/main/assets/statement.txt
@@ -5,7 +5,7 @@
【RxFFmpeg开源项目】:感谢microshow提供的ffmpeg开源解决方案。
【CSDN】:作者从网站上查找了大量的资料,解决了许多的问题。
【云注入】:感谢云注入曾经提供的网络弹窗技术支持。(现已不用)
- 【Bugly】:感谢腾讯曾经提供的技术服务。(现已不用)
+ 【Bugly】:感谢腾讯提供的技术服务。
【MMKV】:感谢腾讯提供的开源项目。
【友盟】:感谢友盟提供的技术服务。
【XUI】【XUpdate】:感谢xuexiangjys提供的开源UI框架、版本更新框架。
diff --git a/app/src/main/assets/updataLog.html b/app/src/main/assets/updataLog.html
index b50b105..476e0dd 100644
--- a/app/src/main/assets/updataLog.html
+++ b/app/src/main/assets/updataLog.html
@@ -19,6 +19,10 @@
因为权限问题,输出路径不能设置为SD卡,缓存文件路径可以设置为SD卡,即SD卡只能读取不能写入
+ 1.6.9beta版本(新)
+ 更新日期:2023年1月26日
+
----重新加入腾讯bugly(真香)
+
1.6.8版本(新)
更新日期:2023年1月24日
----修复视频播放按钮的bug
diff --git a/app/src/main/java/com/molihua/hlbmerge/App.java b/app/src/main/java/com/molihua/hlbmerge/App.java
index d76852e..5473221 100644
--- a/app/src/main/java/com/molihua/hlbmerge/App.java
+++ b/app/src/main/java/com/molihua/hlbmerge/App.java
@@ -2,21 +2,14 @@
import android.app.Application;
-import android.widget.Toast;
import com.molihua.hlbmerge.dao.ConfigData;
-import com.molihua.hlbmerge.utils.LConstants;
-import com.molihua.hlbmerge.utils.UMTools;
+import com.molihua.hlbmerge.utils.InitTool;
import com.molihua.hlbmerge.utils.UpdataTools;
import com.molihuan.pathselector.PathSelector;
import com.molihuan.pathselector.configs.PathSelectorConfig;
-import com.molihuan.pathselector.utils.Mtools;
import com.tencent.mmkv.MMKV;
import com.xuexiang.xui.XUI;
-import com.xuexiang.xupdate.XUpdate;
-import com.xuexiang.xupdate.entity.UpdateError;
-import com.xuexiang.xupdate.listener.OnUpdateFailureListener;
-import com.xuexiang.xupdate.utils.UpdateUtils;
/**
* @ClassName: App
@@ -31,6 +24,9 @@ public void onCreate() {
MMKV.initialize(this);
//配置初始化
ConfigData.init();
+ //友盟预初始化
+ InitTool.preInit(this, true, false);
+ //ffmpeg核心初始化
ConfigData.initFFmpegCore();
//初始化XUI
XUI.init(this);
@@ -40,45 +36,12 @@ public void onCreate() {
//取消自动申请权限
PathSelectorConfig.setAutoGetPermission(false);
//XUpdate初始化
- initXUpdate();
- //友盟预初始化
- UMTools.setDebug(false);
- UMTools.setChannel(UMTools.CHANNEL_RELEASE);
- UMTools.preInit(this);
+ UpdataTools.initXUpdate(this);
+
//ffmpeg核心debug
ConfigData.ffmpegCore.setDebug(false);
super.onCreate();
}
- private void initXUpdate() {
- XUpdate.get()
- .debug(false)
- .isWifiOnly(true) //默认设置只在wifi下检查版本更新
- .isGet(true) //默认设置使用get请求检查版本
- .isAutoMode(false) //默认设置非自动模式,可根据具体使用配置
- .param("versionCode", UpdateUtils.getVersionCode(this)) //设置默认公共请求参数
- .param("appKey", getPackageName())
- .setOnUpdateFailureListener(new OnUpdateFailureListener() { //设置版本更新出错的监听
- @Override
- public void onFailure(UpdateError error) {
- 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());
- }
-
- }
- })
- .supportSilentInstall(true) //设置是否支持静默安装,默认是true
- ;
- }
-
}
diff --git a/app/src/main/java/com/molihua/hlbmerge/activity/AbstractMainActivity.java b/app/src/main/java/com/molihua/hlbmerge/activity/AbstractMainActivity.java
index b3bc434..99a7e3e 100644
--- a/app/src/main/java/com/molihua/hlbmerge/activity/AbstractMainActivity.java
+++ b/app/src/main/java/com/molihua/hlbmerge/activity/AbstractMainActivity.java
@@ -1,5 +1,10 @@
package com.molihua.hlbmerge.activity;
+import android.annotation.SuppressLint;
+import android.content.Intent;
+import android.net.Uri;
+
+import androidx.annotation.Nullable;
import androidx.drawerlayout.widget.DrawerLayout;
import androidx.viewpager.widget.ViewPager;
@@ -13,6 +18,8 @@
import com.molihua.hlbmerge.interfaces.IMainFileShowFragment;
import com.molihua.hlbmerge.interfaces.IMainTitlebarFragment;
import com.molihuan.pathselector.fragment.impl.PathSelectFragment;
+import com.molihuan.pathselector.utils.PermissionsTools;
+import com.molihuan.pathselector.utils.VersionTool;
/**
* @ClassName: AbstractMainActivity
@@ -46,4 +53,31 @@ public abstract class AbstractMainActivity extends BaseActivity implements IMain
public abstract PathSelectFragment getCompletePathSelectFragment();
public abstract void refreshCompleteFileList();
+
+
+ @Override
+ @SuppressLint("WrongConstant")
+ public void onActivityResult(int requestCode, int resultCode, @Nullable Intent data) {
+ //保存这个uri目录的访问权限
+ if (VersionTool.isAndroid11()) {
+ if (requestCode == PermissionsTools.PERMISSION_REQUEST_CODE) {
+ if (data != null) {
+ Uri uri;
+ if ((uri = data.getData()) != null) {
+ getContentResolver()
+ .takePersistableUriPermission(uri,
+ data.getFlags() & (Intent.FLAG_GRANT_READ_URI_PERMISSION | Intent.FLAG_GRANT_WRITE_URI_PERMISSION)
+ );
+ }
+ //获取数据刷新列表
+ updateCollectionFileList();
+ refreshCacheFileList();
+ }
+
+ }
+ }
+ super.onActivityResult(requestCode, resultCode, data);
+ }
+
+
}
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 89b693c..0ffa48f 100644
--- a/app/src/main/java/com/molihua/hlbmerge/activity/BaseActivity.java
+++ b/app/src/main/java/com/molihua/hlbmerge/activity/BaseActivity.java
@@ -32,7 +32,7 @@ protected void onCreate(Bundle savedInstanceState) {
initView();
//设置监听
setListeners();
-
+
}
public abstract @LayoutRes
@@ -49,10 +49,41 @@ public void initView() {
public void setListeners() {
}
+ @Override
+ protected void onStart() {
+ super.onStart();
+ //Mtools.log(getClass().getSimpleName() + "---------onStart");
+ }
+
+ @Override
+ protected void onResume() {
+ super.onResume();
+ //Mtools.log(getClass().getSimpleName() + "---------onResume");
+ }
+
+ @Override
+ protected void onPause() {
+ super.onPause();
+ //Mtools.log(getClass().getSimpleName() + "---------onPause");
+ }
+
+ @Override
+ protected void onStop() {
+ super.onStop();
+ //Mtools.log(getClass().getSimpleName() + "---------onStop");
+ }
+
+ @Override
+ protected void onRestart() {
+ super.onRestart();
+ //Mtools.log(getClass().getSimpleName() + "---------onRestart");
+ }
+
@Override
protected void onDestroy() {
//友盟保存数据
MobclickAgent.onKillProcess(this);
+ //Mtools.log(getClass().getSimpleName() + "---------onDestroy");
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 ed58545..a4e7985 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
@@ -3,6 +3,7 @@
import android.content.Intent;
import android.view.MenuItem;
import android.view.WindowManager;
+import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
@@ -11,9 +12,10 @@
import androidx.fragment.app.Fragment;
import androidx.viewpager.widget.ViewPager;
+import com.blankj.molihuan.utilcode.util.DeviceUtils;
import com.google.android.material.bottomnavigation.BottomNavigationView;
import com.google.android.material.navigation.NavigationView;
-import com.hjq.permissions.OnPermissionCallback;
+import com.molihua.hlbmerge.BuildConfig;
import com.molihua.hlbmerge.R;
import com.molihua.hlbmerge.activity.AbstractMainActivity;
import com.molihua.hlbmerge.adapter.CacheFileListAdapter;
@@ -31,13 +33,13 @@
import com.molihua.hlbmerge.service.ICacheFileManager;
import com.molihua.hlbmerge.utils.FragmentTools;
import com.molihua.hlbmerge.utils.GeneralTools;
+import com.molihua.hlbmerge.utils.InitTool;
import com.molihua.hlbmerge.utils.LConstants;
-import com.molihua.hlbmerge.utils.UMTools;
import com.molihua.hlbmerge.utils.UpdataTools;
+import com.molihua.hlbmerge.utils.UriTool;
import com.molihuan.pathselector.fragment.impl.PathSelectFragment;
-import com.molihuan.pathselector.utils.FileTools;
import com.molihuan.pathselector.utils.Mtools;
-import com.molihuan.pathselector.utils.PermissionsTools;
+import com.tencent.bugly.crashreport.CrashReport;
import com.umeng.analytics.MobclickAgent;
import com.xuexiang.xui.adapter.FragmentAdapter;
import com.xuexiang.xui.widget.searchview.MaterialSearchView;
@@ -73,40 +75,15 @@ public void getComponents() {
drawerLayout = findViewById(R.id.side_container_drawerlayout);
navigationView = findViewById(R.id.side_navigationview);
viewPager = findViewById(R.id.main_view_pager);
-
}
@Override
public void initData() {
//友盟初始化
- UMTools.init(this);
+ InitTool.initWithDialog(this, true, false);
//自动周期检测更新
UpdataTools.autoCheckUpdata(this);
- //存储权限的申请
- PermissionsTools.generalPermissionsOfStorage(this, new OnPermissionCallback() {
- @Override
- public void onGranted(@NonNull List permissions, boolean all) {
- boolean dataUseUri = FileTools.underAndroidDataUseUri(ConfigData.getCacheFilePath());
- if (!dataUseUri) {
- //获取数据刷新列表
- updateCollectionFileList();
- refreshCacheFileList();
- }
- }
- });
-
- PermissionsTools.specialPermissionsOfStorageWithDialog(this, true, new OnPermissionCallback() {
- @Override
- public void onGranted(@NonNull List permissions, boolean all) {
- boolean dataUseUri = FileTools.underAndroidDataUseUri(ConfigData.getCacheFilePath());
- if (!dataUseUri) {
- //获取数据刷新列表
- updateCollectionFileList();
- refreshCacheFileList();
- }
- }
- });
mainTitlebarFragment = new MainTitlebarFragment();
mainFileShowFragment = new MainFileShowFragment();
@@ -118,6 +95,15 @@ public void onGranted(@NonNull List permissions, boolean all) {
@Override
public void initView() {
+ //侧边栏手机信息
+ TextView phoneInfoTv = navigationView.getHeaderView(0).findViewById(R.id.phone_info);
+ phoneInfoTv.setText(
+ "Android:" + DeviceUtils.getSDKVersionName() +
+ " App版本:" + BuildConfig.VERSION_NAME +
+ "\n机型:" + DeviceUtils.getManufacturer() + "/" + DeviceUtils.getModel() +
+ "\n设备id:\n" + CrashReport.getUserId()
+ );
+
//加载主显示区
FragmentAdapter adapter = new FragmentAdapter<>(getSupportFragmentManager());
@@ -227,6 +213,13 @@ public void handleShowHide(boolean isShow) {
);
}
+ @Override
+ protected void onStart() {
+ super.onStart();
+ if (ConfigData.isAgreeTerm()) {
+ UriTool.grantedUriPermission(ConfigData.getCacheFilePath(), this);
+ }
+ }
@Override
public void onPageSelected(int position) {
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 3233141..325feaa 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
@@ -8,7 +8,7 @@
import com.molihua.hlbmerge.R;
import com.molihua.hlbmerge.activity.BaseActivity;
import com.molihua.hlbmerge.controller.videocontroller.DKVideoController;
-import com.molihua.hlbmerge.utils.FileTools;
+import com.molihua.hlbmerge.utils.FileTool;
import com.molihuan.pathselector.utils.Mtools;
import java.io.File;
@@ -100,7 +100,7 @@ public void onClick(View v) {
Mtools.toast("还在开发中...");
break;
case R.id.btn_share:
- FileTools.shareFile(this, new File(videoPath));
+ FileTool.shareFile(this, new File(videoPath));
break;
}
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 a7303b6..4b6d5f9 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
@@ -7,6 +7,7 @@
import androidx.annotation.NonNull;
+import com.blankj.molihuan.utilcode.util.ClipboardUtils;
import com.blankj.molihuan.utilcode.util.TimeUtils;
import com.molihua.hlbmerge.BuildConfig;
import com.molihua.hlbmerge.R;
@@ -52,6 +53,8 @@ public class SettingsActivity extends BaseActivity implements View.OnClickListen
private MaterialSpinner autoUpdataFrequencyMs;
+ private RelativeLayout outputPathShowRela;
+
@Override
public int setContentViewID() {
@@ -75,6 +78,8 @@ public void getComponents() {
ffmpegCoreTypeLine = findViewById(R.id.line_switch_ffmpeg_core_type);
ffmpegCoreTypeMs = findViewById(R.id.ms_ffmpeg_core_type);
+
+ outputPathShowRela = findViewById(R.id.relal_output_path_show);
}
@Override
@@ -168,6 +173,7 @@ public void setListeners() {
autoUpdataFrequencyMs.setOnItemSelectedListener(this);
ffmpegCmdTypeMs.setOnItemSelectedListener(this);
ffmpegCoreTypeMs.setOnItemSelectedListener(this);
+ outputPathShowRela.setOnClickListener(this);
}
@Override
@@ -258,6 +264,9 @@ public void onClick(@NonNull MaterialDialog dialog, @NonNull DialogAction which)
}
})
.show();
+ } else if (id == R.id.relal_output_path_show) {
+ ClipboardUtils.copyText(outputPathShowTv.getText());
+ Mtools.toast("输出路径已复制到剪贴板");
}
}
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 ccfa025..78669ac 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
@@ -15,6 +15,7 @@
import com.molihua.hlbmerge.dao.ConfigData;
import com.molihua.hlbmerge.dialog.impl.CopyProgressDialog;
import com.molihua.hlbmerge.fragment.AbstractMainFragment;
+import com.molihua.hlbmerge.utils.FileTool;
import com.molihuan.pathselector.PathSelector;
import com.molihuan.pathselector.entity.FileBean;
import com.molihuan.pathselector.fragment.BasePathSelectFragment;
@@ -227,7 +228,7 @@ public boolean onClick(View v, TextView tv, List selectedFiles, String
if (fileBean.isDir()) {
Mtools.toast("不能分享文件夹,请将其压缩后再分享");
} else {
- com.molihua.hlbmerge.utils.FileTools.shareFile(mActivity, selectedFiles.get(0).getPath());
+ FileTool.shareFile(mActivity, selectedFiles.get(0).getPath());
}
return false;
diff --git a/app/src/main/java/com/molihua/hlbmerge/fragment/impl/MainFileShowFragment.java b/app/src/main/java/com/molihua/hlbmerge/fragment/impl/MainFileShowFragment.java
index 675ea6a..563f94f 100644
--- a/app/src/main/java/com/molihua/hlbmerge/fragment/impl/MainFileShowFragment.java
+++ b/app/src/main/java/com/molihua/hlbmerge/fragment/impl/MainFileShowFragment.java
@@ -1,8 +1,5 @@
package com.molihua.hlbmerge.fragment.impl;
-import android.annotation.SuppressLint;
-import android.content.Intent;
-import android.net.Uri;
import android.view.View;
import androidx.annotation.NonNull;
@@ -24,8 +21,6 @@
import com.molihua.hlbmerge.service.impl.PathCacheFileManager;
import com.molihua.hlbmerge.service.impl.UriCacheFileManager;
import com.molihuan.pathselector.utils.FileTools;
-import com.molihuan.pathselector.utils.PermissionsTools;
-import com.molihuan.pathselector.utils.VersionTool;
import java.util.ArrayList;
import java.util.List;
@@ -278,28 +273,4 @@ public boolean onBackPressed() {
}
- @SuppressLint("WrongConstant")
- @Override
- public void onActivityResult(int requestCode, int resultCode, @Nullable Intent data) {
- //保存这个uri目录的访问权限
- if (VersionTool.isAndroid11()) {
- if (requestCode == PermissionsTools.PERMISSION_REQUEST_CODE) {
- if (data != null) {
- Uri uri;
- if ((uri = data.getData()) != null) {
- mActivity.getContentResolver()
- .takePersistableUriPermission(uri,
- data.getFlags() & (Intent.FLAG_GRANT_READ_URI_PERMISSION | Intent.FLAG_GRANT_WRITE_URI_PERMISSION)
- );
- }
- //获取数据刷新列表
- updateCollectionFileList();
- refreshCacheFileList();
- }
-
- }
- }
- super.onActivityResult(requestCode, resultCode, data);
- }
-
}
diff --git a/app/src/main/java/com/molihua/hlbmerge/service/impl/PathCacheFileManager.java b/app/src/main/java/com/molihua/hlbmerge/service/impl/PathCacheFileManager.java
index 232b842..24b3b45 100644
--- a/app/src/main/java/com/molihua/hlbmerge/service/impl/PathCacheFileManager.java
+++ b/app/src/main/java/com/molihua/hlbmerge/service/impl/PathCacheFileManager.java
@@ -4,7 +4,7 @@
import com.molihua.hlbmerge.entity.CacheFile;
import com.molihua.hlbmerge.service.BaseCacheFileManager;
-import com.molihua.hlbmerge.utils.FileTools;
+import com.molihua.hlbmerge.utils.FileTool;
import java.io.File;
import java.util.ArrayList;
@@ -28,7 +28,7 @@ public List updateCollectionFileList(String path, List cac
String[] needPath = new String[4];
String[] names = new String[3];
//获取所有的合集
- File[] collectionFile = FileTools.getCollectionChapterFile(path);
+ File[] collectionFile = FileTool.getCollectionChapterFile(path);
if (collectionFile == null || collectionFile.length == 0) {
@@ -45,10 +45,10 @@ public List updateCollectionFileList(String path, List cac
//获取每一个集合中的第一个章节
File oneChapterPath = collectionFile[i].listFiles()[0];
//获取章节里需要的路径
- needPath = FileTools.getNeedPath(oneChapterPath, needPath);
+ needPath = FileTool.getNeedPath(oneChapterPath, needPath);
//获取合集名称和章节名称
- names = FileTools.getCollectionChapterName(needPath[2], names);
+ names = FileTool.getCollectionChapterName(needPath[2], names);
if (names == null) {
return cacheFileList;
@@ -104,12 +104,12 @@ public List updateChapterFileList(String collectionPath, List collection2ChapterCacheFileList(List co
//获取一个合集路径
collectionPath = collectionCacheFileList.get(n).getCollectionPath();
//获取一个合集下面所有的章节
- File[] chapterFile = FileTools.getCollectionChapterFile(collectionPath);
+ File[] chapterFile = FileTool.getCollectionChapterFile(collectionPath);
for (int i = 0; i < chapterFile.length; i++) {
//获取章节里需要的路径
- needPath = FileTools.getNeedPath(chapterFile[i], needPath);
+ needPath = FileTool.getNeedPath(chapterFile[i], needPath);
//获取合集名称和章节名称
- names = FileTools.getCollectionChapterName(needPath[2], names);
+ names = FileTool.getCollectionChapterName(needPath[2], names);
tempList.add(
new CacheFile()
.setFlag(BaseCacheFileManager.FLAG_CACHE_FILE_CHAPTER)
diff --git a/app/src/main/java/com/molihua/hlbmerge/utils/FileTools.java b/app/src/main/java/com/molihua/hlbmerge/utils/FileTool.java
similarity index 95%
rename from app/src/main/java/com/molihua/hlbmerge/utils/FileTools.java
rename to app/src/main/java/com/molihua/hlbmerge/utils/FileTool.java
index c0618ba..3284a96 100644
--- a/app/src/main/java/com/molihua/hlbmerge/utils/FileTools.java
+++ b/app/src/main/java/com/molihua/hlbmerge/utils/FileTool.java
@@ -29,7 +29,7 @@
* @Date: 2022/12/22/20:24
* @Description:
*/
-public class FileTools {
+public class FileTool {
public static void shareFile(Context context, String filePath) {
shareFile(context, filePath, null);
@@ -183,7 +183,7 @@ private static String[] getCollectionChapterNameByJsonStr(String jsonStr, String
try {
jsonObject = new JSONObject(jsonStr);
} catch (JSONException e) {
- e.printStackTrace();
+ Mtools.log("无法将文件转换为json");
result[0] = UUID.randomUUID().toString();
result[1] = UUID.randomUUID().toString();
return result;
@@ -194,7 +194,7 @@ private static String[] getCollectionChapterNameByJsonStr(String jsonStr, String
.getString("cover");
} catch (JSONException e) {
Mtools.log("无法从json中解析封面地址");
- e.printStackTrace();
+ //e.printStackTrace();
}
@@ -204,7 +204,8 @@ private static String[] getCollectionChapterNameByJsonStr(String jsonStr, String
.getString("title")
.replaceAll(LConstants.SPECIAL_CHARACTERS_REGULAR_RULE, "");
} catch (JSONException e) {
- e.printStackTrace();
+ //e.printStackTrace();
+ Mtools.log("无法从json中获取title字段");
result[0] = UUID.randomUUID().toString();
}
@@ -217,13 +218,13 @@ private static String[] getCollectionChapterNameByJsonStr(String jsonStr, String
subJsonObject = jsonObject.getJSONObject("page_data");
subJsonType = 0;
} catch (JSONException e) {
- e.printStackTrace();
+ Mtools.log("无法从json中获取page_data字段");
//如果没有获取到page_data就开始获取ep
try {
subJsonObject = jsonObject.getJSONObject("ep");
subJsonType = 1;
} catch (JSONException ex) {
- ex.printStackTrace();
+ Mtools.log("无法从json中获取ep字段");
//都没有获取到就随机uuid
result[1] = UUID.randomUUID().toString();
return result;
@@ -248,14 +249,14 @@ private static String[] getCollectionChapterNameByJsonStr(String jsonStr, String
.replaceAll(LConstants.SPECIAL_CHARACTERS_REGULAR_RULE, "")
.replaceFirst(result[0], "");
} catch (JSONException e1) {
- e1.printStackTrace();
+ Mtools.log("无法从json中获取" + parseKey + "字段");
try {
result[1] = subJsonObject
.getString("part")
.replaceAll(LConstants.SPECIAL_CHARACTERS_REGULAR_RULE, "")
.replaceFirst(result[0], "");
} catch (JSONException e2) {
- e2.printStackTrace();
+ Mtools.log("无法从json中获取part字段");
result[1] = UUID.randomUUID().toString();
}
}
diff --git a/app/src/main/java/com/molihua/hlbmerge/utils/GeneralTools.java b/app/src/main/java/com/molihua/hlbmerge/utils/GeneralTools.java
index 34a8ce5..bd454c9 100644
--- a/app/src/main/java/com/molihua/hlbmerge/utils/GeneralTools.java
+++ b/app/src/main/java/com/molihua/hlbmerge/utils/GeneralTools.java
@@ -2,9 +2,20 @@
import android.content.Context;
import android.content.Intent;
+import android.content.pm.ApplicationInfo;
import android.net.Uri;
import android.widget.Toast;
+import androidx.annotation.NonNull;
+
+import com.hjq.permissions.OnPermissionCallback;
+import com.molihua.hlbmerge.activity.AbstractMainActivity;
+import com.molihua.hlbmerge.dao.ConfigData;
+import com.molihuan.pathselector.utils.FileTools;
+import com.molihuan.pathselector.utils.PermissionsTools;
+
+import java.util.List;
+
/**
* @ClassName: GeneralTools
@@ -31,5 +42,41 @@ public static void jumpBrowser(Context context, String url) {
}
}
+ public static void initPermissionsOfStorage(AbstractMainActivity context) {
+ //存储权限的申请
+ PermissionsTools.generalPermissionsOfStorage(context, new OnPermissionCallback() {
+ @Override
+ public void onGranted(@NonNull List permissions, boolean all) {
+ boolean dataUseUri = FileTools.underAndroidDataUseUri(ConfigData.getCacheFilePath());
+ if (!dataUseUri) {
+ //获取数据刷新列表
+ context.updateCollectionFileList();
+ context.refreshCacheFileList();
+ }
+ }
+ });
+
+ PermissionsTools.specialPermissionsOfStorageWithDialog(context, true, new OnPermissionCallback() {
+ @Override
+ public void onGranted(@NonNull List permissions, boolean all) {
+ boolean dataUseUri = FileTools.underAndroidDataUseUri(ConfigData.getCacheFilePath());
+ if (!dataUseUri) {
+ //获取数据刷新列表
+ context.updateCollectionFileList();
+ context.refreshCacheFileList();
+ }
+ }
+ });
+ }
+
+ public static boolean isApkDebug(Context context) {
+ try {
+ ApplicationInfo info = context.getApplicationInfo();
+ return (info.flags & ApplicationInfo.FLAG_DEBUGGABLE) != 0;
+ } catch (Exception e) {
+ return false;
+ }
+ }
+
}
diff --git a/app/src/main/java/com/molihua/hlbmerge/utils/InitTool.java b/app/src/main/java/com/molihua/hlbmerge/utils/InitTool.java
new file mode 100644
index 0000000..e86db16
--- /dev/null
+++ b/app/src/main/java/com/molihua/hlbmerge/utils/InitTool.java
@@ -0,0 +1,94 @@
+package com.molihua.hlbmerge.utils;
+
+import android.content.Context;
+
+import com.blankj.molihuan.utilcode.util.DeviceUtils;
+import com.molihua.hlbmerge.activity.AbstractMainActivity;
+import com.molihua.hlbmerge.dao.ConfigData;
+import com.molihua.hlbmerge.dialog.impl.StatementDialog;
+import com.tencent.bugly.crashreport.CrashReport;
+import com.umeng.commonsdk.UMConfigure;
+import com.xuexiang.xui.widget.dialog.materialdialog.DialogAction;
+import com.xuexiang.xui.widget.dialog.materialdialog.MaterialDialog;
+
+/**
+ * @ClassName: UMTools
+ * @Author: molihuan
+ * @Date: 2023/01/03/14:55
+ * @Description: 友盟工具类
+ */
+public class InitTool {
+
+ public final static String APP_KEY = "63b302eed64e6861390b324f";
+ public final static String BUGLY_APP_KEY = "ac467503ed";
+
+ public static String APP_CHANNEL = "release_molihuan";
+
+
+ public static void setChannel(String channel) {
+ APP_CHANNEL = channel;
+ }
+
+ /**
+ * 友盟和bugly初始化
+ *
+ * @param context
+ */
+ public static void init(Context context, boolean buglyDebug, boolean umDebug) {
+
+ if (!GeneralTools.isApkDebug(context)) {
+ buglyDebug = false;
+ umDebug = false;
+ }
+ //友盟初始化
+ //初始化组件化基础库, 所有友盟业务SDK都必须调用此初始化接口。
+ UMConfigure.setLogEnabled(umDebug);
+ UMConfigure.init(context, APP_KEY, APP_CHANNEL, UMConfigure.DEVICE_TYPE_PHONE, "");
+ //bugly初始化
+ CrashReport.UserStrategy strategy = new CrashReport.UserStrategy(context);
+ strategy.setDeviceID(DeviceUtils.getUniqueDeviceId())
+ .setDeviceModel(DeviceUtils.getModel())
+ .setAppChannel(APP_CHANNEL)
+ .setEnableUserInfo(true);
+ CrashReport.initCrashReport(context, BUGLY_APP_KEY, buglyDebug, strategy);
+ CrashReport.setUserId(DeviceUtils.getUniqueDeviceId());
+ }
+
+ /**
+ * 友盟预初始化
+ *
+ * @param context
+ */
+ public static void preInit(Context context, boolean buglyDebug, boolean umDebug) {
+ // SDK预初始化函数不会采集设备信息,也不会向友盟后台上报数据。
+ UMConfigure.preInit(context, APP_KEY, APP_CHANNEL);
+ if (ConfigData.isAgreeTerm()) {
+ init(context, buglyDebug, umDebug);
+ }
+ }
+
+ /**
+ * 友盟初始化(带弹窗)
+ *
+ * @param context
+ */
+ public static void initWithDialog(AbstractMainActivity context, boolean buglyDebug, boolean umDebug) {
+ //是否同意用户协议
+ if (!ConfigData.isAgreeTerm()) {
+ StatementDialog.showStatementDialog(context, new StatementDialog.IButtonCallback() {
+ @Override
+ public void onClick(MaterialDialog dialog, DialogAction which) {
+ init(context, buglyDebug, umDebug);
+ //获取存储权限
+ GeneralTools.initPermissionsOfStorage(context);
+ UriTool.grantedUriPermission(ConfigData.getCacheFilePath(), context);
+ }
+ });
+ } else {
+ //获取存储权限
+ GeneralTools.initPermissionsOfStorage(context);
+ }
+ }
+
+
+}
diff --git a/app/src/main/java/com/molihua/hlbmerge/utils/UMTools.java b/app/src/main/java/com/molihua/hlbmerge/utils/UMTools.java
deleted file mode 100644
index 98c9340..0000000
--- a/app/src/main/java/com/molihua/hlbmerge/utils/UMTools.java
+++ /dev/null
@@ -1,72 +0,0 @@
-package com.molihua.hlbmerge.utils;
-
-import android.content.Context;
-
-import com.molihua.hlbmerge.dao.ConfigData;
-import com.molihua.hlbmerge.dialog.impl.StatementDialog;
-import com.umeng.commonsdk.UMConfigure;
-import com.xuexiang.xui.widget.dialog.materialdialog.DialogAction;
-import com.xuexiang.xui.widget.dialog.materialdialog.MaterialDialog;
-
-/**
- * @ClassName: UMTools
- * @Author: molihuan
- * @Date: 2023/01/03/14:55
- * @Description: 友盟工具类
- */
-public class UMTools {
-
- public final static String APP_KEY = "63b302eed64e6861390b324f";
- public static String APP_CHANNEL = "release_molihuan";
- //debug渠道
- public final static String CHANNEL_DEBUG = "debug_molihuan";
- //release渠道
- public final static String CHANNEL_RELEASE = "release_molihuan";
-
- /**
- * 是否开启debug
- *
- * @param isDebug
- */
- public static void setDebug(boolean isDebug) {
- UMConfigure.setLogEnabled(isDebug);
-
- }
-
- public static void setChannel(String channel) {
- APP_CHANNEL = channel;
- }
-
- /**
- * 友盟预初始化
- *
- * @param context
- */
- public static void preInit(Context context) {
- // SDK预初始化函数不会采集设备信息,也不会向友盟后台上报数据。
- UMConfigure.preInit(context, APP_KEY, APP_CHANNEL);
- }
-
- /**
- * 友盟初始化(带弹窗)
- *
- * @param context
- */
- public static void init(Context context) {
- //是否同意用户协议
- if (ConfigData.isAgreeTerm()) {
- //友盟初始化
- //初始化组件化基础库, 所有友盟业务SDK都必须调用此初始化接口。
- UMConfigure.init(context, APP_KEY, APP_CHANNEL, UMConfigure.DEVICE_TYPE_PHONE, "");
- } else {
- StatementDialog.showStatementDialog(context, new StatementDialog.IButtonCallback() {
- @Override
- public void onClick(MaterialDialog dialog, DialogAction which) {
- UMConfigure.init(context, APP_KEY, APP_CHANNEL, UMConfigure.DEVICE_TYPE_PHONE, "");
- }
- });
- }
- }
-
-
-}
diff --git a/app/src/main/java/com/molihua/hlbmerge/utils/UpdataTools.java b/app/src/main/java/com/molihua/hlbmerge/utils/UpdataTools.java
index 35c166d..d08d85a 100644
--- a/app/src/main/java/com/molihua/hlbmerge/utils/UpdataTools.java
+++ b/app/src/main/java/com/molihua/hlbmerge/utils/UpdataTools.java
@@ -1,11 +1,16 @@
package com.molihua.hlbmerge.utils;
import android.content.Context;
+import android.widget.Toast;
import com.blankj.molihuan.utilcode.util.TimeUtils;
import com.molihua.hlbmerge.dao.ConfigData;
import com.molihuan.pathselector.utils.Mtools;
+import com.xuexiang.xupdate.XUpdate;
import com.xuexiang.xupdate.easy.EasyUpdate;
+import com.xuexiang.xupdate.entity.UpdateError;
+import com.xuexiang.xupdate.listener.OnUpdateFailureListener;
+import com.xuexiang.xupdate.utils.UpdateUtils;
/**
* @ClassName: UpdataTools
@@ -59,6 +64,36 @@ public static void limitClickCheckUpdata(Context context) {
}
+ public static void initXUpdate(Context context) {
+ XUpdate.get()
+ .debug(false)
+ .isWifiOnly(true) //默认设置只在wifi下检查版本更新
+ .isGet(true) //默认设置使用get请求检查版本
+ .isAutoMode(false) //默认设置非自动模式,可根据具体使用配置
+ .param("versionCode", UpdateUtils.getVersionCode(context)) //设置默认公共请求参数
+ .param("appKey", context.getPackageName())
+ .setOnUpdateFailureListener(new OnUpdateFailureListener() { //设置版本更新出错的监听
+ @Override
+ public void onFailure(UpdateError error) {
+ 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(context.getApplicationContext());
+ }
+
+ }
+ })
+ .supportSilentInstall(true) //设置是否支持静默安装,默认是true
+ ;
+ }
+
/**
* 周期自动检查更新(gitee)
* 自动检测更新频率
diff --git a/app/src/main/java/com/molihua/hlbmerge/utils/UriTool.java b/app/src/main/java/com/molihua/hlbmerge/utils/UriTool.java
index f9e70ae..9e3be0f 100644
--- a/app/src/main/java/com/molihua/hlbmerge/utils/UriTool.java
+++ b/app/src/main/java/com/molihua/hlbmerge/utils/UriTool.java
@@ -1,5 +1,6 @@
package com.molihua.hlbmerge.utils;
+import android.app.Activity;
import android.content.Context;
import android.net.Uri;
import android.view.View;
@@ -15,6 +16,7 @@
import com.molihuan.pathselector.dialog.BaseDialog;
import com.molihuan.pathselector.dialog.impl.MessageDialog;
import com.molihuan.pathselector.entity.FontBean;
+import com.molihuan.pathselector.utils.FileTools;
import com.molihuan.pathselector.utils.PermissionsTools;
import com.molihuan.pathselector.utils.UriTools;
import com.xuexiang.xtask.XTask;
@@ -117,14 +119,17 @@ public boolean onClick(View v, BaseDialog dialog) {
}
- public static void grantedUriPermission(String path, Fragment fragment) {
- //获取上下文
- Context context = fragment.getContext();
+ public static void grantedUriPermission(String path, Activity context) {
+
Objects.requireNonNull(context, "context is null");
+ if (!FileTools.needUseUri(path)) {
+ return;
+ }
+
Uri uri = UriTools.path2Uri(path, false);
//获取权限,没有权限返回null有权限返回授权uri字符串
- String existsPermission = PermissionsTools.existsGrantedUriPermission(uri, fragment);
+ String existsPermission = PermissionsTools.existsGrantedUriPermission(uri, context);
if (existsPermission == null) {
//没有权限申请权限
@@ -137,7 +142,7 @@ public static void grantedUriPermission(String path, Fragment fragment) {
@Override
public void onClick(@NonNull MaterialDialog dialog, @NonNull DialogAction which) {
//申请权限
- PermissionsTools.goApplyUriPermissionPage(uri, fragment);
+ PermissionsTools.goApplyUriPermissionPage(uri, context);
dialog.dismiss();
}
})
@@ -161,37 +166,11 @@ public static List getCollectionChapterFile(Fragment fragment, Str
//获取权限,没有权限返回null有权限返回授权uri字符串
String existsPermission = PermissionsTools.existsGrantedUriPermission(uri, fragment);
- if (existsPermission == null) {
- //没有权限申请权限
- XTask.postToMain(new Runnable() {
- @Override
- public void run() {
- //申请权限弹窗
- new MaterialDialog.Builder(context)
- .title("授权提示")
- .content("需要授予\n" + currentPath + "\n目录访问权限")
- .cancelable(false)
- .positiveText("授权")
- .onPositive(new MaterialDialog.SingleButtonCallback() {
- @Override
- public void onClick(@NonNull MaterialDialog dialog, @NonNull DialogAction which) {
- //申请权限
- PermissionsTools.goApplyUriPermissionPage(uri, fragment);
- dialog.dismiss();
- }
- })
- .negativeText("取消")
- .onNegative(new MaterialDialog.SingleButtonCallback() {
- @Override
- public void onClick(@NonNull MaterialDialog dialog, @NonNull DialogAction which) {
- dialog.dismiss();
- }
- })
- .show();
- }
- });
+ List fileList = new ArrayList<>();
- return null;
+ if (existsPermission == null) {
+ //没有权限直接返回
+ return fileList;
}
Uri targetUri = Uri.parse(existsPermission + uri.toString().replaceFirst(UriTools.URI_PERMISSION_REQUEST_COMPLETE_PREFIX, ""));
@@ -205,9 +184,9 @@ public void onClick(@NonNull MaterialDialog dialog, @NonNull DialogAction which)
//TODO 去除不是文件夹的item
if (documentFiles == null) {
- return null;
+ return fileList;
}
- List fileList = new ArrayList<>();
+
for (DocumentFile documentFile : documentFiles) {
if (documentFile.isDirectory()) {
fileList.add(documentFile);
@@ -248,7 +227,7 @@ public static String[] getCollectionChapterName(Uri jsonUri, String[] result) {
//uri转byte
byte[] jsonByte = UriUtils.uri2Bytes(jsonUri);
//通过jsonByte获取名称
- result = FileTools.getCollectionChapterName(jsonByte, result);
+ result = FileTool.getCollectionChapterName(jsonByte, result);
return result;
}
}
diff --git a/app/src/main/res/layout/activity_main.xml b/app/src/main/res/layout/activity_main.xml
index 2f95881..ae4213d 100644
--- a/app/src/main/res/layout/activity_main.xml
+++ b/app/src/main/res/layout/activity_main.xml
@@ -27,7 +27,9 @@
android:id="@+id/main_view_pager"
android:layout_width="match_parent"
android:layout_height="match_parent"
- app:layout_behavior="@string/appbar_scrolling_view_behavior" />
+ app:layout_behavior="@string/appbar_scrolling_view_behavior"
+ tools:ignore="SpeakableTextPresentCheck" />
+
diff --git a/app/src/main/res/layout/activity_settings.xml b/app/src/main/res/layout/activity_settings.xml
index 2836869..b38bd63 100644
--- a/app/src/main/res/layout/activity_settings.xml
+++ b/app/src/main/res/layout/activity_settings.xml
@@ -36,6 +36,7 @@
+ xmlns:tools="http://schemas.android.com/tools">
+
+ android:layout_marginTop="15dp" />
+ android:textSize="17dp" />
+ android:gravity="center_horizontal"
+ tools:text="@string/app_name" />
+
diff --git a/jsonapi/update_release.json b/jsonapi/update_release.json
index fad0676..d2d0e9c 100644
--- a/jsonapi/update_release.json
+++ b/jsonapi/update_release.json
@@ -1,10 +1,10 @@
{
"Code": 0,
"Msg": "",
- "UpdateStatus": 1,
+ "UpdateStatus": 0,
"VersionCode": 49,
- "VersionName": "1.6.8",
- "UploadTime": "2023-01-24",
+ "VersionName": "1.6.9.1",
+ "UploadTime": "2023-01-27",
"ModifyContent": "\r\n1、修复视频播放按钮的bug。\r\n2、新增FFmpegCommand核心。\r\n3、去除x86_64 平台架构。",
"DownloadUrl": "https://www.gitlink.org.cn/api/molihuan/BilibiliCacheVideoMerge/raw?filepath=app/release/app-release.apk",
"ApkSize": 28464,