feat: split all settings

This commit is contained in:
aayush262 2024-04-11 17:25:41 +05:30
parent 5e5277404e
commit 674a512630
19 changed files with 2157 additions and 1754 deletions

View file

@ -132,6 +132,30 @@
<activity <activity
android:name=".settings.SettingsActivity" android:name=".settings.SettingsActivity"
android:parentActivityName=".MainActivity" /> android:parentActivityName=".MainActivity" />
<activity
android:name=".settings.SettingsAboutActivity"
android:parentActivityName=".MainActivity" />
<activity
android:name=".settings.SettingsAccountActivity"
android:parentActivityName=".MainActivity" />
<activity
android:name=".settings.SettingsAnimeActivity"
android:parentActivityName=".MainActivity" />
<activity
android:name=".settings.SettingsCommonActivity"
android:parentActivityName=".MainActivity" />
<activity
android:name=".settings.SettingsExtensionsActivity"
android:parentActivityName=".MainActivity" />
<activity
android:name=".settings.SettingsMangaActivity"
android:parentActivityName=".MainActivity" />
<activity
android:name=".settings.SettingsNotificationActivity"
android:parentActivityName=".MainActivity" />
<activity
android:name=".settings.SettingsThemeActivity"
android:parentActivityName=".MainActivity" />
<activity <activity
android:name=".settings.ExtensionsActivity" android:name=".settings.ExtensionsActivity"
android:parentActivityName=".MainActivity" android:parentActivityName=".MainActivity"

View file

@ -0,0 +1,126 @@
package ani.dantotsu.settings
import android.content.Intent
import android.os.Bundle
import android.view.View
import android.view.ViewGroup
import android.widget.TextView
import androidx.appcompat.app.AppCompatActivity
import androidx.core.view.updateLayoutParams
import androidx.lifecycle.lifecycleScope
import ani.dantotsu.BuildConfig
import ani.dantotsu.R
import ani.dantotsu.databinding.ActivitySettingsAboutBinding
import ani.dantotsu.initActivity
import ani.dantotsu.navBarHeight
import ani.dantotsu.others.AppUpdater
import ani.dantotsu.others.CustomBottomDialog
import ani.dantotsu.restartApp
import ani.dantotsu.settings.saving.PrefManager
import ani.dantotsu.settings.saving.PrefName
import ani.dantotsu.snackString
import ani.dantotsu.statusBarHeight
import ani.dantotsu.themes.ThemeManager
import ani.dantotsu.util.Logger
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.launch
class SettingsAboutActivity : AppCompatActivity() {
private lateinit var binding: ActivitySettingsAboutBinding
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
ThemeManager(this).applyTheme()
initActivity(this)
val context = this
binding = ActivitySettingsAboutBinding.inflate(layoutInflater)
setContentView(binding.root)
binding.apply {
settingsAboutLayout.updateLayoutParams<ViewGroup.MarginLayoutParams> {
topMargin = statusBarHeight
bottomMargin = navBarHeight
}
settingsAboutTitle.setOnClickListener { onBackPressedDispatcher.onBackPressed() }
settingsDev.setOnClickListener {
DevelopersDialogFragment().show(supportFragmentManager, "dialog")
}
settingsForks.setOnClickListener {
ForksDialogFragment().show(supportFragmentManager, "dialog")
}
settingsDisclaimer.setOnClickListener {
val text = TextView(context)
text.setText(R.string.full_disclaimer)
CustomBottomDialog.newInstance().apply {
setTitleText(getString(R.string.disclaimer))
addView(text)
setNegativeButton(getString(R.string.close)) {
dismiss()
}
show(supportFragmentManager, "dialog")
}
}
settingsFAQ.setOnClickListener {
startActivity(Intent(context, FAQActivity::class.java))
}
if (!BuildConfig.FLAVOR.contains("fdroid")) {
settingsCheckUpdate.apply {
isChecked = PrefManager.getVal(PrefName.CheckUpdate)
setOnCheckedChangeListener { _, isChecked ->
PrefManager.setVal(PrefName.CheckUpdate, isChecked)
if (!isChecked) {
snackString(getString(R.string.long_click_to_check_update))
}
}
setOnLongClickListener {
lifecycleScope.launch(Dispatchers.IO) {
AppUpdater.check(context, true)
}
true
}
}
settingsShareUsername.apply {
isChecked = PrefManager.getVal(PrefName.SharedUserID)
settingsShareUsername.setOnCheckedChangeListener { _, isChecked ->
PrefManager.setVal(PrefName.SharedUserID, isChecked)
}
}
} else {
settingsCheckUpdate.apply{
visibility = View.GONE
isEnabled = false
isChecked = false
}
settingsShareUsername.apply{
visibility = View.GONE
isEnabled = false
isChecked = false
}
}
settingsLogToFile.apply {
isChecked = PrefManager.getVal(PrefName.LogToFile)
setOnCheckedChangeListener { _, isChecked ->
PrefManager.setVal(PrefName.LogToFile, isChecked)
restartApp(binding.root)
}
}
settingsShareLog.setOnClickListener {
Logger.shareLog(context)
}
}
}
}

View file

@ -0,0 +1,201 @@
package ani.dantotsu.settings
import android.os.Bundle
import android.view.HapticFeedbackConstants
import android.view.View
import android.view.ViewGroup
import android.view.animation.AnimationUtils
import android.widget.TextView
import androidx.activity.OnBackPressedCallback
import androidx.appcompat.app.AppCompatActivity
import androidx.core.view.updateLayoutParams
import ani.dantotsu.R
import ani.dantotsu.connections.anilist.Anilist
import ani.dantotsu.connections.discord.Discord
import ani.dantotsu.connections.mal.MAL
import ani.dantotsu.databinding.ActivitySettingsAboutBinding
import ani.dantotsu.databinding.ActivitySettingsAccountsBinding
import ani.dantotsu.initActivity
import ani.dantotsu.loadImage
import ani.dantotsu.navBarHeight
import ani.dantotsu.openLinkInBrowser
import ani.dantotsu.others.CustomBottomDialog
import ani.dantotsu.settings.saving.PrefManager
import ani.dantotsu.settings.saving.PrefName
import ani.dantotsu.startMainActivity
import ani.dantotsu.statusBarHeight
import ani.dantotsu.themes.ThemeManager
import io.noties.markwon.Markwon
import io.noties.markwon.SoftBreakAddsNewLinePlugin
class SettingsAccountActivity : AppCompatActivity() {
private lateinit var binding: ActivitySettingsAccountsBinding
private val restartMainActivity = object : OnBackPressedCallback(false) {
override fun handleOnBackPressed() = startMainActivity(this@SettingsAccountActivity)
}
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
ThemeManager(this).applyTheme()
initActivity(this)
val context = this
binding = ActivitySettingsAccountsBinding.inflate(layoutInflater)
setContentView(binding.root)
binding.apply {
settingsAccountsLayout.updateLayoutParams<ViewGroup.MarginLayoutParams> {
topMargin = statusBarHeight
bottomMargin = navBarHeight
}
settingsaccountTitle.setOnClickListener { onBackPressedDispatcher.onBackPressed() }
settingsAccountHelp.setOnClickListener {
CustomBottomDialog.newInstance().apply {
setTitleText(context.getString(R.string.account_help))
addView(
TextView(it.context).apply {
val markWon = Markwon.builder(it.context)
.usePlugin(SoftBreakAddsNewLinePlugin.create()).build()
markWon.setMarkdown(this, context.getString(R.string.full_account_help))
}
)
}.show(supportFragmentManager, "dialog")
}
fun reload() {
if (Anilist.token != null) {
settingsAnilistLogin.setText(R.string.logout)
settingsAnilistLogin.setOnClickListener {
Anilist.removeSavedToken()
restartMainActivity.isEnabled = true
reload()
}
settingsAnilistUsername.visibility = View.VISIBLE
settingsAnilistUsername.text = Anilist.username
settingsAnilistAvatar.loadImage(Anilist.avatar)
settingsAnilistAvatar.setOnClickListener {
it.performHapticFeedback(HapticFeedbackConstants.LONG_PRESS)
val anilistLink = getString(
R.string.anilist_link,
PrefManager.getVal<String>(PrefName.AnilistUserName)
)
openLinkInBrowser(anilistLink)
}
settingsMALLoginRequired.visibility = View.GONE
settingsMALLogin.visibility = View.VISIBLE
settingsMALUsername.visibility = View.VISIBLE
if (MAL.token != null) {
settingsMALLogin.setText(R.string.logout)
settingsMALLogin.setOnClickListener {
MAL.removeSavedToken()
restartMainActivity.isEnabled = true
reload()
}
settingsMALUsername.visibility = View.VISIBLE
settingsMALUsername.text = MAL.username
settingsMALAvatar.loadImage(MAL.avatar)
settingsMALAvatar.setOnClickListener {
it.performHapticFeedback(HapticFeedbackConstants.LONG_PRESS)
openLinkInBrowser(getString(R.string.myanilist_link, MAL.username))
}
} else {
settingsMALAvatar.setImageResource(R.drawable.ic_round_person_24)
settingsMALUsername.visibility = View.GONE
settingsMALLogin.setText(R.string.login)
settingsMALLogin.setOnClickListener {
MAL.loginIntent(context)
}
}
} else {
settingsAnilistAvatar.setImageResource(R.drawable.ic_round_person_24)
settingsAnilistUsername.visibility = View.GONE
settingsAnilistLogin.setText(R.string.login)
settingsAnilistLogin.setOnClickListener {
Anilist.loginIntent(context)
}
settingsMALLoginRequired.visibility = View.VISIBLE
settingsMALLogin.visibility = View.GONE
settingsMALUsername.visibility = View.GONE
}
if (Discord.token != null) {
val id = PrefManager.getVal(PrefName.DiscordId, null as String?)
val avatar = PrefManager.getVal(PrefName.DiscordAvatar, null as String?)
val username = PrefManager.getVal(PrefName.DiscordUserName, null as String?)
if (id != null && avatar != null) {
settingsDiscordAvatar.loadImage("https://cdn.discordapp.com/avatars/$id/$avatar.png")
settingsDiscordAvatar.setOnClickListener {
it.performHapticFeedback(HapticFeedbackConstants.LONG_PRESS)
val discordLink = getString(R.string.discord_link, id)
openLinkInBrowser(discordLink)
}
}
settingsDiscordUsername.visibility = View.VISIBLE
settingsDiscordUsername.text =
username ?: Discord.token?.replace(Regex("."), "*")
settingsDiscordLogin.setText(R.string.logout)
settingsDiscordLogin.setOnClickListener {
Discord.removeSavedToken(context)
restartMainActivity.isEnabled = true
reload()
}
settingsImageSwitcher.visibility = View.VISIBLE
var initialStatus = when (PrefManager.getVal<String>(PrefName.DiscordStatus)) {
"online" -> R.drawable.discord_status_online
"idle" -> R.drawable.discord_status_idle
"dnd" -> R.drawable.discord_status_dnd
else -> R.drawable.discord_status_online
}
settingsImageSwitcher.setImageResource(initialStatus)
val zoomInAnimation =
AnimationUtils.loadAnimation(context, R.anim.bounce_zoom)
settingsImageSwitcher.setOnClickListener {
var status = "online"
initialStatus = when (initialStatus) {
R.drawable.discord_status_online -> {
status = "idle"
R.drawable.discord_status_idle
}
R.drawable.discord_status_idle -> {
status = "dnd"
R.drawable.discord_status_dnd
}
R.drawable.discord_status_dnd -> {
status = "online"
R.drawable.discord_status_online
}
else -> R.drawable.discord_status_online
}
PrefManager.setVal(PrefName.DiscordStatus, status)
settingsImageSwitcher.setImageResource(initialStatus)
settingsImageSwitcher.startAnimation(zoomInAnimation)
}
settingsImageSwitcher.setOnLongClickListener {
it.performHapticFeedback(HapticFeedbackConstants.LONG_PRESS)
DiscordDialogFragment().show(supportFragmentManager, "dialog")
true
}
} else {
settingsImageSwitcher.visibility = View.GONE
settingsDiscordAvatar.setImageResource(R.drawable.ic_round_person_24)
settingsDiscordUsername.visibility = View.GONE
settingsDiscordLogin.setText(R.string.login)
settingsDiscordLogin.setOnClickListener {
Discord.warning(context)
.show(supportFragmentManager, "dialog")
}
}
}
reload()
}
}
}

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,104 @@
package ani.dantotsu.settings
import android.app.AlertDialog
import android.content.Intent
import android.os.Bundle
import android.view.View
import android.view.ViewGroup
import androidx.appcompat.app.AppCompatActivity
import androidx.core.view.updateLayoutParams
import ani.dantotsu.R
import ani.dantotsu.databinding.ActivitySettingsAnimeBinding
import ani.dantotsu.databinding.ActivitySettingsMangaBinding
import ani.dantotsu.download.DownloadsManager
import ani.dantotsu.initActivity
import ani.dantotsu.media.MediaType
import ani.dantotsu.navBarHeight
import ani.dantotsu.restartApp
import ani.dantotsu.settings.saving.PrefManager
import ani.dantotsu.settings.saving.PrefName
import ani.dantotsu.statusBarHeight
import ani.dantotsu.themes.ThemeManager
import uy.kohesive.injekt.Injekt
import uy.kohesive.injekt.api.get
class SettingsAnimeActivity: AppCompatActivity(){
private lateinit var binding: ActivitySettingsAnimeBinding
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
ThemeManager(this).applyTheme()
initActivity(this)
val context = this
binding = ActivitySettingsAnimeBinding.inflate(layoutInflater)
setContentView(binding.root)
binding.apply {
settingsAnimeLayout.updateLayoutParams<ViewGroup.MarginLayoutParams> {
topMargin = statusBarHeight
bottomMargin = navBarHeight
}
settingsPlayer.setOnClickListener {
startActivity(Intent(context, PlayerSettingsActivity::class.java))
}
settingsAnimeTitle.setOnClickListener {
onBackPressedDispatcher.onBackPressed()
}
purgeAnimeDownloads.setOnClickListener {
val dialog = AlertDialog.Builder(context, R.style.MyPopup)
.setTitle(R.string.purge_anime_downloads)
.setMessage(getString(R.string.purge_confirm, getString(R.string.anime)))
.setPositiveButton(R.string.yes) { dialog, _ ->
val downloadsManager = Injekt.get<DownloadsManager>()
downloadsManager.purgeDownloads(MediaType.ANIME)
dialog.dismiss()
}.setNegativeButton(R.string.no) { dialog, _ ->
dialog.dismiss()
}.create()
dialog.window?.setDimAmount(0.8f)
dialog.show()
}
settingsPreferDub.isChecked = PrefManager.getVal(PrefName.SettingsPreferDub)
settingsPreferDub.setOnCheckedChangeListener { _, isChecked ->
PrefManager.setVal(PrefName.SettingsPreferDub, isChecked)
}
settingsShowYt.isChecked = PrefManager.getVal(PrefName.ShowYtButton)
settingsShowYt.setOnCheckedChangeListener { _, isChecked ->
PrefManager.setVal(PrefName.ShowYtButton, isChecked)
}
settingsIncludeAnimeList.isChecked = PrefManager.getVal(PrefName.IncludeAnimeList)
settingsIncludeAnimeList.setOnCheckedChangeListener { _, isChecked ->
PrefManager.setVal(PrefName.IncludeAnimeList, isChecked)
restartApp(binding.root)
}
var previousEp: View = when (PrefManager.getVal<Int>(PrefName.AnimeDefaultView)) {
0 -> settingsEpList
1 -> settingsEpGrid
2 -> settingsEpCompact
else -> settingsEpList
}
previousEp.alpha = 1f
fun uiEp(mode: Int, current: View) {
previousEp.alpha = 0.33f
previousEp = current
current.alpha = 1f
PrefManager.setVal(PrefName.AnimeDefaultView, mode)
}
settingsEpList.setOnClickListener {
uiEp(0, it)
}
settingsEpGrid.setOnClickListener {
uiEp(1, it)
}
settingsEpCompact.setOnClickListener {
uiEp(2, it)
}
}
}
}

View file

@ -0,0 +1,334 @@
package ani.dantotsu.settings
import android.app.AlertDialog
import android.content.Intent
import android.net.Uri
import android.os.Bundle
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.view.inputmethod.EditorInfo
import android.widget.ArrayAdapter
import android.widget.TextView
import androidx.activity.result.contract.ActivityResultContracts
import androidx.appcompat.app.AppCompatActivity
import androidx.core.view.updateLayoutParams
import androidx.documentfile.provider.DocumentFile
import ani.dantotsu.R
import ani.dantotsu.databinding.ActivitySettingsCommonBinding
import ani.dantotsu.download.DownloadsManager
import ani.dantotsu.initActivity
import ani.dantotsu.navBarHeight
import ani.dantotsu.restartApp
import ani.dantotsu.savePrefsToDownloads
import ani.dantotsu.settings.saving.PrefManager
import ani.dantotsu.settings.saving.PrefName
import ani.dantotsu.settings.saving.internal.Location
import ani.dantotsu.settings.saving.internal.PreferenceKeystore
import ani.dantotsu.settings.saving.internal.PreferencePackager
import ani.dantotsu.statusBarHeight
import ani.dantotsu.themes.ThemeManager
import ani.dantotsu.toast
import ani.dantotsu.util.LauncherWrapper
import ani.dantotsu.util.StoragePermissions
import com.google.android.material.textfield.TextInputEditText
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.GlobalScope
import kotlinx.coroutines.launch
import uy.kohesive.injekt.Injekt
import uy.kohesive.injekt.api.get
class SettingsCommonActivity: AppCompatActivity(){
private lateinit var binding: ActivitySettingsCommonBinding
private lateinit var launcher: LauncherWrapper
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
ThemeManager(this).applyTheme()
initActivity(this)
val context = this
binding = ActivitySettingsCommonBinding.inflate(layoutInflater)
setContentView(binding.root)
val openDocumentLauncher =
registerForActivityResult(ActivityResultContracts.OpenDocument()) { uri ->
if (uri != null) {
try {
val jsonString = contentResolver.openInputStream(uri)?.readBytes()
?: throw Exception("Error reading file")
val name = DocumentFile.fromSingleUri(this, uri)?.name ?: "settings"
//.sani is encrypted, .ani is not
if (name.endsWith(".sani")) {
passwordAlertDialog(false) { password ->
if (password != null) {
val salt = jsonString.copyOfRange(0, 16)
val encrypted = jsonString.copyOfRange(16, jsonString.size)
val decryptedJson = try {
PreferenceKeystore.decryptWithPassword(
password, encrypted, salt
)
} catch (e: Exception) {
toast(getString(R.string.incorrect_password))
return@passwordAlertDialog
}
if (PreferencePackager.unpack(decryptedJson)) restartApp(binding.root)
} else {
toast(getString(R.string.password_cannot_be_empty))
}
}
} else if (name.endsWith(".ani")) {
val decryptedJson = jsonString.toString(Charsets.UTF_8)
if (PreferencePackager.unpack(decryptedJson)) restartApp(binding.root)
} else {
toast(getString(R.string.unknown_file_type))
}
} catch (e: Exception) {
e.printStackTrace()
toast(getString(R.string.error_importing_settings))
}
}
}
val contract = ActivityResultContracts.OpenDocumentTree()
launcher = LauncherWrapper(this, contract)
val managers = arrayOf("Default", "1DM", "ADM")
val downloadManagerDialog =
AlertDialog.Builder(this, R.style.MyPopup).setTitle(R.string.download_manager)
var downloadManager: Int = PrefManager.getVal(PrefName.DownloadManager)
binding.apply {
settingsCommonLayout.updateLayoutParams<ViewGroup.MarginLayoutParams> {
topMargin = statusBarHeight
bottomMargin = navBarHeight
}
settingsCommonTitle.setOnClickListener {
onBackPressedDispatcher.onBackPressed()
}
settingsDownloadManager.setOnClickListener {
val dialog = downloadManagerDialog.setSingleChoiceItems(
managers, downloadManager
) { dialog, count ->
downloadManager = count
PrefManager.setVal(PrefName.DownloadManager, downloadManager)
dialog.dismiss()
}.show()
dialog.window?.setDimAmount(0.8f)
}
importExportSettings.setOnClickListener {
StoragePermissions.downloadsPermission(context)
val selectedArray = mutableListOf(false)
val filteredLocations = Location.entries.filter { it.exportable }
selectedArray.addAll(List(filteredLocations.size - 1) { false })
val dialog = AlertDialog.Builder(context, R.style.MyPopup)
.setTitle(R.string.backup_restore).setMultiChoiceItems(
filteredLocations.map { it.name }.toTypedArray(),
selectedArray.toBooleanArray()
) { _, which, isChecked ->
selectedArray[which] = isChecked
}.setPositiveButton(R.string.button_restore) { dialog, _ ->
openDocumentLauncher.launch(arrayOf("*/*"))
dialog.dismiss()
}.setNegativeButton(R.string.button_backup) { dialog, _ ->
if (!selectedArray.contains(true)) {
toast(R.string.no_location_selected)
return@setNegativeButton
}
dialog.dismiss()
val selected =
filteredLocations.filterIndexed { index, _ -> selectedArray[index] }
if (selected.contains(Location.Protected)) {
passwordAlertDialog(true) { password ->
if (password != null) {
savePrefsToDownloads(
"DantotsuSettings",
PrefManager.exportAllPrefs(selected),
context,
password
)
} else {
toast(R.string.password_cannot_be_empty)
}
}
} else {
savePrefsToDownloads(
"DantotsuSettings",
PrefManager.exportAllPrefs(selected),
context,
null
)
}
}.setNeutralButton(R.string.cancel) { dialog, _ ->
dialog.dismiss()
}.create()
dialog.window?.setDimAmount(0.8f)
dialog.show()
}
val exDns = listOf(
"None",
"Cloudflare",
"Google",
"AdGuard",
"Quad9",
"AliDNS",
"DNSPod",
"360",
"Quad101",
"Mullvad",
"Controld",
"Njalla",
"Shecan",
"Libre"
)
settingsExtensionDns.setText(exDns[PrefManager.getVal(PrefName.DohProvider)])
settingsExtensionDns.setAdapter(
ArrayAdapter(
context, R.layout.item_dropdown, exDns
)
)
settingsExtensionDns.setOnItemClickListener { _, _, i, _ ->
PrefManager.setVal(PrefName.DohProvider, i)
settingsExtensionDns.clearFocus()
restartApp(binding.root)
}
settingsContinueMedia.isChecked = PrefManager.getVal(PrefName.ContinueMedia)
settingsContinueMedia.setOnCheckedChangeListener { _, isChecked ->
PrefManager.setVal(PrefName.ContinueMedia, isChecked)
}
settingsSearchSources.isChecked = PrefManager.getVal(PrefName.SearchSources)
settingsSearchSources.setOnCheckedChangeListener { _, isChecked ->
PrefManager.setVal(PrefName.SearchSources, isChecked)
}
settingsRecentlyListOnly.isChecked = PrefManager.getVal(PrefName.RecentlyListOnly)
settingsRecentlyListOnly.setOnCheckedChangeListener { _, isChecked ->
PrefManager.setVal(PrefName.RecentlyListOnly, isChecked)
}
settingsAdultAnimeOnly.isChecked = PrefManager.getVal(PrefName.AdultOnly)
settingsAdultAnimeOnly.setOnCheckedChangeListener { _, isChecked ->
PrefManager.setVal(PrefName.AdultOnly, isChecked)
restartApp(binding.root)
}
settingsDownloadLocation.setOnClickListener {
val dialog = AlertDialog.Builder(context, R.style.MyPopup)
.setTitle(R.string.change_download_location)
.setMessage(R.string.download_location_msg)
.setPositiveButton(R.string.ok) { dialog, _ ->
val oldUri = PrefManager.getVal<String>(PrefName.DownloadsDir)
launcher.registerForCallback { success ->
if (success) {
toast(getString(R.string.please_wait))
val newUri = PrefManager.getVal<String>(PrefName.DownloadsDir)
GlobalScope.launch(Dispatchers.IO) {
Injekt.get<DownloadsManager>().moveDownloadsDir(
context, Uri.parse(oldUri), Uri.parse(newUri)
) { finished, message ->
if (finished) {
toast(getString(R.string.success))
} else {
toast(message)
}
}
}
} else {
toast(getString(R.string.error))
}
}
launcher.launch()
dialog.dismiss()
}.setNeutralButton(R.string.cancel) { dialog, _ ->
dialog.dismiss()
}.create()
dialog.window?.setDimAmount(0.8f)
dialog.show()
}
var previousStart: View = when (PrefManager.getVal<Int>(PrefName.DefaultStartUpTab)) {
0 -> uiSettingsAnime
1 -> uiSettingsHome
2 -> uiSettingsManga
else -> uiSettingsHome
}
previousStart.alpha = 1f
fun uiDefault(mode: Int, current: View) {
previousStart.alpha = 0.33f
previousStart = current
current.alpha = 1f
PrefManager.setVal(PrefName.DefaultStartUpTab, mode)
initActivity(context)
}
uiSettingsAnime.setOnClickListener {
uiDefault(0, it)
}
uiSettingsHome.setOnClickListener {
uiDefault(1, it)
}
uiSettingsManga.setOnClickListener {
uiDefault(2, it)
}
settingsUi.setOnClickListener {
startActivity(
Intent(
context, UserInterfaceSettingsActivity::class.java
)
)
}
}
}
private fun passwordAlertDialog(isExporting: Boolean, callback: (CharArray?) -> Unit) {
val password = CharArray(16).apply { fill('0') }
// Inflate the dialog layout
val dialogView = LayoutInflater.from(this).inflate(R.layout.dialog_user_agent, null)
val box = dialogView.findViewById<TextInputEditText>(R.id.userAgentTextBox)
box?.hint = getString(R.string.password)
box?.setSingleLine()
val dialog =
AlertDialog.Builder(this, R.style.MyPopup).setTitle(getString(R.string.enter_password))
.setView(dialogView).setPositiveButton(R.string.ok, null)
.setNegativeButton(R.string.cancel) { dialog, _ ->
password.fill('0')
dialog.dismiss()
callback(null)
}.create()
fun handleOkAction() {
val editText = dialog.findViewById<TextInputEditText>(R.id.userAgentTextBox)
if (editText?.text?.isNotBlank() == true) {
editText.text?.toString()?.trim()?.toCharArray(password)
dialog.dismiss()
callback(password)
} else {
toast(getString(R.string.password_cannot_be_empty))
}
}
box?.setOnEditorActionListener { _, actionId, _ ->
if (actionId == EditorInfo.IME_ACTION_DONE) {
handleOkAction()
true
} else {
false
}
}
val subtitleTextView = dialogView.findViewById<TextView>(R.id.subtitle)
subtitleTextView?.visibility = View.VISIBLE
if (!isExporting) subtitleTextView?.text =
getString(R.string.enter_password_to_decrypt_file)
dialog.window?.setDimAmount(0.8f)
dialog.show()
// Override the positive button here
dialog.getButton(AlertDialog.BUTTON_POSITIVE).setOnClickListener {
handleOkAction()
}
}
}

