mirror of
https://github.com/YTVanced/VancedManager
synced 2024-11-17 16:55:10 +00:00
revert changes
This commit is contained in:
parent
732e5439ce
commit
beb9aef239
2 changed files with 35 additions and 39 deletions
|
@ -34,10 +34,45 @@ open class Home : BaseFragment() {
|
||||||
val microgsettingsbtn = view.findViewById<ImageView>(R.id.microg_settingsbtn)
|
val microgsettingsbtn = view.findViewById<ImageView>(R.id.microg_settingsbtn)
|
||||||
val vanceduninstallbtn = view.findViewById<ImageView>(R.id.vanced_uninstallbtn)
|
val vanceduninstallbtn = view.findViewById<ImageView>(R.id.vanced_uninstallbtn)
|
||||||
|
|
||||||
|
val microgProgress = view.findViewById<ProgressBar>(R.id.microg_progress)
|
||||||
|
val prefs = activity?.getSharedPreferences("installPrefs", Context.MODE_PRIVATE)
|
||||||
|
val isDownloading: Boolean? = prefs?.getBoolean("isDownloading", false)
|
||||||
|
|
||||||
//we need to check whether these apps are installed or not
|
//we need to check whether these apps are installed or not
|
||||||
val microgStatus = pm?.let { isPackageInstalled("com.mgoogle.android.gms", it) }
|
val microgStatus = pm?.let { isPackageInstalled("com.mgoogle.android.gms", it) }
|
||||||
val vancedStatus = pm?.let { isPackageInstalled("com.vanced.android.youtube", it) }
|
val vancedStatus = pm?.let { isPackageInstalled("com.vanced.android.youtube", it) }
|
||||||
|
|
||||||
|
vancedinstallbtn.setOnClickListener {
|
||||||
|
if (!isDownloading!!) {
|
||||||
|
try {
|
||||||
|
activity?.cacheDir?.deleteRecursively()
|
||||||
|
} catch (e: Exception) {
|
||||||
|
Log.d("VMCache", "Unable to delete cacheDir")
|
||||||
|
}
|
||||||
|
view.findNavController().navigate(R.id.toInstallVariantFragment)
|
||||||
|
} else {
|
||||||
|
Toast.makeText(activity, "Please wait until installation finishes", Toast.LENGTH_SHORT).show()
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
microginstallbtn.setOnClickListener {
|
||||||
|
if (!isDownloading!!) {
|
||||||
|
val dlText = view.findViewById<TextView>(R.id.microg_downloading)
|
||||||
|
try {
|
||||||
|
installApk(
|
||||||
|
"https://x1nto.github.io/VancedFiles/microg.json",
|
||||||
|
microgProgress,
|
||||||
|
dlText
|
||||||
|
)
|
||||||
|
} catch (e: Exception) {
|
||||||
|
Toast.makeText(activity, "Unable to start installation", Toast.LENGTH_SHORT).show()
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
Toast.makeText(activity, "Please wait until installation finishes", Toast.LENGTH_SHORT).show()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
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 = pm.getPackageInfo("com.mgoogle.android.gms", 0).versionName
|
val microgVer = pm.getPackageInfo("com.mgoogle.android.gms", 0).versionName
|
||||||
|
|
|
@ -1,15 +1,10 @@
|
||||||
package com.vanced.manager.ui.fragments
|
package com.vanced.manager.ui.fragments
|
||||||
|
|
||||||
import android.animation.ObjectAnimator
|
import android.animation.ObjectAnimator
|
||||||
import android.content.Context
|
|
||||||
import android.os.Bundle
|
import android.os.Bundle
|
||||||
import android.util.Log
|
|
||||||
import android.view.*
|
import android.view.*
|
||||||
import android.widget.ProgressBar
|
|
||||||
import android.widget.TextView
|
import android.widget.TextView
|
||||||
import android.widget.Toast
|
|
||||||
import androidx.core.animation.addListener
|
import androidx.core.animation.addListener
|
||||||
import androidx.navigation.findNavController
|
|
||||||
import androidx.viewpager2.widget.ViewPager2
|
import androidx.viewpager2.widget.ViewPager2
|
||||||
import com.dezlum.codelabs.getjson.GetJson
|
import com.dezlum.codelabs.getjson.GetJson
|
||||||
import com.github.pwittchen.reactivenetwork.library.rx2.ReactiveNetwork
|
import com.github.pwittchen.reactivenetwork.library.rx2.ReactiveNetwork
|
||||||
|
@ -69,9 +64,6 @@ class HomeFragment : Home() {
|
||||||
val vancedLatestTxt = view?.findViewById<TextView>(R.id.vanced_latest_version)
|
val vancedLatestTxt = view?.findViewById<TextView>(R.id.vanced_latest_version)
|
||||||
val microgLatestTxt = view?.findViewById<TextView>(R.id.microg_latest_version)
|
val microgLatestTxt = view?.findViewById<TextView>(R.id.microg_latest_version)
|
||||||
val networkErrorLayout = view?.findViewById<MaterialCardView>(R.id.home_network_wrapper)
|
val networkErrorLayout = view?.findViewById<MaterialCardView>(R.id.home_network_wrapper)
|
||||||
val prefs = activity?.getSharedPreferences("installPrefs", Context.MODE_PRIVATE)
|
|
||||||
val microgProgress = view?.findViewById<ProgressBar>(R.id.microg_progress)
|
|
||||||
val isDownloading: Boolean? = prefs?.getBoolean("isDownloading", false)
|
|
||||||
|
|
||||||
disposable = ReactiveNetwork.observeInternetConnectivity()
|
disposable = ReactiveNetwork.observeInternetConnectivity()
|
||||||
.subscribeOn(Schedulers.io())
|
.subscribeOn(Schedulers.io())
|
||||||
|
@ -91,37 +83,6 @@ class HomeFragment : Home() {
|
||||||
vancedLatestTxt?.text = vancedRemoteVer
|
vancedLatestTxt?.text = vancedRemoteVer
|
||||||
microgLatestTxt?.text = microgRemoteVer
|
microgLatestTxt?.text = microgRemoteVer
|
||||||
|
|
||||||
vancedinstallbtn?.setOnClickListener {
|
|
||||||
if (!isDownloading!!) {
|
|
||||||
try {
|
|
||||||
activity?.cacheDir?.deleteRecursively()
|
|
||||||
} catch (e: Exception) {
|
|
||||||
Log.d("VMCache", "Unable to delete cacheDir")
|
|
||||||
}
|
|
||||||
view?.findNavController()?.navigate(R.id.toInstallVariantFragment)
|
|
||||||
} else {
|
|
||||||
Toast.makeText(activity, "Please wait until installation finishes", Toast.LENGTH_SHORT).show()
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
microginstallbtn?.setOnClickListener {
|
|
||||||
if (!isDownloading!!) {
|
|
||||||
val dlText = view?.findViewById<TextView>(R.id.microg_downloading)
|
|
||||||
try {
|
|
||||||
installApk(
|
|
||||||
"https://x1nto.github.io/VancedFiles/microg.json",
|
|
||||||
microgProgress!!,
|
|
||||||
dlText!!
|
|
||||||
)
|
|
||||||
} catch (e: Exception) {
|
|
||||||
Toast.makeText(activity, "Unable to start installation", Toast.LENGTH_SHORT).show()
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
Toast.makeText(activity, "Please wait until installation finishes", Toast.LENGTH_SHORT).show()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (microgStatus!!) {
|
if (microgStatus!!) {
|
||||||
val microgVer =
|
val microgVer =
|
||||||
pm.getPackageInfo("com.mgoogle.android.gms", 0).versionName
|
pm.getPackageInfo("com.mgoogle.android.gms", 0).versionName
|
||||||
|
|
Loading…
Reference in a new issue