From b590f87aa5a36a82c23c2c5c0fefbc0fba3bc154 Mon Sep 17 00:00:00 2001 From: X1nto Date: Thu, 4 Jun 2020 21:12:50 +0400 Subject: [PATCH] ah yeah, it's all coming together --- .../vanced/manager/core/base/BaseFragment.kt | 19 +-- .../com/vanced/manager/core/fragments/Home.kt | 94 ++------------ .../manager/ui/fragments/HomeFragment.kt | 47 ++----- .../ui/fragments/ManagerChangelogFragment.kt | 7 +- .../ui/fragments/MicrogChangelogFragment.kt | 16 ++- .../manager/ui/fragments/SettingsFragment.kt | 11 +- .../ui/fragments/UpdateCheckFragment.kt | 24 +--- .../ui/fragments/VancedChangelogFragment.kt | 17 ++- .../manager/ui/viewmodels/HomeViewModel.kt | 45 ++++++- app/src/main/res/layout/fragment_home.xml | 3 +- .../res/layout/fragment_microg_changelog.xml | 1 + .../res/layout/fragment_vanced_changelog.xml | 1 + app/src/main/res/layout/include_microg.xml | 1 + .../main/res/layout/include_useful_links.xml | 74 ++++++----- .../main/res/layout/include_vanced_medias.xml | 117 ++++++++++-------- 15 files changed, 223 insertions(+), 254 deletions(-) diff --git a/app/src/main/java/com/vanced/manager/core/base/BaseFragment.kt b/app/src/main/java/com/vanced/manager/core/base/BaseFragment.kt index 01ae5c0f..b8e8451b 100644 --- a/app/src/main/java/com/vanced/manager/core/base/BaseFragment.kt +++ b/app/src/main/java/com/vanced/manager/core/base/BaseFragment.kt @@ -33,7 +33,7 @@ import java.io.File open class BaseFragment : Fragment() { private var disposable: Disposable? = null - private val baseUrl = "https://x1nto.github.io/VancedFiles/Splits" + private val baseUrl = "https://vanced.app/api/v1/apks/v15.05.54/" fun openUrl(Url: String, color: Int) { val builder = CustomTabsIntent.Builder() @@ -64,7 +64,7 @@ open class BaseFragment : Fragment() { fun downloadArch(loadBar: ProgressBar, dlText: TextView, loadCircle: ProgressBar) { val prefs = activity?.getSharedPreferences("installPrefs", Context.MODE_PRIVATE) prefs?.edit()?.putBoolean("isVancedDownloading", true)?.apply() - val variant = PreferenceManager.getDefaultSharedPreferences(activity).getString("vanced_variant", "Nonroot") + val variant = PreferenceManager.getDefaultSharedPreferences(activity).getString("vanced_variant", "nonroot") val arch = when { Build.SUPPORTED_ABIS.contains("x86") -> "x86" @@ -103,7 +103,7 @@ open class BaseFragment : Fragment() { } private fun downloadTheme(loadBar: ProgressBar, dlText: TextView, loadCircle: ProgressBar) { - val variant = PreferenceManager.getDefaultSharedPreferences(activity).getString("vanced_variant", "Nonroot") + val variant = PreferenceManager.getDefaultSharedPreferences(activity).getString("vanced_variant", "nonroot") val prefs = activity?.getSharedPreferences("installPrefs", Context.MODE_PRIVATE) val theme = prefs?.getString("theme", "dark") val url = "$baseUrl/$variant/Theme/$theme.apk" @@ -137,7 +137,7 @@ open class BaseFragment : Fragment() { } private fun downloadLang(loadBar: ProgressBar, dlText: TextView, loadCircle: ProgressBar) { - val variant = PreferenceManager.getDefaultSharedPreferences(activity).getString("vanced_variant", "Nonroot") + val variant = PreferenceManager.getDefaultSharedPreferences(activity).getString("vanced_variant", "nonroot") val prefs = activity?.getSharedPreferences("installPrefs", Context.MODE_PRIVATE) val lang = prefs?.getString("lang", "en") val url = "$baseUrl/$variant/Language/split_config.$lang.apk" @@ -169,7 +169,7 @@ open class BaseFragment : Fragment() { dlText.visibility = View.GONE loadCircle.visibility = View.VISIBLE prefs.edit()?.putBoolean("isVancedDownloading", false)?.apply() - if (PreferenceManager.getDefaultSharedPreferences(activity).getString("vanced_variant", "Nonroot") == "Root") { + if (PreferenceManager.getDefaultSharedPreferences(activity).getString("vanced_variant", "nonroot") == "root") { launchRootInstaller() } else { launchInstaller() @@ -183,9 +183,9 @@ open class BaseFragment : Fragment() { } private fun downloadEn(loadBar: ProgressBar, dlText: TextView, loadCircle: ProgressBar) { - val variant = PreferenceManager.getDefaultSharedPreferences(activity).getString("vanced_variant", "Nonroot") + val variant = PreferenceManager.getDefaultSharedPreferences(activity).getString("vanced_variant", "nonroot") val prefs = activity?.getSharedPreferences("installPrefs", Context.MODE_PRIVATE) - val url = "https://x1nto.github.io/VancedFiles/Splits/$variant/Language/split_config.en.apk" + val url = "$baseUrl/$variant/Language/split_config.en.apk" val task = activity?.cacheDir?.path?.let { Task( url = url, @@ -211,7 +211,7 @@ open class BaseFragment : Fragment() { dlText.visibility = View.GONE loadCircle.visibility = View.VISIBLE prefs?.edit()?.putBoolean("isVancedDownloading", false)?.apply() - if (PreferenceManager.getDefaultSharedPreferences(activity).getString("vanced_variant", "Nonroot") == "Root") { + if (PreferenceManager.getDefaultSharedPreferences(activity).getString("vanced_variant", "nonroot") == "root") { launchRootInstaller() } else { launchInstaller() @@ -287,7 +287,7 @@ open class BaseFragment : Fragment() { ) } - fun uninstallApk(pkgUri: String) { + /*fun uninstallApk(pkgUri: String) { try { val uri = Uri.parse("package:$pkgUri") val uninstall = Intent(Intent.ACTION_DELETE, uri) @@ -296,5 +296,6 @@ open class BaseFragment : Fragment() { Toast.makeText(activity, "Failed to uninstall", Toast.LENGTH_SHORT).show() } } + */ } \ No newline at end of file diff --git a/app/src/main/java/com/vanced/manager/core/fragments/Home.kt b/app/src/main/java/com/vanced/manager/core/fragments/Home.kt index 91b35ed1..8559bd53 100644 --- a/app/src/main/java/com/vanced/manager/core/fragments/Home.kt +++ b/app/src/main/java/com/vanced/manager/core/fragments/Home.kt @@ -1,11 +1,6 @@ package com.vanced.manager.core.fragments -import android.content.ActivityNotFoundException -import android.content.ComponentName import android.content.Context -import android.content.Intent -import android.content.res.ColorStateList -import android.graphics.Color import android.os.Bundle import android.util.Log import android.view.View @@ -23,38 +18,22 @@ open class Home : BaseFragment() { override fun onViewCreated(view: View, savedInstanceState: Bundle?) { super.onViewCreated(view, savedInstanceState) - val pm = activity?.packageManager - //Damn that's a lot of buttons val microginstallbtn = view.findViewById(R.id.microg_installbtn) val vancedinstallbtn = view.findViewById(R.id.vanced_installbtn) - val bravebtn = view.findViewById