mirror of
https://github.com/aniyomiorg/aniyomi.git
synced 2024-11-24 05:38:01 +03:00
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!!,
|
(activity as? MainActivity)?.binding?.rootCoordinator!!,
|
||||||
R.string.snack_categories_deleted,
|
R.string.snack_categories_deleted,
|
||||||
R.string.action_undo,
|
R.string.action_undo,
|
||||||
3000
|
4000
|
||||||
)
|
)
|
||||||
|
|
||||||
mode.finish()
|
mode.finish()
|
||||||
|
|
|
@ -612,6 +612,9 @@ class MangaController :
|
||||||
*/
|
*/
|
||||||
private fun toggleFavorite() {
|
private fun toggleFavorite() {
|
||||||
val isNowFavorite = presenter.toggleFavorite()
|
val isNowFavorite = presenter.toggleFavorite()
|
||||||
|
if (isNowFavorite) {
|
||||||
|
addSnackbar?.dismiss()
|
||||||
|
}
|
||||||
if (activity != null && !isNowFavorite && presenter.hasDownloads()) {
|
if (activity != null && !isNowFavorite && presenter.hasDownloads()) {
|
||||||
(activity as? MainActivity)?.binding?.rootCoordinator?.snack(activity!!.getString(R.string.delete_downloads_for_manga)) {
|
(activity as? MainActivity)?.binding?.rootCoordinator?.snack(activity!!.getString(R.string.delete_downloads_for_manga)) {
|
||||||
setAction(R.string.action_delete) {
|
setAction(R.string.action_delete) {
|
||||||
|
@ -619,7 +622,6 @@ class MangaController :
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
mangaInfoAdapter?.notifyDataSetChanged()
|
mangaInfoAdapter?.notifyDataSetChanged()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1115,7 +1117,7 @@ class MangaController :
|
||||||
val manga = presenter.manga
|
val manga = presenter.manga
|
||||||
presenter.downloadChapters(chapters)
|
presenter.downloadChapters(chapters)
|
||||||
if (view != null && !manga.favorite) {
|
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) {
|
setAction(R.string.action_add) {
|
||||||
if (!manga.favorite) {
|
if (!manga.favorite) {
|
||||||
addToLibrary(manga)
|
addToLibrary(manga)
|
||||||
|
|
|
@ -49,7 +49,7 @@ fun View.getCoordinates() = Point((left + right) / 2, (top + bottom) / 2)
|
||||||
*/
|
*/
|
||||||
inline fun View.snack(
|
inline fun View.snack(
|
||||||
message: String,
|
message: String,
|
||||||
length: Int = Snackbar.LENGTH_LONG,
|
length: Int = 10_000,
|
||||||
f: Snackbar.() -> Unit = {}
|
f: Snackbar.() -> Unit = {}
|
||||||
): Snackbar {
|
): Snackbar {
|
||||||
val snack = Snackbar.make(this, message, length)
|
val snack = Snackbar.make(this, message, length)
|
||||||
|
|
Loading…
Reference in a new issue