0
0
Fork 0
mirror of https://github.com/YTVanced/VancedManager synced 2024-11-25 12:45:12 +00:00

added some comments

This commit is contained in:
X1nto 2020-04-26 14:37:29 +04:00
parent eb5a0c9764
commit aa91076d07
4 changed files with 15 additions and 5 deletions

View file

@ -6,6 +6,8 @@ import com.google.android.material.dialog.MaterialAlertDialogBuilder
import com.vanced.manager.R
import com.vanced.manager.ui.core.ThemeActivity
// This activity will NOT be used in manifest
// since MainActivity will extend it
@SuppressLint("Registered")
open class Main: ThemeActivity() {

View file

@ -19,11 +19,7 @@ open class About : BaseFragment() {
}
license.setOnClickListener {
openUrl(
"https://raw.githubusercontent.com/YTVanced/VancedInstaller/dev/LICENSE",
R.color.GitHub
)
openUrl("https://raw.githubusercontent.com/YTVanced/VancedInstaller/dev/LICENSE", R.color.GitHub)
}
}

View file

@ -17,6 +17,7 @@ open class Home : BaseFragment() {
val pm = activity?.packageManager
//Damn that's a lot of buttons
val microginstallbtn = getView()?.findViewById(R.id.microg_installbtn) as Button
val microguninstallbtn = getView()?.findViewById(R.id.microg_uninstallbtn) as Button
val microgsettingsbtn = getView()?.findViewById(R.id.microg_settingsbtn) as Button
@ -29,6 +30,7 @@ open class Home : BaseFragment() {
val twitterbtn = getView()?.findViewById(R.id.twitterbtn) as Button
val redditbtn = getView()?.findViewById(R.id.redditbtn) as Button
//we need to check whether these apps are installed or not
val microgStatus = pm?.let { isPackageInstalled("com.mgoogle.android.gms", it) }
val vancedStatus = pm?.let { isPackageInstalled("com.vanced.android.youtube", it) }

View file

@ -13,6 +13,7 @@ import com.vanced.manager.R
@SuppressLint("Registered")
open class ThemeActivity : AppCompatActivity() {
private lateinit var currentTheme: String
private lateinit var pref: SharedPreferences
@ -31,12 +32,21 @@ open class ThemeActivity : AppCompatActivity() {
override fun onResume() {
val theme = pref.getString("theme_mode", "")
super.onResume()
//if for some weird reasons we get invalid
//theme, recreate activity
if (currentTheme != theme)
recreate()
//set Task Header color in recents menu for
//devices with lower Android version than Pie
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.P) {
setTaskBG()
}
}
//This stupid ass AppCompatDelegate does
//not want to work, so I have to use my
//own implementation of theme switching
private fun setFinalTheme(currentTheme: String) {
when (currentTheme) {
"LIGHT" -> setTheme(R.style.LightTheme_Blue)