Skip to content

Instantly share code, notes, and snippets.

@fredgrott
Created September 6, 2016 18:31
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/9a823a7ba06a91a2b727b890df8deaa5 to your computer and use it in GitHub Desktop.
Save fredgrott/9a823a7ba06a91a2b727b890df8deaa5 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 AdaptableViewModel

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

  AdaptableViewModel(@NonNull A adaptable) {
    this.adaptable = adaptable;
  }

  public void setViewModel(@NonNull VM viewModel) {
    this.viewModel = viewModel;
  }

  @Bindable
  @Nullable
  public VM getViewModel() {
    return viewModel;
  }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment