mirror of
https://github.com/szkolny-eu/szkolny-android.git
synced 2024-11-24 19:04:38 -06:00
[UI/App] Update build info dialog colors and text style.
This commit is contained in:
parent
5242d15ebd
commit
34e44a7a36
@ -4,6 +4,7 @@
|
|||||||
|
|
||||||
package pl.szczodrzynski.edziennik.utils.managers
|
package pl.szczodrzynski.edziennik.utils.managers
|
||||||
|
|
||||||
|
import android.text.TextUtils
|
||||||
import androidx.appcompat.app.AlertDialog
|
import androidx.appcompat.app.AlertDialog
|
||||||
import androidx.appcompat.app.AppCompatActivity
|
import androidx.appcompat.app.AppCompatActivity
|
||||||
import com.google.android.material.dialog.MaterialAlertDialogBuilder
|
import com.google.android.material.dialog.MaterialAlertDialogBuilder
|
||||||
@ -64,13 +65,23 @@ class BuildManager(val app: App) : CoroutineScope {
|
|||||||
val yes = activity.getString(R.string.yes)
|
val yes = activity.getString(R.string.yes)
|
||||||
val no = activity.getString(R.string.no)
|
val no = activity.getString(R.string.no)
|
||||||
|
|
||||||
|
val colorOnBackground = R.attr.colorOnBackground.resolveAttr(activity)
|
||||||
|
val mtrlGreen = R.color.md_green_500.resolveColor(activity)
|
||||||
|
val mtrlYellow = R.color.md_yellow_700.resolveColor(activity)
|
||||||
|
val mtrlRed = R.color.md_red_500.resolveColor(activity)
|
||||||
|
|
||||||
val fields = mapOf(
|
val fields = mapOf(
|
||||||
R.string.build_version to BuildConfig.VERSION_BASE,
|
R.string.build_version to BuildConfig.VERSION_BASE,
|
||||||
R.string.build_official to if (isOfficial) yes else no,
|
R.string.build_official to if (isOfficial)
|
||||||
|
yes.asColoredSpannable(mtrlGreen)
|
||||||
|
else
|
||||||
|
no.asColoredSpannable(mtrlRed),
|
||||||
R.string.build_platform to when {
|
R.string.build_platform to when {
|
||||||
isPlayRelease -> activity.getString(R.string.build_platform_play)
|
isPlayRelease -> activity.getString(R.string.build_platform_play)
|
||||||
isApkRelease -> activity.getString(R.string.build_platform_apk)
|
isApkRelease -> activity.getString(R.string.build_platform_apk)
|
||||||
else -> activity.getString(R.string.build_platform_unofficial)
|
else -> activity
|
||||||
|
.getString(R.string.build_platform_unofficial)
|
||||||
|
.asColoredSpannable(mtrlYellow)
|
||||||
},
|
},
|
||||||
R.string.build_branch to gitBranch,
|
R.string.build_branch to gitBranch,
|
||||||
R.string.build_commit to gitHash?.substring(0, 8),
|
R.string.build_commit to gitHash?.substring(0, 8),
|
||||||
@ -84,8 +95,15 @@ class BuildManager(val app: App) : CoroutineScope {
|
|||||||
)
|
)
|
||||||
|
|
||||||
val message = fields.map { (key, value) ->
|
val message = fields.map { (key, value) ->
|
||||||
activity.getString(key) + ":\n" + value
|
TextUtils.concat(
|
||||||
}.join("\n\n")
|
activity
|
||||||
|
.getString(key)
|
||||||
|
.asBoldSpannable()
|
||||||
|
.asColoredSpannable(colorOnBackground),
|
||||||
|
":\n",
|
||||||
|
value
|
||||||
|
)
|
||||||
|
}.concat("\n\n")
|
||||||
|
|
||||||
MaterialAlertDialogBuilder(activity)
|
MaterialAlertDialogBuilder(activity)
|
||||||
.setTitle(R.string.build_details)
|
.setTitle(R.string.build_details)
|
||||||
|
Loading…
Reference in New Issue
Block a user