This commit is contained in:
Finnley Somdahl 2023-12-05 20:51:22 -06:00
parent b8782b0507
commit dc1edc9a42
11 changed files with 43 additions and 22 deletions

View file

@ -136,7 +136,8 @@ class OfflineMangaFragment : Fragment(), OfflineMangaSearchListener {
builder.setNegativeButton("No") { _, _ -> builder.setNegativeButton("No") { _, _ ->
// Do nothing // Do nothing
} }
builder.show() val dialog = builder.show()
dialog.window?.setDimAmount(0.8f)
true true
} }

View file

@ -318,7 +318,7 @@ class AnimeWatchFragment : Fragment() {
if (allSettings.size > 1) { if (allSettings.size > 1) {
val names = allSettings.map { it.lang }.toTypedArray() val names = allSettings.map { it.lang }.toTypedArray()
var selectedIndex = 0 var selectedIndex = 0
AlertDialog.Builder(requireContext()) val dialog = AlertDialog.Builder(requireContext())
.setTitle("Select a Source") .setTitle("Select a Source")
.setSingleChoiceItems(names, selectedIndex) { _, which -> .setSingleChoiceItems(names, selectedIndex) { _, which ->
selectedIndex = which selectedIndex = which
@ -347,6 +347,7 @@ class AnimeWatchFragment : Fragment() {
return@setNegativeButton return@setNegativeButton
} }
.show() .show()
dialog.window?.setDimAmount(0.8f)
} else { } else {
// If there's only one setting, proceed with the fragment transaction // If there's only one setting, proceed with the fragment transaction
requireActivity().runOnUiThread { requireActivity().runOnUiThread {

View file

@ -1111,7 +1111,7 @@ class ExoplayerView : AppCompatActivity(), Player.Listener {
val speedDialog = val speedDialog =
AlertDialog.Builder(this, R.style.DialogTheme).setTitle(getString(R.string.speed)) AlertDialog.Builder(this, R.style.DialogTheme).setTitle(getString(R.string.speed))
exoSpeed.setOnClickListener { exoSpeed.setOnClickListener {
speedDialog.setSingleChoiceItems(speedsName, curSpeed) { dialog, i -> val dialog = speedDialog.setSingleChoiceItems(speedsName, curSpeed) { dialog, i ->
if (isInitialized) { if (isInitialized) {
saveData("${media.id}_speed", i, this) saveData("${media.id}_speed", i, this)
speed = speeds[i] speed = speeds[i]
@ -1122,6 +1122,7 @@ class ExoplayerView : AppCompatActivity(), Player.Listener {
hideSystemBars() hideSystemBars()
} }
}.show() }.show()
dialog.window?.setDimAmount(0.8f)
} }
speedDialog.setOnCancelListener { hideSystemBars() } speedDialog.setOnCancelListener { hideSystemBars() }
@ -1360,7 +1361,7 @@ class ExoplayerView : AppCompatActivity(), Player.Listener {
) )
) )
) )
AlertDialog.Builder(this, R.style.DialogTheme) val dialog = AlertDialog.Builder(this, R.style.DialogTheme)
.setTitle(getString(R.string.continue_from, time)).apply { .setTitle(getString(R.string.continue_from, time)).apply {
setCancelable(false) setCancelable(false)
setPositiveButton(getString(R.string.yes)) { d, _ -> setPositiveButton(getString(R.string.yes)) { d, _ ->
@ -1373,6 +1374,7 @@ class ExoplayerView : AppCompatActivity(), Player.Listener {
d.dismiss() d.dismiss()
} }
}.show() }.show()
dialog.window?.setDimAmount(0.8f)
} else buildExoplayer() } else buildExoplayer()
} }

View file

