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

changes regarding to buttons

This commit is contained in:
X1nto 2020-05-28 13:35:27 +04:00
parent ab89070452
commit 37cc8ae766
4 changed files with 21 additions and 35 deletions

View file

@ -4,7 +4,6 @@ import android.content.ActivityNotFoundException
import android.content.ComponentName
import android.content.Context
import android.content.Intent
import android.os.Build
import android.os.Bundle
import android.util.Log
import android.view.View
@ -76,11 +75,7 @@ open class Home : BaseFragment() {
val microgVerText = view.findViewById<TextView>(R.id.microg_installed_version)
if (microgStatus!!) {
val microgVer = if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) {
pm.getPackageInfo("com.mgoogle.android.gms", 0).longVersionCode
} else {
pm.getPackageInfo("com.mgoogle.android.gms", 0).versionCode
}
val microgVer = pm.getPackageInfo("com.mgoogle.android.gms", 0).versionName
microguninstallbtn.setOnClickListener {
uninstallApk("com.mgoogle.android.gms")

View file

@ -67,7 +67,7 @@ class SplitInstallerService: Service() {
getSharedPreferences("installPrefs", Context.MODE_PRIVATE).edit().putBoolean("isInstalling", false).apply()
Log.d(TAG, "Installation failed")
val mIntent = Intent(MainActivity.INSTALL_FAILED)
mIntent.action = MainActivity.INSTALL_ABORTED
mIntent.action = MainActivity.INSTALL_FAILED
LocalBroadcastManager.getInstance(this).sendBroadcast(mIntent)
}
}

View file

@ -48,7 +48,13 @@ class MainActivity : Main() {
override fun onReceive(context: Context, intent: Intent) {
when {
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_FAILED = "it just failed idk"
const val INSTALL_INVALID = "apk files are invalid"
}
}

View file

@ -80,42 +80,28 @@ class HomeFragment : Home() {
val microgRemoteVer =
GetJson().AsJSONObject("https://x1nto.github.io/VancedFiles/microg.json")
.get("version").asString
vancedLatestTxt?.text = vancedRemoteVer.toString()
microgLatestTxt?.text = microgRemoteVer.toString()
vancedLatestTxt?.text = vancedRemoteVer
microgLatestTxt?.text = microgRemoteVer
if (microgStatus!!) {
val microgVer =
pm.getPackageInfo("com.mgoogle.android.gms", 0).versionName
when {
microgRemoteVer > microgVer -> {
microginstallbtn?.text = activity?.getString(R.string.update)
microginstallbtn?.icon =
activity?.getDrawable(R.drawable.ic_cloud_upload_black_24dp)
}
microgRemoteVer == microgVer -> {
microginstallbtn?.text =
activity?.getString(R.string.button_installed)
microginstallbtn?.icon =
activity?.getDrawable(R.drawable.outline_cloud_done_24)
}
if (microgRemoteVer == microgVer) {
microginstallbtn?.text =
activity?.getString(com.vanced.manager.R.string.button_installed)
microginstallbtn?.icon =
activity?.getDrawable(com.vanced.manager.R.drawable.outline_cloud_done_24)
}
}
if (vancedStatus!!) {
val vancedVer =
pm.getPackageInfo("com.vanced.android.youtube", 0).versionName
when {
vancedRemoteVer > vancedVer -> {
vancedinstallbtn?.text = activity?.getString(R.string.update)
vancedinstallbtn?.icon =
activity?.getDrawable(R.drawable.ic_cloud_upload_black_24dp)
}
vancedRemoteVer == vancedVer -> {
vancedinstallbtn?.text =
activity?.getString(R.string.button_installed)
vancedinstallbtn?.icon =
activity?.getDrawable(R.drawable.outline_cloud_done_24)
}
if (vancedRemoteVer == vancedVer) {
vancedinstallbtn?.text =
activity?.getString(R.string.button_installed)
vancedinstallbtn?.icon =
activity?.getDrawable(R.drawable.outline_cloud_done_24)
}
}