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") { _, _ ->
// Do nothing
}
builder.show()
val dialog = builder.show()
dialog.window?.setDimAmount(0.8f)
true
}

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -42,7 +42,7 @@ class UserInterfaceSettingsActivity : AppCompatActivity() {
val views = resources.getStringArray(R.array.home_layouts)
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 {
setMultiChoiceItems(
views,
@ -52,6 +52,7 @@ class UserInterfaceSettingsActivity : AppCompatActivity() {
saveData(ui, settings)
}
}.show()
dialog.window?.setDimAmount(0.8f)
}
binding.uiSettingsSmallView.isChecked = settings.smallView