Adjust snackbar durations (closes #5932)
This commit is contained in:
parent
d7d46f4447
commit
0ec7121b8f
3 changed files with 6 additions and 4 deletions
|
@ -195,7 +195,7 @@ class CategoryController :
|
|||
(activity as? MainActivity)?.binding?.rootCoordinator!!,
|
||||
R.string.snack_categories_deleted,
|
||||
R.string.action_undo,
|
||||
3000
|
||||
4000
|
||||
)
|
||||
|
||||
mode.finish()
|
||||
|
|
|
@ -612,6 +612,9 @@ class MangaController :
|
|||
*/
|
||||
private fun toggleFavorite() {
|
||||
val isNowFavorite = presenter.toggleFavorite()
|
||||
if (isNowFavorite) {
|
||||
addSnackbar?.dismiss()
|
||||
}
|
||||
if (activity != null && !isNowFavorite && presenter.hasDownloads()) {
|
||||
(activity as? MainActivity)?.binding?.rootCoordinator?.snack(activity!!.getString(R.string.delete_downloads_for_manga)) {
|
||||
setAction(R.string.action_delete) {
|
||||
|
@ -619,7 +622,6 @@ class MangaController :
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
mangaInfoAdapter?.notifyDataSetChanged()
|
||||
}
|
||||
|
||||
|
@ -1115,7 +1117,7 @@ class MangaController :
|
|||
val manga = presenter.manga
|
||||
presenter.downloadChapters(chapters)
|
||||
if (view != null && !manga.favorite) {
|
||||
addSnackbar = (activity as? MainActivity)?.binding?.rootCoordinator?.snack(view.context.getString(R.string.snack_add_to_library), Snackbar.LENGTH_INDEFINITE) {
|
||||
addSnackbar = (activity as? MainActivity)?.binding?.rootCoordinator?.snack(view.context.getString(R.string.snack_add_to_library)) {
|
||||
setAction(R.string.action_add) {
|
||||
if (!manga.favorite) {
|
||||
addToLibrary(manga)
|
||||
|
|
|
@ -49,7 +49,7 @@ fun View.getCoordinates() = Point((left + right) / 2, (top + bottom) / 2)
|
|||
*/
|
||||
inline fun View.snack(
|
||||
message: String,
|
||||
length: Int = Snackbar.LENGTH_LONG,
|
||||
length: Int = 10_000,
|
||||
f: Snackbar.() -> Unit = {}
|
||||
): Snackbar {
|
||||
val snack = Snackbar.make(this, message, length)
|
||||
|
|
Reference in a new issue