0
0
Fork 0
mirror of https://github.com/YTVanced/VancedManager synced 2024-11-26 05:05:15 +00:00

fixed crash, added proper theme support

This commit is contained in:
X1nto 2020-04-05 22:07:26 +04:00
parent 8d28da0bbd
commit cb060e70fd
11 changed files with 63 additions and 91 deletions

View file

@ -0,0 +1,10 @@
<component name="ProjectDictionaryState">
<dictionary name="Xinto">
<words>
<w>installbtn</w>
<w>microg</w>
<w>semibold</w>
<w>vanced</w>
</words>
</dictionary>
</component>

View file

@ -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

View file

@ -25,14 +25,14 @@
<activity
android:name=".ui.MainActivity"
android:label="@string/app_name"
android:theme="@style/Theme.MaterialComponents.DayNight.NoActionBar">
android:theme="@style/LightTheme">
</activity>
<activity
android:name=".ui.AboutActivity"
android:parentActivityName=".ui.MainActivity"
android:label="@string/app_name"
android:theme="@style/Theme.MaterialComponents.DayNight.NoActionBar">
android:theme="@style/LightTheme">
</activity>
<meta-data

View file

@ -25,21 +25,6 @@ class HomeFragment : Fragment() {
savedInstanceState: Bundle?
): View? {
val homefragment = inflater.inflate(R.layout.fragment_home, container, false)
val toolbar = view?.findViewById<Toolbar>(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

View file

@ -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<Toolbar>(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

View file

@ -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()

View file

@ -1,5 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
<androidx.constraintlayout.widget.ConstraintLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"

View file

@ -7,7 +7,7 @@
android:layout_height="match_parent">
<androidx.appcompat.widget.Toolbar
android:id="@+id/home_toolbar"
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:minHeight="?attr/actionBarSize"

View file

@ -1,26 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent">
<androidx.appcompat.widget.Toolbar
android:id="@+id/home_toolbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@drawable/rectangle_2"
android:theme="@style/ThemeOverlay.AppCompat.Dark">
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/ic_info_black_24dp"
android:backgroundTint="#ffffff"
android:layout_gravity="end"
android:layout_marginEnd="@dimen/eightdp"/>
</androidx.appcompat.widget.Toolbar>
</LinearLayout>

View file

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<style name="DarkMode" parent="Theme.MaterialComponents.DayNight.NoActionBar">
<style name="DarkTheme" parent="Theme.MaterialComponents.NoActionBar">
<item name="colorPrimary">#1490D7</item>
<item name="colorPrimaryVariant">#804EAFF5</item>

View file

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<style name="LightMode" parent="Theme.MaterialComponents.DayNight.NoActionBar">
<style name="LightTheme" parent="Theme.MaterialComponents.Light.NoActionBar">
<item name="colorPrimary">#1490D7</item>
<item name="colorPrimaryVariant">#2C7EB9</item>