View file

@ -0,0 +1,246 @@
package ani.dantotsu.settings
import android.app.AlertDialog
import android.os.Bundle
import android.view.HapticFeedbackConstants
import android.view.KeyEvent
import android.view.LayoutInflater
import android.view.ViewGroup
import android.view.inputmethod.EditorInfo
import android.widget.EditText
import androidx.appcompat.app.AppCompatActivity
import androidx.core.view.isVisible
import androidx.core.view.updateLayoutParams
import ani.dantotsu.R
import ani.dantotsu.copyToClipboard
import ani.dantotsu.databinding.ActivitySettingsExtensionsBinding
import ani.dantotsu.databinding.ItemRepositoryBinding
import ani.dantotsu.initActivity
import ani.dantotsu.media.MediaType
import ani.dantotsu.navBarHeight
import ani.dantotsu.settings.saving.PrefManager
import ani.dantotsu.settings.saving.PrefName
import ani.dantotsu.statusBarHeight
import ani.dantotsu.themes.ThemeManager
import com.google.android.material.textfield.TextInputEditText
import eu.kanade.domain.base.BasePreferences
import eu.kanade.tachiyomi.extension.anime.AnimeExtensionManager
import eu.kanade.tachiyomi.extension.manga.MangaExtensionManager
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.launch
import uy.kohesive.injekt.Injekt
import uy.kohesive.injekt.api.get
import uy.kohesive.injekt.injectLazy
class SettingsExtensionsActivity: AppCompatActivity() {
private lateinit var binding: ActivitySettingsExtensionsBinding
private val extensionInstaller = Injekt.get<BasePreferences>().extensionInstaller()
private val animeExtensionManager: AnimeExtensionManager by injectLazy()
private val mangaExtensionManager: MangaExtensionManager by injectLazy()
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
ThemeManager(this).applyTheme()
initActivity(this)
val context = this
binding = ActivitySettingsExtensionsBinding.inflate(layoutInflater)
setContentView(binding.root)
binding.apply {
fun setExtensionOutput(repoInventory: ViewGroup, type: MediaType) {
repoInventory.removeAllViews()
val prefName: PrefName? = when (type) {
MediaType.ANIME -> {
PrefName.AnimeExtensionRepos
}
MediaType.MANGA -> {
PrefName.MangaExtensionRepos
}
else -> {
null
}
}
prefName?.let { repoList ->
PrefManager.getVal<Set<String>>(repoList).forEach { item ->
val view = ItemRepositoryBinding.inflate(
LayoutInflater.from(repoInventory.context), repoInventory, true
)
view.repositoryItem.text =
item.removePrefix("https://raw.githubusercontent.com")
view.repositoryItem.setOnClickListener {
AlertDialog.Builder(context, R.style.MyPopup)
.setTitle(R.string.rem_repository).setMessage(item)
.setPositiveButton(getString(R.string.ok)) { dialog, _ ->
val repos =
PrefManager.getVal<Set<String>>(repoList).minus(item)
PrefManager.setVal(repoList, repos)
setExtensionOutput(repoInventory, type)
CoroutineScope(Dispatchers.IO).launch {
when (type) {
MediaType.ANIME -> {
animeExtensionManager.findAvailableExtensions()
}
MediaType.MANGA -> {
mangaExtensionManager.findAvailableExtensions()
}
else -> {}
}
}
dialog.dismiss()
}.setNegativeButton(getString(R.string.cancel)) { dialog, _ ->
dialog.dismiss()
}.create().show()
}
view.repositoryItem.setOnLongClickListener {
it.performHapticFeedback(HapticFeedbackConstants.LONG_PRESS)
copyToClipboard(item, true)
true
}
}
repoInventory.isVisible = repoInventory.childCount > 0
}
}
fun processUserInput(input: String, mediaType: MediaType) {
val entry =
if (input.endsWith("/") || input.endsWith("index.min.json")) input.substring(
0,
input.lastIndexOf("/")
) else input
if (mediaType == MediaType.ANIME) {
val anime =
PrefManager.getVal<Set<String>>(PrefName.AnimeExtensionRepos).plus(entry)
PrefManager.setVal(PrefName.AnimeExtensionRepos, anime)
CoroutineScope(Dispatchers.IO).launch {
animeExtensionManager.findAvailableExtensions()
}
setExtensionOutput(animeRepoInventory, MediaType.ANIME)
}
if (mediaType == MediaType.MANGA) {
val manga =
PrefManager.getVal<Set<String>>(PrefName.MangaExtensionRepos).plus(entry)
PrefManager.setVal(PrefName.MangaExtensionRepos, manga)
CoroutineScope(Dispatchers.IO).launch {
mangaExtensionManager.findAvailableExtensions()
}
setExtensionOutput(mangaRepoInventory, MediaType.MANGA)
}
}
fun processEditorAction(dialog: AlertDialog, editText: EditText, mediaType: MediaType) {
editText.setOnEditorActionListener { textView, action, keyEvent ->
if (action == EditorInfo.IME_ACTION_SEARCH || action == EditorInfo.IME_ACTION_DONE || (keyEvent?.action == KeyEvent.ACTION_UP && keyEvent.keyCode == KeyEvent.KEYCODE_ENTER)) {
return@setOnEditorActionListener if (textView.text.isNullOrBlank()) {
false
} else {
processUserInput(textView.text.toString(), mediaType)
dialog.dismiss()
true
}
}
false
}
}
settingsExtensionsLayout.updateLayoutParams<ViewGroup.MarginLayoutParams> {
topMargin = statusBarHeight
bottomMargin = navBarHeight
}
settingsExtensionsTitle.setOnClickListener{
onBackPressedDispatcher.onBackPressed()
}
setExtensionOutput(animeRepoInventory, MediaType.ANIME)
setExtensionOutput(mangaRepoInventory, MediaType.MANGA)
animeAddRepository.setOnClickListener {
val dialogView = layoutInflater.inflate(R.layout.dialog_user_agent, null)
val editText =
dialogView.findViewById<TextInputEditText>(R.id.userAgentTextBox).apply {
hint = getString(R.string.anime_add_repository)
}
val alertDialog = AlertDialog.Builder(context, R.style.MyPopup)
.setTitle(R.string.anime_add_repository).setView(dialogView)
.setPositiveButton(getString(R.string.ok)) { dialog, _ ->
if (!editText.text.isNullOrBlank()) processUserInput(
editText.text.toString(),
MediaType.ANIME
)
dialog.dismiss()
}.setNegativeButton(getString(R.string.cancel)) { dialog, _ ->
dialog.dismiss()
}.create()
processEditorAction(alertDialog, editText, MediaType.ANIME)
alertDialog.show()
alertDialog.window?.setDimAmount(0.8f)
}
mangaAddRepository.setOnClickListener {
val dialogView = layoutInflater.inflate(R.layout.dialog_user_agent, null)
val editText =
dialogView.findViewById<TextInputEditText>(R.id.userAgentTextBox).apply {
hint = getString(R.string.manga_add_repository)
}
val alertDialog = AlertDialog.Builder(context, R.style.MyPopup)
.setTitle(R.string.manga_add_repository).setView(dialogView)
.setPositiveButton(getString(R.string.ok)) { dialog, _ ->
if (!editText.text.isNullOrBlank()) processUserInput(
editText.text.toString(),
MediaType.MANGA
)
dialog.dismiss()
}.setNegativeButton(getString(R.string.cancel)) { dialog, _ ->
dialog.dismiss()
}.create()
processEditorAction(alertDialog, editText, MediaType.MANGA)
alertDialog.show()
alertDialog.window?.setDimAmount(0.8f)
}
settingsForceLegacyInstall.isChecked =
extensionInstaller.get() == BasePreferences.ExtensionInstaller.LEGACY
settingsForceLegacyInstall.setOnCheckedChangeListener { _, isChecked ->
if (isChecked) {
extensionInstaller.set(BasePreferences.ExtensionInstaller.LEGACY)
} else {
extensionInstaller.set(BasePreferences.ExtensionInstaller.PACKAGEINSTALLER)
}
}
skipExtensionIcons.isChecked = PrefManager.getVal(PrefName.SkipExtensionIcons)
skipExtensionIcons.setOnCheckedChangeListener { _, isChecked ->
PrefManager.getVal(PrefName.SkipExtensionIcons, isChecked)
}
NSFWExtension.isChecked = PrefManager.getVal(PrefName.NSFWExtension)
NSFWExtension.setOnCheckedChangeListener { _, isChecked ->
PrefManager.setVal(PrefName.NSFWExtension, isChecked)
}
userAgent.setOnClickListener {
val dialogView = layoutInflater.inflate(R.layout.dialog_user_agent, null)
val editText = dialogView.findViewById<TextInputEditText>(R.id.userAgentTextBox)
editText.setText(PrefManager.getVal<String>(PrefName.DefaultUserAgent))
val alertDialog = AlertDialog.Builder(context, R.style.MyPopup)
.setTitle(R.string.user_agent).setView(dialogView)
.setPositiveButton(getString(R.string.ok)) { dialog, _ ->
PrefManager.setVal(PrefName.DefaultUserAgent, editText.text.toString())
dialog.dismiss()
}.setNeutralButton(getString(R.string.reset)) { dialog, _ ->
PrefManager.removeVal(PrefName.DefaultUserAgent)
editText.setText("")
dialog.dismiss()
}.setNegativeButton(getString(R.string.cancel)) { dialog, _ ->
dialog.dismiss()
}.create()
alertDialog.show()
alertDialog.window?.setDimAmount(0.8f)
}
}
}
}

View file

@ -0,0 +1,104 @@
package ani.dantotsu.settings
import android.app.AlertDialog
import android.content.Intent
import android.os.Bundle
import android.view.View
import android.view.ViewGroup
import androidx.appcompat.app.AppCompatActivity
import androidx.core.view.updateLayoutParams
import ani.dantotsu.R
import ani.dantotsu.databinding.ActivitySettingsMangaBinding
import ani.dantotsu.download.DownloadsManager
import ani.dantotsu.initActivity
import ani.dantotsu.media.MediaType
import ani.dantotsu.navBarHeight
import ani.dantotsu.restartApp
import ani.dantotsu.settings.saving.PrefManager
import ani.dantotsu.settings.saving.PrefName
import ani.dantotsu.statusBarHeight
import ani.dantotsu.themes.ThemeManager
import uy.kohesive.injekt.Injekt
import uy.kohesive.injekt.api.get
class SettingsMangaActivity: AppCompatActivity(){
private lateinit var binding: ActivitySettingsMangaBinding
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
ThemeManager(this).applyTheme()
initActivity(this)
val context = this
binding = ActivitySettingsMangaBinding.inflate(layoutInflater)
setContentView(binding.root)
binding.apply {
settingsMangaLayout.updateLayoutParams<ViewGroup.MarginLayoutParams> {
topMargin = statusBarHeight
bottomMargin = navBarHeight
}
settingsMangaTitle.setOnClickListener {
onBackPressedDispatcher.onBackPressed()
}
purgeMangaDownloads.setOnClickListener {
val dialog = AlertDialog.Builder(context, R.style.MyPopup)
.setTitle(R.string.purge_manga_downloads)
.setMessage(getString(R.string.purge_confirm, getString(R.string.manga)))
.setPositiveButton(R.string.yes) { dialog, _ ->
val downloadsManager = Injekt.get<DownloadsManager>()
downloadsManager.purgeDownloads(MediaType.MANGA)
dialog.dismiss()
}.setNegativeButton(R.string.no) { dialog, _ ->
dialog.dismiss()
}.create()
dialog.window?.setDimAmount(0.8f)
dialog.show()
}
purgeNovelDownloads.setOnClickListener {
val dialog = AlertDialog.Builder(context, R.style.MyPopup)
.setTitle(R.string.purge_novel_downloads)
.setMessage(getString(R.string.purge_confirm, getString(R.string.novels)))
.setPositiveButton(R.string.yes) { dialog, _ ->
val downloadsManager = Injekt.get<DownloadsManager>()
downloadsManager.purgeDownloads(MediaType.NOVEL)
dialog.dismiss()
}.setNegativeButton(R.string.no) { dialog, _ ->
dialog.dismiss()
}.create()
dialog.window?.setDimAmount(0.8f)
dialog.show()
}
settingsReader.setOnClickListener {
startActivity(Intent(context, ReaderSettingsActivity::class.java))
}
var previousChp: View = when (PrefManager.getVal<Int>(PrefName.MangaDefaultView)) {
0 -> settingsChpList
1 -> settingsChpCompact
else -> settingsChpList
}
previousChp.alpha = 1f
fun uiChp(mode: Int, current: View) {
previousChp.alpha = 0.33f
previousChp = current
current.alpha = 1f
PrefManager.setVal(PrefName.MangaDefaultView, mode)
}
settingsChpList.setOnClickListener {
uiChp(0, it)
}
settingsChpCompact.setOnClickListener {
uiChp(1, it)
}
settingsIncludeMangaList.isChecked = PrefManager.getVal(PrefName.IncludeMangaList)
settingsIncludeMangaList.setOnCheckedChangeListener { _, isChecked ->
PrefManager.setVal(PrefName.IncludeMangaList, isChecked)
restartApp(binding.root)
}
}
}
}

View file

@ -0,0 +1,200 @@
package ani.dantotsu.settings
import android.app.AlarmManager
import android.app.AlertDialog
import android.content.Context
import android.content.Intent
import android.os.Build
import android.os.Bundle
import android.view.ViewGroup
import androidx.appcompat.app.AppCompatActivity
import androidx.core.view.updateLayoutParams
import ani.dantotsu.R
import ani.dantotsu.connections.anilist.api.NotificationType
import ani.dantotsu.databinding.ActivitySettingsNotificationsBinding
import ani.dantotsu.initActivity
import ani.dantotsu.navBarHeight
import ani.dantotsu.notifications.TaskScheduler
import ani.dantotsu.notifications.anilist.AnilistNotificationWorker
import ani.dantotsu.notifications.comment.CommentNotificationWorker
import ani.dantotsu.notifications.subscription.SubscriptionNotificationWorker
import ani.dantotsu.openSettings
import ani.dantotsu.settings.saving.PrefManager
import ani.dantotsu.settings.saving.PrefName
import ani.dantotsu.statusBarHeight
import ani.dantotsu.themes.ThemeManager
class SettingsNotificationActivity: AppCompatActivity(){
private lateinit var binding: ActivitySettingsNotificationsBinding
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
ThemeManager(this).applyTheme()
initActivity(this)
val context = this
binding = ActivitySettingsNotificationsBinding.inflate(layoutInflater)
setContentView(binding.root)
binding.apply {
var curTime = PrefManager.getVal<Int>(PrefName.SubscriptionNotificationInterval)
val timeNames = SubscriptionNotificationWorker.checkIntervals.map {
val mins = it % 60
val hours = it / 60
if (it > 0) "${if (hours > 0) "$hours hrs " else ""}${if (mins > 0) "$mins mins" else ""}"
else getString(R.string.do_not_update)
}.toTypedArray()
settingsNotificationsLayout.updateLayoutParams<ViewGroup.MarginLayoutParams> {
topMargin = statusBarHeight
bottomMargin = navBarHeight
}
settingsNotificationsTitle.setOnClickListener {
onBackPressedDispatcher.onBackPressed()
}
settingsSubscriptionsTime.text =
getString(R.string.subscriptions_checking_time_s, timeNames[curTime])
val speedDialog = AlertDialog.Builder(context, R.style.MyPopup)
.setTitle(R.string.subscriptions_checking_time)
settingsSubscriptionsTime.setOnClickListener {
val dialog = speedDialog.setSingleChoiceItems(timeNames, curTime) { dialog, i ->
curTime = i
settingsSubscriptionsTime.text =
getString(R.string.subscriptions_checking_time_s, timeNames[i])
PrefManager.setVal(PrefName.SubscriptionNotificationInterval, curTime)
dialog.dismiss()
TaskScheduler.create(
context, PrefManager.getVal(PrefName.UseAlarmManager)
).scheduleAllTasks(context)
}.show()
dialog.window?.setDimAmount(0.8f)
}
settingsSubscriptionsTime.setOnLongClickListener {
TaskScheduler.create(
context, PrefManager.getVal(PrefName.UseAlarmManager)
).scheduleAllTasks(context)
true
}
val aTimeNames = AnilistNotificationWorker.checkIntervals.map { it.toInt() }
val aItems = aTimeNames.map {
val mins = it % 60
val hours = it / 60
if (it > 0) "${if (hours > 0) "$hours hrs " else ""}${if (mins > 0) "$mins mins" else ""}"
else getString(R.string.do_not_update)
}
settingsAnilistSubscriptionsTime.text = getString(
R.string.anilist_notifications_checking_time,
aItems[PrefManager.getVal(PrefName.AnilistNotificationInterval)]
)
settingsAnilistSubscriptionsTime.setOnClickListener {
val selected = PrefManager.getVal<Int>(PrefName.AnilistNotificationInterval)
val dialog = AlertDialog.Builder(context, R.style.MyPopup)
.setTitle(R.string.subscriptions_checking_time)
.setSingleChoiceItems(aItems.toTypedArray(), selected) { dialog, i ->
PrefManager.setVal(PrefName.AnilistNotificationInterval, i)
settingsAnilistSubscriptionsTime.text =
getString(R.string.anilist_notifications_checking_time, aItems[i])
dialog.dismiss()
TaskScheduler.create(
context, PrefManager.getVal(PrefName.UseAlarmManager)
).scheduleAllTasks(context)
}.create()
dialog.window?.setDimAmount(0.8f)
dialog.show()
}
settingsAnilistNotifications.setOnClickListener {
val types = NotificationType.entries.map { it.name }
val filteredTypes =
PrefManager.getVal<Set<String>>(PrefName.AnilistFilteredTypes).toMutableSet()
val selected = types.map { filteredTypes.contains(it) }.toBooleanArray()
val dialog = AlertDialog.Builder(context, R.style.MyPopup)
.setTitle(R.string.anilist_notification_filters)
.setMultiChoiceItems(types.toTypedArray(), selected) { _, which, isChecked ->
val type = types[which]
if (isChecked) {
filteredTypes.add(type)
} else {
filteredTypes.remove(type)
}
PrefManager.setVal(PrefName.AnilistFilteredTypes, filteredTypes)
}.create()
dialog.window?.setDimAmount(0.8f)
dialog.show()
}
val cTimeNames = CommentNotificationWorker.checkIntervals.map { it.toInt() }
val cItems = cTimeNames.map {
val mins = it % 60
val hours = it / 60
if (it > 0) "${if (hours > 0) "$hours hrs " else ""}${if (mins > 0) "$mins mins" else ""}"
else getString(R.string.do_not_update)
}
settingsCommentSubscriptionsTime.text = getString(
R.string.comment_notification_checking_time,
cItems[PrefManager.getVal(PrefName.CommentNotificationInterval)]
)
settingsCommentSubscriptionsTime.setOnClickListener {
val selected = PrefManager.getVal<Int>(PrefName.CommentNotificationInterval)
val dialog = AlertDialog.Builder(context, R.style.MyPopup)
.setTitle(R.string.subscriptions_checking_time)
.setSingleChoiceItems(cItems.toTypedArray(), selected) { dialog, i ->
PrefManager.setVal(PrefName.CommentNotificationInterval, i)
settingsCommentSubscriptionsTime.text =
getString(R.string.comment_notification_checking_time, cItems[i])
dialog.dismiss()
TaskScheduler.create(
context, PrefManager.getVal(PrefName.UseAlarmManager)
).scheduleAllTasks(context)
}.create()
dialog.window?.setDimAmount(0.8f)
dialog.show()
}
settingsNotificationsCheckingSubscriptions.isChecked =
PrefManager.getVal(PrefName.SubscriptionCheckingNotifications)
settingsNotificationsCheckingSubscriptions.setOnCheckedChangeListener { _, isChecked ->
PrefManager.setVal(PrefName.SubscriptionCheckingNotifications, isChecked)
}
settingsNotificationsCheckingSubscriptions.setOnLongClickListener {
openSettings(context, null)
}
settingsNotificationsUseAlarmManager.isChecked =
PrefManager.getVal(PrefName.UseAlarmManager)
settingsNotificationsUseAlarmManager.setOnCheckedChangeListener { _, isChecked ->
if (isChecked) {
val alertDialog = AlertDialog.Builder(context, R.style.MyPopup)
.setTitle(R.string.use_alarm_manager)
.setMessage(R.string.use_alarm_manager_confirm)
.setPositiveButton(R.string.use) { dialog, _ ->
PrefManager.setVal(PrefName.UseAlarmManager, true)
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S) {
if (!(getSystemService(Context.ALARM_SERVICE) as AlarmManager).canScheduleExactAlarms()) {
val intent =
Intent("android.settings.REQUEST_SCHEDULE_EXACT_ALARM")
startActivity(intent)
settingsNotificationsCheckingSubscriptions.isChecked = true
}
}
dialog.dismiss()
}.setNegativeButton(R.string.cancel) { dialog, _ ->
settingsNotificationsCheckingSubscriptions.isChecked = false
PrefManager.setVal(PrefName.UseAlarmManager, false)
dialog.dismiss()
}.create()
alertDialog.window?.setDimAmount(0.8f)
alertDialog.show()
} else {
PrefManager.setVal(PrefName.UseAlarmManager, false)
TaskScheduler.create(context, true).cancelAllTasks()
TaskScheduler.create(context, false)
.scheduleAllTasks(context)
}
}
}
}
}

View file

@ -0,0 +1,139 @@
package ani.dantotsu.settings
import android.os.Bundle
import android.view.View
import android.view.ViewGroup
import android.widget.ArrayAdapter
import androidx.appcompat.app.AppCompatActivity
import androidx.core.view.updateLayoutParams
import ani.dantotsu.R
import ani.dantotsu.databinding.ActivitySettingsThemeBinding
import ani.dantotsu.initActivity
import ani.dantotsu.navBarHeight
import ani.dantotsu.reloadActivity
import ani.dantotsu.restartApp
import ani.dantotsu.settings.saving.PrefManager
import ani.dantotsu.settings.saving.PrefName
import ani.dantotsu.statusBarHeight
import ani.dantotsu.themes.ThemeManager
import eltos.simpledialogfragment.color.SimpleColorDialog
class SettingsThemeActivity : AppCompatActivity() {
private lateinit var binding: ActivitySettingsThemeBinding
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
ThemeManager(this).applyTheme()
initActivity(this)
val context = this
binding = ActivitySettingsThemeBinding.inflate(layoutInflater)
setContentView(binding.root)
binding.apply {
settingsThemeLayout.updateLayoutParams<ViewGroup.MarginLayoutParams> {
topMargin = statusBarHeight
bottomMargin = navBarHeight
}
settingsThemeTitle.setOnClickListener { onBackPressedDispatcher.onBackPressed() }
settingsUseMaterialYou.apply {
isChecked = PrefManager.getVal(PrefName.UseMaterialYou)
setOnCheckedChangeListener { _, isChecked ->
PrefManager.setVal(PrefName.UseMaterialYou, isChecked)
if (isChecked) settingsUseCustomTheme.isChecked = false
restartApp(binding.root)
}
}
settingsUseCustomTheme.isChecked = PrefManager.getVal(PrefName.UseCustomTheme)
settingsUseCustomTheme.setOnCheckedChangeListener { _, isChecked ->
PrefManager.setVal(PrefName.UseCustomTheme, isChecked)
if (isChecked) {
settingsUseMaterialYou.isChecked = false
}
restartApp(binding.root)
}
settingsUseSourceTheme.isChecked = PrefManager.getVal(PrefName.UseSourceTheme)
settingsUseSourceTheme.setOnCheckedChangeListener { _, isChecked ->
PrefManager.setVal(PrefName.UseSourceTheme, isChecked)
restartApp(binding.root)
}
settingsUseOLED.isChecked = PrefManager.getVal(PrefName.UseOLED)
settingsUseOLED.setOnCheckedChangeListener { _, isChecked ->
PrefManager.setVal(PrefName.UseOLED, isChecked)
restartApp(binding.root)
}
val themeString: String = PrefManager.getVal(PrefName.Theme)
val themeText = themeString.substring(0, 1) + themeString.substring(1).lowercase()
themeSwitcher.setText(themeText)
themeSwitcher.setAdapter(
ArrayAdapter(context,
R.layout.item_dropdown,
ThemeManager.Companion.Theme.entries.map {
it.theme.substring(
0,
1
) + it.theme.substring(1).lowercase()
})
)
themeSwitcher.setOnItemClickListener { _, _, i, _ ->
PrefManager.setVal(PrefName.Theme, ThemeManager.Companion.Theme.entries[i].theme)
//ActivityHelper.shouldRefreshMainActivity = true
themeSwitcher.clearFocus()
restartApp(binding.root)
}
customTheme.setOnClickListener {
val originalColor: Int = PrefManager.getVal(PrefName.CustomThemeInt)
class CustomColorDialog : SimpleColorDialog() { //idk where to put it
override fun onPositiveButtonClick() {
restartApp(binding.root)
super.onPositiveButtonClick()
}
}
val tag = "colorPicker"
CustomColorDialog().title(R.string.custom_theme).colorPreset(originalColor)
.colors(context, SimpleColorDialog.MATERIAL_COLOR_PALLET)
.allowCustom(true).showOutline(0x46000000).gridNumColumn(5)
.choiceMode(SimpleColorDialog.SINGLE_CHOICE).neg()
.show(context, tag)
}
var previous: View = when (PrefManager.getVal<Int>(PrefName.DarkMode)) {
0 -> settingsUiAuto
1 -> settingsUiLight
2 -> settingsUiDark
else -> settingsUiAuto
}
previous.alpha = 1f
fun uiTheme(mode: Int, current: View) {
previous.alpha = 0.33f
previous = current
current.alpha = 1f
PrefManager.setVal(PrefName.DarkMode, mode)
reloadActivity()
}
settingsUiAuto.setOnClickListener {
uiTheme(0, it)
}
settingsUiLight.setOnClickListener {
settingsUseOLED.isChecked = false
uiTheme(1, it)
}
settingsUiDark.setOnClickListener {
uiTheme(2, it)
}
}
}
}

View file

@ -74,19 +74,117 @@
android:paddingStart="31dp" android:paddingStart="31dp"
android:paddingEnd="31dp"> android:paddingEnd="31dp">
<include layout="@layout/activity_settings_accounts" /> <TextView
<include layout="@layout/activity_settings_theme" /> android:id="@+id/settingsAccount"
<include layout="@layout/activity_settings_extensions" /> android:layout_width="match_parent"
<include layout="@layout/activity_settings_common" /> android:layout_height="64dp"
<include layout="@layout/activity_settings_anime" /> android:layout_marginEnd="-28dp"
<include layout="@layout/activity_settings_manga" /> android:background="@drawable/ui_bg"
<include layout="@layout/activity_settings_notifications" /> android:backgroundTint="?attr/colorOnBackground"
<include layout="@layout/activity_settings_about" /> android:fontFamily="@font/poppins_bold"
android:gravity="center_vertical"
android:text="@string/accounts"
android:textColor="?attr/colorSecondary"
tools:ignore="TextContrastCheck" />
<TextView
android:id="@+id/settingsTheme"
android:layout_width="match_parent"
android:layout_height="64dp"
android:layout_marginEnd="-28dp"
android:background="@drawable/ui_bg"
android:backgroundTint="?attr/colorOnBackground"
android:fontFamily="@font/poppins_bold"
android:gravity="center_vertical"
android:text="@string/theme"
android:textColor="?attr/colorSecondary"
tools:ignore="TextContrastCheck" />
<TextView
android:id="@+id/settingsExtension"
android:layout_width="match_parent"
android:layout_height="64dp"
android:layout_marginEnd="-28dp"
android:background="@drawable/ui_bg"
android:backgroundTint="?attr/colorOnBackground"
android:fontFamily="@font/poppins_bold"
android:gravity="center_vertical"
android:text="@string/extensions"
android:textColor="?attr/colorSecondary"
tools:ignore="TextContrastCheck" />
<TextView
android:id="@+id/settingsCommon"
android:layout_width="match_parent"
android:layout_height="64dp"
android:layout_marginEnd="-28dp"
android:background="@drawable/ui_bg"
android:backgroundTint="?attr/colorOnBackground"
android:fontFamily="@font/poppins_bold"
android:gravity="center_vertical"
android:text="@string/common"
android:textColor="?attr/colorSecondary"
tools:ignore="TextContrastCheck" />
<TextView
android:id="@+id/settingsNotification"
android:layout_width="match_parent"
android:layout_height="64dp"
android:layout_marginEnd="-28dp"
android:background="@drawable/ui_bg"
android:backgroundTint="?attr/colorOnBackground"
android:fontFamily="@font/poppins_bold"
android:gravity="center_vertical"
android:text="@string/notifications"
android:textColor="?attr/colorSecondary"
tools:ignore="TextContrastCheck" />
<TextView
android:id="@+id/settingsAnime"
android:layout_width="match_parent"
android:layout_height="64dp"
android:layout_marginEnd="-28dp"
android:background="@drawable/ui_bg"
android:backgroundTint="?attr/colorOnBackground"
android:fontFamily="@font/poppins_bold"
android:gravity="center_vertical"
android:text="@string/anime"
android:textColor="?attr/colorSecondary"
tools:ignore="TextContrastCheck" />
<TextView
android:id="@+id/settingsManga"
android:layout_width="match_parent"
android:layout_height="64dp"
android:layout_marginEnd="-28dp"
android:background="@drawable/ui_bg"
android:backgroundTint="?attr/colorOnBackground"
android:fontFamily="@font/poppins_bold"
android:gravity="center_vertical"
android:text="@string/manga"
android:textColor="?attr/colorSecondary"
tools:ignore="TextContrastCheck" />
<TextView
android:id="@+id/settingsAbout"
android:layout_width="match_parent"
android:layout_height="64dp"
android:layout_marginEnd="-28dp"
android:background="@drawable/ui_bg"
android:backgroundTint="?attr/colorOnBackground"
android:fontFamily="@font/poppins_bold"
android:gravity="center_vertical"
android:text="@string/about"
android:textColor="?attr/colorSecondary"
tools:ignore="TextContrastCheck" />
<TextView <TextView
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginTop="31dp" android:layout_marginTop="31dp"
android:layout_marginEnd="-28dp"
android:ellipsize="end" android:ellipsize="end"
android:fontFamily="@font/poppins_bold" android:fontFamily="@font/poppins_bold"
android:maxLines="3" android:maxLines="3"

View file

@ -1,197 +1,194 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<merge xmlns:android="http://schemas.android.com/apk/res/android" <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"> xmlns:tools="http://schemas.android.com/tools"
<ani.dantotsu.others.Xpandable android:id="@+id/settingsAboutLayout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:paddingStart="31dp"
android:paddingEnd="31dp">
<TextView
android:id="@+id/settingsAboutTitle"
android:layout_width="match_parent"
android:layout_height="64dp"
android:layout_marginTop="16dp"
android:fontFamily="@font/poppins"
android:gravity="center"
android:paddingEnd="28dp"
android:text="@string/about"
android:textSize="20sp"
android:textStyle="bold"
app:drawableStartCompat="@drawable/ic_round_arrow_back_ios_new_24"
app:drawableTint="?attr/colorOnBackground"
tools:ignore="RtlSymmetry" />
<Button
android:id="@+id/settingsFAQ"
android:layout_width="match_parent"
android:layout_height="64dp"
android:layout_marginStart="-31dp"
android:layout_marginEnd="-21dp"
android:background="@drawable/ui_bg"
android:backgroundTint="?attr/colorOnBackground"
android:backgroundTintMode="src_atop"
android:fontFamily="@font/poppins_bold"
android:insetTop="0dp"
android:insetBottom="0dp"
android:paddingStart="31dp"
android:paddingEnd="31dp"
android:text="@string/faq"
android:textAlignment="viewStart"
android:textAllCaps="false"
android:textColor="?attr/colorOnBackground"
app:cornerRadius="0dp"
app:icon="@drawable/ic_round_help_24"
app:iconPadding="16dp"
app:iconSize="24dp"
app:iconTint="?attr/colorPrimary" />
<com.google.android.material.materialswitch.MaterialSwitch
android:id="@+id/settingsCheckUpdate"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:orientation="vertical" android:checked="true"
app:isExpanded="false" android:drawableStart="@drawable/ic_round_new_releases_24"
tools:isExpanded="true"> android:drawablePadding="16dp"
android:elegantTextHeight="true"
android:fontFamily="@font/poppins_bold"
android:minHeight="64dp"
android:text="@string/check_app_updates"
android:textAlignment="viewStart"
android:textColor="?attr/colorOnBackground"
app:cornerRadius="0dp"
app:drawableTint="?attr/colorPrimary"
app:showText="false"
app:thumbTint="@color/button_switch_track" />
<com.google.android.material.materialswitch.MaterialSwitch
android:id="@+id/settingsShareUsername"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:checked="false"
android:drawableStart="@drawable/ic_round_search_24"
android:drawablePadding="16dp"
android:elegantTextHeight="true"
android:fontFamily="@font/poppins_bold"
android:minHeight="64dp"
android:text="@string/share_username_in_crash_reports"
android:textAlignment="viewStart"
android:textColor="?attr/colorOnBackground"
app:cornerRadius="0dp"
app:drawableTint="?attr/colorPrimary"
app:showText="false"
app:thumbTint="@color/button_switch_track" />
<com.google.android.material.materialswitch.MaterialSwitch
android:id="@+id/settingsLogToFile"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:checked="false"
android:drawableStart="@drawable/ic_round_edit_note_24"
android:drawablePadding="16dp"
android:elegantTextHeight="true"
android:fontFamily="@font/poppins_bold"
android:minHeight="64dp"
android:text="@string/log_to_file"
android:textAlignment="viewStart"
android:textColor="?attr/colorOnBackground"
app:cornerRadius="0dp"
app:drawableTint="?attr/colorPrimary"
app:showText="false"
app:thumbTint="@color/button_switch_track" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:orientation="horizontal">
<TextView <TextView
android:layout_width="match_parent" android:layout_width="0dp"
android:layout_height="64dp"
android:fontFamily="@font/poppins_bold"
android:gravity="center_vertical"
android:text="@string/about"
android:textColor="?attr/colorSecondary"
app:drawableEndCompat="@drawable/ic_round_arrow_drop_down_24"
tools:ignore="TextContrastCheck" />
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_marginStart="-16dp"
android:layout_marginEnd="-16dp"
android:background="?android:attr/listDivider" />
<Button
android:id="@+id/settingsFAQ"
android:layout_width="match_parent"
android:layout_height="64dp"
android:layout_marginStart="-31dp"
android:layout_marginEnd="-31dp"
android:background="@drawable/ui_bg"
android:backgroundTint="?attr/colorOnBackground"
android:backgroundTintMode="src_atop"
android:fontFamily="@font/poppins_bold"
android:insetTop="0dp"
android:insetBottom="0dp"
android:paddingStart="31dp"
android:paddingEnd="31dp"
android:text="@string/faq"
android:textAlignment="viewStart"
android:textAllCaps="false"
android:textColor="?attr/colorOnBackground"
app:cornerRadius="0dp"
app:icon="@drawable/ic_round_help_24"
app:iconPadding="16dp"
app:iconSize="24dp"
app:iconTint="?attr/colorPrimary" />
<com.google.android.material.materialswitch.MaterialSwitch
android:id="@+id/settingsCheckUpdate"
android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:checked="true" android:layout_weight="1"
android:drawableStart="@drawable/ic_round_new_releases_24" android:alpha="0.58"
android:drawablePadding="16dp"
android:elegantTextHeight="true"
android:fontFamily="@font/poppins_bold" android:fontFamily="@font/poppins_bold"
android:minHeight="64dp" android:text="@string/logging_warning" />
android:text="@string/check_app_updates"
android:textAlignment="viewStart"
android:textColor="?attr/colorOnBackground"
app:cornerRadius="0dp"
app:drawableTint="?attr/colorPrimary"
app:showText="false"
app:thumbTint="@color/button_switch_track" />
<com.google.android.material.materialswitch.MaterialSwitch
android:id="@+id/settingsShareUsername"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:checked="false"
android:drawableStart="@drawable/ic_round_search_24"
android:drawablePadding="16dp"
android:elegantTextHeight="true"
android:fontFamily="@font/poppins_bold"
android:minHeight="64dp"
android:text="@string/share_username_in_crash_reports"
android:textAlignment="viewStart"
android:textColor="?attr/colorOnBackground"
app:cornerRadius="0dp"
app:drawableTint="?attr/colorPrimary"
app:showText="false"
app:thumbTint="@color/button_switch_track" />
<com.google.android.material.materialswitch.MaterialSwitch <ImageButton
android:id="@+id/settingsLogToFile" android:id="@+id/settingsShareLog"
android:layout_width="match_parent" android:layout_width="48dp"
android:layout_height="wrap_content" android:layout_height="48dp"
android:checked="false" android:background="?android:attr/selectableItemBackground"
android:drawableStart="@drawable/ic_round_edit_note_24" android:padding="16dp"
android:drawablePadding="16dp" android:src="@drawable/ic_round_share_24" />
android:elegantTextHeight="true"
android:fontFamily="@font/poppins_bold"
android:minHeight="64dp"
android:text="@string/log_to_file"
android:textAlignment="viewStart"
android:textColor="?attr/colorOnBackground"
app:cornerRadius="0dp"
app:drawableTint="?attr/colorPrimary"
app:showText="false"
app:thumbTint="@color/button_switch_track" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:orientation="horizontal">
<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:alpha="0.58"
android:fontFamily="@font/poppins_bold"
android:text="@string/logging_warning" />
<ImageButton
android:id="@+id/settingsShareLog"
android:layout_width="48dp"
android:layout_height="48dp"
android:background="?android:attr/selectableItemBackground"
android:src="@drawable/ic_round_share_24"
android:padding="16dp" />
</LinearLayout> </LinearLayout>
<Button <Button
android:id="@+id/settingsDev" android:id="@+id/settingsDev"
style="@style/Widget.Material3.Button.TextButton" style="@style/Widget.Material3.Button.TextButton"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="64dp" android:layout_height="64dp"
android:layout_marginStart="-31dp" android:layout_marginStart="-31dp"
android:layout_marginEnd="-31dp" android:layout_marginEnd="-31dp"
android:fontFamily="@font/poppins_bold" android:fontFamily="@font/poppins_bold"
android:insetTop="0dp" android:insetTop="0dp"
android:insetBottom="0dp" android:insetBottom="0dp"
android:paddingStart="31dp" android:paddingStart="31dp"
android:paddingEnd="31dp" android:paddingEnd="31dp"
android:text="@string/devs" android:text="@string/devs"
android:textAlignment="viewStart" android:textAlignment="viewStart"
android:textAllCaps="false" android:textAllCaps="false"
android:textColor="?attr/colorOnBackground" android:textColor="?attr/colorOnBackground"
app:cornerRadius="0dp" app:cornerRadius="0dp"
app:icon="@drawable/ic_round_accessible_forward_24" app:icon="@drawable/ic_round_accessible_forward_24"
app:iconPadding="16dp" app:iconPadding="16dp"
app:iconSize="24dp" /> app:iconSize="24dp" />
<Button <Button
android:id="@+id/settingsForks" android:id="@+id/settingsForks"
style="@style/Widget.Material3.Button.TextButton" style="@style/Widget.Material3.Button.TextButton"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="64dp" android:layout_height="64dp"
android:layout_marginStart="-31dp" android:layout_marginStart="-31dp"
android:layout_marginEnd="-31dp" android:layout_marginEnd="-31dp"
android:fontFamily="@font/poppins_bold" android:fontFamily="@font/poppins_bold"
android:insetTop="0dp" android:insetTop="0dp"
android:insetBottom="0dp" android:insetBottom="0dp"
android:paddingStart="31dp" android:paddingStart="31dp"
android:paddingEnd="31dp" android:paddingEnd="31dp"
android:text="@string/forks" android:text="@string/forks"
android:textAlignment="viewStart" android:textAlignment="viewStart"
android:textAllCaps="false" android:textAllCaps="false"
android:textColor="?attr/colorOnBackground" android:textColor="?attr/colorOnBackground"
app:cornerRadius="0dp" app:cornerRadius="0dp"
app:icon="@drawable/ic_round_restaurant_24" app:icon="@drawable/ic_round_restaurant_24"
app:iconPadding="16dp" app:iconPadding="16dp"
app:iconSize="24dp" /> app:iconSize="24dp" />
<Button <Button
android:id="@+id/settingsDisclaimer" android:id="@+id/settingsDisclaimer"
style="@style/Widget.Material3.Button.TextButton" style="@style/Widget.Material3.Button.TextButton"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="64dp" android:layout_height="64dp"
android:layout_marginStart="-31dp" android:layout_marginStart="-31dp"
android:layout_marginEnd="-31dp" android:layout_marginEnd="-31dp"
android:fontFamily="@font/poppins_bold" android:fontFamily="@font/poppins_bold"
android:insetTop="0dp" android:insetTop="0dp"
android:insetBottom="0dp" android:insetBottom="0dp"
android:paddingStart="31dp" android:paddingStart="31dp"
android:paddingEnd="31dp" android:paddingEnd="31dp"
android:text="@string/disclaimer" android:text="@string/disclaimer"
android:textAlignment="viewStart" android:textAlignment="viewStart"
android:textAllCaps="false" android:textAllCaps="false"
android:textColor="?attr/colorOnBackground" android:textColor="?attr/colorOnBackground"
app:cornerRadius="0dp" app:cornerRadius="0dp"
app:icon="@drawable/ic_round_info_24" app:icon="@drawable/ic_round_info_24"
app:iconPadding="16dp" app:iconPadding="16dp"
app:iconSize="24dp" /> app:iconSize="24dp" />
</ani.dantotsu.others.Xpandable> </LinearLayout>
</merge>

View file

@ -1,29 +1,27 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<merge xmlns:android="http://schemas.android.com/apk/res/android" <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"> xmlns:tools="http://schemas.android.com/tools"
<ani.dantotsu.others.Xpandable android:id="@+id/settingsAccountsLayout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:paddingStart="31dp"
android:paddingEnd="31dp">
<TextView
android:id="@+id/settingsaccountTitle"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="64dp"
android:orientation="vertical" android:layout_marginTop="16dp"
tools:isExpanded="true"> android:fontFamily="@font/poppins"
android:gravity="center"
<TextView android:paddingEnd="28dp"
android:layout_width="match_parent" android:text="@string/accounts"
android:layout_height="64dp" android:textSize="20sp"
android:fontFamily="@font/poppins_bold" android:textStyle="bold"
android:gravity="center_vertical" app:drawableStartCompat="@drawable/ic_round_arrow_back_ios_new_24"
android:text="@string/accounts" app:drawableTint="?attr/colorOnBackground"
android:textColor="?attr/colorSecondary" tools:ignore="RtlSymmetry" />
app:drawableEndCompat="@drawable/ic_round_arrow_drop_down_24"
tools:ignore="TextContrastCheck" />
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_marginStart="-16dp"
android:layout_marginEnd="-16dp"
android:background="?android:attr/listDivider" />
<LinearLayout <LinearLayout
android:id="@+id/settingsAnilistLoginContainer" android:id="@+id/settingsAnilistLoginContainer"
@ -268,12 +266,4 @@
app:drawableStartCompat="@drawable/ic_round_help_24" app:drawableStartCompat="@drawable/ic_round_help_24"
app:drawableTint="?attr/colorPrimary" /> app:drawableTint="?attr/colorPrimary" />
<View </LinearLayout>
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_marginStart="-16dp"
android:layout_marginEnd="-16dp"
android:layout_marginBottom="16dp"
android:background="?android:attr/listDivider" />
</ani.dantotsu.others.Xpandable>
</merge>

View file

@ -1,33 +1,32 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<merge xmlns:android="http://schemas.android.com/apk/res/android" <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"> xmlns:tools="http://schemas.android.com/tools"
<ani.dantotsu.others.Xpandable android:id="@+id/settingsAnimeLayout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:paddingStart="31dp"
android:paddingEnd="31dp">
<TextView
android:id="@+id/settingsAnimeTitle"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="64dp"
android:orientation="vertical" android:layout_marginTop="16dp"
tools:isExpanded="true"> android:fontFamily="@font/poppins"
android:gravity="center"
<TextView android:paddingEnd="28dp"
android:layout_width="match_parent" android:text="@string/anime"
android:layout_height="64dp" android:textSize="20sp"
android:fontFamily="@font/poppins_bold" android:textStyle="bold"
android:gravity="center_vertical" app:drawableStartCompat="@drawable/ic_round_arrow_back_ios_new_24"
android:text="@string/anime" app:drawableTint="?attr/colorOnBackground"
android:textColor="?attr/colorSecondary" tools:ignore="RtlSymmetry" />
app:drawableEndCompat="@drawable/ic_round_arrow_drop_down_24"
tools:ignore="TextContrastCheck" />
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_marginStart="-16dp"
android:layout_marginEnd="-16dp"
android:background="?android:attr/listDivider" />
<LinearLayout <LinearLayout
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="wrap_content"
android:layout_marginTop="8dp" android:layout_marginTop="8dp"
android:gravity="center" android:gravity="center"
android:orientation="horizontal"> android:orientation="horizontal">
@ -197,13 +196,4 @@
app:showText="false" app:showText="false"
app:thumbTint="@color/button_switch_track" /> app:thumbTint="@color/button_switch_track" />
<View </LinearLayout>
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_marginStart="-16dp"
android:layout_marginEnd="-16dp"
android:layout_marginTop="8dp"
android:layout_marginBottom="16dp"
android:background="?android:attr/listDivider" />
</ani.dantotsu.others.Xpandable>
</merge>

