Advertisement
nurrohim11

Untitled

Jul 11th, 2018
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.30 KB | None | 0 0
  1.   public void bind(final ResultsItem item) {
  2.         tv_title.setText(item.getTitle());
  3.         tv_tanggal.setText(DateTime.getLongDate(item.getReleaseDate()));
  4.         tv_deskripsi.setText(item.getOverview());
  5.         Glide.with(itemView.getContext())
  6.                 .load(BuildConfig.BASE_URL_IMG + "w185" + item.getPosterPath())
  7.                 .apply(new RequestOptions()
  8.                         .placeholder(R.drawable.placeholder)
  9.                         .centerCrop())
  10.                 .into(img_poster);
  11.  
  12.        itemView.setOnClickListener(new View.OnClickListener() {
  13.             @Override
  14.             public void onClick(View view) {
  15.                 Intent intent = new Intent(itemView.getContext(), ScrollingActivity.class);
  16.                 intent.putExtra(ScrollingActivity.MOVIE_ITEM, new Gson().toJson(item));
  17.  
  18.                 if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
  19.                     ActivityOptionsCompat activityOptionsCompat = ActivityOptionsCompat
  20.                             .makeSceneTransitionAnimation((Activity) itemView.getContext(), img_poster, "poster");
  21.                     itemView.getContext().startActivity(intent, activityOptionsCompat.toBundle());
  22.                 } else itemView.getContext().startActivity(intent);
  23.             }
  24.         });
  25.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement