mirror of
https://github.com/rebelonion/Dantotsu.git
synced 2026-01-30 17:01:02 +00:00
changed alter dialog view
This commit is contained in:
@@ -314,19 +314,19 @@ class AnimeWatchFragment : Fragment() {
|
|||||||
if (show) View.GONE else View.VISIBLE
|
if (show) View.GONE else View.VISIBLE
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
var itemSelected = false
|
||||||
val allSettings = pkg.sources.filterIsInstance<ConfigurableAnimeSource>()
|
val allSettings = pkg.sources.filterIsInstance<ConfigurableAnimeSource>()
|
||||||
if (allSettings.isNotEmpty()) {
|
if (allSettings.isNotEmpty()) {
|
||||||
var selectedSetting = allSettings[0]
|
var selectedSetting = allSettings[0]
|
||||||
if (allSettings.size > 1) {
|
if (allSettings.size > 1) {
|
||||||
val names = allSettings.map { it.lang }.toTypedArray()
|
val names = allSettings.sortedBy { it.lang }.map { it.lang }.toTypedArray()
|
||||||
var selectedIndex = 0
|
var selectedIndex = 0
|
||||||
val dialog = AlertDialog.Builder(requireContext())
|
val dialog = AlertDialog.Builder(requireContext() , R.style.MyPopup)
|
||||||
.setTitle("Select a Source")
|
.setTitle("Select a Source")
|
||||||
.setSingleChoiceItems(names, selectedIndex) { _, which ->
|
.setSingleChoiceItems(names, selectedIndex) { dialog, which ->
|
||||||
selectedIndex = which
|
selectedIndex = which
|
||||||
}
|
|
||||||
.setPositiveButton("OK") { dialog, _ ->
|
|
||||||
selectedSetting = allSettings[selectedIndex]
|
selectedSetting = allSettings[selectedIndex]
|
||||||
|
itemSelected = true
|
||||||
dialog.dismiss()
|
dialog.dismiss()
|
||||||
|
|
||||||
// Move the fragment transaction here
|
// Move the fragment transaction here
|
||||||
@@ -343,10 +343,10 @@ class AnimeWatchFragment : Fragment() {
|
|||||||
.commit()
|
.commit()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
.setNegativeButton("Cancel") { dialog, _ ->
|
.setOnDismissListener {
|
||||||
dialog.cancel()
|
if (!itemSelected) {
|
||||||
changeUIVisibility(true)
|
changeUIVisibility(true)
|
||||||
return@setNegativeButton
|
}
|
||||||
}
|
}
|
||||||
.show()
|
.show()
|
||||||
dialog.window?.setDimAmount(0.8f)
|
dialog.window?.setDimAmount(0.8f)
|
||||||
|
|||||||
@@ -356,19 +356,19 @@ open class MangaReadFragment : Fragment(), ScanlatorSelectionListener {
|
|||||||
if (show) View.GONE else View.VISIBLE
|
if (show) View.GONE else View.VISIBLE
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
var itemSelected = false
|
||||||
val allSettings = pkg.sources.filterIsInstance<ConfigurableSource>()
|
val allSettings = pkg.sources.filterIsInstance<ConfigurableSource>()
|
||||||
if (allSettings.isNotEmpty()) {
|
if (allSettings.isNotEmpty()) {
|
||||||
var selectedSetting = allSettings[0]
|
var selectedSetting = allSettings[0]
|
||||||
if (allSettings.size > 1) {
|
if (allSettings.size > 1) {
|
||||||
val names = allSettings.map { it.lang }.toTypedArray()
|
val names = allSettings.sortedBy { it.lang }.map { it.lang }.toTypedArray()
|
||||||
var selectedIndex = 0
|
var selectedIndex = 0
|
||||||
val dialog = AlertDialog.Builder(requireContext())
|
val dialog = AlertDialog.Builder(requireContext(), R.style.MyPopup)
|
||||||
.setTitle("Select a Source")
|
.setTitle("Select a Source")
|
||||||
.setSingleChoiceItems(names, selectedIndex) { _, which ->
|
.setSingleChoiceItems(names, selectedIndex) { dialog, which ->
|
||||||
selectedIndex = which
|
selectedIndex = which
|
||||||
}
|
|
||||||
.setPositiveButton("OK") { dialog, _ ->
|
|
||||||
selectedSetting = allSettings[selectedIndex]
|
selectedSetting = allSettings[selectedIndex]
|
||||||
|
itemSelected = true
|
||||||
dialog.dismiss()
|
dialog.dismiss()
|
||||||
|
|
||||||
// Move the fragment transaction here
|
// Move the fragment transaction here
|
||||||
@@ -383,10 +383,10 @@ open class MangaReadFragment : Fragment(), ScanlatorSelectionListener {
|
|||||||
.addToBackStack(null)
|
.addToBackStack(null)
|
||||||
.commit()
|
.commit()
|
||||||
}
|
}
|
||||||
.setNegativeButton("Cancel") { dialog, _ ->
|
.setOnDismissListener {
|
||||||
dialog.cancel()
|
if (!itemSelected) {
|
||||||
changeUIVisibility(true)
|
changeUIVisibility(true)
|
||||||
return@setNegativeButton
|
}
|
||||||
}
|
}
|
||||||
.show()
|
.show()
|
||||||
dialog.window?.setDimAmount(0.8f)
|
dialog.window?.setDimAmount(0.8f)
|
||||||
|
|||||||
Reference in New Issue
Block a user