Last active
July 26, 2017 08:46
-
-
Save eyeahs/570a3f835981761d4f667d6adfa71647 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<android.support.v7.widget.RecyclerView | |
android:id="@+id/results_list" | |
android:layout_width="match_parent" | |
android:layout_height="match_parent" | |
android:layout_below="@+id/toolbar_wrapper" | |
android:scrollbars="vertical" | |
app:itemView="@{listViewModel.itemView}" | |
app:items="@{listViewModel.films}" | |
app:layoutManager="@{LayoutManagers.linear()}" | |
app:onItemSelected="@{listViewModel.onItemSelected}" | |
/> | |
@BindingAdapter("app:onItemSelected") | |
public static void OnItemSelected(RecyclerView recyclerView, final OnItemSelected listener) { | |
final RecyclerView.OnItemTouchListener onItemTouch = new RecyclerItemClickListener(recyclerView.getContext(), (view, position) -> listener.onItemSelected(position)); | |
recyclerView.addOnItemTouchListener(onItemTouch); | |
} | |
////// | |
<ImageView | |
android:id="@+id/film_picture" | |
android:layout_width="wrap_content" | |
android:layout_height="wrap_content" | |
app:url="@{detailViewModel.film.largePosterUrl}" | |
/> | |
@BindingAdapter("app:url") | |
public static void setImageUrl(ImageView view, String url) { | |
Picasso.with(view.getContext()) | |
.load(url) | |
.into(view); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment