pub struct MotionSharedValues(/* private fields */);Expand description
A shareable registry for integer MotionLayout shared values. Layout states attached to the same registry receive changes in order.
Implementations§
Sourcepub fn set(&self, key: &'static str, value: i32) -> bool
pub fn set(&self, key: &'static str, value: i32) -> bool
Publish a changed value. Returns false for a duplicate or an unset -1.
pub fn get(&self, key: &str) -> Option<i32>
Sourcepub fn get_value(&self, key: &str) -> i32
pub fn get_value(&self, key: &str) -> i32
Return the current value, or AndroidX’s UNSET value (-1).
Sourcepub fn add_listener(
&self,
key: &'static str,
callback: impl Fn(&'static str, i32, i32) + Send + Sync + 'static,
) -> MotionSharedValuesListener
pub fn add_listener( &self, key: &'static str, callback: impl Fn(&'static str, i32, i32) + Send + Sync + 'static, ) -> MotionSharedValuesListener
Listen for changed values on a key. Callbacks run synchronously after the registry lock is released and receive (key, new value, previous value).
Sourcepub fn add_listener_for_key(
&self,
key: &'static str,
listener: &MotionSharedValuesListener,
)
pub fn add_listener_for_key( &self, key: &'static str, listener: &MotionSharedValuesListener, )
Register an existing listener for another key.
Sourcepub fn remove_listener(&self, key: &str, listener: &MotionSharedValuesListener)
pub fn remove_listener(&self, key: &str, listener: &MotionSharedValuesListener)
Remove all registrations of this listener for one key.
Sourcepub fn remove_listener_from_all(&self, listener: &MotionSharedValuesListener)
pub fn remove_listener_from_all(&self, listener: &MotionSharedValuesListener)
Remove this listener from every key.
Sourcepub fn clear_listeners(&self)
pub fn clear_listeners(&self)
Remove all host and layout listeners without clearing stored values. Layout events queued before this call remain available for delivery.
Trait Implementations§
Auto Trait Implementations§
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more