Skip to content

Instantly share code, notes, and snippets.

View fredgrott's full-sized avatar
👾
focusing on flutter cross platform mobile dev

Fred Grott fredgrott

👾
focusing on flutter cross platform mobile dev
View GitHub Profile

Original code developed by Robert LaThanh Modifications by Fred Grott, all under Apache License 2.0 Copyright (C) 2016

The Taggable Interface for the simple adapter

public interface Taggable {

 void setTag(@Nullable Object tag);
@Nullable

Original code developed by Robert LaThanh Modifications by Fred Grott, all under Apache License 2.0 Copyright (C) 2016

The SimpleAdapter interface

public interface SimpleAdapter<VM, A> {

Original code developed by Robert LaThanh Modifications by Fred Grott, all under Apache License 2.0 Copyright (C) 2016

SimpleBindingAdapter abstract class:

public abstract class SimpleBindingAdapter<A, VM, VH extends RecyclerView.ViewHolder>
        extends RecyclerView.Adapter<VH>  {
  //== Operating fields =======================================================

Original code developed by Robert LaThanh Modifications by Fred Grott, all under Apache License 2.0 Copyright (C) 2016

The AdaptableViewModel

public class AdaptableViewModel<A, VM> extends BaseObservable {
  @NonNull A adaptable;
 @Nullable VM viewModel;

Original code developed by Robert LaThanh Modifications by Fred Grott, all under Apache License 2.0 Copyright (C) 2016

AdaptOnDemandSimpleBindingAdapter

public abstract class AdaptOnDemandSimpleBindingAdapter<A, VM,
        VH extends RecyclerView.ViewHolder &
                Taggable>

Original code developed by Robert LaThanh Modifications by Fred Grott, all under Apache License 2.0 Copyright (C) 2016

@Override
  public void onBindViewHolder(final VH loadingViewHolder,
                               int position) {
    final AdaptableViewModel<A, VM> adaptableViewModel = items.get(position);
    VM viewModel = adaptableViewModel.viewModel;

Original code developed by Robert LaThanh Modifications by Fred Grott, all under Apache License 2.0 Copyright (C) 2016

public interface AdaptableViewModel<VM> {

  /**
   * Get the
   * already-{@link AdaptableAdapter#adapt(AdaptableViewModel) adapted}
   * version of this object, which had been saved by a previous call to

Original code developed by Robert LaThanh Modifications by Fred Grott, all under Apache License 2.0 Copyright (C) 2016

public abstract class AbstractAdaptableViewModel<VM>
        extends BaseObservable
        implements AdaptableViewModel<VM> {

  private @Nullable VM viewModel;