mirror of
https://github.com/YTVanced/VancedManager
synced 2024-11-19 09:45:10 +00:00
changes regarding to buttons
This commit is contained in:
parent
ab89070452
commit
37cc8ae766
4 changed files with 21 additions and 35 deletions
|
@ -4,7 +4,6 @@ import android.content.ActivityNotFoundException
|
||||||
import android.content.ComponentName
|
import android.content.ComponentName
|
||||||
import android.content.Context
|
import android.content.Context
|
||||||
import android.content.Intent
|
import android.content.Intent
|
||||||
import android.os.Build
|
|
||||||
import android.os.Bundle
|
import android.os.Bundle
|
||||||
import android.util.Log
|
import android.util.Log
|
||||||
import android.view.View
|
import android.view.View
|
||||||
|
@ -76,11 +75,7 @@ open class Home : BaseFragment() {
|
||||||
|
|
||||||
val microgVerText = view.findViewById<TextView>(R.id.microg_installed_version)
|
val microgVerText = view.findViewById<TextView>(R.id.microg_installed_version)
|
||||||
if (microgStatus!!) {
|
if (microgStatus!!) {
|
||||||
val microgVer = if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) {
|
val microgVer = pm.getPackageInfo("com.mgoogle.android.gms", 0).versionName
|
||||||
pm.getPackageInfo("com.mgoogle.android.gms", 0).longVersionCode
|
|
||||||
} else {
|
|
||||||
pm.getPackageInfo("com.mgoogle.android.gms", 0).versionCode
|
|
||||||
}
|
|
||||||
|
|
||||||
microguninstallbtn.setOnClickListener {
|
microguninstallbtn.setOnClickListener {
|
||||||
uninstallApk("com.mgoogle.android.gms")
|
uninstallApk("com.mgoogle.android.gms")
|
||||||
|
|
|
@ -67,7 +67,7 @@ class SplitInstallerService: Service() {
|
||||||
getSharedPreferences("installPrefs", Context.MODE_PRIVATE).edit().putBoolean("isInstalling", false).apply()
|
getSharedPreferences("installPrefs", Context.MODE_PRIVATE).edit().putBoolean("isInstalling", false).apply()
|
||||||
Log.d(TAG, "Installation failed")
|
Log.d(TAG, "Installation failed")
|
||||||
val mIntent = Intent(MainActivity.INSTALL_FAILED)
|
val mIntent = Intent(MainActivity.INSTALL_FAILED)
|
||||||
mIntent.action = MainActivity.INSTALL_ABORTED
|
mIntent.action = MainActivity.INSTALL_FAILED
|
||||||
LocalBroadcastManager.getInstance(this).sendBroadcast(mIntent)
|
LocalBroadcastManager.getInstance(this).sendBroadcast(mIntent)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -48,7 +48,13 @@ class MainActivity : Main() {
|
||||||
override fun onReceive(context: Context, intent: Intent) {
|
override fun onReceive(context: Context, intent: Intent) {
|
||||||
when {
|
when {
|
||||||
intent.action.equals(INSTALL_COMPLETED) -> launchVanced()
|
intent.action.equals(INSTALL_COMPLETED) -> launchVanced()
|
||||||
else -> intent.action?.let { alertBuilder(it) }
|
intent.action.equals(INSTALL_BLOCKED) -> alertBuilder(INSTALL_BLOCKED)
|
||||||
|
intent.action.equals(INSTALL_FAILED) -> alertBuilder(INSTALL_FAILED)
|
||||||
|
intent.action.equals(INSTALL_ABORTED) -> alertBuilder(INSTALL_ABORTED)
|
||||||
|
intent.action.equals(INSTALL_STORAGE) -> alertBuilder(INSTALL_STORAGE)
|
||||||
|
intent.action.equals(INSTALL_CONFLICT) -> alertBuilder(INSTALL_CONFLICT)
|
||||||
|
intent.action.equals(INSTALL_INVALID) -> alertBuilder(INSTALL_INVALID)
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -177,6 +183,5 @@ class MainActivity : Main() {
|
||||||
const val INSTALL_CONFLICT = "app conflicts with already installed app"
|
const val INSTALL_CONFLICT = "app conflicts with already installed app"
|
||||||
const val INSTALL_FAILED = "it just failed idk"
|
const val INSTALL_FAILED = "it just failed idk"
|
||||||
const val INSTALL_INVALID = "apk files are invalid"
|
const val INSTALL_INVALID = "apk files are invalid"
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -80,44 +80,30 @@ class HomeFragment : Home() {
|
||||||
val microgRemoteVer =
|
val microgRemoteVer =
|
||||||
GetJson().AsJSONObject("https://x1nto.github.io/VancedFiles/microg.json")
|
GetJson().AsJSONObject("https://x1nto.github.io/VancedFiles/microg.json")
|
||||||
.get("version").asString
|
.get("version").asString
|
||||||
vancedLatestTxt?.text = vancedRemoteVer.toString()
|
vancedLatestTxt?.text = vancedRemoteVer
|
||||||
microgLatestTxt?.text = microgRemoteVer.toString()
|
microgLatestTxt?.text = microgRemoteVer
|
||||||
|
|
||||||
if (microgStatus!!) {
|
if (microgStatus!!) {
|
||||||
val microgVer =
|
val microgVer =
|
||||||
pm.getPackageInfo("com.mgoogle.android.gms", 0).versionName
|
pm.getPackageInfo("com.mgoogle.android.gms", 0).versionName
|
||||||
when {
|
if (microgRemoteVer == microgVer) {
|
||||||
microgRemoteVer > microgVer -> {
|
|
||||||
microginstallbtn?.text = activity?.getString(R.string.update)
|
|
||||||
microginstallbtn?.icon =
|
|
||||||
activity?.getDrawable(R.drawable.ic_cloud_upload_black_24dp)
|
|
||||||
}
|
|
||||||
microgRemoteVer == microgVer -> {
|
|
||||||
microginstallbtn?.text =
|
microginstallbtn?.text =
|
||||||
activity?.getString(R.string.button_installed)
|
activity?.getString(com.vanced.manager.R.string.button_installed)
|
||||||
microginstallbtn?.icon =
|
microginstallbtn?.icon =
|
||||||
activity?.getDrawable(R.drawable.outline_cloud_done_24)
|
activity?.getDrawable(com.vanced.manager.R.drawable.outline_cloud_done_24)
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (vancedStatus!!) {
|
if (vancedStatus!!) {
|
||||||
val vancedVer =
|
val vancedVer =
|
||||||
pm.getPackageInfo("com.vanced.android.youtube", 0).versionName
|
pm.getPackageInfo("com.vanced.android.youtube", 0).versionName
|
||||||
when {
|
if (vancedRemoteVer == vancedVer) {
|
||||||
vancedRemoteVer > vancedVer -> {
|
|
||||||
vancedinstallbtn?.text = activity?.getString(R.string.update)
|
|
||||||
vancedinstallbtn?.icon =
|
|
||||||
activity?.getDrawable(R.drawable.ic_cloud_upload_black_24dp)
|
|
||||||
}
|
|
||||||
vancedRemoteVer == vancedVer -> {
|
|
||||||
vancedinstallbtn?.text =
|
vancedinstallbtn?.text =
|
||||||
activity?.getString(R.string.button_installed)
|
activity?.getString(R.string.button_installed)
|
||||||
vancedinstallbtn?.icon =
|
vancedinstallbtn?.icon =
|
||||||
activity?.getDrawable(R.drawable.outline_cloud_done_24)
|
activity?.getDrawable(R.drawable.outline_cloud_done_24)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
val oa2 = ObjectAnimator.ofFloat(networkErrorLayout, "yFraction", 0f, 0.3f)
|
val oa2 = ObjectAnimator.ofFloat(networkErrorLayout, "yFraction", 0f, 0.3f)
|
||||||
val oa3 = ObjectAnimator.ofFloat(networkErrorLayout, "yFraction", 0.3f, -1f)
|
val oa3 = ObjectAnimator.ofFloat(networkErrorLayout, "yFraction", 0.3f, -1f)
|
||||||
|
|
Loading…
Reference in a new issue