View file

@ -1,34 +1,32 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<merge xmlns:android="http://schemas.android.com/apk/res/android" <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"> xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/settingsCommonLayout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:paddingStart="31dp"
android:paddingEnd="31dp">
<ani.dantotsu.others.Xpandable <TextView
android:id="@+id/settingsCommonTitle"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="64dp"
android:orientation="vertical" android:layout_marginTop="16dp"
tools:isExpanded="true"> android:fontFamily="@font/poppins"
android:gravity="center"
<TextView android:paddingEnd="28dp"
android:layout_width="match_parent" android:text="@string/common"
android:layout_height="64dp" android:textSize="20sp"
android:fontFamily="@font/poppins_bold" android:textStyle="bold"
android:gravity="center_vertical" app:drawableStartCompat="@drawable/ic_round_arrow_back_ios_new_24"
android:text="@string/common" app:drawableTint="?attr/colorOnBackground"
android:textColor="?attr/colorSecondary" tools:ignore="RtlSymmetry" />
app:drawableEndCompat="@drawable/ic_round_arrow_drop_down_24"
tools:ignore="TextContrastCheck" />
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_marginStart="-16dp"
android:layout_marginEnd="-16dp"
android:background="?android:attr/listDivider" />
<LinearLayout <LinearLayout
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="wrap_content"
android:layout_marginBottom="8dp" android:layout_marginBottom="8dp"
android:gravity="center" android:gravity="center"
android:orientation="horizontal"> android:orientation="horizontal">
@ -185,7 +183,7 @@
<com.google.android.material.textfield.TextInputLayout <com.google.android.material.textfield.TextInputLayout
style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox.ExposedDropdownMenu" style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox.ExposedDropdownMenu"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="wrap_content"
android:layout_marginBottom="8dp" android:layout_marginBottom="8dp"
app:boxCornerRadiusBottomEnd="8dp" app:boxCornerRadiusBottomEnd="8dp"
app:boxCornerRadiusBottomStart="8dp" app:boxCornerRadiusBottomStart="8dp"
@ -305,14 +303,5 @@
app:iconPadding="16dp" app:iconPadding="16dp"
app:iconSize="24dp" app:iconSize="24dp"
app:iconTint="?attr/colorPrimary" /> app:iconTint="?attr/colorPrimary" />
<View </LinearLayout>
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_marginStart="-16dp"
android:layout_marginEnd="-16dp"
android:layout_marginTop="8dp"
android:layout_marginBottom="16dp"
android:background="?android:attr/listDivider" />
</ani.dantotsu.others.Xpandable>
</merge>

View file

@ -1,31 +1,29 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<merge xmlns:android="http://schemas.android.com/apk/res/android" <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"> xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/settingsExtensionsLayout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:paddingStart="31dp"
android:paddingEnd="31dp">
<ani.dantotsu.others.Xpandable <TextView
android:id="@+id/extensionSettings" android:id="@+id/settingsExtensionsTitle"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="64dp"
android:orientation="vertical" android:layout_marginTop="16dp"
tools:isExpanded="true"> android:fontFamily="@font/poppins"
android:gravity="center"
android:paddingEnd="28dp"
android:text="@string/extensions"
android:textSize="20sp"
android:textStyle="bold"
app:drawableStartCompat="@drawable/ic_round_arrow_back_ios_new_24"
app:drawableTint="?attr/colorOnBackground"
tools:ignore="RtlSymmetry" />
<TextView
android:layout_width="match_parent"
android:layout_height="64dp"
android:fontFamily="@font/poppins_bold"
android:gravity="center_vertical"
android:text="@string/extensions_settings"
android:textColor="?attr/colorSecondary"
app:drawableEndCompat="@drawable/ic_round_arrow_drop_down_24"
tools:ignore="TextContrastCheck" />
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_marginStart="-16dp"
android:layout_marginEnd="-16dp"
android:background="?android:attr/listDivider" />
<Button <Button
android:id="@+id/userAgent" android:id="@+id/userAgent"
@ -192,13 +190,4 @@
app:showText="false" app:showText="false"
app:thumbTint="@color/button_switch_track" /> app:thumbTint="@color/button_switch_track" />
<View </LinearLayout>
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_marginStart="-16dp"
android:layout_marginTop="8dp"
android:layout_marginEnd="-16dp"
android:layout_marginBottom="16dp"
android:background="?android:attr/listDivider" />
</ani.dantotsu.others.Xpandable>
</merge>

View file

@ -1,33 +1,33 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<merge xmlns:android="http://schemas.android.com/apk/res/android" <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"> xmlns:tools="http://schemas.android.com/tools"
<ani.dantotsu.others.Xpandable android:id="@+id/settingsMangaLayout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:paddingStart="31dp"
android:paddingEnd="31dp">
<TextView
android:id="@+id/settingsMangaTitle"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="64dp"
android:orientation="vertical" android:layout_marginTop="16dp"
tools:isExpanded="true"> android:fontFamily="@font/poppins"
android:gravity="center"
android:paddingEnd="28dp"
android:text="@string/manga"
android:textSize="20sp"
android:textStyle="bold"
app:drawableStartCompat="@drawable/ic_round_arrow_back_ios_new_24"
app:drawableTint="?attr/colorOnBackground"
tools:ignore="RtlSymmetry" />
<TextView
android:layout_width="match_parent"
android:layout_height="64dp"
android:fontFamily="@font/poppins_bold"
android:gravity="center_vertical"
android:text="@string/manga"
android:textColor="?attr/colorSecondary"
app:drawableEndCompat="@drawable/ic_round_arrow_drop_down_24"
tools:ignore="TextContrastCheck" />
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_marginStart="-16dp"
android:layout_marginEnd="-16dp"
android:background="?android:attr/listDivider" />
<LinearLayout <LinearLayout
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="wrap_content"
android:layout_marginTop="16dp" android:layout_marginTop="16dp"
android:gravity="center" android:gravity="center"
android:orientation="horizontal"> android:orientation="horizontal">
@ -160,13 +160,5 @@
app:drawableTint="?attr/colorPrimary" app:drawableTint="?attr/colorPrimary"
app:showText="false" app:showText="false"
app:thumbTint="@color/button_switch_track" /> app:thumbTint="@color/button_switch_track" />
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_marginStart="-16dp"
android:layout_marginEnd="-16dp"
android:layout_marginBottom="16dp"
android:background="?android:attr/listDivider" />
</ani.dantotsu.others.Xpandable> </LinearLayout>
</merge>

View file

@ -1,30 +1,28 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<merge xmlns:android="http://schemas.android.com/apk/res/android" <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"> xmlns:tools="http://schemas.android.com/tools"
<ani.dantotsu.others.Xpandable android:id="@+id/settingsNotificationsLayout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:paddingStart="31dp"
android:paddingEnd="31dp">
<TextView
android:id="@+id/settingsNotificationsTitle"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="64dp"
android:orientation="vertical" android:layout_marginTop="16dp"
tools:isExpanded="true"> android:fontFamily="@font/poppins"
android:gravity="center"
<TextView android:paddingEnd="28dp"
android:layout_width="match_parent" android:text="@string/notifications"
android:layout_height="64dp" android:textSize="20sp"
android:fontFamily="@font/poppins_bold" android:textStyle="bold"
android:gravity="center_vertical" app:drawableStartCompat="@drawable/ic_round_arrow_back_ios_new_24"
android:text="@string/notifications" app:drawableTint="?attr/colorOnBackground"
android:textColor="?attr/colorSecondary" tools:ignore="RtlSymmetry" />
app:drawableEndCompat="@drawable/ic_round_arrow_drop_down_24"
tools:ignore="TextContrastCheck" />
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_marginStart="-16dp"
android:layout_marginEnd="-16dp"
android:background="?android:attr/listDivider" />
<Button <Button
android:id="@+id/settingsSubscriptionsTime" android:id="@+id/settingsSubscriptionsTime"
style="@style/Widget.Material3.Button.TextButton" style="@style/Widget.Material3.Button.TextButton"
@ -164,13 +162,4 @@
app:showText="false" app:showText="false"
app:thumbTint="@color/button_switch_track" /> app:thumbTint="@color/button_switch_track" />
<View </LinearLayout>
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_marginStart="-16dp"
android:layout_marginEnd="-16dp"
android:layout_marginTop="8dp"
android:layout_marginBottom="16dp"
android:background="?android:attr/listDivider" />
</ani.dantotsu.others.Xpandable>
</merge>

View file

