app / com.ocean.ishareeconomy_android.viewmodels / LendingViewModel

LendingViewModel

class LendingViewModel : AndroidViewModel

Part of viewmodels.

LendingViewModel designed to store and manage UI-related data in a lifecycle conscious way. This allows data to survive configuration changes such as screen rotations. In addition, background work such as fetching network results can continue through configuration changes and deliver results after the new Fragment or Activity is available. It's also responsible for the removal of objects

Types

Factory

Factory for constructing LendingViewModel with parameter

class Factory : Factory

Constructors

<init>

AddLendingViewModel

LendingViewModel(application: Application, id: String, auth: String)

Properties

id

: String the logged in user's id

val id: String

lending

: the list of LendingObject that the user is sharing

val lending: LiveData<List<LendingObject>>

Functions

onCleared

Cancel all coroutines when the ViewModel is cleared

fun onCleared(): Unit

removeObject

fun removeObject(lendObject: LendingObject): Unit

selectObject

fun selectObject(lendObject: LendingObject?): Unit