Confirm large manga downloading
This commit is contained in:
@@ -7,6 +7,7 @@ import android.os.Bundle
|
||||
import android.view.Menu
|
||||
import android.view.MenuItem
|
||||
import android.widget.Toast
|
||||
import androidx.appcompat.app.AlertDialog
|
||||
import androidx.core.content.pm.ShortcutManagerCompat
|
||||
import androidx.core.net.toFile
|
||||
import androidx.lifecycle.lifecycleScope
|
||||
@@ -120,7 +121,18 @@ class MangaDetailsActivity : BaseActivity(), MangaDetailsView {
|
||||
}
|
||||
R.id.action_save -> {
|
||||
manga?.let {
|
||||
DownloadService.start(this, it)
|
||||
val chaptersCount = it.chapters?.size ?: 0
|
||||
if (chaptersCount > 5) {
|
||||
AlertDialog.Builder(this)
|
||||
.setTitle(R.string.save_manga)
|
||||
.setMessage(getString(R.string.large_manga_save_confirm, chaptersCount))
|
||||
.setNegativeButton(android.R.string.cancel, null)
|
||||
.setPositiveButton(R.string.save) { _, _ ->
|
||||
DownloadService.start(this, it)
|
||||
}.show()
|
||||
} else {
|
||||
DownloadService.start(this, it)
|
||||
}
|
||||
}
|
||||
true
|
||||
}
|
||||
|
||||
@@ -3,6 +3,7 @@ package org.koitharu.kotatsu.utils.ext
|
||||
import android.content.Context
|
||||
import androidx.appcompat.app.AlertDialog
|
||||
|
||||
@Deprecated("Useless")
|
||||
fun Context.showDialog(block: AlertDialog.Builder.() -> Unit): AlertDialog {
|
||||
return AlertDialog.Builder(this)
|
||||
.apply(block)
|
||||
|
||||
@@ -109,4 +109,6 @@
|
||||
<string name="about_app">О программе</string>
|
||||
<string name="show_notification_app_update">Показывать уведомление при наличии новой версии</string>
|
||||
<string name="open_in_browser">Открыть в браузере</string>
|
||||
<string name="large_manga_save_confirm">В этой манге %d глав. Вы уверены, что хотите сохранить их все?</string>
|
||||
<string name="save_manga">Сохранить мангу</string>
|
||||
</resources>
|
||||
@@ -110,4 +110,6 @@
|
||||
<string name="about_app">About</string>
|
||||
<string name="show_notification_app_update">Show notification if update is available</string>
|
||||
<string name="open_in_browser">Open in browser</string>
|
||||
<string name="large_manga_save_confirm">This manga has %d chapters. Are you want to save all of it?</string>
|
||||
<string name="save_manga">Save manga</string>
|
||||
</resources>
|
||||
Reference in New Issue
Block a user