Java Code Examples for android.databinding.ObservableList#get()

The following examples show how to use android.databinding.ObservableList#get() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ListBindingAdapters.java    From views-widgets-samples with Apache License 2.0 7 votes vote down vote up
@Override
public void onItemRangeInserted(ObservableList observableList,
        int start, int count) {
    if (mLayoutId == 0) {
        return;
    }
    startTransition(mTarget);
    final int end = start + count;
    LayoutInflater inflater = (LayoutInflater) mTarget.getContext()
            .getSystemService(Context.LAYOUT_INFLATER_SERVICE);
    for (int i = end - 1; i >= start; i--) {
        Object entry = observableList.get(i);
        ViewDataBinding binding =
                bindLayout(inflater, mTarget, mLayoutId, entry);
        mTarget.addView(binding.getRoot(), start);
    }
}
 
Example 2
Source File: ListBindingAdapters.java    From android-ui-toolkit-demos with Apache License 2.0 7 votes vote down vote up
@Override
public void onItemRangeChanged(ObservableList observableList,
        int start, int count) {
    if (mLayoutId == 0) {
        return;
    }
    LayoutInflater inflater = (LayoutInflater) mTarget.getContext()
            .getSystemService(Context.LAYOUT_INFLATER_SERVICE);
    startTransition(mTarget);
    final int end = start + count;
    for (int i = start; i < end; i++) {
        Object data = observableList.get(i);
        ViewDataBinding binding = bindLayout(inflater,
                mTarget, mLayoutId, data);
        binding.setVariable(BR.data, observableList.get(i));
        mTarget.removeViewAt(i);
        mTarget.addView(binding.getRoot(), i);
    }
}
 
Example 3
Source File: ListBindingAdapters.java    From android-ui-toolkit-demos with Apache License 2.0 7 votes vote down vote up
@Override
public void onItemRangeInserted(ObservableList observableList,
        int start, int count) {
    if (mLayoutId == 0) {
        return;
    }
    startTransition(mTarget);
    final int end = start + count;
    LayoutInflater inflater = (LayoutInflater) mTarget.getContext()
            .getSystemService(Context.LAYOUT_INFLATER_SERVICE);
    for (int i = end - 1; i >= start; i--) {
        Object entry = observableList.get(i);
        ViewDataBinding binding =
                bindLayout(inflater, mTarget, mLayoutId, entry);
        mTarget.addView(binding.getRoot(), start);
    }
}
 
Example 4
Source File: ListBindingAdapters.java    From views-widgets-samples with Apache License 2.0 6 votes vote down vote up
@Override
public void onItemRangeChanged(ObservableList observableList,
        int start, int count) {
    if (mLayoutId == 0) {
        return;
    }
    LayoutInflater inflater = (LayoutInflater) mTarget.getContext()
            .getSystemService(Context.LAYOUT_INFLATER_SERVICE);
    startTransition(mTarget);
    final int end = start + count;
    for (int i = start; i < end; i++) {
        Object data = observableList.get(i);
        ViewDataBinding binding = bindLayout(inflater,
                mTarget, mLayoutId, data);
        binding.setVariable(BR.data, observableList.get(i));
        mTarget.removeViewAt(i);
        mTarget.addView(binding.getRoot(), i);
    }
}
 
Example 5
Source File: ViewModelTest.java    From Android-App-Architecture-MVVM-Databinding with Apache License 2.0 4 votes vote down vote up
private void verifyList1(final ObservableList<MovieViewModel> movieViewModelList) {
    assertFalse("Movie list is empty.", movieViewModelList.isEmpty());
    assertEquals("Movie list size is not one.", movieViewModelList.size(), 1);
    final MovieViewModel movieViewModel = movieViewModelList.get(0);
    verifyMovie1ViewModel(movieViewModel);
}