mirror of
https://github.com/YTVanced/VancedManager
synced 2024-11-16 16:25:11 +00:00
attempt to fix theme issue
This commit is contained in:
parent
4947d3ab7a
commit
b015ff4061
4 changed files with 5 additions and 51 deletions
|
@ -2,10 +2,12 @@ package com.vanced.manager.core
|
|||
|
||||
import android.app.Application
|
||||
import com.downloader.PRDownloader
|
||||
import com.vanced.manager.utils.ThemeHelper.setFinalTheme
|
||||
|
||||
class App: Application() {
|
||||
|
||||
override fun onCreate() {
|
||||
setFinalTheme(this)
|
||||
super.onCreate()
|
||||
PRDownloader.initialize(applicationContext)
|
||||
}
|
||||
|
|
|
@ -4,15 +4,15 @@ import android.annotation.SuppressLint
|
|||
import android.content.Context
|
||||
import android.os.Bundle
|
||||
import android.util.Log
|
||||
import androidx.appcompat.app.AppCompatActivity
|
||||
import androidx.preference.PreferenceManager
|
||||
import com.vanced.manager.ui.core.ThemedActivity
|
||||
import com.vanced.manager.ui.dialogs.DialogContainer.showSecurityDialog
|
||||
import com.vanced.manager.ui.dialogs.DialogContainer.statementFalse
|
||||
|
||||
// This activity will NOT be used in manifest
|
||||
// since MainActivity will extend it
|
||||
@SuppressLint("Registered")
|
||||
open class Main: ThemedActivity() {
|
||||
open class Main: AppCompatActivity() {
|
||||
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
|
|
|
@ -26,7 +26,7 @@ class MainActivity : Main() {
|
|||
private lateinit var binding: ActivityMainBinding
|
||||
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
setFinalTheme(this)
|
||||
//setFinalTheme(this)
|
||||
super.onCreate(savedInstanceState)
|
||||
|
||||
binding = DataBindingUtil.setContentView(this, R.layout.activity_main)
|
||||
|
|
|
@ -1,48 +0,0 @@
|
|||
package com.vanced.manager.ui.core
|
||||
|
||||
import android.annotation.SuppressLint
|
||||
import android.app.ActivityManager
|
||||
import android.content.SharedPreferences
|
||||
import android.content.res.Configuration
|
||||
import android.os.Build
|
||||
import android.os.Bundle
|
||||
import androidx.appcompat.app.AppCompatActivity
|
||||
import androidx.core.content.res.ResourcesCompat
|
||||
import androidx.preference.PreferenceManager
|
||||
import com.vanced.manager.R
|
||||
|
||||
// This activity will NOT be used in manifest
|
||||
// since MainActivity will extend it
|
||||
@SuppressLint("Registered")
|
||||
open class ThemedActivity : AppCompatActivity() {
|
||||
|
||||
private lateinit var currentTheme: String
|
||||
private lateinit var pref: SharedPreferences
|
||||
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
|
||||
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.P) {
|
||||
setTaskBG()
|
||||
}
|
||||
}
|
||||
|
||||
override fun onResume() {
|
||||
super.onResume()
|
||||
//set Task Header color in recents menu for
|
||||
//devices that are not using pie recents
|
||||
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.P) {
|
||||
setTaskBG()
|
||||
}
|
||||
}
|
||||
|
||||
private fun setTaskBG() {
|
||||
val label = getString(R.string.app_name)
|
||||
val color = ResourcesCompat.getColor(resources, R.color.Black, null)
|
||||
val taskDec: ActivityManager.TaskDescription =
|
||||
ActivityManager.TaskDescription(label, null, color)
|
||||
setTaskDescription(taskDec)
|
||||
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in a new issue