Use custom alert builder for all dialogs [skip ci]
This commit is contained in:
parent
f9f9767ecc
commit
3ac9307329
4 changed files with 1471 additions and 1251 deletions
|
@ -19,6 +19,7 @@ import ani.dantotsu.settings.saving.PrefManager
|
|||
import ani.dantotsu.settings.saving.PrefName
|
||||
import ani.dantotsu.statusBarHeight
|
||||
import ani.dantotsu.themes.ThemeManager
|
||||
import ani.dantotsu.util.customAlertDialog
|
||||
import uy.kohesive.injekt.Injekt
|
||||
import uy.kohesive.injekt.api.get
|
||||
|
||||
|
@ -57,23 +58,16 @@ class SettingsAnimeActivity : AppCompatActivity() {
|
|||
desc = getString(R.string.purge_anime_downloads_desc),
|
||||
icon = R.drawable.ic_round_delete_24,
|
||||
onClick = {
|
||||
val dialog = AlertDialog.Builder(context, R.style.MyPopup)
|
||||
.setTitle(R.string.purge_anime_downloads)
|
||||
.setMessage(
|
||||
getString(
|
||||
R.string.purge_confirm,
|
||||
getString(R.string.anime)
|
||||
)
|
||||
)
|
||||
.setPositiveButton(R.string.yes) { dialog, _ ->
|
||||
context.customAlertDialog().apply {
|
||||
setTitle(R.string.purge_anime_downloads)
|
||||
setMessage(R.string.purge_confirm, getString(R.string.anime))
|
||||
setPosButton(R.string.yes, onClick = {
|
||||
val downloadsManager = Injekt.get<DownloadsManager>()
|
||||
downloadsManager.purgeDownloads(MediaType.ANIME)
|
||||
dialog.dismiss()
|
||||
}.setNegativeButton(R.string.no) { dialog, _ ->
|
||||
dialog.dismiss()
|
||||
}.create()
|
||||
dialog.window?.setDimAmount(0.8f)
|
||||
dialog.show()
|
||||
})
|
||||
setNegButton(R.string.no)
|
||||
show()
|
||||
}
|
||||
}
|
||||
|
||||
),
|
||||
|
@ -143,4 +137,4 @@ class SettingsAnimeActivity : AppCompatActivity() {
|
|||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue