moved variant selection to home page
This commit is contained in:
parent
0062a43c55
commit
fa76194880
|
@ -3,4 +3,5 @@
|
|||
.github/
|
||||
build/
|
||||
out/
|
||||
app/src/main/java/com/vanced/manager/core/base/DummyJava.java
|
||||
local.properties
|
||||
|
|
21
README.md
21
README.md
|
@ -9,19 +9,28 @@ No one really thought there would be problems with this format, because installa
|
|||
## Problems with .apks format
|
||||
Main problems with new format were either with device CPU architecture or MemeUI shit with MiUI optimisations. We wrote instructions for VancedHelper but no one used it for troubleshooting. Then some users complained about new format and refused to upgrade to newest version (We don't give a fuck about that) because "I dOn'T WaNT To HaVe OnE MoRE apP To insTalL VanCeD" so we decided to make an installer for Vanced
|
||||
# Vanced Manager
|
||||
Ladies and gentlemen, I'm very proud to introduce the new **Vanced Manager Beta Build 1.4.0™**
|
||||
Vanced Manager is an universal utility for installing/updating Vanced and MicroG. It will push notifications once the update is ready and for root users, it can also automatically download and install them (Now that's what I call pwetty epic).
|
||||
Ladies and gentlemen, I'm very proud to introduce the new **Vancad Manger Beta Build 1.4.0™** (typo is intentional)
|
||||
Vanced Manager is an universal utility for installing/updating Vanced and MicroG. It will push notifications once the update is ready (Now that's what I call pwetty epic).
|
||||
Vanced manager comes with a slick UI ~~that was stolen from the new Magisk Manager (I'm very sorry John but I looked at your code for about 100 times).~~ Actually, while UI may look very similar to new Magisk Manager's UI, It's still very different (that's a blatant lie, I know).
|
||||
|
||||
Main Menu screenshot taken from tablet
|
||||
![screenshot](https://i.imgur.com/r2jiq7J.png)
|
||||
Isn't this lovely and beautiful?
|
||||
|
||||
## Manager (clap) Reviews (clap)
|
||||
|
||||
- 1337Potato: shit
|
||||
- Response: Yes
|
||||
|
||||
- Noobbot: The app is not useful because I have YT Premium. Thank you bye
|
||||
- Response: I hope you get sucked by a di-
|
||||
|
||||
- Vortextriangle: The app is so useful that I uninstalled it after installing Vanced
|
||||
- Response: yo that's finna woke
|
||||
|
||||
## Credits
|
||||
### Vanced Manager developers
|
||||
- MrDodojo (API)
|
||||
- Hope (API Integration into the app)
|
||||
- moosd (Patcher)
|
||||
- X1nto (UX, (maybe I will make installer too idk))
|
||||
- X1nto (UI, UX, Downloader, Installer, Signature Checker, PussiSlayer69, Collector of 400 BAT, Professional Liar)
|
||||
### The Vanced Team
|
||||
- xfileFIN
|
||||
![xfileFIN](https://i.imgur.com/hLdzTVq.png)
|
||||
|
|
|
@ -38,7 +38,8 @@
|
|||
</activity>
|
||||
<activity
|
||||
android:name=".ui.MainActivity"
|
||||
android:label="@string/app_name" />
|
||||
android:label="@string/app_name"
|
||||
android:theme="@style/DarkTheme.Blue" />
|
||||
|
||||
<meta-data
|
||||
android:name="preloaded_fonts"
|
||||
|
|
|
@ -1,33 +0,0 @@
|
|||
package com.vanced.manager.core.base;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.app.PendingIntent;
|
||||
import android.content.Intent;
|
||||
import android.content.pm.PackageInstaller;
|
||||
|
||||
import com.vanced.manager.core.installer.AppUninstallerService;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.OutputStream;
|
||||
|
||||
public class DummyJava {
|
||||
|
||||
public static void installApp(Activity activity, InputStream in, String pkg) throws IOException {
|
||||
PackageInstaller packageInstaller = activity.getPackageManager().getPackageInstaller();
|
||||
PackageInstaller.SessionParams params = new PackageInstaller.SessionParams(PackageInstaller.SessionParams.MODE_FULL_INSTALL);
|
||||
params.setAppPackageName(pkg);
|
||||
int sessionId = packageInstaller.createSession(params);
|
||||
PackageInstaller.Session session = packageInstaller.openSession(sessionId);
|
||||
OutputStream outputStream = session.openWrite("install", 0, -1);
|
||||
byte[] buffer = new byte[65536];
|
||||
int c;
|
||||
while ((c = in.read(buffer)) != -1) {
|
||||
outputStream.write(buffer, 0, c);
|
||||
}
|
||||
session.fsync(outputStream);
|
||||
in.close();
|
||||
outputStream.close();
|
||||
}
|
||||
|
||||
}
|
|
@ -14,12 +14,11 @@ import com.vanced.manager.core.base.BaseFragment
|
|||
import com.vanced.manager.core.downloader.MicrogDownloadService
|
||||
import com.vanced.manager.core.downloader.VancedDownloadService
|
||||
import com.vanced.manager.core.installer.StubInstaller
|
||||
import com.vanced.manager.ui.dialogs.DialogContainer.rootModeDetected
|
||||
import com.vanced.manager.ui.dialogs.DialogContainer.secondMiuiDialog
|
||||
import com.vanced.manager.utils.MiuiHelper
|
||||
import com.vanced.manager.utils.PackageHelper.uninstallApk
|
||||
|
||||
open class Home : BaseFragment(), View.OnClickListener {
|
||||
open class Home : BaseFragment(), View.OnClickListener, AdapterView.OnItemSelectedListener {
|
||||
|
||||
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
||||
super.onViewCreated(view, savedInstanceState)
|
||||
|
@ -29,12 +28,14 @@ open class Home : BaseFragment(), View.OnClickListener {
|
|||
val signaturebtn = view.findViewById<MaterialButton>(R.id.signature_button)
|
||||
val microguninstallbtn = view.findViewById<ImageView>(R.id.microg_uninstallbtn)
|
||||
val vanceduninstallbtn = view.findViewById<ImageView>(R.id.vanced_uninstallbtn)
|
||||
val spinner: Spinner = view.findViewById(R.id.home_variant_selector)
|
||||
|
||||
vancedinstallbtn.setOnClickListener(this)
|
||||
microginstallbtn.setOnClickListener(this)
|
||||
signaturebtn.setOnClickListener(this)
|
||||
microguninstallbtn.setOnClickListener(this)
|
||||
vanceduninstallbtn.setOnClickListener(this)
|
||||
spinner.onItemSelectedListener = this
|
||||
|
||||
}
|
||||
|
||||
|
@ -64,14 +65,9 @@ open class Home : BaseFragment(), View.OnClickListener {
|
|||
when (v?.id) {
|
||||
R.id.vanced_installbtn -> {
|
||||
if (!isVancedDownloading!!) {
|
||||
if (variant == "root") {
|
||||
if (MiuiHelper.isMiui()) {
|
||||
activity?.let { secondMiuiDialog(it) }
|
||||
} else
|
||||
activity?.let { rootModeDetected(it) }
|
||||
} else {
|
||||
if (MiuiHelper.isMiui()) {
|
||||
activity?.let { secondMiuiDialog(it) }
|
||||
if (MiuiHelper.isMiui()) {
|
||||
activity?.let {
|
||||
secondMiuiDialog(it)
|
||||
}
|
||||
}
|
||||
try {
|
||||
|
@ -80,12 +76,21 @@ open class Home : BaseFragment(), View.OnClickListener {
|
|||
Log.d("VMCache", "Unable to delete cacheDir")
|
||||
}
|
||||
if (prefs.getBoolean("valuesModified", false)) {
|
||||
activity?.startService(Intent(activity, VancedDownloadService::class.java))
|
||||
activity?.startService(
|
||||
Intent(
|
||||
activity,
|
||||
VancedDownloadService::class.java
|
||||
)
|
||||
)
|
||||
prefs.edit().putBoolean("isInstalling", false).apply()
|
||||
} else
|
||||
view?.findNavController()?.navigate(R.id.toInstallThemeFragment)
|
||||
} else {
|
||||
Toast.makeText(activity, "Please wait until installation finishes", Toast.LENGTH_SHORT).show()
|
||||
Toast.makeText(
|
||||
activity,
|
||||
"Please wait until installation finishes",
|
||||
Toast.LENGTH_SHORT
|
||||
).show()
|
||||
}
|
||||
}
|
||||
R.id.microg_installbtn -> {
|
||||
|
@ -111,4 +116,18 @@ open class Home : BaseFragment(), View.OnClickListener {
|
|||
}
|
||||
}
|
||||
|
||||
override fun onNothingSelected(parent: AdapterView<*>?) {
|
||||
view?.findViewById<Spinner>(R.id.home_variant_selector)?.setSelection(0)
|
||||
}
|
||||
|
||||
override fun onItemSelected(parent: AdapterView<*>?, view: View?, position: Int, id: Long) {
|
||||
when (position) {
|
||||
0 -> writeToVariantPref("nonroot")
|
||||
1 -> writeToVariantPref("root")
|
||||
}
|
||||
}
|
||||
|
||||
private fun writeToVariantPref(variant: String) =
|
||||
getDefaultSharedPreferences(activity).edit().putString("vanced_variant", variant).apply()
|
||||
|
||||
}
|
|
@ -32,30 +32,22 @@ object DialogContainer {
|
|||
}
|
||||
|
||||
private fun showMiuiDialog(context: Context) {
|
||||
basicAlertBuilder("Detected MiUI user!", "Hey! Looks like you're a MiUI user. in order to properly use Vanced Manager, you will have to disable MiUI optimisations in developer settings." +
|
||||
"If you can't find such setting, it means that you are using a new version of ROM which does not need fixing anything.", context)
|
||||
basicAlertBuilder(
|
||||
context.getString(R.string.miui_one_title),
|
||||
context.getString(R.string.miui_one),
|
||||
context
|
||||
)
|
||||
}
|
||||
|
||||
fun secondMiuiDialog(context: Context) {
|
||||
AlertDialog.Builder(context)
|
||||
.setTitle("I'm gonna stop you right there!")
|
||||
.setMessage("I am once again asking you to disable MiUI optimisations if you have not already. K thx bai")
|
||||
.setPositiveButton("wut?") { dialog, _ ->
|
||||
run {
|
||||
if (PreferenceManager.getDefaultSharedPreferences(context).getString("vanced_variant", "Nonroot") == "Root")
|
||||
rootModeDetected(context)
|
||||
else
|
||||
dialog.dismiss()
|
||||
}
|
||||
}
|
||||
.setTitle(context.getString(R.string.miui_two_title))
|
||||
.setMessage(context.getString(R.string.miui_two))
|
||||
.setPositiveButton("Fine") { dialog, _ -> dialog.dismiss() }
|
||||
.create()
|
||||
.show()
|
||||
}
|
||||
|
||||
fun rootModeDetected(context: Context) {
|
||||
basicAlertBuilder("Root mode detected!", "In order for app to work properly, please make sure you disabled signature verification.", context)
|
||||
}
|
||||
|
||||
//Easter Egg
|
||||
fun statementFalse(context: Context) {
|
||||
AlertDialog.Builder(context)
|
||||
|
@ -80,7 +72,7 @@ object DialogContainer {
|
|||
|
||||
fun installAlertBuilder(msg: String, context: Context) {
|
||||
AlertDialog.Builder(context)
|
||||
.setTitle("Error")
|
||||
.setTitle(context.getString(R.string.error))
|
||||
.setMessage(msg)
|
||||
.setPositiveButton(context.getString(R.string.close)) { dialog, _ -> dialog.dismiss() }
|
||||
.create()
|
||||
|
@ -89,9 +81,10 @@ object DialogContainer {
|
|||
|
||||
fun regularPackageInstalled(msg: String, activity: MainActivity) {
|
||||
AlertDialog.Builder(activity)
|
||||
.setTitle("Success")
|
||||
.setTitle(activity.getString(R.string.success))
|
||||
.setMessage(msg)
|
||||
.setPositiveButton(activity.getString(R.string.close)) { _, _ -> activity.restartActivity() }
|
||||
.setCancelable(false)
|
||||
.create()
|
||||
.show()
|
||||
}
|
||||
|
@ -104,9 +97,9 @@ object DialogContainer {
|
|||
else
|
||||
ComponentName("com.vanced.android.youtube", "com.google.android.youtube.HomeActivity")
|
||||
AlertDialog.Builder(context)
|
||||
.setTitle("Success!")
|
||||
.setMessage("Vanced has been successfully installed, do you want to launch it now?")
|
||||
.setPositiveButton("Launch") {
|
||||
.setTitle(context.getString(R.string.success))
|
||||
.setMessage(context.getString(R.string.vanced_installed))
|
||||
.setPositiveButton(context.getString(R.string.launch)) {
|
||||
_, _ -> startActivity(context, intent, null)
|
||||
}
|
||||
.setNegativeButton("Cancel") { dialog, _ ->
|
||||
|
|
|
@ -267,6 +267,8 @@ class HomeFragment : Home() {
|
|||
MICROG_DOWNLOADED -> {
|
||||
view?.findViewById<TextView>(R.id.microg_downloading)?.visibility = View.GONE
|
||||
view?.findViewById<ProgressBar>(R.id.microg_progress)?.visibility = View.GONE
|
||||
view?.findViewById<ProgressBar>(R.id.microg_installing)?.visibility =
|
||||
View.VISIBLE
|
||||
activity?.let { installApp(it, it.filesDir.path + "/microg.apk", "com.mgoogle.android.gms") }
|
||||
}
|
||||
VANCED_DOWNLOADED -> {
|
||||
|
@ -284,46 +286,15 @@ class HomeFragment : Home() {
|
|||
}
|
||||
|
||||
private fun registerReceivers() {
|
||||
val intentFilter = IntentFilter()
|
||||
intentFilter.addAction(SIGNATURE_DISABLED)
|
||||
intentFilter.addAction(SIGNATURE_ENABLED)
|
||||
intentFilter.addAction(VANCED_DOWNLOADING)
|
||||
intentFilter.addAction(MICROG_DOWNLOADING)
|
||||
intentFilter.addAction(VANCED_DOWNLOADED)
|
||||
intentFilter.addAction(MICROG_DOWNLOADED)
|
||||
activity?.let {
|
||||
LocalBroadcastManager.getInstance(it).registerReceiver(broadcastReceiver, IntentFilter(
|
||||
SIGNATURE_DISABLED
|
||||
))
|
||||
}
|
||||
activity?.let {
|
||||
LocalBroadcastManager.getInstance(it).registerReceiver(broadcastReceiver, IntentFilter(
|
||||
SIGNATURE_ENABLED
|
||||
)
|
||||
)
|
||||
}
|
||||
activity?.let {
|
||||
LocalBroadcastManager.getInstance(it).registerReceiver(broadcastReceiver, IntentFilter(
|
||||
VANCED_DOWNLOADING
|
||||
)
|
||||
)
|
||||
}
|
||||
activity?.let {
|
||||
LocalBroadcastManager.getInstance(it).registerReceiver(broadcastReceiver, IntentFilter(
|
||||
MICROG_DOWNLOADING
|
||||
)
|
||||
)
|
||||
}
|
||||
activity?.let {
|
||||
LocalBroadcastManager.getInstance(it).registerReceiver(broadcastReceiver, IntentFilter(
|
||||
VANCED_DOWNLOADED
|
||||
)
|
||||
)
|
||||
}
|
||||
activity?.let {
|
||||
LocalBroadcastManager.getInstance(it).registerReceiver(broadcastReceiver, IntentFilter(
|
||||
MICROG_DOWNLOADED
|
||||
)
|
||||
)
|
||||
}
|
||||
activity?.let {
|
||||
LocalBroadcastManager.getInstance(it).registerReceiver(broadcastReceiver, IntentFilter(
|
||||
DOWNLOAD_ERROR
|
||||
)
|
||||
)
|
||||
LocalBroadcastManager.getInstance(it).registerReceiver(broadcastReceiver, intentFilter)
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -4,11 +4,11 @@ import android.content.Intent
|
|||
import android.os.Bundle
|
||||
import android.view.Menu
|
||||
import android.view.MenuInflater
|
||||
import androidx.preference.*
|
||||
import com.topjohnwu.superuser.Shell
|
||||
import androidx.preference.ListPreference
|
||||
import androidx.preference.Preference
|
||||
import androidx.preference.PreferenceFragmentCompat
|
||||
import com.vanced.manager.R
|
||||
import com.vanced.manager.ui.MainActivity
|
||||
import java.util.*
|
||||
|
||||
class SettingsFragment : PreferenceFragmentCompat() {
|
||||
|
||||
|
@ -28,7 +28,8 @@ class SettingsFragment : PreferenceFragmentCompat() {
|
|||
}
|
||||
|
||||
val themeSwitch: ListPreference? = findPreference("theme_mode")
|
||||
themeSwitch?.summary = preferenceScreen.sharedPreferences.getString("theme_mode", "Light")
|
||||
themeSwitch?.summary =
|
||||
preferenceScreen.sharedPreferences.getString("theme_mode", "Follow System")
|
||||
themeSwitch?.setOnPreferenceChangeListener { _, _ ->
|
||||
activity?.recreate()
|
||||
true
|
||||
|
@ -41,6 +42,7 @@ class SettingsFragment : PreferenceFragmentCompat() {
|
|||
true
|
||||
}
|
||||
|
||||
/*
|
||||
val installMode: DropDownPreference? = findPreference("vanced_variant")
|
||||
installMode?.summary = preferenceScreen.sharedPreferences.getString("vanced_variant",
|
||||
"nonroot"
|
||||
|
@ -57,6 +59,8 @@ class SettingsFragment : PreferenceFragmentCompat() {
|
|||
true
|
||||
}
|
||||
|
||||
*/
|
||||
|
||||
val chosenPrefs: Preference? = findPreference("vanced_chosen_modes")
|
||||
chosenPrefs?.setOnPreferenceClickListener {
|
||||
val fm = childFragmentManager.beginTransaction()
|
||||
|
|
|
@ -9,7 +9,8 @@ object ThemeHelper {
|
|||
|
||||
fun setFinalTheme(context: Context) {
|
||||
val currentAccent = PreferenceManager.getDefaultSharedPreferences(context).getString("accent_color", "Blue")
|
||||
when (PreferenceManager.getDefaultSharedPreferences(context).getString("theme_mode", "Blue")) {
|
||||
when (PreferenceManager.getDefaultSharedPreferences(context)
|
||||
.getString("theme_mode", "Follow System")) {
|
||||
"Light" -> setLightAccent(currentAccent, context)
|
||||
"Dark" -> setDarkAccent(currentAccent, context)
|
||||
"Follow System" -> {
|
||||
|
|
|
@ -36,12 +36,21 @@
|
|||
android:visibility="gone"
|
||||
tools:visibility="visible"/>
|
||||
|
||||
<Spinner
|
||||
android:id="@+id/home_variant_selector"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="@dimen/stdp"
|
||||
android:layout_marginTop="@dimen/eightdp"
|
||||
android:layout_marginEnd="@dimen/stdp"
|
||||
android:entries="@array/vanced_variant" />
|
||||
|
||||
<include
|
||||
layout="@layout/include_vanced"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="8dp"
|
||||
android:layout_marginStart="@dimen/stdp"
|
||||
android:layout_marginTop="@dimen/stdp"
|
||||
android:layout_marginEnd="@dimen/stdp"
|
||||
bind:viewModel="@{viewModel}"/>
|
||||
|
||||
|
|
|
@ -118,6 +118,13 @@
|
|||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
<ProgressBar
|
||||
android:id="@+id/microg_installing"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:visibility="gone"
|
||||
tools:visibility="visible" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/microg_downloading"
|
||||
android:layout_width="wrap_content"
|
||||
|
|
|
@ -46,7 +46,7 @@
|
|||
<com.google.android.material.button.MaterialButton
|
||||
android:id="@+id/vanced_installbtn"
|
||||
style="@style/ButtonStyle"
|
||||
android:text="@{viewModel.microgInstalled ? @string/install : @string/no_microg}"
|
||||
android:text="@string/install"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:icon="@drawable/outline_cloud_download_24" />
|
||||
|
|
|
@ -30,11 +30,6 @@
|
|||
</string-array>
|
||||
|
||||
<string-array name="vanced_variant">
|
||||
<item>Nonroot</item>
|
||||
<item>Root</item>
|
||||
</string-array>
|
||||
|
||||
<string-array name="vanced_variant_values">
|
||||
<item>nonroot</item>
|
||||
<item>root</item>
|
||||
</string-array>
|
||||
|
|
|
@ -3,8 +3,6 @@
|
|||
|
||||
<!-- Global Strings -->
|
||||
<string name="close">Close</string>
|
||||
<string name="security_context">Please make sure you downloaded app from vanced.app, Vanced Discord server or GitHub</string>
|
||||
<string name="welcome">Welcome</string>
|
||||
|
||||
<!-- Main Activity -->
|
||||
<string name="title_about">About</string>
|
||||
|
@ -65,7 +63,20 @@
|
|||
<string name="re_check">Re-check</string>
|
||||
<string name="update_center">Update Center</string>
|
||||
<string name="update_found">Update found!</string>
|
||||
<string name="update_notfound">No new updates</string>>
|
||||
<string name="update_notfound">No new updates</string>
|
||||
|
||||
<!-- Dialogs -->
|
||||
<string name="miui_one_title">Detected MiUI user!</string>
|
||||
<string name="miui_one">Hey! Looks like you\'re a MiUI user. in order to properly use Vanced Manager, you will have to disable MiUI optimisations in developer settings\nIf you can't find such setting, it means that you are using a new version of ROM which does not need fixing anything.</string>
|
||||
<string name="miui_two_title">I\'m gonna stop you right there!</string>
|
||||
<string name="miui_two">I am once again asking you to disable MiUI optimisations if you have not already. K thx bai</string>
|
||||
<string name="error">Error</string>
|
||||
<string name="security_context">Please make sure you downloaded app from vanced.app, Vanced Discord server or GitHub</string>
|
||||
<string name="success">Success!</string>
|
||||
<string name="vanced_installed">Vanced has been successfully installed, do you want to launch it now?</string>
|
||||
<string name="launch">Launch</string>
|
||||
<string name="welcome">Welcome</string>
|
||||
|
||||
|
||||
<!-- Install Page -->
|
||||
<string name="choose_preferred_language">Choose your preferred language for Vanced</string>
|
||||
|
|
|
@ -50,12 +50,6 @@
|
|||
android:title="Vanced"
|
||||
app:iconSpaceReserved="false">
|
||||
|
||||
<DropDownPreference
|
||||
android:title="Installation Mode"
|
||||
android:entries="@array/vanced_variant"
|
||||
android:entryValues="@array/vanced_variant_values"
|
||||
android:key="vanced_variant"/>
|
||||
|
||||
<Preference
|
||||
android:title="Chosen Installation values"
|
||||
android:key="vanced_chosen_modes" />
|
||||
|
|
Loading…
Reference in New Issue