From cb060e70fdeba68f26ac87855fb3aa62766b5d58 Mon Sep 17 00:00:00 2001 From: X1nto Date: Sun, 5 Apr 2020 22:07:26 +0400 Subject: [PATCH] fixed crash, added proper theme support --- .idea/dictionaries/Xinto.xml | 10 +++++ README.md | 14 +++---- app/src/main/AndroidManifest.xml | 4 +- .../java/com/vanced/manager/HomeFragment.kt | 15 ------- .../com/vanced/manager/SettingsFragment.kt | 34 ++------------- .../com/vanced/manager/ui/MainActivity.kt | 42 ++++++++++++++++--- app/src/main/res/layout/activity_about.xml | 3 +- app/src/main/res/layout/activity_main.xml | 2 +- app/src/main/res/layout/home_toolbar.xml | 26 ------------ app/src/main/res/values-night/themes.xml | 2 +- app/src/main/res/values/themes.xml | 2 +- 11 files changed, 63 insertions(+), 91 deletions(-) create mode 100644 .idea/dictionaries/Xinto.xml delete mode 100644 app/src/main/res/layout/home_toolbar.xml diff --git a/.idea/dictionaries/Xinto.xml b/.idea/dictionaries/Xinto.xml new file mode 100644 index 00000000..541fe66b --- /dev/null +++ b/.idea/dictionaries/Xinto.xml @@ -0,0 +1,10 @@ + + + + installbtn + microg + semibold + vanced + + + \ No newline at end of file diff --git a/README.md b/README.md index c2adf8c8..bb334b8e 100644 --- a/README.md +++ b/README.md @@ -5,19 +5,19 @@ Hi, my name is Steve Cock, I'm the main UI designer for the upcoming Vanced Mana No one really thought there would be problems with this format, because installation was pretty simple, at least that's what xfile thought... ## 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 +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 ci Alpha Ui Preview Test Build 0.1.9™** which doesn't fucking work at the tme because of shit material UI problems and i have no idea ho- +Ladies and gentlemen, I'm very proud to introduce the new **Vanced Manager ci Alpha Ui Preview Test Build 0.1.9™** which doesn't fucking work at the time because of shit material UI problems and i have no idea ho- So... 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 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 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). +Vanced manager comes with a slick UI ~~that was stolen from the new Magisk Manager (I'm very sorry John but i looked 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). ##### I'll probably forget this later so I should put a comment here saying that we should put some screenshots from manager once the UI is ready because why not ## Credits -Vanced Manager developers: +### Vanced Manager developers: - MrDodojo (API) -- Hope (API Implementation) +- Hope (API Implementation into the app) - moosd (Installer) -- X1nto (UI, animations and basic functionality (Hope helped me alot tho)) -### And of course Vanced Team +- X1nto (UI, animations and basic functionality (Hope helped me a lot tho)) +### And of course The Vanced Team: - xfileFIN ![xfileFIN](https://i.imgur.com/hLdzTVq.png) - KevinX8 diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 756a52e4..b625024d 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -25,14 +25,14 @@ + android:theme="@style/LightTheme"> + android:theme="@style/LightTheme"> (R.id.home_toolbar) - - toolbar?.title = "Home" - toolbar?.inflateMenu(R.menu.toolbar_menu) - toolbar?.setOnMenuItemClickListener { - if (it.itemId == R.id.about) { - val intent = Intent() - intent.component = ComponentName( - "com.vanced.manager", - "com.vanced.manager.ui.AboutActivity" - ) - startActivity(intent) - } - true - } return homefragment diff --git a/app/src/main/java/com/vanced/manager/SettingsFragment.kt b/app/src/main/java/com/vanced/manager/SettingsFragment.kt index 55f49a24..24fa8580 100644 --- a/app/src/main/java/com/vanced/manager/SettingsFragment.kt +++ b/app/src/main/java/com/vanced/manager/SettingsFragment.kt @@ -1,46 +1,18 @@ package com.vanced.manager -import android.content.ComponentName -import android.content.Intent import android.os.Bundle -import android.view.LayoutInflater -import android.view.View -import android.view.ViewGroup import androidx.appcompat.app.AppCompatDelegate -import androidx.appcompat.widget.Toolbar import androidx.preference.ListPreference import androidx.preference.PreferenceFragmentCompat +import com.vanced.manager.ui.MainActivity class SettingsFragment : PreferenceFragmentCompat() { - override fun onCreateView( - inflater: LayoutInflater, - container: ViewGroup?, - savedInstanceState: Bundle? - ): View? { - val settingsfragment = inflater.inflate(R.layout.fragment_home, container, false) - val toolbar = view?.findViewById(R.id.home_toolbar) - - toolbar?.title = "Settings" - toolbar?.inflateMenu(R.menu.toolbar_menu) - toolbar?.setOnMenuItemClickListener { - if (it.itemId == R.id.about) { - val intent = Intent() - intent.component = ComponentName( - "com.vanced.manager", - "com.vanced.manager.ui.AboutActivity" - ) - startActivity(intent) - } - true - } - - return settingsfragment - } - override fun onCreatePreferences(savedInstanceState: Bundle?, rootKey: String?) { setPreferencesFromResource(R.xml.preferences, rootKey) + (activity as MainActivity).supportActionBar?.title = getString(R.string.settings) + val themeSwitch: ListPreference? = findPreference("theme_modes") themeSwitch?.setOnPreferenceChangeListener { _, _ -> val currentVal: String = themeSwitch.value 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 b71f51e0..7e6c0295 100644 --- a/app/src/main/java/com/vanced/manager/ui/MainActivity.kt +++ b/app/src/main/java/com/vanced/manager/ui/MainActivity.kt @@ -1,27 +1,41 @@ package com.vanced.manager.ui +import android.content.Intent import android.os.Bundle +import android.view.Menu +import android.view.MenuItem import androidx.appcompat.app.AlertDialog import com.google.android.material.bottomnavigation.BottomNavigationView import androidx.appcompat.app.AppCompatActivity import androidx.appcompat.app.AppCompatDelegate -import androidx.appcompat.widget.Toolbar import androidx.fragment.app.FragmentTransaction import com.vanced.manager.HomeFragment import com.vanced.manager.R import com.vanced.manager.SettingsFragment -import androidx.preference.ListPreference -import androidx.preference.PreferenceFragmentCompat +import kotlinx.android.synthetic.main.activity_main.* class MainActivity : AppCompatActivity() { lateinit var homeFragment: HomeFragment lateinit var settingsFragment: SettingsFragment + override fun onCreate(savedInstanceState: Bundle?) { - super.onCreate(savedInstanceState) + when (AppCompatDelegate.getDefaultNightMode()) { + AppCompatDelegate.MODE_NIGHT_YES -> { + setTheme(R.style.DarkTheme) + } + AppCompatDelegate.MODE_NIGHT_NO -> { + setTheme(R.style.LightTheme) + } + } + super.onCreate(null) setContentView(R.layout.activity_main) + setSupportActionBar(toolbar) + supportActionBar?.title = getString(R.string.title_home) + + val prefs = getSharedPreferences("prefs", MODE_PRIVATE) val firstStart = prefs.getBoolean("firstStart", true) if (firstStart) { @@ -67,11 +81,27 @@ class MainActivity : AppCompatActivity() { false } } + + override fun onCreateOptionsMenu(menu: Menu?): Boolean { + menuInflater.inflate(R.menu.toolbar_menu, menu) + return super .onCreateOptionsMenu(menu) + } + + override fun onOptionsItemSelected(item: MenuItem) = when (item.itemId) { + R.id.about -> { + val intent = Intent(this, AboutActivity::class.java) + startActivity(intent) + true + } + else -> { + super.onOptionsItemSelected(item) + } + } + private fun showGayDialog() { - val clientList = arrayOf("Newpipe", "Vanced") AlertDialog.Builder(this) .setTitle("Welcome!") - .setMessage("Just letting you know that NewPipe > Vanced, amirite ladies and gals? up top!\nIf you use Vanced you are fooking gae") + .setMessage("Before we implement a proper security system to check whether app was modified or not, please be sure that you downloaded manager from vanced.app/github") .setPositiveButton("close" ) { dialog, which -> dialog.dismiss() } .create().show() diff --git a/app/src/main/res/layout/activity_about.xml b/app/src/main/res/layout/activity_about.xml index 0e0ce31a..c47bac1c 100644 --- a/app/src/main/res/layout/activity_about.xml +++ b/app/src/main/res/layout/activity_about.xml @@ -1,5 +1,6 @@ - - - - - -