forked from github/wulkanowy-mirror
Fix task description color crash (#2475)
This commit is contained in:
parent
d01fe9c370
commit
b31c7e1720
4
.gitignore
vendored
4
.gitignore
vendored
@ -67,6 +67,10 @@ captures/
|
|||||||
.idea/discord.xml
|
.idea/discord.xml
|
||||||
.idea/migrations.xml
|
.idea/migrations.xml
|
||||||
.idea/androidTestResultsUserPreferences.xml
|
.idea/androidTestResultsUserPreferences.xml
|
||||||
|
.idea/copilot
|
||||||
|
.idea/deploymentTargetDropDown.xml
|
||||||
|
.idea/deploymentTargetSelector.xml
|
||||||
|
.idea/kotlinc.xml
|
||||||
|
|
||||||
# Keystore files
|
# Keystore files
|
||||||
*.jks
|
*.jks
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
package io.github.wulkanowy.ui.base
|
package io.github.wulkanowy.ui.base
|
||||||
|
|
||||||
import android.app.ActivityManager
|
import android.app.ActivityManager
|
||||||
|
import android.os.Build
|
||||||
import android.os.Bundle
|
import android.os.Bundle
|
||||||
import android.view.View
|
import android.view.View
|
||||||
import android.widget.Toast
|
import android.widget.Toast
|
||||||
@ -45,11 +46,19 @@ abstract class BaseActivity<T : BasePresenter<out BaseView>, VB : ViewBinding> :
|
|||||||
themeManager.applyActivityTheme(this)
|
themeManager.applyActivityTheme(this)
|
||||||
super.onCreate(savedInstanceState)
|
super.onCreate(savedInstanceState)
|
||||||
supportFragmentManager.registerFragmentLifecycleCallbacks(fragmentLifecycleLogger, true)
|
supportFragmentManager.registerFragmentLifecycleCallbacks(fragmentLifecycleLogger, true)
|
||||||
|
applyCustomTaskDescription()
|
||||||
|
}
|
||||||
|
|
||||||
@Suppress("DEPRECATION")
|
@Suppress("DEPRECATION")
|
||||||
setTaskDescription(
|
private fun applyCustomTaskDescription() {
|
||||||
ActivityManager.TaskDescription(null, null, getThemeAttrColor(R.attr.colorSurface))
|
if (Build.VERSION.SDK_INT > Build.VERSION_CODES.R) return
|
||||||
)
|
try {
|
||||||
|
val newColor = getThemeAttrColor(R.attr.colorSurface)
|
||||||
|
val taskDescription = ActivityManager.TaskDescription(null, null, newColor)
|
||||||
|
setTaskDescription(taskDescription)
|
||||||
|
} catch (e: Exception) {
|
||||||
|
Timber.e(e)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun showError(text: String, error: Throwable) {
|
override fun showError(text: String, error: Throwable) {
|
||||||
|
Loading…
Reference in New Issue
Block a user