* Set statusbar color in theme_black.xml
* Set statusbar & navbar color in theme_dark.xml
* Set statusbar & navbar color in light & plain theme
* Setting navbar color programmatically.
* Setting statusbar color same as actionbar.
Co-authored-by: Mike Hardy <github@mikehardy.net>
* Add `findNotes` function in `CollectionV16` new backend's searchNotes
Modify SearchNotes to be able to use both legacy and V16 functions
change ordering key for notes, and use JvmOverloads instead of overriding
* Fix config key, make query non-null
removed the `Kotlin Cleanup` here even though TextUtils import is still present in the file because it is needed for the use case of `TextUtils.TruncateAt.END`
Reduce the cost of converting its value from a string to Int and vice-versa
This is done by calling `callChangeListener` manually. Previously, it was called on `super.OnDialogClosed()`, which passed the value as a string
This removes the workaround which prevented other views from being moved
while trying to move the snackbar. Instead, BaseTransientBottomBar
.Behavior logic is restored.
The removed workaround was applicable to SwipeDismissBehavior. The idea
was taken from an old StackOverflow featuring an old version of
Behavior. It worked by checking by only ever intercepting gestures if
the finger is currently on top of the snackbar.
BaseTransientBottomBar.Behavior, which Snackbar.setBehavior expects,
overrides canSwipeDismissView, and checks if the child is
SnackbarBaseLayout. canSwipeDismissView is called by the original
ViewDragHelper.Callback; since we have rolled out our own, it's best to
inline this check.
Previously, snackbar behavior was set by by changing behavior of view's
CoordinatorLayout.LayoutParams. This came with a few downsides:
* We had to set it in a Snackbar.Callback. Snackbar's original
behavior is created when it is shown, besides, we needed the
original listener.
* It required a few casts.
* We had to steal the original listener since it is useful for
pausing the snackbars.
With this, behavior is set “the official way”, by calling
Snackbar.setBehavior. This comes with the only downside:
* Snackbar.setBehavior expects a BaseTransientBottomBar.Behavior,
which extends SwipeDismissBehavior, so we get it on the superclass
list. It seems that this class wasn't meant to be subclassed.
While now we have a funny class on the parent list, setting behavior
“the official way” simplifies the code quite a bit, so this is probably
a worthwhile change.
The listener ultimately manages snackbars, including their removal after
the duration has passed. Properly informing it of drag events makes it
possible for it to pause the timer while the snackbar is moved, etc.
SensibleSwipeDismissBehavior is more a fix for the inconsistent behavior
of SwipeDismissBehavior, rather than a custom implementation.
This addresses the following issues:
* When the snackbar is swiped to the right, its opacity changes,
but not when swiped to the left;
* When moving the snackbar to dismiss it, the target distance
calculation does not take margins into account, which makes the
snackbar briefly appear stuck near the edge;
* Any amount of horizontal velocity will dismiss the snackbar,
which can result in user dismissing the snackbar even though they
didn't want to;
* If you drag the snackbar to the right, and then flinging it to the
left, it will suddenly change course and start moving to the right.
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.