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