From c95a0eaf2b9e2c5057844805e18aa07d9a537481 Mon Sep 17 00:00:00 2001 From: Xinto Date: Thu, 17 Sep 2020 14:13:16 +0400 Subject: [PATCH] Fixed bugs and improved performance --- app/build.gradle | 2 +- .../main/java/com/vanced/manager/core/App.kt | 33 +++++----- .../core/downloader/MicrogDownloader.kt | 11 ++-- .../core/downloader/MusicDownloader.kt | 11 ++-- .../core/downloader/VancedDownloader.kt | 21 +++--- .../core/installer/AppInstallerService.kt | 4 +- .../core/installer/SplitInstallerService.kt | 2 +- .../com/vanced/manager/model/DataModel.kt | 64 ++++++++----------- .../com/vanced/manager/model/ProgressModel.kt | 34 ++++------ .../manager/ui/fragments/HomeFragment.kt | 8 +-- .../VancedLanguageSelectionFragment.kt | 9 +-- .../manager/ui/viewmodels/HomeViewModel.kt | 24 ++++--- .../com/vanced/manager/utils/PackageHelper.kt | 2 +- app/src/main/res/layout/activity_main.xml | 3 +- app/src/main/res/layout/fragment_home.xml | 3 +- app/src/main/res/layout/fragment_main.xml | 11 +--- .../main/res/layout/include_changelogs.xml | 1 - app/src/main/res/layout/include_microg.xml | 1 - app/src/main/res/layout/include_music.xml | 1 - .../main/res/layout/include_useful_links.xml | 3 +- app/src/main/res/layout/include_vanced.xml | 1 - 21 files changed, 112 insertions(+), 137 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index 840d9695..7c571cb7 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -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' diff --git a/app/src/main/java/com/vanced/manager/core/App.kt b/app/src/main/java/com/vanced/manager/core/App.kt index bef11542..7856cd23 100644 --- a/app/src/main/java/com/vanced/manager/core/App.kt +++ b/app/src/main/java/com/vanced/manager/core/App.kt @@ -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) { diff --git a/app/src/main/java/com/vanced/manager/core/downloader/MicrogDownloader.kt b/app/src/main/java/com/vanced/manager/core/downloader/MicrogDownloader.kt index 5a77066c..a41c0a73 100644 --- a/app/src/main/java/com/vanced/manager/core/downloader/MicrogDownloader.kt +++ b/app/src/main/java/com/vanced/manager/core/downloader/MicrogDownloader.kt @@ -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() } }) diff --git a/app/src/main/java/com/vanced/manager/core/downloader/MusicDownloader.kt b/app/src/main/java/com/vanced/manager/core/downloader/MusicDownloader.kt index 2c197967..83e6c2be 100644 --- a/app/src/main/java/com/vanced/manager/core/downloader/MusicDownloader.kt +++ b/app/src/main/java/com/vanced/manager/core/downloader/MusicDownloader.kt @@ -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() } }) diff --git a/app/src/main/java/com/vanced/manager/core/downloader/VancedDownloader.kt b/app/src/main/java/com/vanced/manager/core/downloader/VancedDownloader.kt index 0a2ece38..46daacbb 100644 --- a/app/src/main/java/com/vanced/manager/core/downloader/VancedDownloader.kt +++ b/app/src/main/java/com/vanced/manager/core/downloader/VancedDownloader.kt @@ -37,7 +37,7 @@ object VancedDownloader { private var variant: String? = null private var theme: String? = null private var lang: Array? = 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 diff --git a/app/src/main/java/com/vanced/manager/core/installer/AppInstallerService.kt b/app/src/main/java/com/vanced/manager/core/installer/AppInstallerService.kt index 3fb8dfe9..ea449b55 100644 --- a/app/src/main/java/com/vanced/manager/core/installer/AppInstallerService.kt +++ b/app/src/main/java/com/vanced/manager/core/installer/AppInstallerService.kt @@ -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) } diff --git a/app/src/main/java/com/vanced/manager/core/installer/SplitInstallerService.kt b/app/src/main/java/com/vanced/manager/core/installer/SplitInstallerService.kt index bd2d905e..a8a0d3e4 100644 --- a/app/src/main/java/com/vanced/manager/core/installer/SplitInstallerService.kt +++ b/app/src/main/java/com/vanced/manager/core/installer/SplitInstallerService.kt @@ -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) diff --git a/app/src/main/java/com/vanced/manager/model/DataModel.kt b/app/src/main/java/com/vanced/manager/model/DataModel.kt index 1acb4c52..2d58a5e6 100644 --- a/app/src/main/java/com/vanced/manager/model/DataModel.kt +++ b/app/src/main/java/com/vanced/manager/model/DataModel.kt @@ -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() + val installedVersionName = ObservableField() + val buttonTxt = ObservableField() + val buttonIcon = ObservableField() + val changelog = ObservableField() + + 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 { diff --git a/app/src/main/java/com/vanced/manager/model/ProgressModel.kt b/app/src/main/java/com/vanced/manager/model/ProgressModel.kt index 8495be4d..abdf9d12 100644 --- a/app/src/main/java/com/vanced/manager/model/ProgressModel.kt +++ b/app/src/main/java/com/vanced/manager/model/ProgressModel.kt @@ -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() + val showInstallCircle = ObservableBoolean() + var showDownloadBar = ObservableBoolean() + + init { + downloadProgress.set(0) + downloadingFile.set("") + showInstallCircle.set(false) + showDownloadBar.set(false) } } diff --git a/app/src/main/java/com/vanced/manager/ui/fragments/HomeFragment.kt b/app/src/main/java/com/vanced/manager/ui/fragments/HomeFragment.kt index fa181c86..f7708228 100644 --- a/app/src/main/java/com/vanced/manager/ui/fragments/HomeFragment.kt +++ b/app/src/main/java/com/vanced/manager/ui/fragments/HomeFragment.kt @@ -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() } } } diff --git a/app/src/main/java/com/vanced/manager/ui/fragments/VancedLanguageSelectionFragment.kt b/app/src/main/java/com/vanced/manager/ui/fragments/VancedLanguageSelectionFragment.kt index 2a329558..1273df8d 100644 --- a/app/src/main/java/com/vanced/manager/ui/fragments/VancedLanguageSelectionFragment.kt +++ b/app/src/main/java/com/vanced/manager/ui/fragments/VancedLanguageSelectionFragment.kt @@ -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("langs")?.value ?: mutableListOf("null") loadBoxes(view.findViewById(R.id.lang_button_ll)) view.findViewById(R.id.vanced_install_finish).setOnClickListener { val chosenLangs = mutableListOf("en") diff --git a/app/src/main/java/com/vanced/manager/ui/viewmodels/HomeViewModel.kt b/app/src/main/java/com/vanced/manager/ui/viewmodels/HomeViewModel.kt index b12215cc..d15c0da9 100644 --- a/app/src/main/java/com/vanced/manager/ui/viewmodels/HomeViewModel.kt +++ b/app/src/main/java/com/vanced/manager/ui/viewmodels/HomeViewModel.kt @@ -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> = _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) } } diff --git a/app/src/main/java/com/vanced/manager/utils/PackageHelper.kt b/app/src/main/java/com/vanced/manager/utils/PackageHelper.kt index 2c1d49a4..bf241bd1 100644 --- a/app/src/main/java/com/vanced/manager/utils/PackageHelper.kt +++ b/app/src/main/java/com/vanced/manager/utils/PackageHelper.kt @@ -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) diff --git a/app/src/main/res/layout/activity_main.xml b/app/src/main/res/layout/activity_main.xml index fc469f26..2b59313e 100644 --- a/app/src/main/res/layout/activity_main.xml +++ b/app/src/main/res/layout/activity_main.xml @@ -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"> + bind:onRefreshListener="@{()-> viewModel.fetchData()}"> diff --git a/app/src/main/res/layout/fragment_main.xml b/app/src/main/res/layout/fragment_main.xml index c13d230a..527513aa 100644 --- a/app/src/main/res/layout/fragment_main.xml +++ b/app/src/main/res/layout/fragment_main.xml @@ -1,10 +1,9 @@ + xmlns:app="http://schemas.android.com/apk/res-auto"> - @@ -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" /> - + diff --git a/app/src/main/res/layout/include_changelogs.xml b/app/src/main/res/layout/include_changelogs.xml index 467c0527..85bddb9c 100644 --- a/app/src/main/res/layout/include_changelogs.xml +++ b/app/src/main/res/layout/include_changelogs.xml @@ -23,7 +23,6 @@ android:layout_height="wrap_content" android:layout_marginStart="1dp" android:layout_marginEnd="1dp" - android:animateLayoutChanges="true" android:orientation="vertical"> + app:contentPaddingBottom="8dp">