Skip to content

Commit

Permalink
Adapt Android 12 and other updates
Browse files Browse the repository at this point in the history
  • Loading branch information
ecodemo committed Jan 17, 2022
1 parent 78a73d5 commit 01be4f3
Show file tree
Hide file tree
Showing 10 changed files with 292 additions and 154 deletions.
132 changes: 70 additions & 62 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,83 +3,91 @@ apply plugin: 'kotlin-android'

//自定义方法
def releaseTime(){
return new Date().format("yyyyMMdd",java.util.TimeZone.getTimeZone("UTC"))
return new Date().format("yyyyMMdd",java.util.TimeZone.getTimeZone("UTC"))
}

android {
compileSdkVersion 30
compileSdkVersion 30
buildToolsVersion "30.0.3"
ndkVersion '23.0.7599858'
ndkPath '/root/android/android-ndk'
buildFeatures {
dataBinding true
viewBinding true
ndkPath '/root/android/android-ndk'

buildFeatures {
dataBinding true
viewBinding true
}
defaultConfig {
applicationId "com.ecodemo.silk"
minSdkVersion 21
targetSdkVersion 30
versionCode 20
versionName "1.1.4"
multiDexEnabled true
externalNativeBuild {
cmake {
cppFlags ""
//arguments "-DANDROID_STL=c++_shared"
abiFilters 'arm64-v8a', 'x86'
}

defaultConfig {
applicationId "com.ecodemo.silk"
minSdkVersion 21
targetSdkVersion 30
versionCode 23
versionName "1.1.7"
multiDexEnabled true

externalNativeBuild {
cmake {
cppFlags ""
//arguments "-DANDROID_STL=c++_shared"
abiFilters 'arm64-v8a'
//abiFilters 'armeabi-v7a'
}
}
}
}

lintOptions {
abortOnError false
}

lintOptions {
abortOnError false
buildTypes {
debug{
minifyEnabled false
zipAlignEnabled false
shrinkResources false
// signingConfig signingConfigs.release
}

buildTypes {
debug{
minifyEnabled false
zipAlignEnabled false
shrinkResources false
//signingConfig signingConfigs.release
}
release {
minifyEnabled true
multiDexEnabled true
zipAlignEnabled true
//signingConfig signingConfigs.release
//proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
release {
minifyEnabled true
multiDexEnabled true
zipAlignEnabled true
// signingConfig signingConfigs.release
//proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}

compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}

compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}

//修改生成的apk名字,格式为 app名_版本号_打包时间_渠道名_release.apk
applicationVariants.all{ variant->
variant.outputs.all{
outputFileName= "Silk解码器_${defaultConfig.versionName}_${releaseTime()}.apk"
}

//修改生成的apk名字,格式为 app名_版本号_打包时间_渠道名_release.apk
applicationVariants.all{ variant->
variant.outputs.all{
outputFileName= "Silk解码器_${defaultConfig.versionName}_${releaseTime()}.apk"
}
}


externalNativeBuild {
cmake {
path "src/main/cpp/CMakeLists.txt"
version "3.19.8"
}


externalNativeBuild {
cmake {
path "src/main/cpp/CMakeLists.txt"
version "3.19.8"
}
}
}

repositories {
flatDir {
dirs 'libs'
}
}

dependencies {
implementation fileTree(dir: "libs", include: ["*.jar"])
implementation fileTree(dir: "libs", include: ["*.jar"])
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version"
implementation 'androidx.core:core-ktx:1.3.1'
implementation 'androidx.multidex:multidex:2.0.1'
implementation 'androidx.recyclerview:recyclerview:1.1.0'
implementation 'androidx.documentfile:documentfile:1.0.1'
implementation 'androidx.core:core-ktx:1.3.1'
implementation 'androidx.multidex:multidex:2.0.1'
implementation 'androidx.recyclerview:recyclerview:1.1.0'
implementation 'androidx.documentfile:documentfile:1.0.1'
//compile(name:'FFmpegAndroid', ext:'aar')
}
3 changes: 3 additions & 0 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,15 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
package="com.ecodemo.silk">
<!-- android:sharedUserId="com.termux" -->
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission
android:name="android.permission.MANAGE_EXTERNAL_STORAGE"
tools:ignore="ScopedStorage" />
<application
android:hardwareAccelerated="false"
android:largeHeap="true"
android:name="com.ecodemo.silk.MxApplication"
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
Expand Down
32 changes: 29 additions & 3 deletions app/src/main/assets/about.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,37 @@
</head>
<body>
<div><strong>Silk解码器</strong></div>
<div style="margin-top:10px;font-size:14px">Copyright © 2021 <a style="text-decoration: none" href="coolmarket://u/1512829">Dmeng</a>.All rights reserved.</div>
</p><hr/>
<div style="font-size:14px">Silk Decoder uses the following open source software from the Android Open-Source Project - licensed under the MIT License:
<div style="margin-top:10px;font-size:14px">Copyright © 2022 <a style="text-decoration: none" href="coolmarket://u/1512829">Dmeng</a>.All rights reserved.</div>
</p><hr/><p>
MIT License<br/>
<br/>
Copyright (c) 2022 Ecodemo<br/>
<br/>
Permission is hereby granted, free of charge, to any person obtaining a copy<br/>
of this software and associated documentation files (the "Software"), to deal<br/>
in the Software without restriction, including without limitation the rights<br/>
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell<br/>
copies of the Software, and to permit persons to whom the Software is<br/>
furnished to do so, subject to the following conditions:<br/>
<br/>
The above copyright notice and this permission notice shall be included in all<br/>
copies or substantial portions of the Software.<br/>
<br/>
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.</p>
<hr/>
<div style="font-size:14px">Silk Decoder uses the following open source software from the Android Open-Source Project - licensed under the MIT License:</div>
<ul>
<li><a style="text-decoration: none" href="https://github.com/kn007/silk-v3-decoder">silk-v3-decoder</a></li>
</ul>
<div style="font-size:14px">Licensed under the View License:</div>
<ul>
<li><a style="text-decoration: none" href="https://github.com/FFmpeg/FFmpeg">FFmpeg</a></li>
</ul>
</body>
</html>
10 changes: 7 additions & 3 deletions app/src/main/java/com/ecodemo/silk/DecodeAdapter.kt
Original file line number Diff line number Diff line change
Expand Up @@ -35,16 +35,20 @@ class DecodeAdapter(var context_: Context, var dataList: MutableList<File>): Rec
holder.date?.text = sdf.format(Date(file.lastModified()))
holder.size?.text = MxRecyclerAdapter.getFileSize(file.length().toFloat())
holder.root?.setOnClickListener {
var items = arrayOf("播放"/*,"删除"*/)
var items = arrayOf("播放", "删除")
//var path = dataList[holder].getUri().getPath()
var dialog_ = AlertDialog.Builder(context)
dialog_.setItems(items, DialogInterface.OnClickListener(){_, witch ->
when(witch) {
0 -> {
PlayerUtils(context, file)
}
0 -> {

1 -> {
file.delete()
if (file.exists()) {
dataList.remove(file)
notifyDataSetChanged()
}
}
}
})
Expand Down
Loading

0 comments on commit 01be4f3

Please sign in to comment.