0
0
mirror of https://github.com/ankidroid/Anki-Android.git synced 2024-09-20 20:03:05 +02:00
Anki-Android/lint-rules
oakkitten 0cf4ff0b7b Streamline snackbar creation
This changes the way snackbars are created. Instead of calling a
function with many arguments, the new methods consistently only take
text, duration, and a builder block--whether it is called on an
activity or a view. I chose builder pattern instead of call chaining as
it makes sure that the snackbar is actually shown in the end.

Note that if showSnackbar is called on an Activity that does not have a
view with id root_layout--which does not allow proper placing and
interaction with snackbars--a runtime exception will be intentionally
thrown in a debug build. Release builds will show a toast with the
contents of the snackbar instead.

Some durations were changed, notably, Card browser's snackbar that allow
searching in all decks now stay until dismissed. This is something user
may want to do at any time later; and if the snackbar is in the way,
they can dismiss it by swiping.

In com.ichi2.anki.CoroutineHelpersKt.launchCatchingTask, a few unrelated
to this change TODO comments were added.
2022-08-18 13:36:36 -05:00
..
src Streamline snackbar creation 2022-08-18 13:36:36 -05:00
.gitignore Add lint checks for new time api 2020-08-25 10:04:26 +02:00
build.gradle Use JUnit5 on tests 2022-05-01 19:13:49 -05:00
kotlinMigration-lint.gradle Converted FixedPreferencesTitleLengthTest[LINT TEST] to Kotlin 2022-07-07 20:12:20 +01:00