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 6836e07d..3d6e730e 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 @@ -33,7 +33,7 @@ class AppInstallerService: Service() { sendBroadcast(Intent(HomeFragment.MICROG_INSTALLED)) } } - else -> sendFailure(this, intent.getIntExtra(PackageInstaller.EXTRA_STATUS, -999)) + else -> sendFailure(intent.getIntExtra(PackageInstaller.EXTRA_STATUS, -999), this) } stopSelf() return START_NOT_STICKY diff --git a/app/src/main/java/com/vanced/manager/core/installer/RootSplitInstallerService.kt b/app/src/main/java/com/vanced/manager/core/installer/RootSplitInstallerService.kt index 0d46b60d..95043c98 100644 --- a/app/src/main/java/com/vanced/manager/core/installer/RootSplitInstallerService.kt +++ b/app/src/main/java/com/vanced/manager/core/installer/RootSplitInstallerService.kt @@ -72,14 +72,8 @@ class RootSplitInstallerService: Service() { sendBroadcast(Intent(HomeFragment.REFRESH_HOME)) sendBroadcast(Intent(HomeFragment.VANCED_INSTALLED)) } - } else { - sendFailure(this, installResult.code) - /* - val mIntent = Intent(HomeFragment.INSTALL_FAILED) - mIntent.putExtra("errorMsg", getString(R.string.installation_signature)) - localBroadcastManager.sendBroadcast(mIntent) - */ - } + } else + sendFailure(installResult.code, this) } private fun SimpleDateFormat.tryParse(str: String) = try { 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 05fbfdd1..362a8e0d 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 @@ -32,7 +32,7 @@ class SplitInstallerService: Service() { sendBroadcast(Intent(HomeFragment.VANCED_INSTALLED)) } } - else -> sendFailure(this, intent.getIntExtra(PackageInstaller.EXTRA_STATUS, -999)) + else -> sendFailure(intent.getIntExtra(PackageInstaller.EXTRA_STATUS, -999), this) } stopSelf() diff --git a/app/src/main/java/com/vanced/manager/ui/MainActivity.kt b/app/src/main/java/com/vanced/manager/ui/MainActivity.kt index 42393361..4bdac2e8 100644 --- a/app/src/main/java/com/vanced/manager/ui/MainActivity.kt +++ b/app/src/main/java/com/vanced/manager/ui/MainActivity.kt @@ -75,7 +75,6 @@ class MainActivity : AppCompatActivity() { override fun onOptionsItemSelected(item: MenuItem): Boolean { if (isInstallationRunning(this)) { - Log.d("VMService", "Installation is already running") return false } diff --git a/app/src/main/java/com/vanced/manager/ui/fragments/ChosenPreferenceDialogFragment.kt b/app/src/main/java/com/vanced/manager/ui/fragments/ChosenPreferenceDialogFragment.kt index 1d282525..fa73d270 100644 --- a/app/src/main/java/com/vanced/manager/ui/fragments/ChosenPreferenceDialogFragment.kt +++ b/app/src/main/java/com/vanced/manager/ui/fragments/ChosenPreferenceDialogFragment.kt @@ -40,7 +40,7 @@ class ChosenPreferenceDialogFragment : DialogFragment() { newPrefs.add(loc.getDisplayLanguage(loc).capitalize(Locale.ROOT)) } } - binding.chosenTheme.text = requireActivity().getString(R.string.chosen_theme, prefs.getString("theme", "dark")).capitalize(Locale.ROOT) + binding.chosenTheme.text = requireActivity().getString(R.string.chosen_theme, prefs.getString("theme", "dark")?.capitalize(Locale.ROOT)) binding.chosenLang.text = requireActivity().getString(R.string.chosen_lang, newPrefs.joinToString()) binding.chosenPrefsClose.setOnClickListener { dismiss() } diff --git a/app/src/main/java/com/vanced/manager/utils/AppUtils.kt b/app/src/main/java/com/vanced/manager/utils/AppUtils.kt index 57bece2d..924d4182 100644 --- a/app/src/main/java/com/vanced/manager/utils/AppUtils.kt +++ b/app/src/main/java/com/vanced/manager/utils/AppUtils.kt @@ -5,7 +5,7 @@ import android.app.Service import android.content.Context import android.content.Intent import android.content.pm.PackageInstaller -import android.util.Log +import android.os.Handler import androidx.localbroadcastmanager.content.LocalBroadcastManager import com.vanced.manager.R import com.vanced.manager.core.downloader.* @@ -27,18 +27,18 @@ object AppUtils { val activityManager = context.getSystemService(Context.ACTIVITY_SERVICE) as ActivityManager val runningServices = activityManager.getRunningServices(Int.MAX_VALUE) runningServices.forEach { info -> - if (info.service.className == cls.name) { - Log.d("VMService", "${cls.name} is running") - return true - } + return info.service.className == cls.name } return false } - fun sendFailure(context: Context, status: Int) { - val intent = Intent(HomeFragment.INSTALL_FAILED) - intent.putExtra("errorMsg", getErrorMessage(status, context)) - LocalBroadcastManager.getInstance(context).sendBroadcast(intent) + fun sendFailure(status: Int, context: Context) { + //Delay error broadcast until activity (and fragment) get back to the screen + Handler().postDelayed({ + val intent = Intent(HomeFragment.INSTALL_FAILED) + intent.putExtra("errorMsg", getErrorMessage(status, context)) + LocalBroadcastManager.getInstance(context).sendBroadcast(intent) + }, 500) } private fun getErrorMessage(status: Int, context: Context): String { diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 4082da47..c148fb91 100755 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -53,7 +53,7 @@ Interface Manager Chosen installation preferences - Language: %1$s + Language(s): %1$s Theme: %1$s Use Chrome Custom Tabs Links will open in Chrome Custom Tabs @@ -74,7 +74,7 @@ Dismiss Guide Hold on! - Looks like you\'re using the Magisk version of Vanced, which is discontinued and can not be updated using this app. Please remove it first by removing the magisk module. + Looks like you\'re using the Magisk/TWRP version of Vanced, which is discontinued and can not be updated using this app. Please remove it first by removing the magisk module/using TWRP Vanced uninstaller. MIUI detected! Hey! it looks like you\'re a MIUI user. in order to properly use this application, you will have to disable MIUI optimisations in the developer settings. (You can safely ignore this warning if you are on a 20.2.20 or later ROM based on xiaomi.eu) Error