diff --git a/UPDATE.md b/UPDATE.md
index 476a7f64..34a0d12d 100644
--- a/UPDATE.md
+++ b/UPDATE.md
@@ -1,19 +1,14 @@
-何处春江无月明 版本
+江流宛转绕芳甸 版本
#### 新
-适配 Flyme 状态栏歌词
-支持重启应用恢复先前的歌单,当前歌曲
+适配安卓 4.4
+协议弹窗
#### 改
-网络优化
-优化滑动体验
-界面优化
-优化安装包大小
+移除在线反馈功能
+其他优化
#### 修
-修复当列表为 1,引发的闪退问题
-修复部分机型启动服务失败的问题
-
diff --git a/app/build.gradle b/app/build.gradle
index 77890011..8bec1400 100644
--- a/app/build.gradle
+++ b/app/build.gradle
@@ -27,10 +27,10 @@ android {
defaultConfig {
applicationId "com.dirror.music"
- minSdkVersion 21
+ minSdkVersion 19
targetSdkVersion 30
- versionCode 679
- versionName "何处春江无月明"
+ versionCode 680
+ versionName "江流宛转绕芳甸"
multiDexEnabled true
@@ -83,14 +83,14 @@ dependencies {
androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'
implementation "androidx.drawerlayout:drawerlayout:1.1.1"
- implementation 'com.squareup.okhttp3:okhttp:4.9.0'
+ // 适配安卓 4.4 不要更新
+ implementation 'com.squareup.okhttp3:okhttp:3.12.0'
implementation 'com.google.code.gson:gson:2.8.6'
implementation 'com.eightbitlab:blurview:1.6.3'
implementation 'androidx.lifecycle:lifecycle-runtime-ktx:2.2.0'
implementation 'androidx.navigation:navigation-fragment-ktx:2.3.2'
implementation 'androidx.palette:palette-ktx:1.0.0'
- implementation 'cn.bmob.android:bmob-sdk:3.7.8'
implementation 'io.reactivex.rxjava2:rxjava:2.2.11'
implementation 'io.reactivex.rxjava2:rxandroid:2.1.1'
implementation 'com.squareup.okio:okio:2.10.0'
@@ -119,4 +119,6 @@ dependencies {
implementation 'com.bitvale:switcher:1.1.1'
// coil 图片加载库
implementation 'io.coil-kt:coil:1.1.1'
+
+ implementation 'com.android.support:multidex:1.0.3'
}
\ No newline at end of file
diff --git a/app/release/output-metadata.json b/app/release/output-metadata.json
index e2aaaa17..ea4e9c47 100644
--- a/app/release/output-metadata.json
+++ b/app/release/output-metadata.json
@@ -10,8 +10,8 @@
{
"type": "SINGLE",
"filters": [],
- "versionCode": 679,
- "versionName": "婵炶揪绲惧ú鏍囬埡鍛強闁靛濡囧銈夋煛閸愵亜校婵狅拷閿熶粙鏌¢崟鑸靛",
+ "versionCode": 680,
+ "versionName": "濠殿喖婀遍崰鎰矈閿旀拝鎷风憴鍕灱婵炴潙妫涚槐鎺楀即閳ユ壙锝夋煟椤喗瀚�",
"outputFile": "app-release.apk"
}
]
diff --git "a/app/release/\344\275\225\345\244\204\346\230\245\346\261\237\346\227\240\346\234\210\346\230\216.apk" "b/app/release/\346\261\237\346\265\201\345\256\233\350\275\254\347\273\225\350\212\263\347\224\270.apk"
similarity index 57%
rename from "app/release/\344\275\225\345\244\204\346\230\245\346\261\237\346\227\240\346\234\210\346\230\216.apk"
rename to "app/release/\346\261\237\346\265\201\345\256\233\350\275\254\347\273\225\350\212\263\347\224\270.apk"
index 3908305b..b085a2ec 100644
Binary files "a/app/release/\344\275\225\345\244\204\346\230\245\346\261\237\346\227\240\346\234\210\346\230\216.apk" and "b/app/release/\346\261\237\346\265\201\345\256\233\350\275\254\347\273\225\350\212\263\347\224\270.apk" differ
diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
index 22a25878..c8b457d6 100644
--- a/app/src/main/AndroidManifest.xml
+++ b/app/src/main/AndroidManifest.xml
@@ -14,7 +14,8 @@
-
-
+ tools:ignore="UnusedAttribute">
+
+
@@ -88,10 +90,11 @@
android:name=".service.MusicService"
android:exported="false" />
-
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/java/com/dirror/music/MyApplication.kt b/app/src/main/java/com/dirror/music/MyApplication.kt
index 1144cd33..1f7e0936 100644
--- a/app/src/main/java/com/dirror/music/MyApplication.kt
+++ b/app/src/main/java/com/dirror/music/MyApplication.kt
@@ -3,21 +3,25 @@ package com.dirror.music
import android.app.Application
import android.content.Context
import android.content.Intent
+import android.os.Build
import androidx.annotation.Keep
import androidx.lifecycle.MutableLiveData
-import cn.bmob.v3.Bmob
+import androidx.multidex.MultiDex
import com.dirror.music.manager.ActivityManager
import com.dirror.music.manager.CloudMusicManager
import com.dirror.music.manager.UserManager
import com.dirror.music.room.AppDatabase
-import com.dirror.music.service.MusicControllerInterface
import com.dirror.music.service.MusicService
import com.dirror.music.service.MusicServiceConnection
-import com.dirror.music.util.*
+import com.dirror.music.util.Config
+import com.dirror.music.util.DarkThemeUtil
+import com.dirror.music.util.Secure
+import com.dirror.music.util.toast
import com.tencent.mmkv.MMKV
import com.umeng.analytics.MobclickAgent
import com.umeng.commonsdk.UMConfigure
+
/**
* 自定义 Application
* @author Moriafly
@@ -47,20 +51,38 @@ class MyApplication : Application() {
lateinit var appDatabase: AppDatabase
}
-
-
/* 获取 Bmob */
private external fun getBmobAppKey(): String
/* 获取友盟 */
private external fun getUmAppKey(): String
+ override fun attachBaseContext(base: Context?) {
+ super.attachBaseContext(base)
+ MultiDex.install(this)
+ }
+
override fun onCreate() {
super.onCreate()
// 全局 context
context = applicationContext
// MMKV 初始化
- MMKV.initialize(this)
+ // val rootDir: String = MMKV.getRootDir()
+ // toast(rootDir)
+ // toast(filesDir.absolutePath)
+// if (Build.VERSION.SDK_INT == 19) {
+// // MMKV.initialize(cacheDir.absolutePath + "/mmkv") { libName ->
+// ReLinker.loadLibrary(context, "libmmkv", object : LoadListener {
+// override fun success() { /* Yay */
+// MMKV.initialize(context)
+// }
+//
+// override fun failure(t: Throwable) { /* Boo */
+// }
+// })
+// } else {
+ MMKV.initialize(context)
+// }
config = Config()
// 管理初始化
userManager = UserManager()
@@ -82,8 +104,6 @@ class MyApplication : Application() {
*/
private fun checkSecure() {
if (Secure.isSecure()) {
- // 初始化 Bmob
- Bmob.initialize(this, getBmobAppKey())
// 初始化友盟
UMConfigure.init(context, getUmAppKey(), "", UMConfigure.DEVICE_TYPE_PHONE, "")
// 选用 AUTO 页面采集模式
@@ -101,7 +121,7 @@ class MyApplication : Application() {
private fun startMusicService() {
// 通过 Service 播放音乐,混合启动
val intent = Intent(this, MusicService::class.java)
- if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.O) {
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
startForegroundService(intent)
} else {
startService(intent)
diff --git a/app/src/main/java/com/dirror/music/bmob/BmobManager.kt b/app/src/main/java/com/dirror/music/bmob/BmobManager.kt
deleted file mode 100644
index 9f5354b7..00000000
--- a/app/src/main/java/com/dirror/music/bmob/BmobManager.kt
+++ /dev/null
@@ -1,33 +0,0 @@
-package com.dirror.music.bmob
-
-import androidx.annotation.Keep
-import cn.bmob.v3.exception.BmobException
-import cn.bmob.v3.listener.SaveListener
-
-/**
- * @author 24568
- */
-@Keep
-class BmobManager {
-
- /**
- * 上传反馈数据
- * @param feedback
- * @param contact
- */
- fun uploadFeedback(feedback: String?, contact: String?, success: () -> Unit, failure: () -> Unit) {
- val feedbackData = FeedbackData()
- feedbackData.feedback = feedback
- feedbackData.contact = contact
- feedbackData.save(object : SaveListener() {
- override fun done(objectId: String?, ex: BmobException?) {
- if (ex == null) {
- success.invoke()
- } else {
- failure.invoke()
- }
- }
- })
- }
-
-}
\ No newline at end of file
diff --git a/app/src/main/java/com/dirror/music/bmob/FeedbackData.kt b/app/src/main/java/com/dirror/music/bmob/FeedbackData.kt
deleted file mode 100644
index 46f28d92..00000000
--- a/app/src/main/java/com/dirror/music/bmob/FeedbackData.kt
+++ /dev/null
@@ -1,20 +0,0 @@
-package com.dirror.music.bmob
-
-import android.os.Build
-import androidx.annotation.Keep
-import cn.bmob.v3.BmobObject
-import com.dirror.music.util.getVisionCode
-import com.dirror.music.util.getVisionName
-
-/**
- * @author 24568
- */
-@Keep
-class FeedbackData : BmobObject() {
- var feedback: String? = null
- var contact: String? = null
- val model: String = Build.MODEL // 设备名称
- val androidVersion: String = Build.VERSION.RELEASE // 安卓版本
- val appVer: String = "${getVisionName()}(${getVisionCode()})" // APP 版本
- val moreInfo: String = "" // 更多信息
-}
\ No newline at end of file
diff --git a/app/src/main/java/com/dirror/music/room/PlayQueueDao.kt b/app/src/main/java/com/dirror/music/room/PlayQueueDao.kt
index 200b2737..a5eb1370 100644
--- a/app/src/main/java/com/dirror/music/room/PlayQueueDao.kt
+++ b/app/src/main/java/com/dirror/music/room/PlayQueueDao.kt
@@ -20,4 +20,7 @@ interface PlayQueueDao {
@Query("delete from PlayQueueData where id = :id")
fun deleteById(id: String): Int
+ @Query("delete from PlayQueueData")
+ fun clear()
+
}
\ No newline at end of file
diff --git a/app/src/main/java/com/dirror/music/service/MusicService.kt b/app/src/main/java/com/dirror/music/service/MusicService.kt
index 1381c029..85e9e7da 100644
--- a/app/src/main/java/com/dirror/music/service/MusicService.kt
+++ b/app/src/main/java/com/dirror/music/service/MusicService.kt
@@ -374,7 +374,7 @@ open class MusicService : BaseMediaService() {
override fun setPlaylist(songListData: ArrayList) {
PlayQueue.setNormal(songListData)
- if (mode == MODE_RANDOM) {
+ if (mode == MODE_RANDOM && !recover) {
PlayQueue.random()
}
}
diff --git a/app/src/main/java/com/dirror/music/service/PlayQueue.kt b/app/src/main/java/com/dirror/music/service/PlayQueue.kt
index 28c4fa9f..c4046e09 100644
--- a/app/src/main/java/com/dirror/music/service/PlayQueue.kt
+++ b/app/src/main/java/com/dirror/music/service/PlayQueue.kt
@@ -4,8 +4,9 @@ import androidx.lifecycle.MutableLiveData
import com.dirror.music.MyApplication
import com.dirror.music.music.standard.data.StandardSongData
import com.dirror.music.room.PlayQueueData
+import kotlinx.coroutines.GlobalScope
+import kotlinx.coroutines.launch
import kotlin.collections.ArrayList
-import kotlin.concurrent.thread
/**
* 播放队列
@@ -52,9 +53,9 @@ object PlayQueue {
* 保存歌单到数据库
*/
private fun savePlayQueue() {
- thread {
+ GlobalScope.launch {
MyApplication.appDatabase.playQueueDao().loadAll().forEach {
- MyApplication.appDatabase.playQueueDao().deleteById(it.songData.id?:"")
+ MyApplication.appDatabase.playQueueDao().deleteById(it.songData.id ?: "")
}
currentQueue.value?.forEach {
MyApplication.appDatabase.playQueueDao().insert(PlayQueueData(it))
diff --git a/app/src/main/java/com/dirror/music/ui/activity/AboutActivity.kt b/app/src/main/java/com/dirror/music/ui/activity/AboutActivity.kt
index 7922858d..8731a35d 100644
--- a/app/src/main/java/com/dirror/music/ui/activity/AboutActivity.kt
+++ b/app/src/main/java/com/dirror/music/ui/activity/AboutActivity.kt
@@ -73,6 +73,12 @@ class AboutActivity : BaseActivity() {
itemJoinQQGroup.setOnClickListener {
joinQQGroup(this@AboutActivity, QQ_GROUP_KEY)
}
+
+ moriafly.setOnLongClickListener {
+ toast("Moriafly settings reset")
+ MyApplication.config.mmkv.encode(Config.SHOW_AGREEMENT, true)
+ return@setOnLongClickListener true
+ }
}
}
diff --git a/app/src/main/java/com/dirror/music/ui/activity/AgreementActivity.kt b/app/src/main/java/com/dirror/music/ui/activity/AgreementActivity.kt
new file mode 100644
index 00000000..ca0228b1
--- /dev/null
+++ b/app/src/main/java/com/dirror/music/ui/activity/AgreementActivity.kt
@@ -0,0 +1,43 @@
+package com.dirror.music.ui.activity
+
+import android.content.Intent
+import android.graphics.Bitmap
+import com.dirror.music.MyApplication
+import com.dirror.music.databinding.ActivityAgreementBinding
+import com.dirror.music.manager.ActivityCollector
+import com.dirror.music.ui.base.BaseActivity
+import com.dirror.music.util.Config
+import com.dirror.music.util.Secure
+
+class AgreementActivity : BaseActivity() {
+
+ private lateinit var binding: ActivityAgreementBinding
+
+ override fun initBinding() {
+ binding = ActivityAgreementBinding.inflate(layoutInflater)
+ setContentView(binding.root)
+ }
+
+ override fun initListener() {
+ binding.btnAgree.setOnClickListener {
+ MyApplication.config.mmkv.encode(Config.SHOW_AGREEMENT, false)
+ val intent = Intent(this, MainActivity::class.java)
+ startActivity(intent)
+ finish()
+ }
+
+ binding.btnExit.setOnClickListener {
+ MyApplication.musicController.value?.stopMusicService()
+ ActivityCollector.finishAll()
+
+ object : Thread() {
+ override fun run() {
+ super.run()
+ sleep(500)
+ Secure.killMyself()
+ }
+ }.start()
+ }
+ }
+
+}
\ No newline at end of file
diff --git a/app/src/main/java/com/dirror/music/ui/activity/FeedbackActivity.kt b/app/src/main/java/com/dirror/music/ui/activity/FeedbackActivity.kt
index f79fde7c..fad5327c 100644
--- a/app/src/main/java/com/dirror/music/ui/activity/FeedbackActivity.kt
+++ b/app/src/main/java/com/dirror/music/ui/activity/FeedbackActivity.kt
@@ -1,11 +1,8 @@
package com.dirror.music.ui.activity
import com.dirror.music.MyApplication
-import com.dirror.music.bmob.BmobManager
import com.dirror.music.databinding.ActivityFeedbackBinding
import com.dirror.music.ui.base.BaseActivity
-import com.dirror.music.util.singleClick
-import com.dirror.music.util.toast
class FeedbackActivity : BaseActivity() {
@@ -21,27 +18,6 @@ class FeedbackActivity : BaseActivity() {
}
override fun initListener() {
- binding.btnUpload.setOnClickListener {
- singleClick {
- val feedback = binding.etFeedback.text.toString()
- val contact = binding.etContact.text.toString()
- when {
- feedback.length < 10 -> toast("反馈内容不少于 10 个字符")
- contact.isEmpty() -> toast("请输入联系方式")
- else -> {
- // 上传反馈内容
- BmobManager().uploadFeedback(feedback, contact, {
- // 上传成功
- toast("上传成功,感谢反馈")
- finish()
- }, {
- // 上传失败
- toast("上传失败,请稍后重试")
- })
- }
- }
- }
- }
binding.itemHelpDocument.setOnClickListener {
MyApplication.activityManager.startWebActivity(this, HELP_URL)
}
diff --git a/app/src/main/java/com/dirror/music/ui/activity/MainActivity.kt b/app/src/main/java/com/dirror/music/ui/activity/MainActivity.kt
index e50f3c95..253e4154 100644
--- a/app/src/main/java/com/dirror/music/ui/activity/MainActivity.kt
+++ b/app/src/main/java/com/dirror/music/ui/activity/MainActivity.kt
@@ -54,6 +54,7 @@ class MainActivity : BaseActivity() {
}
override fun initData() {
+
// Intent 过滤器
var intentFilter = IntentFilter()
intentFilter.addAction("android.intent.action.HEADSET_PLUG")
diff --git a/app/src/main/java/com/dirror/music/ui/activity/SplashActivity.kt b/app/src/main/java/com/dirror/music/ui/activity/SplashActivity.kt
index cfe74af8..65929470 100644
--- a/app/src/main/java/com/dirror/music/ui/activity/SplashActivity.kt
+++ b/app/src/main/java/com/dirror/music/ui/activity/SplashActivity.kt
@@ -3,8 +3,10 @@ package com.dirror.music.ui.activity
import android.content.Intent
import androidx.appcompat.app.AppCompatActivity
import android.os.Bundle
+import com.dirror.music.MyApplication
import com.dirror.music.databinding.ActivitySplashBinding
import com.dirror.music.ui.base.BaseActivity
+import com.dirror.music.util.Config
/**
* 启动页 Activity
@@ -20,8 +22,12 @@ class SplashActivity : BaseActivity() {
override fun onStart() {
super.onStart()
- val intent = Intent(this, MainActivity::class.java)
- startActivity(intent)
+ if (MyApplication.config.mmkv.decodeBool(Config.SHOW_AGREEMENT, true)) {
+ startActivity(Intent(this, AgreementActivity::class.java))
+ } else {
+ val intent = Intent(this, MainActivity::class.java)
+ startActivity(intent)
+ }
finish()
}
diff --git a/app/src/main/java/com/dirror/music/util/Config.kt b/app/src/main/java/com/dirror/music/util/Config.kt
index 55c13951..375d48a2 100644
--- a/app/src/main/java/com/dirror/music/util/Config.kt
+++ b/app/src/main/java/com/dirror/music/util/Config.kt
@@ -74,5 +74,7 @@ class Config {
const val SERVICE_RECOVER_PROGRESS = "service_recover_progress"
/* 魅族状态栏歌词 */
const val MEIZU_STATUS_BAR_LYRIC = "boolean_meizu_status_bar_lyric"
+ /* 是否启动显示协议 */
+ const val SHOW_AGREEMENT = "boolean_show_agreement"
}
}
\ No newline at end of file
diff --git a/app/src/main/java/com/dirror/music/util/MagicHttp.kt b/app/src/main/java/com/dirror/music/util/MagicHttp.kt
index de79f678..3d9f28dc 100644
--- a/app/src/main/java/com/dirror/music/util/MagicHttp.kt
+++ b/app/src/main/java/com/dirror/music/util/MagicHttp.kt
@@ -102,7 +102,8 @@ object MagicHttp {
client.newCall(request).enqueue(object : Callback {
override fun onResponse(call: Call, response: Response) {
- val string = response.body?.string()!!
+ val string = response.body()?.string()?:""
+ // val string = response.body?.string()!!
success.invoke(string)
}
@@ -138,7 +139,7 @@ object MagicHttp {
client.newCall(request).enqueue(object : Callback {
override fun onResponse(call: Call, response: Response) {
- val string = response.body?.string()!!
+ val string = response.body()?.string()?:""
success.invoke(string)
}
@@ -171,7 +172,7 @@ object MagicHttp {
client.newCall(request).enqueue(object : Callback {
override fun onResponse(call: Call, response: Response) {
- val string = response.body?.string()!!
+ val string = response.body()?.string()?:""
success.invoke(string)
}
@@ -247,7 +248,7 @@ object MagicHttp {
.build()
client.newCall(request).enqueue(object : Callback {
override fun onResponse(call: Call, response: Response) {
- val string = response.body?.string()!!
+ val string = response.body()?.string()?:""
it.resume(string)
}
diff --git a/app/src/main/res/layout/activity_about.xml b/app/src/main/res/layout/activity_about.xml
index aa5cede2..ed1ab6d0 100644
--- a/app/src/main/res/layout/activity_about.xml
+++ b/app/src/main/res/layout/activity_about.xml
@@ -145,6 +145,7 @@ Dso Music 软件内不提供歌曲下载,只提供在线音乐试听,请支
android:layout_height="40dp" />
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/layout/activity_feedback.xml b/app/src/main/res/layout/activity_feedback.xml
index 8579dd5d..b03ac48d 100644
--- a/app/src/main/res/layout/activity_feedback.xml
+++ b/app/src/main/res/layout/activity_feedback.xml
@@ -13,23 +13,7 @@
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
- app:text="@string/feedback">
-
-
-
+ app:text="@string/feedback"/>
-
-
-
-
-
-
-
-
-
diff --git a/app/src/main/res/layout/dialog_update.xml b/app/src/main/res/layout/dialog_update.xml
index fadf9f70..a3e32705 100644
--- a/app/src/main/res/layout/dialog_update.xml
+++ b/app/src/main/res/layout/dialog_update.xml
@@ -88,15 +88,10 @@
+ android:layout_width="match_parent"
+ android:text="下载" />
diff --git a/app/src/main/res/values/styles.xml b/app/src/main/res/values/styles.xml
index 6f85c7cc..40077994 100644
--- a/app/src/main/res/values/styles.xml
+++ b/app/src/main/res/values/styles.xml
@@ -94,4 +94,15 @@
- @android:color/transparent
+
+
\ No newline at end of file
diff --git a/build.gradle b/build.gradle
index bce7d783..740ec189 100644
--- a/build.gradle
+++ b/build.gradle
@@ -18,8 +18,6 @@ buildscript {
allprojects {
repositories {
maven { url 'https://jitpack.io' }
- // Bmob 的 maven 仓库地址 -- 必填
- maven { url 'https://dl.bintray.com/chaozhouzhang/maven'}
maven { url 'https://dl.bintray.com/umsdk/release' }
// 阿里云
maven { url 'https://maven.aliyun.com/repository/public/' }