mirror of
https://github.com/YTVanced/VancedManager
synced 2024-11-23 03:35:11 +00:00
fixed issues and removed accent color hardcoding
This commit is contained in:
parent
bb4f31b805
commit
239191a5c6
7 changed files with 20 additions and 39 deletions
|
@ -18,7 +18,6 @@
|
|||
android:label="@string/app_name"
|
||||
android:roundIcon="@mipmap/ic_launcher_round"
|
||||
android:supportsRtl="true"
|
||||
android:requestLegacyExternalStorage="true"
|
||||
android:usesCleartextTraffic="true"
|
||||
tools:ignore="UnusedAttribute">
|
||||
|
||||
|
|
|
@ -70,7 +70,7 @@ open class Home : BaseFragment() {
|
|||
if (microgStatus!!) {
|
||||
val microgVer = pm.getPackageInfo("com.mgoogle.android.gms", 0).versionName
|
||||
microguninstallbtn.setOnClickListener {
|
||||
uninstallApk("com.mgoogle.android.gms", 69)
|
||||
uninstallApk("com.mgoogle.android.gms")
|
||||
}
|
||||
|
||||
microgsettingsbtn.setOnClickListener {
|
||||
|
@ -97,7 +97,7 @@ open class Home : BaseFragment() {
|
|||
if (vancedStatus!!) {
|
||||
val vancedVer = pm.getPackageInfo("com.vanced.android.youtube", 0).versionName
|
||||
vanceduninstallbtn.setOnClickListener {
|
||||
uninstallApk("com.vanced.android.youtube", 420)
|
||||
uninstallApk("com.vanced.android.youtube")
|
||||
}
|
||||
vancedVerText.text = vancedVer.toString()
|
||||
} else {
|
||||
|
@ -166,7 +166,7 @@ open class Home : BaseFragment() {
|
|||
intent.setDataAndType(uri, "application/vnd.android.package-archive")
|
||||
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
|
||||
intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION)
|
||||
activity?.startActivityForResult(intent, 420)
|
||||
startActivity(intent)
|
||||
},
|
||||
onError = { throwable ->
|
||||
Toast.makeText(requireContext(), throwable.toString(), Toast.LENGTH_SHORT)
|
||||
|
@ -175,11 +175,11 @@ open class Home : BaseFragment() {
|
|||
)
|
||||
}
|
||||
|
||||
private fun uninstallApk(pkgUri: String, requestCode: Int) {
|
||||
private fun uninstallApk(pkgUri: String) {
|
||||
try {
|
||||
val uri = Uri.parse(pkgUri)
|
||||
val uninstall = Intent(Intent.ACTION_DELETE, uri)
|
||||
activity?.startActivityForResult(uninstall, requestCode)
|
||||
startActivity(uninstall)
|
||||
} catch (e: ActivityNotFoundException) {
|
||||
Toast.makeText(requireContext(), "App not installed", Toast.LENGTH_SHORT).show()
|
||||
activity?.recreate()
|
||||
|
|
|
@ -9,8 +9,11 @@ import android.util.Log
|
|||
class SplitInstallerService: Service() {
|
||||
|
||||
override fun onStartCommand(intent: Intent, flags: Int, startId: Int): Int {
|
||||
|
||||
when (if (intent.hasExtra(PackageInstaller.EXTRA_STATUS)) null else intent.getIntExtra(PackageInstaller.EXTRA_STATUS, 0)) {
|
||||
when (
|
||||
if (intent.hasExtra(PackageInstaller.EXTRA_STATUS))
|
||||
null
|
||||
else
|
||||
intent.getIntExtra(PackageInstaller.EXTRA_STATUS, 0)) {
|
||||
PackageInstaller.STATUS_PENDING_USER_ACTION -> {
|
||||
val confirmationIntent = intent.getParcelableExtra<Intent>(Intent.EXTRA_INTENT)
|
||||
confirmationIntent?.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
|
||||
|
|
|
@ -81,23 +81,6 @@ class MainActivity : Main() {
|
|||
return false
|
||||
}
|
||||
|
||||
|
||||
override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
|
||||
super.onActivityResult(requestCode, resultCode, data)
|
||||
when (requestCode) {
|
||||
69 -> {
|
||||
recreate()
|
||||
}
|
||||
420 -> {
|
||||
recreate()
|
||||
}
|
||||
666 -> {
|
||||
recreate()
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private fun setDisplayHomeAsUpEnabled(isNeeded: Boolean) {
|
||||
val toolbar: Toolbar = findViewById(R.id.home_toolbar)
|
||||
when {
|
||||
|
|
|
@ -70,22 +70,18 @@ open class ThemedActivity : AppCompatActivity() {
|
|||
}
|
||||
|
||||
private fun setDarkAccent(accentColor: String) {
|
||||
val themeVal: Int = ("R.style.DarkTheme_$accentColor").toInt()
|
||||
when (accentColor) {
|
||||
"Blue" -> setTheme(R.style.DarkTheme_Blue)
|
||||
"Red" -> setTheme(R.style.DarkTheme_Red)
|
||||
"Green" -> setTheme(R.style.DarkTheme_Green)
|
||||
"Yellow" -> setTheme(R.style.DarkTheme_Yellow)
|
||||
"Purple" -> setTheme(R.style.DarkTheme_Purple)
|
||||
accentColor -> setTheme(themeVal)
|
||||
else -> setTheme(R.style.DarkTheme_Blue)
|
||||
}
|
||||
}
|
||||
|
||||
private fun setLightAccent(accentColor: String) {
|
||||
val themeVal: Int = ("R.style.LightTheme_$accentColor").toInt()
|
||||
when (accentColor) {
|
||||
"Blue" -> setTheme(R.style.LightTheme_Blue)
|
||||
"Red" -> setTheme(R.style.LightTheme_Red)
|
||||
"Green" -> setTheme(R.style.LightTheme_Green)
|
||||
"Yellow" -> setTheme(R.style.LightTheme_Yellow)
|
||||
"Purple" -> setTheme(R.style.LightTheme_Purple)
|
||||
accentColor -> setTheme(themeVal)
|
||||
else -> setTheme(R.style.LightTheme_Blue)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -58,8 +58,8 @@
|
|||
|
||||
<style name="DarkTheme.Purple" parent="DarkTheme.Blue">
|
||||
|
||||
<item name="colorPrimary">#9370DB</item>
|
||||
<item name="colorPrimaryVariant">#B59370DB</item>
|
||||
<item name="colorPrimary">#6D49B7</item>
|
||||
<item name="colorPrimaryVariant">#563C8D</item>
|
||||
<item name="colorSecondary">#734BC7</item>
|
||||
<item name="colorSecondaryVariant">#9A734BC7</item>
|
||||
|
||||
|
|
|
@ -58,8 +58,8 @@
|
|||
|
||||
<style name="LightTheme.Purple" parent="LightTheme.Blue">
|
||||
|
||||
<item name="colorPrimary">#9370DB</item>
|
||||
<item name="colorPrimaryVariant">#B59370DB</item>
|
||||
<item name="colorPrimary">#6D49B7</item>
|
||||
<item name="colorPrimaryVariant">#563C8D</item>
|
||||
<item name="colorSecondary">#734BC7</item>
|
||||
<item name="colorSecondaryVariant">#9A734BC7</item>
|
||||
|
||||
|
|
Loading…
Reference in a new issue