Skip to content

Commit

Permalink
修改版本信息显示
Browse files Browse the repository at this point in the history
  • Loading branch information
Henry-ZHR committed Mar 31, 2024
1 parent 05eb5ad commit 11923a9
Show file tree
Hide file tree
Showing 5 changed files with 68 additions and 32 deletions.
11 changes: 0 additions & 11 deletions app/src/main/java/remix/myplayer/bean/misc/Feedback.kt

This file was deleted.

16 changes: 16 additions & 0 deletions app/src/main/java/remix/myplayer/misc/AppInfo.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
package remix.myplayer.misc

import remix.myplayer.BuildConfig

object AppInfo {
val prettyPrinted by lazy {
"""
APPLICATION_ID: ${BuildConfig.APPLICATION_ID}
VERSION_CODE: ${BuildConfig.VERSION_CODE}
VERSION_NAME: ${BuildConfig.VERSION_NAME}
FLAVOR: ${BuildConfig.FLAVOR}
BUILD_TYPE: ${BuildConfig.BUILD_TYPE}
GITHUB_SHA: ${BuildConfig.GITHUB_SHA}
""".trimIndent()
}
}
25 changes: 25 additions & 0 deletions app/src/main/java/remix/myplayer/misc/SystemInfo.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
package remix.myplayer.misc

import android.os.Build

object SystemInfo {
private val supportedAbis: Array<String> by lazy {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
Build.SUPPORTED_ABIS
} else {
@Suppress("deprecation")
arrayOf(Build.CPU_ABI, Build.CPU_ABI2)
}
}

val prettyPrinted: String by lazy {
"""
DISPLAY: ${Build.DISPLAY}
SUPPORTED_ABIS: ${supportedAbis.contentToString()}
MANUFACTURER: ${Build.MANUFACTURER}
MODEL: ${Build.MODEL}
RELEASE: ${Build.VERSION.RELEASE}
SDK_INT: ${Build.VERSION.SDK_INT}
""".trimIndent()
}
}
25 changes: 21 additions & 4 deletions app/src/main/java/remix/myplayer/ui/activity/AboutActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@ import android.os.Bundle
import remix.myplayer.BuildConfig
import remix.myplayer.R
import remix.myplayer.databinding.ActivityAboutBinding
import remix.myplayer.misc.AppInfo
import remix.myplayer.theme.Theme
import remix.myplayer.theme.ThemeStore
import remix.myplayer.theme.TintHelper

class AboutActivity : ToolbarActivity() {
private lateinit var binding: ActivityAboutBinding
Expand All @@ -14,10 +18,23 @@ class AboutActivity : ToolbarActivity() {
super.onCreate(savedInstanceState)
binding = ActivityAboutBinding.inflate(layoutInflater)
setContentView(binding.root)
binding.aboutText.text =
"v${BuildConfig.VERSION_NAME}" +
" (${BuildConfig.VERSION_CODE})" +
" (${BuildConfig.FLAVOR})"

binding.aboutText.text = "v${BuildConfig.VERSION_NAME}"
binding.aboutText.setOnLongClickListener {
Theme.getBaseDialog(this)
.content(AppInfo.prettyPrinted)
.positiveText(R.string.close)
.build()
.run {
with(contentView ?: return@setOnLongClickListener false) {
TintHelper.setTint(this, ThemeStore.accentColor, false)
setTextIsSelectable(true)
}
show()
}
true
}

setUpToolbar(getString(R.string.about))
}
}
23 changes: 6 additions & 17 deletions app/src/main/java/remix/myplayer/ui/activity/SettingActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ import kotlinx.coroutines.withContext
import remix.myplayer.App.Companion.IS_GOOGLEPLAY
import remix.myplayer.BuildConfig
import remix.myplayer.R
import remix.myplayer.bean.misc.Feedback
import remix.myplayer.bean.misc.Library
import remix.myplayer.bean.misc.Library.Companion.getAllLibraryString
import remix.myplayer.bean.mp3.Song
Expand All @@ -50,7 +49,9 @@ import remix.myplayer.helper.M3UHelper.exportPlayListToFile
import remix.myplayer.helper.M3UHelper.importLocalPlayList
import remix.myplayer.helper.M3UHelper.importM3UFile
import remix.myplayer.helper.ShakeDetector
import remix.myplayer.misc.AppInfo
import remix.myplayer.misc.MediaScanner
import remix.myplayer.misc.SystemInfo
import remix.myplayer.misc.cache.DiskCache
import remix.myplayer.misc.floatpermission.FloatWindowManager
import remix.myplayer.misc.handler.MsgHandler
Expand Down Expand Up @@ -723,24 +724,12 @@ class SettingActivity : ToolbarActivity(), ColorChooserDialog.ColorCallback,

private fun gotoEmail() {
fun send(sendLog: Boolean) {
val feedBack = Feedback(
BuildConfig.VERSION_NAME,
BuildConfig.VERSION_CODE.toString(),
Build.DISPLAY,
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
Build.SUPPORTED_ABIS.joinToString(", ", "[", "]")
} else {
@Suppress("DEPRECATION")
"[" + Build.CPU_ABI + ", " + Build.CPU_ABI2 + "]"
},
Build.MANUFACTURER,
Build.MODEL,
Build.VERSION.RELEASE,
Build.VERSION.SDK_INT.toString()
)
val emailIntent = Intent()
emailIntent.putExtra(Intent.EXTRA_SUBJECT, getString(R.string.feedback))
emailIntent.putExtra(Intent.EXTRA_TEXT, "\n\n\n" + feedBack)
emailIntent.putExtra(
Intent.EXTRA_TEXT,
"\n\n\nApp info:\n${AppInfo.prettyPrinted}\n\nSystem info:\n${SystemInfo.prettyPrinted}"
)

tryLaunch(catch = {
Timber.w(it)
Expand Down

0 comments on commit 11923a9

Please sign in to comment.