Skip to content

Instantly share code, notes, and snippets.

@fredgrott
Created September 6, 2016 18:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save fredgrott/afb8c9e6bf1e246675c66d47a4edf214 to your computer and use it in GitHub Desktop.
Save fredgrott/afb8c9e6bf1e246675c66d47a4edf214 to your computer and use it in GitHub Desktop.

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> {

  /**
   * Adapt the data contained in the {@code adaptable} into a ViewModel
   * ({@link VM}) viewModel that is ready to be bound to the View (displayed).
   *
   * When, precisely, this will happen depends on the
   * {@link SimpleBindingAdapter} used.
   * One may decide to do all of the adapting before showing any items, while
   * another may initiate adapting for each item when it comes into view
   * (showing a loading indicator placeholder while adpating is occurring).
   *
   * @return the adapted version of this object, ready to be bound
   */
  @NonNull VM adapt(@NonNull A adaptable);

}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment