Implement threshold/thresholdRange operators
ClosedPublic

Authored by markwei on Wed, Apr 5, 8:02 PM.

Diff Detail

Repository
rMDMSTREAMSANDROID reactive-motion-android
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.
markwei created this revision.Wed, Apr 5, 8:02 PM
Restricted Application added a reviewer: O2: Material Motion. · View Herald TranscriptWed, Apr 5, 8:02 PM
Restricted Application added a project: Material Motion. · View Herald Transcript
Restricted Application added a reviewer: O6: Material Android platform reviewers. · View Herald Transcript
Restricted Application added a reviewer: Material Motion. · View Herald Transcript
Restricted Application failed to build Restricted Buildable!Wed, Apr 5, 8:04 PM
featherless accepted this revision.Sat, Apr 8, 8:01 PM
featherless added a subscriber: featherless.
featherless added inline comments.
library/src/main/java/com/google/android/material/motion/operators/CommonOperators.java
92

Super minor, but this expression involves a small double negative. It's currently "If min is greater than value, emit below".

If it's possible to write this as value.compareTo(min) < 0, then it may read more naturally as "If value is below min, emit below".

94

Similarly here.

This revision is now accepted and ready to land.Sat, Apr 8, 8:01 PM
markwei marked an inline comment as done.Tue, Apr 11, 7:43 PM
markwei added inline comments.
library/src/main/java/com/google/android/material/motion/operators/CommonOperators.java
92

Good point. I originally had it this way because I wanted to avoid a null pointer exception (the stream can emit null T values). But i just double checked the Comparable java interface and it states that a null pointer exception will be thrown if the argument is null as well. Since I no longer have an incentive to write it this way, I'll get rid of the double negative (in another diff).

This revision was automatically updated to reflect the committed changes.
markwei added inline comments.Tue, Apr 11, 7:58 PM
library/src/main/java/com/google/android/material/motion/operators/CommonOperators.java
92