OpenGrok
Home
Sort by relevance
Sort by last modified time
Full Search
Definition
Symbol
File Path
History
|
|
Help
Searched
refs:ViewModel
(Results
1 - 12
of
12
) sorted by null
/frameworks/support/lifecycle/extensions/src/main/java/android/arch/lifecycle/
ViewModel.java
20
*
ViewModel
is a class that is responsible for preparing and managing the data for
25
* A
ViewModel
is always created in association with a scope (an fragment or an activity) and will
29
* In other words, this means that a
ViewModel
will not be destroyed if its owner is destroyed for a
31
* existing
ViewModel
.
33
* The purpose of the
ViewModel
is to acquire and keep the information that is necessary for an
35
*
ViewModel
. ViewModels usually expose this information via {@link LiveData} or Android Data
38
*
ViewModel
's only responsibility is to manage the data for the UI. It <b>should never</b> access
49
* final UserModel
viewModel
= ViewModelProviders.of(this).get(UserModel.class);
50
*
viewModel
.userLiveData.observer(this, new Observer<User>() {
59
*
viewModel
.doAction()
[
all
...]
ViewModelStore.java
38
private final HashMap<String,
ViewModel
> mMap = new HashMap<>();
40
final void put(String key,
ViewModel
viewModel
) {
41
ViewModel
oldViewModel = mMap.get(key);
45
mMap.put(key,
viewModel
);
48
final
ViewModel
get(String key) {
56
for (
ViewModel
vm : mMap.values()) {
ViewModelProvider.java
43
* @param <T> The type parameter for the
ViewModel
.
44
* @return a newly created
ViewModel
46
<T extends
ViewModel
> T create(Class<T> modelClass);
79
* Returns an existing
ViewModel
or creates a new one in the scope (usually, a fragment or
82
* The created
ViewModel
is associated with the given scope and will be retained
86
* @param modelClass The class of the
ViewModel
to create an instance of it if it is not
88
* @param <T> The type parameter for the
ViewModel
.
89
* @return A
ViewModel
that is an instance of the given type {@code T}.
91
public <T extends
ViewModel
> T get(Class<T> modelClass) {
100
* Returns an existing
ViewModel
or creates a new one in the scope (usually, a fragment o
[
all
...]
AndroidViewModel.java
22
* Application context aware {@link
ViewModel
}.
27
public class AndroidViewModel extends
ViewModel
{
ViewModelProviders.java
45
* {@code fragment} is alive. More detailed explanation is in {@link
ViewModel
}.
65
* is alive. More detailed explanation is in {@link
ViewModel
}.
80
* {@code fragment} is alive. More detailed explanation is in {@link
ViewModel
}.
95
* is alive. More detailed explanation is in {@link
ViewModel
}.
111
* {@link
ViewModel
}, which have an empty constructor.
128
public <T extends
ViewModel
> T create(Class<T> modelClass) {
/frameworks/data-binding/integration-tests/TestApp/app/src/androidTestApi7/java/android/databinding/testapp/
BindableObservablesTest.java
25
import android.databinding.testapp.vo.
ViewModel
;
44
ViewModel
model = new
ViewModel
();
57
ViewModel
model = new
ViewModel
();
71
ViewModel
model = new
ViewModel
();
85
ViewModel
model = new
ViewModel
();
105
ViewModel
model = new ViewModel()
[
all
...]
/frameworks/support/paging/integration-tests/testapp/src/main/java/android/arch/paging/integration/testapp/
PagedListItemViewModel.java
20
import android.arch.lifecycle.
ViewModel
;
26
* Sample
ViewModel
backed by an artificial data source
29
public class PagedListItemViewModel extends
ViewModel
{
/frameworks/data-binding/integration-tests/TestApp/app/src/main/java/android/databinding/testapp/vo/
ViewModel.java
20
public class
ViewModel
extends BaseObservable {
/frameworks/support/lifecycle/extensions/src/test/java/android/arch/lifecycle/
ViewModelStoreTest.java
46
static class TestViewModel extends
ViewModel
{
ViewModelProviderTest.java
81
ViewModel1
viewModel
= provider.get(ViewModel1.class);
82
assertThat(
viewModel
, is(provider.get(ViewModel1.class)));
85
public static class ViewModel1 extends
ViewModel
{
94
public static class ViewModel2 extends
ViewModel
{
/frameworks/support/lifecycle/integration-tests/test-app/src/main/java/com/android/support/lifecycle/testapp/
LiveDataTestActivity.java
26
import com.android.support.lifecycle.
ViewModel
;
39
public LiveDataViewModel
viewModel
;
43
/**
ViewModel
class */
44
public static class LiveDataViewModel extends
ViewModel
{
88
viewModel
= ViewModelStore.get(this, VM_TAG, LiveDataViewModel.class);
89
viewModel
.liveData.observe(this, s ->
103
viewModel
.liveData.setValue(LIVE_DATA_VALUE);
/frameworks/support/lifecycle/extensions/src/androidTest/java/android/arch/lifecycle/
ViewModelTest.java
183
public static class ViewModel1 extends
ViewModel
{
Completed in 1039 milliseconds