Added accent color picker

This commit is contained in:
X1nto 2020-12-15 01:18:58 +04:00
parent 07f720e39b
commit cc72b1c7d1
47 changed files with 355 additions and 228 deletions

View File

@ -124,6 +124,10 @@ dependencies {
implementation 'androidx.navigation:navigation-ui-ktx:2.3.2'
implementation 'androidx.preference:preference-ktx:1.1.1'
implementation 'androidx.swiperefreshlayout:swiperefreshlayout:1.1.0'
//Appearance
implementation 'com.github.madrapps:pikolo:2.0.1'
implementation 'com.google.android.material:material:1.3.0-alpha04'
// JSON parser

View File

@ -51,14 +51,14 @@
<activity
android:name=".ui.WelcomeActivity"
android:theme="@style/DarkTheme_Blue"/>
android:theme="@style/DarkTheme"/>
<activity
android:name=".ui.MainActivity"
android:configChanges="layoutDirection|locale"
android:exported="true"
android:label="@string/app_name"
android:theme="@style/DarkTheme_Blue">
android:theme="@style/DarkTheme">
<intent-filter>
<action android:name="android.intent.action.VIEW" />

View File

@ -4,7 +4,6 @@ import android.content.Intent
import android.os.Bundle
import androidx.appcompat.app.AppCompatActivity
import androidx.preference.PreferenceManager.getDefaultSharedPreferences
import com.vanced.manager.R
import com.vanced.manager.ui.MainActivity
import com.vanced.manager.ui.WelcomeActivity

View File

@ -0,0 +1,37 @@
package com.vanced.manager.ui.core
import android.content.Context
import android.util.AttributeSet
import androidx.core.content.res.ResourcesCompat
import androidx.core.graphics.ColorUtils
import com.google.android.material.button.MaterialButton
import com.vanced.manager.R
import com.vanced.manager.utils.Extensions.getDefaultPrefs
import com.vanced.manager.utils.Extensions.lifecycleOwner
import com.vanced.manager.utils.ThemeHelper.accentColor
import com.vanced.manager.utils.ThemeHelper.defAccentColor
class ThemedMaterialButton @JvmOverloads constructor(
context: Context,
attributeSet: AttributeSet? = null,
defStyleAttr: Int = 0
) : MaterialButton(context, attributeSet, defStyleAttr) {
init {
setBgColor(context.getDefaultPrefs().getInt("manager_accent", defAccentColor))
context.lifecycleOwner()?.let { owner ->
accentColor.observe(owner) { color ->
setBgColor(color.toInt())
}
}
}
private fun setBgColor(color: Int) {
setBackgroundColor(color)
if (ColorUtils.calculateLuminance(color) < 0.75) {
setTextColor(ResourcesCompat.getColor(resources, R.color.White, null))
} else {
setTextColor(ResourcesCompat.getColor(resources, R.color.Black, null))
}
}
}

View File

@ -0,0 +1,25 @@
package com.vanced.manager.ui.core
import android.content.Context
import android.content.res.ColorStateList
import android.util.AttributeSet
import com.google.android.material.checkbox.MaterialCheckBox
import com.vanced.manager.R
import com.vanced.manager.utils.Extensions.getDefaultPrefs
import com.vanced.manager.utils.Extensions.lifecycleOwner
import com.vanced.manager.utils.ThemeHelper.accentColor
import com.vanced.manager.utils.ThemeHelper.defAccentColor
class ThemedMaterialCheckbox @JvmOverloads constructor(
context: Context,
attributeSet: AttributeSet? = null,
) : MaterialCheckBox(context, attributeSet, R.attr.checkboxStyle) {
init {
buttonTintList = ColorStateList.valueOf(context.getDefaultPrefs().getInt("manager_accent", defAccentColor))
context.lifecycleOwner()?.let { owner ->
accentColor.observe(owner) { color ->
buttonTintList = ColorStateList.valueOf(color.toInt())
}
}
}
}

View File

@ -0,0 +1,25 @@
package com.vanced.manager.ui.core
import android.content.Context
import android.content.res.ColorStateList
import android.util.AttributeSet
import com.google.android.material.radiobutton.MaterialRadioButton
import com.vanced.manager.R
import com.vanced.manager.utils.Extensions.getDefaultPrefs
import com.vanced.manager.utils.Extensions.lifecycleOwner
import com.vanced.manager.utils.ThemeHelper.accentColor
import com.vanced.manager.utils.ThemeHelper.defAccentColor
class ThemedMaterialRadioButton @JvmOverloads constructor(
context: Context,
attributeSet: AttributeSet? = null,
) : MaterialRadioButton(context, attributeSet, R.attr.radioButtonStyle) {
init {
buttonTintList = ColorStateList.valueOf(context.getDefaultPrefs().getInt("manager_accent", defAccentColor))
context.lifecycleOwner()?.let { owner ->
accentColor.observe(owner) { color ->
buttonTintList = ColorStateList.valueOf(color.toInt())
}
}
}
}

View File

@ -0,0 +1,24 @@
package com.vanced.manager.ui.core
import android.content.Context
import android.util.AttributeSet
import com.google.android.material.button.MaterialButton
import com.vanced.manager.utils.Extensions.getDefaultPrefs
import com.vanced.manager.utils.Extensions.lifecycleOwner
import com.vanced.manager.utils.ThemeHelper.accentColor
import com.vanced.manager.utils.ThemeHelper.defAccentColor
class ThemedOutlinedMaterialButton @JvmOverloads constructor(
context: Context,
attributeSet: AttributeSet? = null,
defStyleAttr: Int = 0
) : MaterialButton(context, attributeSet, defStyleAttr) {
init {
setTextColor(context.getDefaultPrefs().getInt("manager_accent", defAccentColor))
context.lifecycleOwner()?.let { owner ->
accentColor.observe(owner) { color ->
setTextColor(color.toInt())
}
}
}
}

View File

@ -0,0 +1,38 @@
package com.vanced.manager.ui.core
import android.content.Context
import android.content.res.ColorStateList
import android.graphics.Color
import android.util.AttributeSet
import androidx.appcompat.widget.SwitchCompat
import androidx.core.graphics.ColorUtils
import androidx.core.graphics.drawable.DrawableCompat
import com.vanced.manager.R
import com.vanced.manager.utils.Extensions.getDefaultPrefs
import com.vanced.manager.utils.Extensions.lifecycleOwner
import com.vanced.manager.utils.ThemeHelper.accentColor
import com.vanced.manager.utils.ThemeHelper.defAccentColor
class ThemedSwitchCompat @JvmOverloads constructor(
context: Context,
attributeSet: AttributeSet? = null,
) : SwitchCompat(context, attributeSet, R.attr.switchStyle) {
private val states = arrayOf(intArrayOf(-android.R.attr.state_checked), intArrayOf(android.R.attr.state_checked))
init {
setSwitchColors(context.getDefaultPrefs().getInt("manager_accent", defAccentColor))
context.lifecycleOwner()?.let { owner ->
accentColor.observe(owner) { color ->
setSwitchColors(color.toInt())
}
}
}
private fun setSwitchColors(color: Int) {
val thumbColors = intArrayOf(Color.LTGRAY, color)
val trackColors = intArrayOf(Color.GRAY, ColorUtils.setAlphaComponent(color, 70))
DrawableCompat.setTintList(DrawableCompat.wrap(thumbDrawable), ColorStateList(states, thumbColors))
DrawableCompat.setTintList(DrawableCompat.wrap(trackDrawable), ColorStateList(states, trackColors))
}
}

View File

@ -0,0 +1,24 @@
package com.vanced.manager.ui.core
import android.content.Context
import android.util.AttributeSet
import androidx.appcompat.widget.AppCompatTextView
import com.vanced.manager.utils.Extensions.getDefaultPrefs
import com.vanced.manager.utils.Extensions.lifecycleOwner
import com.vanced.manager.utils.ThemeHelper.accentColor
import com.vanced.manager.utils.ThemeHelper.defAccentColor
class ThemedTextView @JvmOverloads constructor(
context: Context,
attributeSet: AttributeSet? = null,
defStyleAttr: Int = 0
) : AppCompatTextView(context, attributeSet, defStyleAttr) {
init {
setTextColor(context.getDefaultPrefs().getInt("manager_accent", defAccentColor))
context.lifecycleOwner()?.let { owner ->
accentColor.observe(owner) { color ->
setTextColor(color.toInt())
}
}
}
}

View File

@ -10,6 +10,7 @@ import com.vanced.manager.R
import com.vanced.manager.core.ui.base.BindingBottomSheetDialogFragment
import com.vanced.manager.core.ui.ext.showDialog
import com.vanced.manager.databinding.DialogBottomRadioButtonBinding
import com.vanced.manager.ui.core.ThemedMaterialRadioButton
import com.vanced.manager.utils.Extensions.getCheckedButtonTag
import com.vanced.manager.utils.Extensions.getDefaultPrefs
@ -73,7 +74,7 @@ class AppVersionSelectorDialog : BindingBottomSheetDialogFragment<DialogBottomRa
private fun loadBoxes() =
arguments?.getStringArrayList(TAG_VERSIONS)?.map { version ->
MaterialRadioButton(requireActivity()).apply {
ThemedMaterialRadioButton(requireActivity()).apply {
text = version
tag = version
textSize = 18f

View File

@ -1,16 +1,23 @@
package com.vanced.manager.ui.dialogs
import android.graphics.Color
import android.os.Bundle
import android.util.Log
import android.view.LayoutInflater
import android.view.ViewGroup
import android.widget.TextView
import android.widget.Toast
import androidx.core.content.edit
import androidx.preference.PreferenceManager.getDefaultSharedPreferences
import com.google.android.material.radiobutton.MaterialRadioButton
import com.vanced.manager.core.ui.base.BindingBottomSheetDialogFragment
import com.madrapps.pikolo.listeners.OnColorSelectionListener
import com.vanced.manager.R
import com.vanced.manager.core.ui.base.BindingDialogFragment
import com.vanced.manager.databinding.DialogManagerAccentColorBinding
import com.vanced.manager.utils.Extensions.getCheckedButtonTag
import com.vanced.manager.utils.Extensions.toHex
import com.vanced.manager.utils.ThemeHelper.defAccentColor
import com.vanced.manager.utils.ThemeHelper.mutableAccentColor
class ManagerAccentColorDialog : BindingBottomSheetDialogFragment<DialogManagerAccentColorBinding>() {
class ManagerAccentColorDialog : BindingDialogFragment<DialogManagerAccentColorBinding>() {
companion object {
fun newInstance(): ManagerAccentColorDialog = ManagerAccentColorDialog().apply {
@ -28,21 +35,52 @@ class ManagerAccentColorDialog : BindingBottomSheetDialogFragment<DialogManagerA
override fun otherSetups() {
bindData()
isCancelable = false
}
private fun bindData() {
with(binding) {
val accent = prefs.getString("manager_accent", "Blue")
root.findViewWithTag<MaterialRadioButton>(accent).isChecked = true
val accent = prefs.getInt("manager_accent", defAccentColor)
hexEdittext.setText(accent.toHex(), TextView.BufferType.EDITABLE)
accentPicker.apply {
setColor(accent)
setColorSelectionListener(object : OnColorSelectionListener {
override fun onColorSelected(color: Int) {
mutableAccentColor.value = color
hexEdittext.setText(color.toHex(), TextView.BufferType.EDITABLE)
}
override fun onColorSelectionEnd(color: Int) {
return
}
override fun onColorSelectionStart(color: Int) {
return
}
})
}
accentSave.setOnClickListener {
val newPref = binding.accentRadiogroup.getCheckedButtonTag()
if (accent != newPref) {
prefs.edit { putString("manager_accent", newPref) }
dismiss()
requireActivity().recreate()
} else {
dismiss()
try {
val colorFromEdittext = Color.parseColor(hexEdittext.text.toString())
mutableAccentColor.value = colorFromEdittext
prefs.edit { putInt("manager_accent", colorFromEdittext) }
} catch (e: IllegalArgumentException) {
Log.d("VMTheme", getString(R.string.failed_accent))
Toast.makeText(requireActivity(), getString(R.string.failed_accent), Toast.LENGTH_SHORT).show()
return@setOnClickListener
}
dismiss()
}
accentSave.setOnClickListener {
mutableAccentColor.value = accent
dismiss()
}
accentReset.setOnClickListener {
prefs.edit { putInt("manager_accent", defAccentColor) }
mutableAccentColor.value = defAccentColor
dismiss()
}
}
}

View File

@ -7,10 +7,10 @@ import android.view.ViewGroup.LayoutParams.MATCH_PARENT
import android.view.ViewGroup.LayoutParams.WRAP_CONTENT
import androidx.core.content.edit
import androidx.preference.PreferenceManager.getDefaultSharedPreferences
import com.google.android.material.radiobutton.MaterialRadioButton
import com.vanced.manager.BuildConfig.MANAGER_LANGUAGES
import com.vanced.manager.core.ui.base.BindingBottomSheetDialogFragment
import com.vanced.manager.databinding.DialogManagerLanguageBinding
import com.vanced.manager.ui.core.ThemedMaterialRadioButton
import com.vanced.manager.utils.Extensions.getCheckedButtonTag
import com.vanced.manager.utils.LanguageHelper.getLanguageFormat
@ -41,7 +41,7 @@ class ManagerLanguageDialog : BindingBottomSheetDialogFragment<DialogManagerLang
languageRadiogroup.addView(mrb, MATCH_PARENT, WRAP_CONTENT)
}
val language = prefs.getString("manager_lang", "System Default")
root.findViewWithTag<MaterialRadioButton>(language).isChecked = true
root.findViewWithTag<ThemedMaterialRadioButton>(language).isChecked = true
languageSave.setOnClickListener {
val newPref = binding.languageRadiogroup.getCheckedButtonTag()
if (language != newPref) {
@ -57,7 +57,7 @@ class ManagerLanguageDialog : BindingBottomSheetDialogFragment<DialogManagerLang
private fun addRadioButtons() =
(arrayOf("System Default") + MANAGER_LANGUAGES).map { lang ->
MaterialRadioButton(requireActivity()).apply {
ThemedMaterialRadioButton(requireActivity()).apply {
text = getLanguageFormat(requireActivity(), lang)
textSize = 18f
tag = lang

View File

@ -37,7 +37,6 @@ class URLChangeDialog : BindingDialogFragment<DialogCustomUrlBinding>() {
private fun bindData() {
with(binding) {
urlInput.setText(
if (arguments != null) {
arguments?.getString("url")

View File

@ -16,6 +16,7 @@ import com.vanced.manager.R
import com.vanced.manager.core.ui.base.BindingBottomSheetDialogFragment
import com.vanced.manager.core.ui.ext.showDialog
import com.vanced.manager.databinding.DialogVancedLanguageSelectionBinding
import com.vanced.manager.ui.core.ThemedMaterialCheckbox
import com.vanced.manager.utils.InternetTools.vanced
import com.vanced.manager.utils.LanguageHelper.getDefaultVancedLanguages
import java.util.*
@ -66,7 +67,7 @@ class VancedLanguageSelectionDialog : BindingBottomSheetDialogFragment<DialogVan
val langPrefs = prefs.getString("lang", getDefaultVancedLanguages())
langs?.forEach { lang ->
val loc = Locale(lang)
val box: MaterialCheckBox = MaterialCheckBox(requireActivity()).apply {
val box = ThemedMaterialCheckbox(requireActivity()).apply {
tag = lang
isChecked = langPrefs?.contains(lang) ?: false
text = loc.getDisplayLanguage(loc).capitalize(Locale.ROOT)

View File

@ -6,11 +6,11 @@ import android.os.Bundle
import android.view.LayoutInflater
import android.view.ViewGroup
import androidx.core.content.edit
import com.google.android.material.radiobutton.MaterialRadioButton
import com.vanced.manager.R
import com.vanced.manager.core.ui.base.BindingBottomSheetDialogFragment
import com.vanced.manager.core.ui.ext.showDialog
import com.vanced.manager.databinding.DialogBottomRadioButtonBinding
import com.vanced.manager.ui.core.ThemedMaterialRadioButton
import com.vanced.manager.utils.Extensions.convertToAppTheme
import com.vanced.manager.utils.Extensions.getCheckedButtonTag
import com.vanced.manager.utils.InternetTools.vanced
@ -46,7 +46,7 @@ class VancedThemeSelectorDialog : BindingBottomSheetDialogFragment<DialogBottomR
)
}
dialogTitle.text = requireActivity().getString(R.string.theme)
val tag = root.findViewWithTag<MaterialRadioButton>(prefs.getString("theme", "dark"))
val tag = root.findViewWithTag<ThemedMaterialRadioButton>(prefs.getString("theme", "dark"))
if (tag != null) {
tag.isChecked = true
}
@ -61,7 +61,7 @@ class VancedThemeSelectorDialog : BindingBottomSheetDialogFragment<DialogBottomR
}
private fun loadButtons() = vanced.get()?.array<String>("themes")?.value?.map {theme ->
MaterialRadioButton(requireActivity()).apply {
ThemedMaterialRadioButton(requireActivity()).apply {
text = theme.convertToAppTheme(requireActivity())
tag = theme
textSize = 18f

View File

@ -17,7 +17,10 @@ import com.vanced.manager.core.ui.base.BindingFragment
import com.vanced.manager.core.ui.ext.showDialog
import com.vanced.manager.databinding.FragmentSettingsBinding
import com.vanced.manager.ui.dialogs.*
import com.vanced.manager.utils.Extensions.toHex
import com.vanced.manager.utils.LanguageHelper.getLanguageFormat
import com.vanced.manager.utils.ThemeHelper.accentColor
import com.vanced.manager.utils.ThemeHelper.defAccentColor
import java.io.File
class SettingsFragment : BindingFragment<FragmentSettingsBinding>() {
@ -26,10 +29,6 @@ class SettingsFragment : BindingFragment<FragmentSettingsBinding>() {
const val LIGHT = "Light"
const val DARK = "Dark"
const val BLUE = "Blue"
const val RED = "Red"
const val GREEN = "Green"
const val YELLOW = "Yellow"
}
private val prefs by lazy { getDefaultSharedPreferences(requireActivity()) }
@ -105,18 +104,12 @@ class SettingsFragment : BindingFragment<FragmentSettingsBinding>() {
}
private fun FragmentSettingsBinding.bindManagerAccentColor() {
val accentPref = prefs.getString("manager_accent", "Blue")
managerAccentColor.setSummary(prefs.getInt("manager_accent", defAccentColor).toHex())
managerAccentColor.apply {
setSummary(
when (accentPref) {
BLUE -> getString(R.string.accent_blue)
RED -> getString(R.string.accent_red)
GREEN -> getString(R.string.accent_green)
YELLOW -> getString(R.string.accent_yellow)
else -> getString(R.string.accent_purple)
}
)
setOnClickListener { showDialog(ManagerAccentColorDialog()) }
accentColor.observe(viewLifecycleOwner) {
managerAccentColor.setSummary(prefs.getInt("manager_accent", defAccentColor).toHex())
}
}
}

View File

@ -2,10 +2,12 @@ package com.vanced.manager.utils
import android.app.Activity
import android.content.Context
import android.content.ContextWrapper
import android.content.SharedPreferences
import android.widget.RadioGroup
import androidx.fragment.app.DialogFragment
import androidx.fragment.app.FragmentActivity
import androidx.lifecycle.LifecycleOwner
import androidx.preference.PreferenceManager.getDefaultSharedPreferences
import androidx.swiperefreshlayout.widget.SwipeRefreshLayout
import com.google.android.material.radiobutton.MaterialRadioButton
@ -20,10 +22,6 @@ object Extensions {
return findViewById<MaterialRadioButton>(checkedRadioButtonId)?.tag?.toString()
}
fun RadioGroup.getCheckedButtonText(): String {
return findViewById<MaterialRadioButton>(checkedRadioButtonId).text.toString()
}
fun DialogFragment.show(activity: FragmentActivity) {
show(activity.supportFragmentManager, "")
}
@ -71,4 +69,19 @@ object Extensions {
fun SharedPreferences.getInstallUrl() = getString("install_url", baseUrl)
fun Context.lifecycleOwner(): LifecycleOwner? {
var curContext = this
var maxDepth = 20
while (maxDepth-- > 0 && curContext !is LifecycleOwner) {
curContext = (curContext as ContextWrapper).baseContext
}
return if (curContext is LifecycleOwner) {
curContext
} else {
null
}
}
fun Int.toHex(): String = java.lang.String.format("#%06X", 0xFFFFFF and this)
}

View File

@ -10,7 +10,6 @@ import android.os.Build
import android.util.Log
import com.topjohnwu.superuser.Shell
import com.topjohnwu.superuser.io.SuFile
import com.topjohnwu.superuser.io.SuFileInputStream
import com.topjohnwu.superuser.io.SuFileOutputStream
import com.vanced.manager.BuildConfig
import com.vanced.manager.core.installer.AppInstallerService
@ -31,7 +30,6 @@ import java.util.*
import java.util.regex.Pattern
import kotlin.collections.ArrayList
import kotlin.collections.HashMap
import kotlin.jvm.Throws
object PackageHelper {

View File

@ -2,46 +2,29 @@ package com.vanced.manager.utils
import android.app.Activity
import android.content.res.Configuration
import androidx.lifecycle.LiveData
import androidx.lifecycle.MutableLiveData
import com.vanced.manager.R
import com.vanced.manager.utils.Extensions.getDefaultPrefs
object ThemeHelper {
const val defAccentColor: Int = -13732865
val mutableAccentColor = MutableLiveData<Int>()
val accentColor: LiveData<Int> = mutableAccentColor
fun Activity.setFinalTheme() {
val prefs = getDefaultPrefs()
val currentAccent = prefs.getString("manager_accent", "Blue")
when (prefs.getString("manager_theme", "System Default")) {
"Light" -> setTheme(getLightAccent(currentAccent))
"Dark" -> setTheme(getDarkAccent(currentAccent))
when (getDefaultPrefs().getString("manager_theme", "System Default")) {
"Light" -> setTheme(R.style.LightTheme)
"Dark" -> setTheme(R.style.DarkTheme)
"System Default" -> {
when (resources.configuration.uiMode and Configuration.UI_MODE_NIGHT_MASK) {
Configuration.UI_MODE_NIGHT_YES -> setTheme(getDarkAccent(currentAccent))
Configuration.UI_MODE_NIGHT_NO -> setTheme(getLightAccent(currentAccent))
Configuration.UI_MODE_NIGHT_YES -> setTheme(R.style.DarkTheme)
Configuration.UI_MODE_NIGHT_NO -> setTheme(R.style.LightTheme)
}
}
else -> setTheme(getLightAccent("Blue"))
}
}
private fun getDarkAccent(accentColor: String?): Int {
return when (accentColor) {
"Blue" -> R.style.DarkTheme_Blue
"Red" -> R.style.DarkTheme_Red
"Green" -> R.style.DarkTheme_Green
"Yellow" -> R.style.DarkTheme_Yellow
"Purple" -> R.style.DarkTheme_Purple
else -> R.style.DarkTheme_Blue
}
}
private fun getLightAccent(accentColor: String?): Int {
return when (accentColor) {
"Blue" -> R.style.LightTheme_Blue
"Red" -> R.style.LightTheme_Red
"Green" -> R.style.LightTheme_Green
"Yellow" -> R.style.LightTheme_Yellow
"Purple" -> R.style.LightTheme_Purple
else -> R.style.LightTheme_Blue
else -> setTheme(R.style.LightTheme)
}
}

View File

@ -58,7 +58,7 @@
android:textSize="15sp"
tools:text="Downloading base.apk..." />
<com.google.android.material.button.MaterialButton
<com.vanced.manager.ui.core.ThemedOutlinedMaterialButton
android:id="@+id/app_download_cancel"
android:layout_alignParentEnd="true"
android:text="@string/cancel"

View File

@ -33,7 +33,7 @@
app:layout_constraintTop_toBottomOf="@id/about_app_name"
tools:src="@drawable/ic_vanced" />
<TextView
<com.vanced.manager.ui.core.ThemedTextView
android:id="@+id/about_app_changelog_header"
android:layout_width="match_parent"
android:layout_height="wrap_content"
@ -50,5 +50,7 @@
android:layout_marginTop="8dp"
app:layout_constraintTop_toBottomOf="@id/about_app_changelog_header"
tools:text="@tools:sample/lorem/random" />
</androidx.constraintlayout.widget.ConstraintLayout>
</com.google.android.material.card.MaterialCardView>

View File

@ -23,7 +23,7 @@
</RadioGroup>
</androidx.core.widget.NestedScrollView>
<com.google.android.material.button.MaterialButton
<com.vanced.manager.ui.core.ThemedMaterialButton
android:id="@+id/dialog_save"
android:text="@string/save"
style="@style/BottomDialogButtonStyle" />

View File

@ -37,13 +37,13 @@
android:layout_height="wrap_content"
android:layout_marginTop="8dp">
<com.google.android.material.button.MaterialButton
<com.vanced.manager.ui.core.ThemedOutlinedMaterialButton
android:id="@+id/url_reset"
style="@style/OutlinedButtonStyle"
android:layout_alignParentStart="true"
android:text="@string/reset" />
<com.google.android.material.button.MaterialButton
<com.vanced.manager.ui.core.ThemedMaterialButton
android:id="@+id/url_save"
style="@style/ButtonStyle"
android:layout_alignParentEnd="true"

View File

@ -18,15 +18,17 @@
tools:text="@string/app_install_files_detected_summary"
style="@style/DialogCardSubtitle" />
<com.google.android.material.button.MaterialButton
<com.vanced.manager.ui.core.ThemedMaterialButton
android:id="@+id/installation_detected_install"
android:layout_marginTop="16dp"
android:text="@string/install"
style="@style/BottomDialogButtonStyle" />
<com.google.android.material.button.MaterialButton
<com.vanced.manager.ui.core.ThemedMaterialButton
android:id="@+id/installation_detected_redownload"
android:text="@string/redownload"
style="@style/BottomDialogButtonStyle" />
</LinearLayout>
</com.google.android.material.card.MaterialCardView>

View File

@ -1,5 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<com.google.android.material.card.MaterialCardView xmlns:android="http://schemas.android.com/apk/res/android"
<com.google.android.material.card.MaterialCardView
xmlns:android="http://schemas.android.com/apk/res/android"
style="@style/BottomDialogCard">
<LinearLayout
@ -11,55 +12,41 @@
android:text="@string/accent_color"
style="@style/BottomDialogCardTitle" />
<androidx.core.widget.NestedScrollView
<com.madrapps.pikolo.RGBColorPicker
android:id="@+id/accent_picker"
android:layout_width="match_parent"
android:layout_height="wrap_content">
android:layout_height="350dp" />
<RadioGroup
android:id="@+id/accent_radiogroup"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<com.google.android.material.textfield.TextInputEditText
android:id="@+id/hex_edittext"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
<com.google.android.material.radiobutton.MaterialRadioButton
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:tag="Blue"
android:text="@string/accent_blue"
android:textSize="18sp" />
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="8dp">
<com.google.android.material.radiobutton.MaterialRadioButton
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:tag="Red"
android:text="@string/accent_red"
android:textSize="18sp" />
<com.vanced.manager.ui.core.ThemedOutlinedMaterialButton
android:id="@+id/accent_reset"
style="@style/OutlinedButtonStyle"
android:layout_alignParentStart="true"
android:text="@string/reset" />
<com.google.android.material.radiobutton.MaterialRadioButton
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:tag="Green"
android:text="@string/accent_green"
android:textSize="18sp" />
<com.vanced.manager.ui.core.ThemedOutlinedMaterialButton
android:id="@+id/accent_cancel"
style="@style/OutlinedButtonStyle"
android:layout_alignEnd="@id/accent_save"
android:text="@string/cancel" />
<com.google.android.material.radiobutton.MaterialRadioButton
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:tag="Yellow"
android:text="@string/accent_yellow"
android:textSize="18sp" />
<com.vanced.manager.ui.core.ThemedMaterialButton
android:id="@+id/accent_save"
style="@style/ButtonStyle"
android:layout_alignParentEnd="true"
android:text="@string/save" />
<com.google.android.material.radiobutton.MaterialRadioButton
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:tag="Purple"
android:text="@string/accent_purple"
android:textSize="18sp" />
</RadioGroup>
</androidx.core.widget.NestedScrollView>
</RelativeLayout>
<com.google.android.material.button.MaterialButton
android:id="@+id/accent_save"
android:text="@string/save"
style="@style/BottomDialogButtonStyle" />
</LinearLayout>
</com.google.android.material.card.MaterialCardView>

View File

@ -21,7 +21,7 @@
android:layout_height="wrap_content" />
</androidx.core.widget.NestedScrollView>
<com.google.android.material.button.MaterialButton
<com.vanced.manager.ui.core.ThemedMaterialButton
android:id="@+id/language_save"
android:text="@string/save"
style="@style/BottomDialogButtonStyle" />

View File

@ -20,32 +20,35 @@
android:layout_width="match_parent"
android:layout_height="wrap_content">
<com.google.android.material.radiobutton.MaterialRadioButton
<com.vanced.manager.ui.core.ThemedMaterialRadioButton
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:tag="System Default"
android:text="@string/system_default"
android:textSize="18sp" />
<com.google.android.material.radiobutton.MaterialRadioButton
<com.vanced.manager.ui.core.ThemedMaterialRadioButton
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:tag="Light"
android:text="@string/theme_light"
android:textSize="18sp" />
<com.google.android.material.radiobutton.MaterialRadioButton
<com.vanced.manager.ui.core.ThemedMaterialRadioButton
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:tag="Dark"
android:text="@string/theme_dark"
android:textSize="18sp" />
</RadioGroup>
</androidx.core.widget.NestedScrollView>
<com.google.android.material.button.MaterialButton
<com.vanced.manager.ui.core.ThemedMaterialButton
android:id="@+id/theme_save"
android:text="@string/save"
style="@style/BottomDialogButtonStyle" />
</LinearLayout>
</com.google.android.material.card.MaterialCardView>

View File

@ -41,7 +41,7 @@
tools:progress="10"
tools:visibility="visible" />
<com.google.android.material.button.MaterialButton
<com.vanced.manager.ui.core.ThemedOutlinedMaterialButton
android:id="@+id/manager_update_cancel"
android:layout_width="wrap_content"
android:layout_height="wrap_content"

View File

@ -22,14 +22,14 @@
android:layout_height="wrap_content"
tools:ignore="HardcodedText">
<com.google.android.material.radiobutton.MaterialRadioButton
<com.vanced.manager.ui.core.ThemedMaterialRadioButton
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:tag="nonroot"
android:text="nonroot"
android:textSize="18sp" />
<com.google.android.material.radiobutton.MaterialRadioButton
<com.vanced.manager.ui.core.ThemedMaterialRadioButton
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:tag="root"
@ -38,7 +38,7 @@
</RadioGroup>
</androidx.core.widget.NestedScrollView>
<com.google.android.material.button.MaterialButton
<com.vanced.manager.ui.core.ThemedMaterialButton
android:id="@+id/variant_save"
android:text="@string/save"
style="@style/BottomDialogButtonStyle" />

View File

@ -34,7 +34,7 @@
android:src="@drawable/ic_baseline_navigate_next_36" />
</RelativeLayout>
<com.google.android.material.button.MaterialButton
<com.vanced.manager.ui.core.ThemedMaterialButton
android:id="@+id/music_install"
android:text="@string/install"
style="@style/BottomDialogButtonStyle" />

View File

@ -19,7 +19,7 @@
tools:itemCount="2"
tools:listitem="@layout/view_app_checkbox" />
<com.google.android.material.button.MaterialButton
<com.vanced.manager.ui.core.ThemedMaterialButton
android:id="@+id/select_apps_save"
style="@style/BottomDialogButtonStyle"
android:layout_marginTop="4dp"

View File

@ -29,7 +29,7 @@
android:orientation="vertical" />
</androidx.core.widget.NestedScrollView>
<com.google.android.material.button.MaterialButton
<com.vanced.manager.ui.core.ThemedMaterialButton
android:id="@+id/vanced_install_finish"
style="@style/BottomDialogButtonStyle"
android:text="@string/save" />

View File

@ -82,7 +82,7 @@
android:src="@drawable/ic_baseline_navigate_next_36" />
</RelativeLayout>
<com.google.android.material.button.MaterialButton
<com.vanced.manager.ui.core.ThemedMaterialButton
android:id="@+id/vanced_install"
android:text="@string/install"
style="@style/BottomDialogButtonStyle" />

View File

@ -26,7 +26,7 @@
tools:itemCount="3"
tools:listitem="@layout/view_app" />
<TextView
<com.vanced.manager.ui.core.ThemedTextView
android:layout_marginHorizontal="24dp"
android:layout_marginTop="12dp"
android:text="@string/support_us"
@ -42,7 +42,7 @@
tools:itemCount="2"
tools:listitem="@layout/view_sponsor" />
<TextView
<com.vanced.manager.ui.core.ThemedTextView
android:layout_marginHorizontal="24dp"
android:layout_marginTop="12dp"
android:text="@string/useful_links"

View File

@ -14,7 +14,7 @@
android:textAlignment="center"
app:layout_constraintTop_toTopOf="parent" />
<com.google.android.material.button.MaterialButton
<com.vanced.manager.ui.core.ThemedMaterialButton
android:id="@+id/welcome_get_started"
android:layout_width="wrap_content"
android:layout_height="wrap_content"

View File

@ -14,7 +14,7 @@
android:layout_height="match_parent"
android:orientation="vertical">
<TextView
<com.vanced.manager.ui.core.ThemedTextView
android:id="@+id/about_card_vancedTeam"
style="@style/CardTextHeader"
android:text="@string/manager_dev"

View File

@ -13,7 +13,7 @@
android:layout_height="match_parent"
android:orientation="vertical">
<TextView
<com.vanced.manager.ui.core.ThemedTextView
android:id="@+id/about_card_vancedTeam"
style="@style/CardTextHeader"
android:layout_marginStart="16dp"

View File

@ -14,7 +14,7 @@
android:layout_height="match_parent"
android:orientation="vertical">
<TextView
<com.vanced.manager.ui.core.ThemedTextView
android:id="@+id/about_card_vancedTeam"
style="@style/CardTextHeader"
android:text="@string/vanced_team"

View File

@ -21,14 +21,14 @@
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent">
<TextView
<com.vanced.manager.ui.core.ThemedTextView
android:id="@+id/app_name"
style="@style/CardTextHeader"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
tools:text="@string/vanced" />
<com.google.android.material.button.MaterialButton
<com.vanced.manager.ui.core.ThemedOutlinedMaterialButton
android:id="@+id/app_install_button"
style="@style/OutlinedButtonStyle"
android:layout_marginTop="4dp"

View File

@ -9,7 +9,7 @@
android:layout_marginTop="16dp"
android:layout_marginEnd="8dp">
<TextView
<com.vanced.manager.ui.core.ThemedTextView
android:id="@+id/app_checkbox_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
@ -48,4 +48,5 @@
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent"
tools:checked="true" />
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<TextView xmlns:android="http://schemas.android.com/apk/res/android"
<com.vanced.manager.ui.core.ThemedTextView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/category_title"
style="@style/CardTextHeader"

View File

@ -29,12 +29,11 @@
app:layout_constraintTop_toBottomOf="@id/preference_switch_title"
tools:text="Receive push notifications when an update for vanced is released" />
<androidx.appcompat.widget.SwitchCompat
<com.vanced.manager.ui.core.ThemedSwitchCompat
android:id="@+id/preference_switch"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:clickable="false"
android:theme="@style/PreferenceSwitch"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent" />

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<style name="LightTheme_Blue" parent="BaseLight_Blue">
<style name="LightTheme" parent="BaseLight">
<item name="android:windowLightStatusBar">true</item>
<item name="android:statusBarColor">?colorSurface</item>
</style>

View File

@ -10,6 +10,8 @@
<color name="GitHub">#17191A</color>
<color name="Gray">#5F5E5E</color>
<color name="White">#ffffff</color>
<color name="Black">#000000</color>
<color name="splash">#131317</color>
</resources>

View File

@ -105,6 +105,7 @@
<string name="chown_fail">Failed to `chown` APK to system owner, please try again.</string>
<string name="error_downloading">Error Downloading %1$s</string>
<string name="failed_uninstall">Failed to uninstall package %1$s</string>
<string name="failed_accent">Failed to apply new accent color</string>
<string name="files_missing_va">Failed to locate the required files for installation. Re-download the installation files, then try again.</string>
<string name="ifile_missing">Failed to locate apk file for black/dark theme from storage, please try again.</string>
<string name="installation_aborted">Installation failed because the user aborted the installation.</string>

View File

@ -2,7 +2,7 @@
<resources>
<!-- BASE LIGHT -->
<style name="BaseLight_Blue" parent="Theme.MaterialComponents.Light.NoActionBar">
<style name="BaseLight" parent="Theme.MaterialComponents.Light.NoActionBar">
<item name="colorPrimary">#2e73ff</item>
<item name="colorPrimaryVariant">#2C7EB9</item>
@ -41,47 +41,11 @@
<!-- LIGHT -->
<style name="LightTheme_Blue" parent="BaseLight_Blue"/>
<style name="LightTheme_Red" parent="LightTheme_Blue">
<item name="colorPrimary">#D71414</item>
<item name="colorPrimaryVariant">#B92C2C</item>
<item name="colorSecondary">#AF3E3E</item>
<item name="colorSecondaryVariant">#80AF3E3E</item>
</style>
<style name="LightTheme_Green" parent="LightTheme_Blue">
<item name="colorPrimary">#3ED714</item>
<item name="colorPrimaryVariant">#2CB943</item>
<item name="colorSecondary">#3EAF51</item>
<item name="colorSecondaryVariant">#803EAF44</item>
</style>
<style name="LightTheme_Yellow" parent="LightTheme_Blue">
<item name="colorPrimary">#ffd500</item>
<item name="colorPrimaryVariant">#A6FFD500</item>
<item name="colorSecondary">#D3B418</item>
<item name="colorSecondaryVariant">#B7D3B418</item>
</style>
<style name="LightTheme_Purple" parent="LightTheme_Blue">
<item name="colorPrimary">#6D49B7</item>
<item name="colorPrimaryVariant">#563C8D</item>
<item name="colorSecondary">#734BC7</item>
<item name="colorSecondaryVariant">#9A734BC7</item>
</style>
<style name="LightTheme" parent="BaseLight"/>
<!-- DARK -->
<style name="DarkTheme_Blue" parent="Theme.MaterialComponents.NoActionBar">
<style name="DarkTheme" parent="Theme.MaterialComponents.NoActionBar">
<item name="colorPrimary">#2e73ff</item>
<item name="colorPrimaryVariant">#2C7EB9</item>
@ -119,40 +83,4 @@
</style>
<style name="DarkTheme_Red" parent="DarkTheme_Blue">
<item name="colorPrimary">#D71414</item>
<item name="colorPrimaryVariant">#B92C2C</item>
<item name="colorSecondary">#AF3E3E</item>
<item name="colorSecondaryVariant">#80AF3E3E</item>
</style>
<style name="DarkTheme_Green" parent="DarkTheme_Blue">
<item name="colorPrimary">#3ED714</item>
<item name="colorPrimaryVariant">#2CB943</item>
<item name="colorSecondary">#3EAF51</item>
<item name="colorSecondaryVariant">#803EAF44</item>
</style>
<style name="DarkTheme_Yellow" parent="DarkTheme_Blue">
<item name="colorPrimary">#ffd500</item>
<item name="colorPrimaryVariant">#A6FFD500</item>
<item name="colorSecondary">#D3B418</item>
<item name="colorSecondaryVariant">#B7D3B418</item>
</style>
<style name="DarkTheme_Purple" parent="DarkTheme_Blue">
<item name="colorPrimary">#6D49B7</item>
<item name="colorPrimaryVariant">#563C8D</item>
<item name="colorSecondary">#734BC7</item>
<item name="colorSecondaryVariant">#9A734BC7</item>
</style>
</resources>

View File

@ -1,7 +1,7 @@
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
ext.kotlin_version = '1.4.10'
ext.kotlin_version = '1.4.21'
repositories {
google()
jcenter()
@ -13,7 +13,7 @@ buildscript {
classpath 'com.google.gms:google-services:4.3.4'
classpath 'com.google.firebase:perf-plugin:1.3.4'
classpath 'com.google.firebase:firebase-crashlytics-gradle:2.4.1'
classpath 'androidx.navigation:navigation-safe-args-gradle-plugin:2.3.1'
classpath 'androidx.navigation:navigation-safe-args-gradle-plugin:2.3.2'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files