Advertisement
Guest User

Untitled

a guest
Jul 26th, 2017
61
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.35 KB | None | 0 0
  1. <android.support.v7.widget.RecyclerView
  2. android:id="@+id/results_list"
  3. android:layout_width="match_parent"
  4. android:layout_height="match_parent"
  5. android:layout_below="@+id/toolbar_wrapper"
  6. android:scrollbars="vertical"
  7. app:itemView="@{listViewModel.itemView}"
  8. app:items="@{listViewModel.films}"
  9. app:layoutManager="@{LayoutManagers.linear()}"
  10. app:onItemSelected="@{listViewModel.onItemSelected}"
  11. />
  12.  
  13. @BindingAdapter("app:onItemSelected")
  14. public static void OnItemSelected(RecyclerView recyclerView, final OnItemSelected listener) {
  15. final RecyclerView.OnItemTouchListener onItemTouch = new RecyclerItemClickListener(recyclerView.getContext(), (view, position) -> listener.onItemSelected(position));
  16. recyclerView.addOnItemTouchListener(onItemTouch);
  17. }
  18.  
  19. //////
  20.  
  21. <ImageView
  22. android:id="@+id/film_picture"
  23. android:layout_width="wrap_content"
  24. android:layout_height="wrap_content"
  25. app:url="@{detailViewModel.film.largePosterUrl}"
  26. />
  27.  
  28. @BindingAdapter("app:url")
  29. public static void setImageUrl(ImageView view, String url) {
  30. Picasso.with(view.getContext())
  31. .load(url)
  32. .into(view);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement