Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /**
- * Observable manager for saving the [Cart]'s resource information.
- */
- class CartManager : LiveData<Resource<Cart?>>() {
- init {
- value = Success(null)
- }
- /**
- * Set the [Cart] value and notifies observers.
- */
- internal fun set(cart: Cart) {
- postValue(Success(cart))
- }
- /**
- * Clear any information from the device.
- */
- internal fun clear() {
- postValue(Success(null))
- }
- /**
- * Signals that the resource information is being retrieved from network.
- */
- internal fun loading() {
- postValue(Loading())
- }
- /**
- * Signals that an error occurred when trying to fetch the resource information.
- */
- internal fun error(t: Throwable) {
- postValue(Failure(t))
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement