Custom AlertDialog fix
This commit is contained in:
parent
ac6b22f659
commit
f463275a73
2 changed files with 22 additions and 25 deletions
|
@ -81,7 +81,8 @@ class MangaReaderActivity : AppCompatActivity() {
|
||||||
|
|
||||||
private var isContVisible = false
|
private var isContVisible = false
|
||||||
private var showProgressDialog = true
|
private var showProgressDialog = true
|
||||||
private var progressDialog: AlertDialog.Builder? = null
|
|
||||||
|
//private var progressDialog: AlertDialog.Builder? = null
|
||||||
private var maxChapterPage = 0L
|
private var maxChapterPage = 0L
|
||||||
private var currentChapterPage = 0L
|
private var currentChapterPage = 0L
|
||||||
|
|
||||||
|
@ -253,23 +254,6 @@ class MangaReaderActivity : AppCompatActivity() {
|
||||||
|
|
||||||
showProgressDialog =
|
showProgressDialog =
|
||||||
if (settings.askIndividual) loadData<Boolean>("${media.id}_progressDialog") != true else false
|
if (settings.askIndividual) loadData<Boolean>("${media.id}_progressDialog") != true else false
|
||||||
progressDialog =
|
|
||||||
if (showProgressDialog && Anilist.userid != null && if (media.isAdult) settings.updateForH else true) {
|
|
||||||
val dialogView = layoutInflater.inflate(R.layout.item_custom_dialog, null)
|
|
||||||
val checkbox = dialogView.findViewById<CheckBox>(R.id.dialog_checkbox)
|
|
||||||
checkbox.text = getString(R.string.dont_ask_again, media.userPreferredName)
|
|
||||||
checkbox.setOnCheckedChangeListener { _, isChecked ->
|
|
||||||
if (isChecked) progressDialog = null
|
|
||||||
saveData("${media.id}_progressDialog", isChecked)
|
|
||||||
showProgressDialog = isChecked
|
|
||||||
}
|
|
||||||
AlertDialog.Builder(this, R.style.MyPopup)
|
|
||||||
.setTitle(getString(R.string.title_update_progress))
|
|
||||||
.setView(dialogView)
|
|
||||||
.apply {
|
|
||||||
setOnCancelListener { hideBars() }
|
|
||||||
}
|
|
||||||
} else null
|
|
||||||
|
|
||||||
//Chapter Change
|
//Chapter Change
|
||||||
fun change(index: Int) {
|
fun change(index: Int) {
|
||||||
|
@ -811,9 +795,20 @@ class MangaReaderActivity : AppCompatActivity() {
|
||||||
|
|
||||||
private fun progress(runnable: Runnable) {
|
private fun progress(runnable: Runnable) {
|
||||||
if (maxChapterPage - currentChapterPage <= 1 && Anilist.userid != null) {
|
if (maxChapterPage - currentChapterPage <= 1 && Anilist.userid != null) {
|
||||||
if (showProgressDialog && progressDialog != null) {
|
if (showProgressDialog) {
|
||||||
progressDialog?.setCancelable(false)
|
val dialogView = layoutInflater.inflate(R.layout.item_custom_dialog, null)
|
||||||
?.setPositiveButton(getString(R.string.yes)) { dialog, _ ->
|
val checkbox = dialogView.findViewById<CheckBox>(R.id.dialog_checkbox)
|
||||||
|
checkbox.text = getString(R.string.dont_ask_again, media.userPreferredName)
|
||||||
|
checkbox.setOnCheckedChangeListener { _, isChecked ->
|
||||||
|
saveData("${media.id}_progressDialog", isChecked)
|
||||||
|
showProgressDialog = !isChecked
|
||||||
|
}
|
||||||
|
|
||||||
|
AlertDialog.Builder(this, R.style.MyPopup)
|
||||||
|
.setTitle(getString(R.string.title_update_progress))
|
||||||
|
.setView(dialogView)
|
||||||
|
.setCancelable(false)
|
||||||
|
.setPositiveButton(getString(R.string.yes)) { dialog, _ ->
|
||||||
saveData("${media.id}_save_progress", true)
|
saveData("${media.id}_save_progress", true)
|
||||||
updateProgress(
|
updateProgress(
|
||||||
media,
|
media,
|
||||||
|
@ -823,12 +818,14 @@ class MangaReaderActivity : AppCompatActivity() {
|
||||||
dialog.dismiss()
|
dialog.dismiss()
|
||||||
runnable.run()
|
runnable.run()
|
||||||
}
|
}
|
||||||
?.setNegativeButton(getString(R.string.no)) { dialog, _ ->
|
.setNegativeButton(getString(R.string.no)) { dialog, _ ->
|
||||||
saveData("${media.id}_save_progress", false)
|
saveData("${media.id}_save_progress", false)
|
||||||
dialog.dismiss()
|
dialog.dismiss()
|
||||||
runnable.run()
|
runnable.run()
|
||||||
}
|
}
|
||||||
progressDialog?.show()
|
.setOnCancelListener { hideBars() }
|
||||||
|
.create()
|
||||||
|
.show()
|
||||||
} else {
|
} else {
|
||||||
if (loadData<Boolean>("${media.id}_save_progress") != false && if (media.isAdult) settings.updateForH else true)
|
if (loadData<Boolean>("${media.id}_save_progress") != false && if (media.isAdult) settings.updateForH else true)
|
||||||
updateProgress(
|
updateProgress(
|
||||||
|
|
|
@ -46,8 +46,8 @@
|
||||||
<item name="android:layout_marginRight">16dp</item>
|
<item name="android:layout_marginRight">16dp</item>
|
||||||
<item name="android:background">@drawable/round_corner</item>
|
<item name="android:background">@drawable/round_corner</item>
|
||||||
</style>
|
</style>
|
||||||
<string name="MySnackBarText" parent="Widget.MaterialComponents.Snackbar.TextView">
|
<string name="MySnackBarText" parent="Widget.MaterialComponents.Snackbar.TextView" translatable="false">
|
||||||
<item name="android:textColor">?attr/colorOnBackground</item>
|
<item name="android:textColor">@color/bg_opp</item>
|
||||||
</string>
|
</string>
|
||||||
|
|
||||||
<style name="fontTooltip" parent="Widget.Material3.Tooltip">
|
<style name="fontTooltip" parent="Widget.Material3.Tooltip">
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue