mirror of
https://github.com/YTVanced/VancedManager
synced 2024-11-26 21:13:01 +00:00
test
This commit is contained in:
parent
aa7bade5ce
commit
b1fe32b2bd
2 changed files with 5 additions and 7 deletions
|
@ -2,6 +2,7 @@ package com.vanced.manager.core
|
|||
|
||||
import android.annotation.SuppressLint
|
||||
import android.app.PendingIntent
|
||||
import android.content.Context
|
||||
import android.content.Intent
|
||||
import android.content.pm.PackageInstaller
|
||||
import android.os.Bundle
|
||||
|
@ -48,6 +49,7 @@ open class Main: BaseActivity() {
|
|||
|
||||
override fun onDestroy() {
|
||||
super.onDestroy()
|
||||
getSharedPreferences("installPrefs", Context.MODE_PRIVATE).edit().putBoolean("isInstalling", false).apply()
|
||||
try {
|
||||
cacheDir.deleteRecursively()
|
||||
} catch (e: Exception) {
|
||||
|
|
|
@ -31,7 +31,7 @@ open class BaseFragment : Fragment() {
|
|||
|
||||
private var disposable: Disposable? = null
|
||||
private val prefs = activity?.getSharedPreferences("installPrefs", Context.MODE_PRIVATE)
|
||||
private val baseUrl = "https://x1nto.github.io/VancedFiles/Splits/"
|
||||
private val baseUrl = "https://x1nto.github.io/VancedFiles/Splits"
|
||||
|
||||
fun openUrl(Url: String, color: Int) {
|
||||
val builder = CustomTabsIntent.Builder()
|
||||
|
@ -79,7 +79,6 @@ open class BaseFragment : Fragment() {
|
|||
loadBar.progress = progress.percent().toInt()
|
||||
},
|
||||
onComplete = {
|
||||
loadBar.visibility = View.GONE
|
||||
downloadTheme(loadBar, dlText)
|
||||
},
|
||||
onError = { throwable ->
|
||||
|
@ -88,7 +87,7 @@ open class BaseFragment : Fragment() {
|
|||
)
|
||||
}
|
||||
private fun downloadTheme(loadBar: ProgressBar, dlText: TextView) {
|
||||
val theme = prefs?.getString("theme", "")
|
||||
val theme = prefs?.getString("theme", "dark")
|
||||
val url = "$baseUrl/Theme/$theme.apk"
|
||||
|
||||
val task = activity?.cacheDir?.path?.let {
|
||||
|
@ -107,12 +106,10 @@ open class BaseFragment : Fragment() {
|
|||
.subscribeBy(
|
||||
onNext = { progress ->
|
||||
val filename = getFileNameFromUrl(url)
|
||||
loadBar.visibility = View.VISIBLE
|
||||
dlText.text = "Downloading $filename..."
|
||||
loadBar.progress = progress.percent().toInt()
|
||||
},
|
||||
onComplete = {
|
||||
loadBar.visibility = View.GONE
|
||||
downloadLang(loadBar, dlText)
|
||||
},
|
||||
onError = { throwable ->
|
||||
|
@ -122,7 +119,7 @@ open class BaseFragment : Fragment() {
|
|||
}
|
||||
|
||||
private fun downloadLang(loadBar: ProgressBar, dlText: TextView) {
|
||||
val lang = prefs?.getString("lang", "")
|
||||
val lang = prefs?.getString("lang", "en")
|
||||
val url = "$baseUrl/Language/split_config.$lang.apk"
|
||||
|
||||
val task = activity?.cacheDir?.path?.let {
|
||||
|
@ -141,7 +138,6 @@ open class BaseFragment : Fragment() {
|
|||
.subscribeBy(
|
||||
onNext = { progress ->
|
||||
val filename = getFileNameFromUrl(url)
|
||||
loadBar.visibility = View.VISIBLE
|
||||
dlText.text = "Downloading $filename..."
|
||||
loadBar.progress = progress.percent().toInt()
|
||||
},
|
||||
|
|
Loading…
Reference in a new issue