mirror of
https://github.com/YTVanced/VancedManager
synced 2024-11-23 11:45:11 +00:00
Fixed bugs and improved performance
This commit is contained in:
parent
7b628da170
commit
c95a0eaf2b
21 changed files with 112 additions and 137 deletions
|
@ -67,7 +67,7 @@ dependencies {
|
|||
implementation 'androidx.activity:activity:1.1.0'
|
||||
implementation 'androidx.appcompat:appcompat:1.2.0'
|
||||
implementation 'androidx.browser:browser:1.2.0'
|
||||
implementation 'androidx.constraintlayout:constraintlayout:2.0.0'
|
||||
implementation 'androidx.constraintlayout:constraintlayout:2.0.1'
|
||||
implementation 'androidx.core:core-ktx:1.3.1'
|
||||
implementation 'androidx.fragment:fragment-ktx:1.2.5'
|
||||
implementation 'androidx.lifecycle:lifecycle-livedata-core-ktx:2.2.0'
|
||||
|
|
|
@ -7,6 +7,7 @@ import com.crowdin.platform.Crowdin
|
|||
import com.crowdin.platform.CrowdinConfig
|
||||
import com.crowdin.platform.data.remote.NetworkType
|
||||
import com.downloader.PRDownloader
|
||||
import com.vanced.manager.utils.InternetTools.baseUrl
|
||||
import com.vanced.manager.utils.JsonHelper.getJson
|
||||
import kotlinx.coroutines.CoroutineScope
|
||||
import kotlinx.coroutines.Dispatchers
|
||||
|
@ -14,33 +15,31 @@ import kotlinx.coroutines.launch
|
|||
|
||||
open class App: Application() {
|
||||
|
||||
lateinit var vanced : JsonObject
|
||||
lateinit var music: JsonObject
|
||||
lateinit var microg: JsonObject
|
||||
lateinit var manager: JsonObject
|
||||
var vanced: JsonObject? = null
|
||||
var music: JsonObject? = null
|
||||
var microg: JsonObject? = null
|
||||
var manager: JsonObject? = null
|
||||
|
||||
override fun onCreate() {
|
||||
loadJson()
|
||||
super.onCreate()
|
||||
PRDownloader.initialize(this)
|
||||
|
||||
//if (Build.VERSION.SDK_INT < Build.VERSION_CODES.R) {
|
||||
Crowdin.init(this,
|
||||
CrowdinConfig.Builder()
|
||||
.withDistributionHash("36c51aed3180a4f43073d28j4s6")
|
||||
.withNetworkType(NetworkType.WIFI)
|
||||
.build()
|
||||
)
|
||||
//}
|
||||
Crowdin.init(this,
|
||||
CrowdinConfig.Builder()
|
||||
.withDistributionHash("36c51aed3180a4f43073d28j4s6")
|
||||
.withNetworkType(NetworkType.WIFI)
|
||||
.build()
|
||||
)
|
||||
|
||||
}
|
||||
|
||||
fun loadJson() = CoroutineScope(Dispatchers.IO).launch {
|
||||
val latest = getJson("https://vanced.app/api/v1/latest.json")
|
||||
vanced = latest.obj("vanced")!!
|
||||
music = latest.obj("music")!!
|
||||
microg = latest.obj("microg")!!
|
||||
manager = latest.obj("manager")!!
|
||||
val latest = getJson("$baseUrl/latest.json")
|
||||
vanced = latest.obj("vanced")
|
||||
music = latest.obj("music")
|
||||
microg = latest.obj("microg")
|
||||
manager = latest.obj("manager")
|
||||
}
|
||||
|
||||
override fun onConfigurationChanged(newConfig: Configuration) {
|
||||
|
|
|
@ -29,21 +29,22 @@ object MicrogDownloader {
|
|||
.build()
|
||||
.setOnStartOrResumeListener {
|
||||
installing = true
|
||||
microgProgress.get()?.setDownloadingFile(getFileNameFromUrl(url))
|
||||
microgProgress.get()?.showDownloadBar = true
|
||||
microgProgress.get()?.downloadingFile?.set(context.getString(R.string.downloading_file, getFileNameFromUrl(url)))
|
||||
microgProgress.get()?.showDownloadBar?.set(true)
|
||||
}
|
||||
.setOnProgressListener { progress ->
|
||||
microgProgress.get()?.setDownloadProgress((progress.currentBytes * 100 / progress.totalBytes).toInt())
|
||||
microgProgress.get()?.downloadProgress?.set((progress.currentBytes * 100 / progress.totalBytes).toInt())
|
||||
}
|
||||
.start(object : OnDownloadListener {
|
||||
override fun onDownloadComplete() {
|
||||
install("microg", "${context.getExternalFilesDir("apk")}/microg.apk", context)
|
||||
microgProgress.get()?.showDownloadBar = false
|
||||
microgProgress.get()?.showInstallCircle = true
|
||||
microgProgress.get()?.showDownloadBar?.set(false)
|
||||
microgProgress.get()?.showInstallCircle?.set(true)
|
||||
}
|
||||
|
||||
override fun onError(error: Error?) {
|
||||
installing = false
|
||||
microgProgress.get()?.showDownloadBar?.set(false)
|
||||
Toast.makeText(context, context.getString(R.string.error_downloading, "microG"), Toast.LENGTH_SHORT).show()
|
||||
}
|
||||
})
|
||||
|
|
|
@ -30,21 +30,22 @@ object MusicDownloader {
|
|||
.build()
|
||||
.setOnStartOrResumeListener {
|
||||
installing = true
|
||||
musicProgress.get()?.setDownloadingFile(getFileNameFromUrl(url))
|
||||
musicProgress.get()?.showDownloadBar = true
|
||||
musicProgress.get()?.downloadingFile?.set(context.getString(R.string.downloading_file, getFileNameFromUrl(url)))
|
||||
musicProgress.get()?.showDownloadBar?.set(true)
|
||||
}
|
||||
.setOnProgressListener { progress ->
|
||||
musicProgress.get()?.setDownloadProgress((progress.currentBytes * 100 / progress.totalBytes).toInt())
|
||||
musicProgress.get()?.downloadProgress?.set((progress.currentBytes * 100 / progress.totalBytes).toInt())
|
||||
}
|
||||
.start(object : OnDownloadListener {
|
||||
override fun onDownloadComplete() {
|
||||
install("music", "${context.getExternalFilesDir("apk")}/music.apk", context)
|
||||
musicProgress.get()?.showDownloadBar = false
|
||||
musicProgress.get()?.showInstallCircle = true
|
||||
musicProgress.get()?.showDownloadBar?.set(false)
|
||||
musicProgress.get()?.showInstallCircle?.set(true)
|
||||
}
|
||||
|
||||
override fun onError(error: Error?) {
|
||||
installing = false
|
||||
musicProgress.get()?.showDownloadBar?.set(false)
|
||||
Toast.makeText(context, context.getString(R.string.error_downloading, "Music"), Toast.LENGTH_SHORT).show()
|
||||
}
|
||||
})
|
||||
|
|
|
@ -37,7 +37,7 @@ object VancedDownloader {
|
|||
private var variant: String? = null
|
||||
private var theme: String? = null
|
||||
private var lang: Array<String>? = null
|
||||
private var newInstaller: Boolean? = null
|
||||
//private var newInstaller: Boolean? = null
|
||||
|
||||
private lateinit var themePath: String
|
||||
|
||||
|
@ -61,7 +61,7 @@ object VancedDownloader {
|
|||
theme = prefs.getString("theme", "dark")
|
||||
themePath = "$installUrl/apks/v$vancedVersion/$variant/Theme"
|
||||
hashUrl = "apks/v$vancedVersion/$variant/Theme/hash.json"
|
||||
newInstaller = defPrefs.getBoolean("new_installer", false)
|
||||
//newInstaller = defPrefs.getBoolean("new_installer", false)
|
||||
arch =
|
||||
when {
|
||||
Build.SUPPORTED_ABIS.contains("x86") -> "x86"
|
||||
|
@ -94,18 +94,18 @@ object VancedDownloader {
|
|||
.download(url, context.getExternalFilesDir("apks")?.path, getFileNameFromUrl(url))
|
||||
.build()
|
||||
.setOnStartOrResumeListener {
|
||||
installing = true
|
||||
vancedProgress.get()?.setDownloadingFile(getFileNameFromUrl(url))
|
||||
vancedProgress.get()?.showDownloadBar = true
|
||||
installing = true
|
||||
vancedProgress.get()?.downloadingFile?.set(context.getString(R.string.downloading_file, getFileNameFromUrl(url)))
|
||||
vancedProgress.get()?.showDownloadBar?.set(true)
|
||||
}
|
||||
.setOnProgressListener { progress ->
|
||||
vancedProgress.get()?.setDownloadProgress((progress.currentBytes * 100 / progress.totalBytes).toInt())
|
||||
vancedProgress.get()?.downloadProgress?.set((progress.currentBytes * 100 / progress.totalBytes).toInt())
|
||||
}
|
||||
.start(object : OnDownloadListener {
|
||||
override fun onDownloadComplete() {
|
||||
when (type) {
|
||||
"theme" ->
|
||||
if (variant == "root" && newInstaller == true) {
|
||||
if (variant == "root") {
|
||||
if (validateTheme(context)) {
|
||||
if(downloadStockCheck(context))
|
||||
downloadSplits(context, "arch")
|
||||
|
@ -115,7 +115,7 @@ object VancedDownloader {
|
|||
downloadSplits(context, "theme")
|
||||
} else
|
||||
downloadSplits(context, "arch")
|
||||
"arch" -> if (variant == "root" && newInstaller == true) downloadSplits(context, "stock") else downloadSplits(context, "lang")
|
||||
"arch" -> if (variant == "root") downloadSplits(context, "stock") else downloadSplits(context, "lang")
|
||||
"stock" -> downloadSplits(context, "dpi")
|
||||
"dpi" -> downloadSplits(context, "lang")
|
||||
"lang" -> {
|
||||
|
@ -137,6 +137,7 @@ object VancedDownloader {
|
|||
prepareInstall(variant!!, context)
|
||||
} else {
|
||||
installing = false
|
||||
vancedProgress.get()?.showDownloadBar?.set(false)
|
||||
Toast.makeText(context, context.getString(R.string.error_downloading, "Vanced"), Toast.LENGTH_SHORT).show()
|
||||
}
|
||||
}
|
||||
|
@ -194,8 +195,8 @@ object VancedDownloader {
|
|||
*/
|
||||
|
||||
private fun prepareInstall(variant: String, context: Context) {
|
||||
vancedProgress.get()?.showDownloadBar = false
|
||||
vancedProgress.get()?.showInstallCircle = true
|
||||
vancedProgress.get()?.showDownloadBar?.set(false)
|
||||
vancedProgress.get()?.showInstallCircle?.set(true)
|
||||
if (variant == "root")
|
||||
installVancedRoot(context)
|
||||
else
|
||||
|
|
|
@ -8,6 +8,7 @@ import android.util.Log
|
|||
import com.vanced.manager.ui.viewmodels.HomeViewModel.Companion.microgProgress
|
||||
import com.vanced.manager.ui.viewmodels.HomeViewModel.Companion.musicProgress
|
||||
import com.vanced.manager.utils.AppUtils.sendFailure
|
||||
import com.vanced.manager.utils.AppUtils.sendRefresh
|
||||
|
||||
class AppInstallerService: Service() {
|
||||
|
||||
|
@ -25,7 +26,8 @@ class AppInstallerService: Service() {
|
|||
}
|
||||
PackageInstaller.STATUS_SUCCESS -> {
|
||||
Log.d(TAG, "Installation succeed")
|
||||
if (intent.getStringExtra("app") == "microg") microgProgress.get()?.showInstallCircle = false else musicProgress.get()?.showInstallCircle = false
|
||||
if (intent.getStringExtra("app") == "microg") microgProgress.get()?.showInstallCircle?.set(false) else musicProgress.get()?.showInstallCircle?.set(false)
|
||||
sendRefresh(this)
|
||||
}
|
||||
else -> sendFailure(intent.getIntExtra(PackageInstaller.EXTRA_STATUS, -999), this)
|
||||
}
|
||||
|
|
|
@ -24,7 +24,7 @@ class SplitInstallerService: Service() {
|
|||
}
|
||||
PackageInstaller.STATUS_SUCCESS -> {
|
||||
Log.d(TAG, "Installation succeed")
|
||||
vancedProgress.get()?.showInstallCircle = false
|
||||
vancedProgress.get()?.showInstallCircle?.set(false)
|
||||
sendRefresh(this)
|
||||
}
|
||||
else -> sendFailure(intent.getIntExtra(PackageInstaller.EXTRA_STATUS, -999), this)
|
||||
|
|
|
@ -4,60 +4,46 @@ import android.content.Context
|
|||
import android.graphics.drawable.Drawable
|
||||
import android.os.Build
|
||||
import androidx.core.content.ContextCompat
|
||||
import androidx.databinding.ObservableBoolean
|
||||
import androidx.databinding.ObservableField
|
||||
import androidx.databinding.ObservableInt
|
||||
import com.beust.klaxon.JsonObject
|
||||
import com.vanced.manager.R
|
||||
import com.vanced.manager.utils.InternetTools.baseUrl
|
||||
import com.vanced.manager.utils.InternetTools.getObjectFromJson
|
||||
import com.vanced.manager.utils.PackageHelper.isPackageInstalled
|
||||
import kotlinx.coroutines.Dispatchers
|
||||
import kotlinx.coroutines.runBlocking
|
||||
|
||||
open class DataModel(
|
||||
private val jsonObject: JsonObject,
|
||||
jsonObject: JsonObject?,
|
||||
variant: String = "nonroot",
|
||||
app: String,
|
||||
private val context: Context
|
||||
) {
|
||||
|
||||
private val appPkg =
|
||||
when (jsonObject.toString()) {
|
||||
when (app) {
|
||||
"vanced" -> if (variant == "root") "com.google.android.youtube" else "com.vanced.android.youtube"
|
||||
"microg" -> "com.mgoogle.android.gms"
|
||||
else -> "com.vanced.android.apps.youtube.music"
|
||||
}
|
||||
|
||||
/*
|
||||
private var versionName: String = ""
|
||||
private var installedVersionName: String = ""
|
||||
private var changelog: String = ""
|
||||
|
||||
private var versionCode: Int = 0
|
||||
private var installedVersionCode: Int = 0
|
||||
*/
|
||||
|
||||
open fun isAppInstalled(): Boolean = isPackageInstalled(appPkg, context.packageManager)
|
||||
|
||||
open fun getVersionName(): String = jsonObject.string("version")!!
|
||||
|
||||
open fun getVersionCode(): Int = jsonObject.int("versionCode")!!
|
||||
|
||||
open fun getInstalledVersionName(): String = runBlocking(Dispatchers.IO) {
|
||||
getPkgVersionName(isAppInstalled(), appPkg)
|
||||
}
|
||||
|
||||
open fun getInstalledVersionCode(): Int = runBlocking(Dispatchers.IO) {
|
||||
getPkgVersionCode(isAppInstalled(), appPkg)
|
||||
}
|
||||
|
||||
open fun getButtonTxt(): String = compareInt(getInstalledVersionCode(), getVersionCode())
|
||||
|
||||
open fun getButtonIcon(): Drawable? = compareIntDrawable(getInstalledVersionCode(), getVersionCode())
|
||||
|
||||
open fun getChangelog(): String = runBlocking(Dispatchers.IO) {
|
||||
when (jsonObject.toString()) {
|
||||
"vanced" -> getObjectFromJson("$baseUrl/changelog/${getVersionName().replace('.', '_')}.json", "message")
|
||||
"music" -> jsonObject.string("changelog")!!
|
||||
else -> getObjectFromJson("https://ytvanced.github.io/VancedBackend/$jsonObject.json", "changelog")
|
||||
}
|
||||
private val versionCode = ObservableInt()
|
||||
private val installedVersionCode = ObservableInt()
|
||||
|
||||
val isAppInstalled = ObservableBoolean()
|
||||
val versionName = ObservableField<String>()
|
||||
val installedVersionName = ObservableField<String>()
|
||||
val buttonTxt = ObservableField<String>()
|
||||
val buttonIcon = ObservableField<Drawable>()
|
||||
val changelog = ObservableField<String>()
|
||||
|
||||
init {
|
||||
isAppInstalled.set(isPackageInstalled(appPkg, context.packageManager))
|
||||
versionName.set(jsonObject?.string("version")?.removeSuffix("-vanced") ?: context.getString(R.string.unavailable))
|
||||
installedVersionName.set(getPkgVersionName(isAppInstalled.get(), appPkg))
|
||||
versionCode.set(jsonObject?.int("versionCode")?: 0)
|
||||
installedVersionCode.set(getPkgVersionCode(isAppInstalled.get(), appPkg))
|
||||
buttonTxt.set(compareInt(installedVersionCode.get(), versionCode.get()))
|
||||
buttonIcon.set(compareIntDrawable(installedVersionCode.get(), versionCode.get()))
|
||||
changelog.set(jsonObject?.string("changelog") ?: context.getString(R.string.unavailable))
|
||||
}
|
||||
|
||||
private fun getPkgVersionName(toCheck: Boolean, pkg: String): String {
|
||||
|
|
|
@ -1,27 +1,21 @@
|
|||
package com.vanced.manager.model
|
||||
|
||||
import androidx.databinding.ObservableBoolean
|
||||
import androidx.databinding.ObservableField
|
||||
import androidx.databinding.ObservableInt
|
||||
|
||||
open class ProgressModel {
|
||||
|
||||
private var downloadProgress = 0
|
||||
private var downloadingFile = ""
|
||||
|
||||
var showInstallCircle = false
|
||||
var showDownloadBar = false
|
||||
|
||||
open fun getDownloadProgress(): Int {
|
||||
return downloadProgress
|
||||
}
|
||||
|
||||
open fun setDownloadProgress(progress: Int) {
|
||||
downloadProgress = progress
|
||||
}
|
||||
|
||||
open fun getDownloadingFile(): String {
|
||||
return downloadingFile
|
||||
}
|
||||
|
||||
open fun setDownloadingFile(file: String) {
|
||||
downloadingFile = file
|
||||
val downloadProgress = ObservableInt()
|
||||
val downloadingFile = ObservableField<String>()
|
||||
val showInstallCircle = ObservableBoolean()
|
||||
var showDownloadBar = ObservableBoolean()
|
||||
|
||||
init {
|
||||
downloadProgress.set(0)
|
||||
downloadingFile.set("")
|
||||
showInstallCircle.set(false)
|
||||
showDownloadBar.set(false)
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -57,17 +57,17 @@ open class HomeFragment : Fragment(), View.OnClickListener {
|
|||
includeChangelogsLayout.changelogButton.setOnClickListener(this@HomeFragment)
|
||||
|
||||
includeVancedLayout.vancedCard.setOnLongClickListener {
|
||||
versionToast("Vanced", viewModel?.vanced?.get()?.getInstalledVersionName()!!)
|
||||
versionToast("Vanced", viewModel?.vanced?.get()?.installedVersionName?.get()!!)
|
||||
true
|
||||
}
|
||||
|
||||
includeMusicLayout.musicCard.setOnLongClickListener {
|
||||
versionToast("Music", viewModel?.music?.get()?.getInstalledVersionName()!!)
|
||||
versionToast("Music", viewModel?.music?.get()?.installedVersionName?.get()!!)
|
||||
true
|
||||
}
|
||||
|
||||
includeMicrogLayout.microgCard.setOnLongClickListener {
|
||||
versionToast("MicroG", viewModel?.microg?.get()?.getInstalledVersionName()!!)
|
||||
versionToast("MicroG", viewModel?.microg?.get()?.installedVersionName?.get()!!)
|
||||
true
|
||||
}
|
||||
}
|
||||
|
@ -145,7 +145,7 @@ open class HomeFragment : Fragment(), View.OnClickListener {
|
|||
installAlertBuilder(intent.getStringExtra("errorMsg") as String, requireActivity())
|
||||
installing = false
|
||||
}
|
||||
REFRESH_HOME -> viewModel.fetchData(false)
|
||||
REFRESH_HOME -> viewModel.fetchData()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -11,13 +11,11 @@ import android.widget.LinearLayout
|
|||
import androidx.core.content.res.ResourcesCompat
|
||||
import androidx.fragment.app.Fragment
|
||||
import androidx.navigation.findNavController
|
||||
import androidx.preference.PreferenceManager
|
||||
import com.google.android.material.button.MaterialButton
|
||||
import com.google.android.material.checkbox.MaterialCheckBox
|
||||
import com.vanced.manager.R
|
||||
import com.vanced.manager.core.App
|
||||
import com.vanced.manager.core.downloader.VancedDownloader.downloadVanced
|
||||
import com.vanced.manager.utils.InternetTools.baseUrl
|
||||
import com.vanced.manager.utils.InternetTools.getArrayFromJson
|
||||
import kotlinx.coroutines.CoroutineScope
|
||||
import kotlinx.coroutines.Dispatchers
|
||||
import kotlinx.coroutines.launch
|
||||
|
@ -38,9 +36,8 @@ class VancedLanguageSelectionFragment : Fragment() {
|
|||
@ExperimentalStdlibApi
|
||||
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
||||
super.onViewCreated(view, savedInstanceState)
|
||||
CoroutineScope(Dispatchers.IO).launch {
|
||||
langs = getArrayFromJson("${PreferenceManager.getDefaultSharedPreferences(requireActivity()).getString("install_url", baseUrl)}/vanced.json", "langs")
|
||||
}
|
||||
val app = activity?.application as App
|
||||
langs = app.vanced?.array<String>("langs")?.value ?: mutableListOf("null")
|
||||
loadBoxes(view.findViewById(R.id.lang_button_ll))
|
||||
view.findViewById<MaterialButton>(R.id.vanced_install_finish).setOnClickListener {
|
||||
val chosenLangs = mutableListOf("en")
|
||||
|
|
|
@ -27,6 +27,7 @@ import com.vanced.manager.utils.PackageHelper.uninstallApk
|
|||
import kotlinx.coroutines.CoroutineScope
|
||||
import kotlinx.coroutines.Dispatchers
|
||||
import kotlinx.coroutines.launch
|
||||
import okhttp3.internal.wait
|
||||
|
||||
open class HomeViewModel(application: Application): AndroidViewModel(application) {
|
||||
|
||||
|
@ -46,15 +47,11 @@ open class HomeViewModel(application: Application): AndroidViewModel(application
|
|||
|
||||
val navigateDestination : LiveData<Event<Int>> = _navigateDestination
|
||||
|
||||
fun fetchData(firstInit: Boolean) {
|
||||
fun fetchData() {
|
||||
CoroutineScope(Dispatchers.IO).launch {
|
||||
fetching.set(true)
|
||||
if (!firstInit) managerApp.loadJson()
|
||||
managerApp.loadJson()
|
||||
Crowdin.forceUpdate(getApplication())
|
||||
vanced.set(DataModel(managerApp.vanced, variant, app))
|
||||
microg.set(DataModel(managerApp.microg, context = app))
|
||||
music.set(DataModel(managerApp.music, context = app))
|
||||
manager.set(DataModel(managerApp.manager, context = app))
|
||||
fetching.set(false)
|
||||
}
|
||||
}
|
||||
|
@ -100,7 +97,7 @@ open class HomeViewModel(application: Application): AndroidViewModel(application
|
|||
fun installVanced() {
|
||||
if (!installing) {
|
||||
if (!fetching.get()) {
|
||||
if (variant == "nonroot" && !microg.get()?.isAppInstalled()!!) {
|
||||
if (variant == "nonroot" && !microg.get()?.isAppInstalled?.get()!!) {
|
||||
microgToast.show()
|
||||
} else {
|
||||
if (app.getSharedPreferences("installPrefs", Context.MODE_PRIVATE).getBoolean("valuesModified", false)) {
|
||||
|
@ -117,7 +114,7 @@ open class HomeViewModel(application: Application): AndroidViewModel(application
|
|||
fun installMusic() {
|
||||
if (!installing) {
|
||||
if (!fetching.get()) {
|
||||
if (!microg.get()?.isAppInstalled()!!) {
|
||||
if (!microg.get()?.isAppInstalled?.get()!!) {
|
||||
microgToast.show()
|
||||
} else {
|
||||
downloadMusic(getApplication())
|
||||
|
@ -145,8 +142,17 @@ open class HomeViewModel(application: Application): AndroidViewModel(application
|
|||
}
|
||||
|
||||
init {
|
||||
fetching.set(true)
|
||||
while (managerApp.manager == null)
|
||||
this.wait()
|
||||
vanced.set(DataModel(managerApp.vanced, variant, "vanced", app))
|
||||
microg.set(DataModel(managerApp.microg, app = "microg", context = app))
|
||||
music.set(DataModel(managerApp.music, app = "music", context = app))
|
||||
manager.set(DataModel(managerApp.manager, app = "manager", context = app))
|
||||
vancedProgress.set(ProgressModel())
|
||||
musicProgress.set(ProgressModel())
|
||||
microgProgress.set(ProgressModel())
|
||||
fetching.set(false)
|
||||
fetchData(true)
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -75,7 +75,7 @@ object PackageHelper {
|
|||
val pendingIntent = PendingIntent.getService(context, 0, callbackIntent, 0)
|
||||
val packageInstaller = context.packageManager.packageInstaller
|
||||
val params = PackageInstaller.SessionParams(PackageInstaller.SessionParams.MODE_FULL_INSTALL)
|
||||
params.setAppPackageName(if (app == "microg") "com.mgoogle.android.gms" else "com.vanced.android.music")
|
||||
params.setAppPackageName(if (app == "microg") "com.mgoogle.android.gms" else "com.vanced.android.apps.youtube.music")
|
||||
val sessionId = packageInstaller.createSession(params)
|
||||
val session = packageInstaller.openSession(sessionId)
|
||||
val inputStream: InputStream = FileInputStream(path)
|
||||
|
|
|
@ -7,8 +7,7 @@
|
|||
android:id="@+id/container"
|
||||
android:background="?colorSurface"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:animateLayoutChanges="true">
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<com.google.android.material.appbar.AppBarLayout
|
||||
android:id="@+id/home_appbar"
|
||||
|
|
|
@ -18,12 +18,11 @@
|
|||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
bind:refreshing="@{viewModel.fetching}"
|
||||
bind:onRefreshListener="@{()-> viewModel.fetchData(false)}">
|
||||
bind:onRefreshListener="@{()-> viewModel.fetchData()}">
|
||||
|
||||
<androidx.core.widget.NestedScrollView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:animateLayoutChanges="true"
|
||||
android:fillViewport="true"
|
||||
android:scrollbars="none">
|
||||
|
||||
|
|
|
@ -1,10 +1,9 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<layout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools">
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto">
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
<FrameLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
|
@ -13,13 +12,9 @@
|
|||
android:layout_height="match_parent"
|
||||
android:id="@+id/nav_host"
|
||||
android:name="androidx.navigation.fragment.NavHostFragment"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:defaultNavHost="true"
|
||||
app:navGraph="@navigation/mobile_navigation" />
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
</FrameLayout>
|
||||
|
||||
</layout>
|
||||
|
|
|
@ -23,7 +23,6 @@
|
|||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="1dp"
|
||||
android:layout_marginEnd="1dp"
|
||||
android:animateLayoutChanges="true"
|
||||
android:orientation="vertical">
|
||||
|
||||
<RelativeLayout
|
||||
|
|
|
@ -21,7 +21,6 @@
|
|||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:animateLayoutChanges="true"
|
||||
android:orientation="vertical">
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
|
|
|
@ -21,7 +21,6 @@
|
|||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:animateLayoutChanges="true"
|
||||
android:orientation="vertical">
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
|
|
|
@ -15,8 +15,7 @@
|
|||
<com.google.android.material.card.MaterialCardView
|
||||
style="@style/MaterialCard"
|
||||
app:contentPaddingTop="2dp"
|
||||
app:contentPaddingBottom="8dp"
|
||||
android:animateLayoutChanges="true">
|
||||
app:contentPaddingBottom="8dp">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
|
|
|
@ -22,7 +22,6 @@
|
|||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:animateLayoutChanges="true"
|
||||
android:orientation="vertical">
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
|
|
Loading…
Reference in a new issue