@ -169,7 +169,7 @@ class MangaReadAdapter(
} }
// Create AlertDialog // Create AlertDialog
AlertDialog.Builder(currContext(), R.style.MyPopup) val dialog = AlertDialog.Builder(currContext(), R.style.MyPopup)
.setView(dialogView) .setView(dialogView)
.setPositiveButton("OK") { dialog, which -> .setPositiveButton("OK") { dialog, which ->
//add unchecked to hidden //add unchecked to hidden
@ -185,6 +185,7 @@ class MangaReadAdapter(
} }
.setNegativeButton("Cancel", null) .setNegativeButton("Cancel", null)
.show() .show()
dialog.window?.setDimAmount(0.8f)
} }
binding.animeDownloadTop.setOnClickListener { binding.animeDownloadTop.setOnClickListener {
@ -202,6 +203,7 @@ class MangaReadAdapter(
} }
alertDialog.setNegativeButton("Cancel") { dialog, _ -> dialog.cancel() } alertDialog.setNegativeButton("Cancel") { dialog, _ -> dialog.cancel() }
val dialog = alertDialog.show() val dialog = alertDialog.show()
dialog.window?.setDimAmount(0.8f)
} }
var selected = when (style) { var selected = when (style) {

View file

@ -338,7 +338,7 @@ open class MangaReadFragment : Fragment(), ScanlatorSelectionListener {
if (allSettings.size > 1) { if (allSettings.size > 1) {
val names = allSettings.map { it.lang }.toTypedArray() val names = allSettings.map { it.lang }.toTypedArray()
var selectedIndex = 0 var selectedIndex = 0
AlertDialog.Builder(requireContext()) val dialog = AlertDialog.Builder(requireContext())
.setTitle("Select a Source") .setTitle("Select a Source")
.setSingleChoiceItems(names, selectedIndex) { _, which -> .setSingleChoiceItems(names, selectedIndex) { _, which ->
selectedIndex = which selectedIndex = which
@ -365,6 +365,7 @@ open class MangaReadFragment : Fragment(), ScanlatorSelectionListener {
return@setNegativeButton return@setNegativeButton
} }
.show() .show()
dialog.window?.setDimAmount(0.8f)
} else { } else {
// If there's only one setting, proceed with the fragment transaction // If there's only one setting, proceed with the fragment transaction
val fragment = MangaSourcePreferencesFragment().getInstance(selectedSetting.id) { val fragment = MangaSourcePreferencesFragment().getInstance(selectedSetting.id) {

View file

@ -112,7 +112,8 @@ class NovelResponseAdapter(
builder.setNegativeButton("No") { _, _ -> builder.setNegativeButton("No") { _, _ ->
// Do nothing // Do nothing
} }
builder.show() val dialog = builder.show()
dialog.window?.setDimAmount(0.8f)
true true
} }
} }

View file

@ -55,7 +55,7 @@ class InstalledAnimeExtensionsFragment : Fragment(), SearchQueryHandler {
if (allSettings.size > 1) { if (allSettings.size > 1) {
val names = allSettings.map { it.lang }.toTypedArray() val names = allSettings.map { it.lang }.toTypedArray()
var selectedIndex = 0 var selectedIndex = 0
AlertDialog.Builder(requireContext(), R.style.MyPopup) val dialog = AlertDialog.Builder(requireContext(), R.style.MyPopup)
.setTitle("Select a Source") .setTitle("Select a Source")
.setSingleChoiceItems(names, selectedIndex) { dialog, which -> .setSingleChoiceItems(names, selectedIndex) { dialog, which ->
selectedIndex = which selectedIndex = which
@ -85,6 +85,7 @@ class InstalledAnimeExtensionsFragment : Fragment(), SearchQueryHandler {
} }
} }
.show() .show()
dialog.window?.setDimAmount(0.8f)
} else { } else {
// If there's only one setting, proceed with the fragment transaction // If there's only one setting, proceed with the fragment transaction
val eActivity = requireActivity() as ExtensionsActivity val eActivity = requireActivity() as ExtensionsActivity

View file

@ -62,7 +62,7 @@ class InstalledMangaExtensionsFragment : Fragment(), SearchQueryHandler {
if (allSettings.size > 1) { if (allSettings.size > 1) {
val names = allSettings.map { it.lang }.toTypedArray() val names = allSettings.map { it.lang }.toTypedArray()
var selectedIndex = 0 var selectedIndex = 0
AlertDialog.Builder(requireContext(), R.style.MyPopup) val dialog = AlertDialog.Builder(requireContext(), R.style.MyPopup)
.setTitle("Select a Source") .setTitle("Select a Source")
.setSingleChoiceItems(names, selectedIndex) { dialog, which -> .setSingleChoiceItems(names, selectedIndex) { dialog, which ->
selectedIndex = which selectedIndex = which
@ -81,6 +81,7 @@ class InstalledMangaExtensionsFragment : Fragment(), SearchQueryHandler {
.commit() .commit()
} }
.show() .show()
dialog.window?.setDimAmount(0.8f)
} else { } else {
// If there's only one setting, proceed with the fragment transaction // If there's only one setting, proceed with the fragment transaction
val fragment = MangaSourcePreferencesFragment().getInstance(selectedSetting.id) { val fragment = MangaSourcePreferencesFragment().getInstance(selectedSetting.id) {

View file

@ -106,13 +106,14 @@ class PlayerSettingsActivity : AppCompatActivity() {
val speedDialog = AlertDialog.Builder(this, R.style.DialogTheme) val speedDialog = AlertDialog.Builder(this, R.style.DialogTheme)
.setTitle(getString(R.string.default_speed)) .setTitle(getString(R.string.default_speed))
binding.playerSettingsSpeed.setOnClickListener { binding.playerSettingsSpeed.setOnClickListener {
speedDialog.setSingleChoiceItems(speedsName, settings.defaultSpeed) { dialog, i -> val dialog = speedDialog.setSingleChoiceItems(speedsName, settings.defaultSpeed) { dialog, i ->
settings.defaultSpeed = i settings.defaultSpeed = i
binding.playerSettingsSpeed.text = binding.playerSettingsSpeed.text =
getString(R.string.default_playback_speed, speedsName[i]) getString(R.string.default_playback_speed, speedsName[i])
saveData(player, settings) saveData(player, settings)
dialog.dismiss() dialog.dismiss()
}.show() }.show()
dialog.window?.setDimAmount(0.8f)
} }
binding.playerSettingsCursedSpeeds.isChecked = settings.cursedSpeeds binding.playerSettingsCursedSpeeds.isChecked = settings.cursedSpeeds
@ -255,11 +256,12 @@ class PlayerSettingsActivity : AppCompatActivity() {
val resizeDialog = AlertDialog.Builder(this, R.style.DialogTheme) val resizeDialog = AlertDialog.Builder(this, R.style.DialogTheme)
.setTitle(getString(R.string.default_resize_mode)) .setTitle(getString(R.string.default_resize_mode))
binding.playerResizeMode.setOnClickListener { binding.playerResizeMode.setOnClickListener {
resizeDialog.setSingleChoiceItems(resizeModes, settings.resize) { dialog, count -> val dialog = resizeDialog.setSingleChoiceItems(resizeModes, settings.resize) { dialog, count ->
settings.resize = count settings.resize = count
saveData(player, settings) saveData(player, settings)
dialog.dismiss() dialog.dismiss()
}.show() }.show()
dialog.window?.setDimAmount(0.8f)
} }
fun restartApp() { fun restartApp() {
Snackbar.make( Snackbar.make(
@ -339,7 +341,7 @@ class PlayerSettingsActivity : AppCompatActivity() {
val primaryColorDialog = AlertDialog.Builder(this, R.style.DialogTheme) val primaryColorDialog = AlertDialog.Builder(this, R.style.DialogTheme)
.setTitle(getString(R.string.primary_sub_color)) .setTitle(getString(R.string.primary_sub_color))
binding.videoSubColorPrimary.setOnClickListener { binding.videoSubColorPrimary.setOnClickListener {
primaryColorDialog.setSingleChoiceItems( val dialog = primaryColorDialog.setSingleChoiceItems(
colorsPrimary, colorsPrimary,
settings.primaryColor settings.primaryColor
) { dialog, count -> ) { dialog, count ->
@ -347,6 +349,7 @@ class PlayerSettingsActivity : AppCompatActivity() {
saveData(player, settings) saveData(player, settings)
dialog.dismiss() dialog.dismiss()
}.show() }.show()
dialog.window?.setDimAmount(0.8f)
} }
val colorsSecondary = arrayOf( val colorsSecondary = arrayOf(
"Black", "Black",
@ -365,7 +368,7 @@ class PlayerSettingsActivity : AppCompatActivity() {
val secondaryColorDialog = AlertDialog.Builder(this, R.style.DialogTheme) val secondaryColorDialog = AlertDialog.Builder(this, R.style.DialogTheme)
.setTitle(getString(R.string.outline_sub_color)) .setTitle(getString(R.string.outline_sub_color))
binding.videoSubColorSecondary.setOnClickListener { binding.videoSubColorSecondary.setOnClickListener {
secondaryColorDialog.setSingleChoiceItems( val dialog = secondaryColorDialog.setSingleChoiceItems(
colorsSecondary, colorsSecondary,
settings.secondaryColor settings.secondaryColor
) { dialog, count -> ) { dialog, count ->
@ -373,16 +376,18 @@ class PlayerSettingsActivity : AppCompatActivity() {
saveData(player, settings) saveData(player, settings)
dialog.dismiss() dialog.dismiss()
}.show() }.show()
dialog.window?.setDimAmount(0.8f)
} }
val typesOutline = arrayOf("Outline", "Shine", "Drop Shadow", "None") val typesOutline = arrayOf("Outline", "Shine", "Drop Shadow", "None")
val outlineDialog = AlertDialog.Builder(this, R.style.DialogTheme) val outlineDialog = AlertDialog.Builder(this, R.style.DialogTheme)
.setTitle(getString(R.string.outline_type)) .setTitle(getString(R.string.outline_type))
binding.videoSubOutline.setOnClickListener { binding.videoSubOutline.setOnClickListener {
outlineDialog.setSingleChoiceItems(typesOutline, settings.outline) { dialog, count -> val dialog = outlineDialog.setSingleChoiceItems(typesOutline, settings.outline) { dialog, count ->
settings.outline = count settings.outline = count
saveData(player, settings) saveData(player, settings)
dialog.dismiss() dialog.dismiss()
}.show() }.show()
dialog.window?.setDimAmount(0.8f)
} }
val colorsSubBackground = arrayOf( val colorsSubBackground = arrayOf(
"Transparent", "Transparent",
@ -401,7 +406,7 @@ class PlayerSettingsActivity : AppCompatActivity() {
val subBackgroundDialog = AlertDialog.Builder(this, R.style.DialogTheme) val subBackgroundDialog = AlertDialog.Builder(this, R.style.DialogTheme)
.setTitle(getString(R.string.outline_sub_color)) .setTitle(getString(R.string.outline_sub_color))
binding.videoSubColorBackground.setOnClickListener { binding.videoSubColorBackground.setOnClickListener {
subBackgroundDialog.setSingleChoiceItems( val dialog = subBackgroundDialog.setSingleChoiceItems(
colorsSubBackground, colorsSubBackground,
settings.subBackground settings.subBackground
) { dialog, count -> ) { dialog, count ->
@ -409,6 +414,7 @@ class PlayerSettingsActivity : AppCompatActivity() {
saveData(player, settings) saveData(player, settings)
dialog.dismiss() dialog.dismiss()
}.show() }.show()
dialog.window?.setDimAmount(0.8f)
} }
val colorsSubWindow = arrayOf( val colorsSubWindow = arrayOf(
@ -428,7 +434,7 @@ class PlayerSettingsActivity : AppCompatActivity() {
val subWindowDialog = AlertDialog.Builder(this, R.style.DialogTheme) val subWindowDialog = AlertDialog.Builder(this, R.style.DialogTheme)
.setTitle(getString(R.string.outline_sub_color)) .setTitle(getString(R.string.outline_sub_color))
binding.videoSubColorWindow.setOnClickListener { binding.videoSubColorWindow.setOnClickListener {
subWindowDialog.setSingleChoiceItems( val dialog = subWindowDialog.setSingleChoiceItems(
colorsSubWindow, colorsSubWindow,
settings.subWindow settings.subWindow
) { dialog, count -> ) { dialog, count ->
@ -436,6 +442,7 @@ class PlayerSettingsActivity : AppCompatActivity() {
saveData(player, settings) saveData(player, settings)
dialog.dismiss() dialog.dismiss()
}.show() }.show()
dialog.window?.setDimAmount(0.8f)
} }
val fonts = arrayOf( val fonts = arrayOf(
"Poppins Semi Bold", "Poppins Semi Bold",
@ -448,11 +455,12 @@ class PlayerSettingsActivity : AppCompatActivity() {
val fontDialog = AlertDialog.Builder(this, R.style.DialogTheme) val fontDialog = AlertDialog.Builder(this, R.style.DialogTheme)
.setTitle(getString(R.string.subtitle_font)) .setTitle(getString(R.string.subtitle_font))
binding.videoSubFont.setOnClickListener { binding.videoSubFont.setOnClickListener {
fontDialog.setSingleChoiceItems(fonts, settings.font) { dialog, count -> val dialog = fontDialog.setSingleChoiceItems(fonts, settings.font) { dialog, count ->
settings.font = count settings.font = count
saveData(player, settings) saveData(player, settings)
dialog.dismiss() dialog.dismiss()
}.show() }.show()
dialog.window?.setDimAmount(0.8f)
} }
binding.subtitleFontSize.setText(settings.fontSize.toString()) binding.subtitleFontSize.setText(settings.fontSize.toString())
binding.subtitleFontSize.setOnEditorActionListener { _, actionId, _ -> binding.subtitleFontSize.setOnEditorActionListener { _, actionId, _ ->

View file

@ -199,8 +199,7 @@ class SettingsActivity : AppCompatActivity() {
passedColor = color passedColor = color
linearLayout.setBackgroundColor(color) linearLayout.setBackgroundColor(color)
}) })
alertDialog.window?.setDimAmount(0.8f)
alertDialog.show()
} }
//val animeSource = loadData<Int>("settings_def_anime_source_s")?.let { if (it >= AnimeSources.names.size) 0 else it } ?: 0 //val animeSource = loadData<Int>("settings_def_anime_source_s")?.let { if (it >= AnimeSources.names.size) 0 else it } ?: 0
@ -237,11 +236,12 @@ class SettingsActivity : AppCompatActivity() {
AlertDialog.Builder(this, R.style.DialogTheme).setTitle("Download Manager") AlertDialog.Builder(this, R.style.DialogTheme).setTitle("Download Manager")
var downloadManager = loadData<Int>("settings_download_manager") ?: 0 var downloadManager = loadData<Int>("settings_download_manager") ?: 0
binding.settingsDownloadManager.setOnClickListener { binding.settingsDownloadManager.setOnClickListener {
downloadManagerDialog.setSingleChoiceItems(managers, downloadManager) { dialog, count -> val dialog = downloadManagerDialog.setSingleChoiceItems(managers, downloadManager) { dialog, count ->
downloadManager = count downloadManager = count
saveData("settings_download_manager", downloadManager) saveData("settings_download_manager", downloadManager)
dialog.dismiss() dialog.dismiss()
}.show() }.show()
dialog.window?.setDimAmount(0.8f)
} }
binding.settingsForceLegacyInstall.isChecked = binding.settingsForceLegacyInstall.isChecked =
@ -287,6 +287,7 @@ class SettingsActivity : AppCompatActivity() {
.create() .create()
alertDialog.show() alertDialog.show()
alertDialog.window?.setDimAmount(0.8f)
} }
@ -592,7 +593,7 @@ class SettingsActivity : AppCompatActivity() {
val speedDialog = AlertDialog.Builder(this, R.style.DialogTheme) val speedDialog = AlertDialog.Builder(this, R.style.DialogTheme)
.setTitle(R.string.subscriptions_checking_time) .setTitle(R.string.subscriptions_checking_time)
binding.settingsSubscriptionsTime.setOnClickListener { binding.settingsSubscriptionsTime.setOnClickListener {
speedDialog.setSingleChoiceItems(timeNames, curTime) { dialog, i -> val dialog = speedDialog.setSingleChoiceItems(timeNames, curTime) { dialog, i ->
curTime = i curTime = i
binding.settingsSubscriptionsTime.text = binding.settingsSubscriptionsTime.text =
getString(R.string.subscriptions_checking_time_s, timeNames[i]) getString(R.string.subscriptions_checking_time_s, timeNames[i])
@ -600,6 +601,7 @@ class SettingsActivity : AppCompatActivity() {
dialog.dismiss() dialog.dismiss()
startSubscription(true) startSubscription(true)
}.show() }.show()
dialog.window?.setDimAmount(0.8f)
} }
binding.settingsSubscriptionsTime.setOnLongClickListener { binding.settingsSubscriptionsTime.setOnLongClickListener {

View file

@ -42,7 +42,7 @@ class UserInterfaceSettingsActivity : AppCompatActivity() {
val views = resources.getStringArray(R.array.home_layouts) val views = resources.getStringArray(R.array.home_layouts)
binding.uiSettingsHomeLayout.setOnClickListener { binding.uiSettingsHomeLayout.setOnClickListener {
AlertDialog.Builder(this, R.style.DialogTheme) val dialog = AlertDialog.Builder(this, R.style.DialogTheme)
.setTitle(getString(R.string.home_layout_show)).apply { .setTitle(getString(R.string.home_layout_show)).apply {
setMultiChoiceItems( setMultiChoiceItems(
views, views,
@ -52,6 +52,7 @@ class UserInterfaceSettingsActivity : AppCompatActivity() {
saveData(ui, settings) saveData(ui, settings)
} }
}.show() }.show()
dialog.window?.setDimAmount(0.8f)
} }
binding.uiSettingsSmallView.isChecked = settings.smallView binding.uiSettingsSmallView.isChecked = settings.smallView