@ -1,260 +1,250 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<merge xmlns:android="http://schemas.android.com/apk/res/android" <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"> xmlns:tools="http://schemas.android.com/tools"
<ani.dantotsu.others.Xpandable android:id="@+id/settingsThemeLayout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:paddingStart="31dp"
android:paddingEnd="31dp">
<TextView
android:id="@+id/settingsThemeTitle"
android:layout_width="match_parent"
android:layout_height="64dp"
android:layout_marginTop="16dp"
android:fontFamily="@font/poppins"
android:gravity="center"
android:paddingEnd="28dp"
android:text="@string/theme"
android:textSize="20sp"
android:textStyle="bold"
app:drawableStartCompat="@drawable/ic_round_arrow_back_ios_new_24"
app:drawableTint="?attr/colorOnBackground"
tools:ignore="RtlSymmetry" />
<LinearLayout
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:orientation="vertical" android:layout_marginTop="8dp"
tools:isExpanded="true"> android:gravity="center"
android:orientation="horizontal">
<TextView <TextView
android:layout_width="match_parent" android:layout_width="0dp"
android:layout_height="64dp"
android:fontFamily="@font/poppins_bold"
android:gravity="center_vertical"
android:text="@string/theme"
android:textColor="?attr/colorSecondary"
app:drawableEndCompat="@drawable/ic_round_arrow_drop_down_24"
tools:ignore="TextContrastCheck" />
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_marginStart="-16dp"
android:layout_marginEnd="-16dp"
android:background="?android:attr/listDivider" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginTop="8dp"
android:gravity="center"
android:orientation="horizontal">
<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:alpha="0.58"
android:fontFamily="@font/poppins_bold"
android:text="@string/theme" />
<androidx.cardview.widget.CardView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:cardBackgroundColor="@color/nav_bg_inv"
app:cardCornerRadius="16dp"
app:cardElevation="0dp">
<ImageButton
android:id="@+id/settingsUiLight"
android:layout_width="48dp"
android:layout_height="64dp"
android:alpha="0.33"
android:background="?android:attr/selectableItemBackground"
android:src="@drawable/ic_round_brightness_high_24"
app:tint="?attr/colorOnBackground"
tools:ignore="ContentDescription,SpeakableTextPresentCheck,ImageContrastCheck,DuplicateSpeakableTextCheck" />
</androidx.cardview.widget.CardView>
<androidx.cardview.widget.CardView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:cardBackgroundColor="@color/nav_bg_inv"
app:cardCornerRadius="16dp"
app:cardElevation="0dp">
<ImageButton
android:id="@+id/settingsUiDark"
android:layout_width="48dp"
android:layout_height="64dp"
android:alpha="0.33"
android:background="?android:attr/selectableItemBackground"
android:scaleX="-1"
android:src="@drawable/ic_round_brightness_4_24"
app:tint="?attr/colorOnBackground"
tools:ignore="ContentDescription,SpeakableTextPresentCheck,ImageContrastCheck" />
</androidx.cardview.widget.CardView>
<androidx.cardview.widget.CardView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:cardBackgroundColor="@color/nav_bg_inv"
app:cardCornerRadius="16dp"
app:cardElevation="0dp">
<ImageButton
android:id="@+id/settingsUiAuto"
android:layout_width="48dp"
android:layout_height="64dp"
android:alpha="0.33"
android:background="?android:attr/selectableItemBackground"
android:src="@drawable/ic_round_brightness_auto_24"
app:tint="?attr/colorOnBackground"
tools:ignore="ContentDescription,SpeakableTextPresentCheck,ImageContrastCheck" />
</androidx.cardview.widget.CardView>
</LinearLayout>
<com.google.android.material.textfield.TextInputLayout
style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox.ExposedDropdownMenu"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginBottom="8dp"
app:boxCornerRadiusBottomEnd="8dp"
app:boxCornerRadiusBottomStart="8dp"
app:boxCornerRadiusTopEnd="8dp"
app:boxCornerRadiusTopStart="8dp"
app:hintAnimationEnabled="true"
app:startIconDrawable="@drawable/ic_round_source_24">
<AutoCompleteTextView
android:id="@+id/themeSwitcher"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:fontFamily="@font/poppins_bold"
android:freezesText="false"
android:inputType="none"
android:padding="8dp"
android:text="@string/watch"
android:textAllCaps="true"
android:textColor="?android:attr/textColorSecondary"
android:textSize="14sp"
tools:ignore="LabelFor,TextContrastCheck,DuplicateSpeakableTextCheck" />
</com.google.android.material.textfield.TextInputLayout>
<com.google.android.material.materialswitch.MaterialSwitch
android:id="@+id/settingsUseOLED"
android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:checked="false" android:layout_weight="1"
android:drawableStart="@drawable/ic_round_brightness_4_24"
android:drawablePadding="16dp"
android:elegantTextHeight="true"
android:fontFamily="@font/poppins_bold"
android:minHeight="64dp"
android:text="@string/oled_theme_variant"
android:textAlignment="viewStart"
android:textColor="?attr/colorOnBackground"
app:cornerRadius="0dp"
app:drawableTint="?attr/colorPrimary"
app:showText="false"
app:thumbTint="@color/button_switch_track" />
<View
android:id="@+id/themeDivider1"
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_marginStart="-16dp"
android:layout_marginEnd="-16dp"
android:background="?android:attr/listDivider" />
<TextView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fontFamily="@font/poppins_bold"
android:gravity="center"
android:padding="16dp"
android:text="@string/requires_android_12"
android:textColor="?attr/colorSecondary" />
<com.google.android.material.materialswitch.MaterialSwitch
android:id="@+id/settingsUseMaterialYou"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:checked="false"
android:drawableStart="@drawable/ic_round_new_releases_24"
android:drawablePadding="16dp"
android:elegantTextHeight="true"
android:fontFamily="@font/poppins_bold"
android:minHeight="64dp"
android:text="@string/use_material_you"
android:textAlignment="viewStart"
android:textColor="?attr/colorOnBackground"
app:cornerRadius="0dp"
app:drawableTint="?attr/colorPrimary"
app:showText="false"
app:thumbTint="@color/button_switch_track" />
<com.google.android.material.materialswitch.MaterialSwitch
android:id="@+id/settingsUseSourceTheme"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="16dp"
android:checked="false"
android:drawableStart="@drawable/ic_palette"
android:drawablePadding="16dp"
android:elegantTextHeight="true"
android:fontFamily="@font/poppins_bold"
android:minHeight="64dp"
android:text="@string/use_unique_theme_for_each_item"
android:textAlignment="viewStart"
android:textColor="?attr/colorOnBackground"
app:cornerRadius="0dp"
app:drawableTint="?attr/colorPrimary"
app:showText="false"
app:thumbTint="@color/button_switch_track" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="-11dp"
android:alpha="0.58" android:alpha="0.58"
android:fontFamily="@font/poppins_bold" android:fontFamily="@font/poppins_bold"
android:text="@string/custom_theme" /> android:text="@string/theme" />
<com.google.android.material.materialswitch.MaterialSwitch <androidx.cardview.widget.CardView
android:id="@+id/settingsUseCustomTheme" android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:cardBackgroundColor="@color/nav_bg_inv"
app:cardCornerRadius="16dp"
app:cardElevation="0dp">
<ImageButton
android:id="@+id/settingsUiLight"
android:layout_width="48dp"
android:layout_height="64dp"
android:alpha="0.33"
android:background="?android:attr/selectableItemBackground"
android:src="@drawable/ic_round_brightness_high_24"
app:tint="?attr/colorOnBackground"
tools:ignore="ContentDescription,SpeakableTextPresentCheck,ImageContrastCheck,DuplicateSpeakableTextCheck" />
</androidx.cardview.widget.CardView>
<androidx.cardview.widget.CardView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:cardBackgroundColor="@color/nav_bg_inv"
app:cardCornerRadius="16dp"
app:cardElevation="0dp">
<ImageButton
android:id="@+id/settingsUiDark"
android:layout_width="48dp"
android:layout_height="64dp"
android:alpha="0.33"
android:background="?android:attr/selectableItemBackground"
android:scaleX="-1"
android:src="@drawable/ic_round_brightness_4_24"
app:tint="?attr/colorOnBackground"
tools:ignore="ContentDescription,SpeakableTextPresentCheck,ImageContrastCheck" />
</androidx.cardview.widget.CardView>
<androidx.cardview.widget.CardView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:cardBackgroundColor="@color/nav_bg_inv"
app:cardCornerRadius="16dp"
app:cardElevation="0dp">
<ImageButton
android:id="@+id/settingsUiAuto"
android:layout_width="48dp"
android:layout_height="64dp"
android:alpha="0.33"
android:background="?android:attr/selectableItemBackground"
android:src="@drawable/ic_round_brightness_auto_24"
app:tint="?attr/colorOnBackground"
tools:ignore="ContentDescription,SpeakableTextPresentCheck,ImageContrastCheck" />
</androidx.cardview.widget.CardView>
</LinearLayout>
<com.google.android.material.textfield.TextInputLayout
style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox.ExposedDropdownMenu"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="8dp"
app:boxCornerRadiusBottomEnd="8dp"
app:boxCornerRadiusBottomStart="8dp"
app:boxCornerRadiusTopEnd="8dp"
app:boxCornerRadiusTopStart="8dp"
app:hintAnimationEnabled="true"
app:startIconDrawable="@drawable/ic_round_source_24">
<AutoCompleteTextView
android:id="@+id/themeSwitcher"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:checked="false" android:layout_weight="1"
android:drawableStart="@drawable/ic_palette"
android:drawablePadding="16dp"
android:elegantTextHeight="true"
android:fontFamily="@font/poppins_bold" android:fontFamily="@font/poppins_bold"
android:minHeight="64dp" android:freezesText="false"
android:text="@string/use_custom_theme" android:inputType="none"
android:textAlignment="viewStart" android:padding="8dp"
android:textColor="?attr/colorOnBackground" android:text="@string/watch"
app:cornerRadius="0dp" android:textAllCaps="true"
app:drawableTint="?attr/colorPrimary" android:textColor="?android:attr/textColorSecondary"
app:showText="false" android:textSize="14sp"
app:thumbTint="@color/button_switch_track" /> tools:ignore="LabelFor,TextContrastCheck,DuplicateSpeakableTextCheck" />
</com.google.android.material.textfield.TextInputLayout>
<Button <com.google.android.material.materialswitch.MaterialSwitch
android:id="@+id/customTheme" android:id="@+id/settingsUseOLED"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="64dp" android:layout_height="wrap_content"
android:layout_marginStart="-31dp" android:checked="false"
android:layout_marginEnd="-31dp" android:drawableStart="@drawable/ic_round_brightness_4_24"
android:background="@drawable/ui_bg" android:drawablePadding="16dp"
android:backgroundTint="?attr/colorSecondary" android:elegantTextHeight="true"
android:backgroundTintMode="src_atop" android:fontFamily="@font/poppins_bold"
android:fontFamily="@font/poppins_bold" android:minHeight="64dp"
android:insetTop="0dp" android:text="@string/oled_theme_variant"
android:insetBottom="0dp" android:textAlignment="viewStart"
android:paddingStart="31dp" android:textColor="?attr/colorOnBackground"
android:paddingEnd="31dp" app:cornerRadius="0dp"
android:text="@string/color_picker" app:drawableTint="?attr/colorPrimary"
android:textAlignment="viewStart" app:showText="false"
android:textAllCaps="false" app:thumbTint="@color/button_switch_track" />
android:textColor="?attr/colorOnBackground"
app:cornerRadius="0dp"
app:icon="@drawable/ic_round_color_picker_24"
app:iconPadding="16dp"
app:iconSize="24dp"
app:iconTint="?attr/colorPrimary" />
<View <View
android:id="@+id/themeDivider2" android:id="@+id/themeDivider1"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="1dp" android:layout_height="1dp"
android:layout_marginStart="-16dp" android:layout_marginStart="-16dp"
android:layout_marginEnd="-16dp" android:layout_marginEnd="-16dp"
android:layout_marginBottom="8dp" android:background="?android:attr/listDivider" />
android:background="?android:attr/listDivider" />
</ani.dantotsu.others.Xpandable> <TextView
</merge> android:layout_width="match_parent"
android:layout_height="wrap_content"
android:fontFamily="@font/poppins_bold"
android:gravity="center"
android:padding="16dp"
android:text="@string/requires_android_12"
android:textColor="?attr/colorSecondary" />
<com.google.android.material.materialswitch.MaterialSwitch
android:id="@+id/settingsUseMaterialYou"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:checked="false"
android:drawableStart="@drawable/ic_round_new_releases_24"
android:drawablePadding="16dp"
android:elegantTextHeight="true"
android:fontFamily="@font/poppins_bold"
android:minHeight="64dp"
android:text="@string/use_material_you"
android:textAlignment="viewStart"
android:textColor="?attr/colorOnBackground"
app:cornerRadius="0dp"
app:drawableTint="?attr/colorPrimary"
app:showText="false"
app:thumbTint="@color/button_switch_track" />
<com.google.android.material.materialswitch.MaterialSwitch
android:id="@+id/settingsUseSourceTheme"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="16dp"
android:checked="false"
android:drawableStart="@drawable/ic_palette"
android:drawablePadding="16dp"
android:elegantTextHeight="true"
android:fontFamily="@font/poppins_bold"
android:minHeight="64dp"
android:text="@string/use_unique_theme_for_each_item"
android:textAlignment="viewStart"
android:textColor="?attr/colorOnBackground"
app:cornerRadius="0dp"
app:drawableTint="?attr/colorPrimary"
app:showText="false"
app:thumbTint="@color/button_switch_track" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="-11dp"
android:alpha="0.58"
android:fontFamily="@font/poppins_bold"
android:text="@string/custom_theme" />
<com.google.android.material.materialswitch.MaterialSwitch
android:id="@+id/settingsUseCustomTheme"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:checked="false"
android:drawableStart="@drawable/ic_palette"
android:drawablePadding="16dp"
android:elegantTextHeight="true"
android:fontFamily="@font/poppins_bold"
android:minHeight="64dp"
android:text="@string/use_custom_theme"
android:textAlignment="viewStart"
android:textColor="?attr/colorOnBackground"
app:cornerRadius="0dp"
app:drawableTint="?attr/colorPrimary"
app:showText="false"
app:thumbTint="@color/button_switch_track" />
<Button
android:id="@+id/customTheme"
android:layout_width="match_parent"
android:layout_height="64dp"
android:layout_marginStart="-31dp"
android:layout_marginEnd="-31dp"
android:background="@drawable/ui_bg"
android:backgroundTint="?attr/colorSecondary"
android:backgroundTintMode="src_atop"
android:fontFamily="@font/poppins_bold"
android:insetTop="0dp"
android:insetBottom="0dp"
android:paddingStart="31dp"
android:paddingEnd="31dp"
android:text="@string/color_picker"
android:textAlignment="viewStart"
android:textAllCaps="false"
android:textColor="?attr/colorOnBackground"
app:cornerRadius="0dp"
app:icon="@drawable/ic_round_color_picker_24"
app:iconPadding="16dp"
app:iconSize="24dp"
app:iconTint="?attr/colorPrimary" />
</LinearLayout>