🐛 Fix source switching crash & enhance stability (v3.0.4)

### 🐛 Bug Fixes
- Fix random crashes when switching video sources in settings management
- Enhanced VodConfig.setHome() null pointer exception handling
- Improved Fragment lifecycle checks to prevent crashes
- Optimized HistoryDialog source switching safety
- Enhanced thread safety for concurrent loading

###  Performance Improvements
- Added automatic cache cleaning functionality
- Improved memory usage optimization
- Enhanced network request stability

### 🆕 New Features
- Added comprehensive error handling mechanisms
- Enhanced crash protection functionality
- Improved Fragment state validation

### 📱 Build Improvements
- Updated README with professional documentation
- Enhanced build configuration for ARM64-V8A and ARM V7A
- Improved APK packaging and signing process
This commit is contained in:
您的名字
2025-07-30 21:25:10 +08:00
parent 0d7b25710c
commit dab1425dea
345 changed files with 40300 additions and 754 deletions
+1
View File
@@ -0,0 +1 @@
+42
View File
@@ -0,0 +1,42 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<!-- 主题颜色 -->
<color name="primary">#FF0057B8</color>
<color name="primaryDark">#FF003C7E</color>
<color name="accent">#FF0057B8</color>
<!-- 基本颜色 -->
<color name="white">#FFFFFFFF</color>
<color name="black">#FF000000</color>
<color name="transparent">#00000000</color>
<!-- 带透明度的颜色 -->
<color name="white_10">#1AFFFFFF</color>
<color name="white_80">#CCFFFFFF</color>
<color name="white_90">#E6FFFFFF</color>
<color name="black_10">#1A000000</color>
<color name="black_20">#33000000</color>
<color name="black_50">#80000000</color>
<color name="black_60">#99000000</color>
<color name="black_80">#CC000000</color>
<color name="black_90">#E6000000</color>
<!-- 文本颜色 -->
<color name="text_primary">#FFFFFFFF</color>
<color name="text_secondary">#B3FFFFFF</color>
<color name="text_dark">#FF212121</color>
<!-- 背景颜色 -->
<color name="bg_dark">#FF121212</color>
<color name="bg_light">#FFFAFAFA</color>
<!-- 控件颜色 -->
<color name="ripple">#33FFFFFF</color>
<color name="divider">#1FFFFFFF</color>
<color name="scrim">#52000000</color>
<!-- 状态颜色 -->
<color name="success">#FF4CAF50</color>
<color name="warning">#FFFFEB3B</color>
<color name="error">#FFF44336</color>
</resources>
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
+175
View File
@@ -0,0 +1,175 @@
plugins {
id 'com.android.application'
}
android {
namespace 'com.fongmi.android.tv'
compileSdk 35
flavorDimensions = ["mode", "abi"]
signingConfigs {
release {
storeFile file("../keystore/release.jks")
storePassword "xmbox123"
keyAlias "xmbox"
keyPassword "xmbox123"
}
}
defaultConfig {
applicationId "com.fongmi.android.tv"
minSdk 21
//noinspection ExpiredTargetSdkVersion
targetSdk 28
versionCode 303
versionName "3.0.3"
// 禁用注解处理器,避免EventBus索引生成问题
javaCompileOptions {
annotationProcessorOptions {
arguments = ["room.schemaLocation": "$projectDir/schemas".toString()]
}
}
}
productFlavors {
leanback {
dimension "mode"
}
mobile {
dimension "mode"
}
arm64_v8a {
dimension "abi"
ndk { abiFilters "arm64-v8a" }
}
armeabi_v7a {
dimension "abi"
ndk { abiFilters "armeabi-v7a" }
}
}
buildFeatures {
buildConfig true
viewBinding true
}
buildTypes {
debug {
// 开启调试
debuggable true
minifyEnabled false
shrinkResources false
}
release {
minifyEnabled true
shrinkResources true
signingConfig signingConfigs.release
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
packagingOptions {
resources {
exclude 'META-INF/beans.xml'
exclude 'META-INF/versions/9/OSGI-INF/MANIFEST.MF'
}
}
android.applicationVariants.configureEach { variant ->
variant.outputs.configureEach { output ->
outputFileName = "${variant.productFlavors[0].name}-${variant.productFlavors[1].name}.apk"
}
}
configurations.configureEach {
resolutionStrategy {
force 'com.squareup.okhttp3:okhttp:' + okhttpVersion
}
}
lint {
disable 'UnsafeOptInUsageError'
}
compileOptions {
coreLibraryDesugaringEnabled true
sourceCompatibility JavaVersion.VERSION_11
targetCompatibility JavaVersion.VERSION_11
}
// 添加额外的源文件目录,包含我们提取的EventIndex类
sourceSets {
main {
java.srcDirs += ['../extracted_files/java']
jniLibs.srcDirs += ['../extracted_files/libs']
}
}
}
dependencies {
// 禁用EventBus注解处理器,避免生成EventIndex类的问题
implementation 'org.greenrobot:eventbus:3.3.1'
implementation fileTree(dir: "libs", include: ["*.aar"])
implementation project(':catvod')
//implementation project(':chaquo')
implementation project(':quickjs')
implementation 'androidx.appcompat:appcompat:1.7.0'
implementation 'androidx.media:media:1.7.0'
implementation 'androidx.media3:media3-common:' + media3Version
implementation 'androidx.media3:media3-container:' + media3Version
implementation 'androidx.media3:media3-database:' + media3Version
implementation 'androidx.media3:media3-datasource:' + media3Version
implementation 'androidx.media3:media3-datasource-okhttp:' + media3Version
implementation 'androidx.media3:media3-datasource-rtmp:' + media3Version
implementation 'androidx.media3:media3-decoder:' + media3Version
implementation 'androidx.media3:media3-effect:' + media3Version
implementation 'androidx.media3:media3-exoplayer:' + media3Version
implementation 'androidx.media3:media3-exoplayer-dash:' + media3Version
implementation 'androidx.media3:media3-exoplayer-hls:' + media3Version
implementation 'androidx.media3:media3-exoplayer-rtsp:' + media3Version
implementation 'androidx.media3:media3-exoplayer-smoothstreaming:' + media3Version
implementation 'androidx.media3:media3-extractor:' + media3Version
implementation 'androidx.media3:media3-ui:' + media3Version
implementation 'androidx.room:room-runtime:2.7.1'
implementation 'cat.ereza:customactivityoncrash:2.4.0'
implementation('com.github.anilbeesetti.nextlib:nextlib-media3ext:0.8.4') { exclude group: 'androidx.media3' }
implementation 'com.github.bassaer:materialdesigncolors:1.0.0'
implementation 'com.github.bumptech.glide:glide:4.16.0'
implementation 'com.github.bumptech.glide:annotations:4.16.0'
implementation('com.github.bumptech.glide:avif-integration:4.16.0') { exclude group: 'org.aomedia.avif.android', module: 'avif' }
implementation 'com.github.bumptech.glide:okhttp3-integration:4.16.0'
implementation 'com.github.jahirfiquitiva:TextDrawable:1.0.3'
implementation 'com.github.thegrizzlylabs:sardine-android:0.9'
implementation 'com.github.teamnewpipe:NewPipeExtractor:v0.24.6'
implementation 'com.google.android.material:material:1.12.0'
implementation 'com.google.zxing:core:3.5.3'
implementation 'com.guolindev.permissionx:permissionx:1.8.0'
implementation 'com.hierynomus:smbj:0.14.0'
implementation 'io.antmedia:rtmp-client:3.2.0'
implementation 'javax.servlet:javax.servlet-api:3.1.0'
implementation 'org.aomedia.avif.android:avif:1.1.1.14d8e3c4'
implementation 'org.eclipse.jetty:jetty-client:8.1.21.v20160908'
implementation('org.eclipse.jetty:jetty-server:8.1.21.v20160908') { exclude group: 'org.eclipse.jetty.orbit', module: 'javax.servlet' }
implementation('org.eclipse.jetty:jetty-servlet:8.1.21.v20160908') { exclude group: 'org.eclipse.jetty.orbit', module: 'javax.servlet' }
implementation 'org.fourthline.cling:cling-core:2.1.1'
implementation 'org.fourthline.cling:cling-support:2.1.1'
implementation 'org.nanohttpd:nanohttpd:2.3.1'
implementation('org.simpleframework:simple-xml:2.7.1') { exclude group: 'stax', module: 'stax-api' exclude group: 'xpp3', module: 'xpp3' }
leanbackImplementation 'androidx.leanback:leanback:1.2.0'
leanbackImplementation 'com.github.JessYanCoding:AndroidAutoSize:1.2.1'
mobileImplementation 'androidx.biometric:biometric:1.1.0'
mobileImplementation 'androidx.swiperefreshlayout:swiperefreshlayout:1.1.0'
mobileImplementation 'com.google.android.flexbox:flexbox:3.0.0'
mobileImplementation('com.journeyapps:zxing-android-embedded:4.3.0') { transitive = false }
// 注解处理器,去掉了EventBus的
annotationProcessor 'androidx.room:room-compiler:2.7.1'
annotationProcessor 'com.github.bumptech.glide:compiler:4.16.0'
coreLibraryDesugaring 'com.android.tools:desugar_jdk_libs_nio:2.1.4'
implementation 'io.noties.markwon:core:4.6.2'
}
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.

After

Width:  |  Height:  |  Size: 95 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 281 B

Binary file not shown.
Binary file not shown.
Binary file not shown.

After

Width:  |  Height:  |  Size: 670 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 318 B

Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.

After

Width:  |  Height:  |  Size: 627 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 224 B

Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.
Binary file not shown.

After

Width:  |  Height:  |  Size: 267 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 110 B

+82
View File
@@ -0,0 +1,82 @@
#!/bin/bash
# XMBOX项目设置脚本
# 这个脚本会自动复制提取的文件到正确的位置
echo "开始设置XMBOX项目..."
# 确保我们在正确的目录
cd "$(dirname "$0")"
EXTRACT_DIR=$(pwd)
PROJECT_DIR=$(dirname "$EXTRACT_DIR")
echo "提取目录: $EXTRACT_DIR"
echo "项目目录: $PROJECT_DIR"
# 创建必要的目录
echo "创建必要的目录..."
mkdir -p "$PROJECT_DIR/app/libs/arm64-v8a"
mkdir -p "$PROJECT_DIR/app/src/main/java/com/fongmi/android/tv/event"
mkdir -p "$PROJECT_DIR/app/src/main/res/values"
# 复制native库文件
echo "复制native库文件..."
if [ -d "$EXTRACT_DIR/libs/arm64-v8a" ]; then
cp -R "$EXTRACT_DIR/libs/arm64-v8a/"* "$PROJECT_DIR/app/libs/arm64-v8a/" || echo "复制native库失败"
echo "Native库复制完成"
else
echo "libs/arm64-v8a 目录不存在"
fi
# 复制EventIndex类
echo "复制EventIndex类..."
if [ -f "$EXTRACT_DIR/java/com/fongmi/android/tv/event/EventIndex.java" ]; then
cp "$EXTRACT_DIR/java/com/fongmi/android/tv/event/EventIndex.java" "$PROJECT_DIR/app/src/main/java/com/fongmi/android/tv/event/" || echo "复制EventIndex类失败"
echo "EventIndex类复制完成"
else
echo "EventIndex.java 文件不存在"
fi
# 复制颜色资源文件
echo "复制颜色资源文件..."
if [ -f "$EXTRACT_DIR/colors.xml" ]; then
cp "$EXTRACT_DIR/colors.xml" "$PROJECT_DIR/app/src/main/res/values/" || echo "复制颜色资源文件失败"
echo "颜色资源文件复制完成"
else
echo "colors.xml 文件不存在"
fi
# 备份原有的build.gradle文件
echo "备份原有的build.gradle文件..."
if [ -f "$PROJECT_DIR/app/build.gradle" ]; then
cp "$PROJECT_DIR/app/build.gradle" "$PROJECT_DIR/app/build.gradle.bak" || echo "备份build.gradle失败"
echo "build.gradle备份完成"
else
echo "app/build.gradle 文件不存在"
fi
# 将修改后的build.gradle复制到项目中
echo "复制修改后的build.gradle文件..."
if [ -f "$EXTRACT_DIR/modified_build.gradle" ]; then
cp "$EXTRACT_DIR/modified_build.gradle" "$PROJECT_DIR/app/build.gradle" || echo "复制build.gradle失败"
echo "build.gradle复制完成"
else
echo "modified_build.gradle 文件不存在"
fi
# 修改gradle.properties文件
echo "修改gradle.properties文件..."
if [ -f "$PROJECT_DIR/gradle.properties" ]; then
# 添加Java兼容性配置
echo "" >> "$PROJECT_DIR/gradle.properties"
echo "# 允许访问JDK内部API" >> "$PROJECT_DIR/gradle.properties"
echo "android.injected.testOnly=false" >> "$PROJECT_DIR/gradle.properties"
echo "android.enableR8.fullMode=false" >> "$PROJECT_DIR/gradle.properties"
echo "org.gradle.jvmargs=-Xmx2048m -Dfile.encoding=UTF-8 --add-exports=java.base/sun.nio.ch=ALL-UNNAMED --add-opens=java.base/java.lang=ALL-UNNAMED --add-opens=java.base/java.lang.reflect=ALL-UNNAMED --add-opens=java.base/java.io=ALL-UNNAMED --add-exports=jdk.unsupported/sun.misc=ALL-UNNAMED" >> "$PROJECT_DIR/gradle.properties"
echo "gradle.properties修改完成"
else
echo "gradle.properties 文件不存在"
fi
echo "设置完成!您现在可以尝试构建项目了。"
echo "请运行: ./gradlew assembleMobileArm64_v8aDebug --info"