예제 #1
0
 private void loadImages() {
   final ImageView imageView = (ImageView) findViewById(R.id.movie_poster);
   Uri builtUri =
       Uri.parse("http://image.tmdb.org/t/p/w185" + mMovie.getPosterPath()).buildUpon().build();
   Picasso.with(this).load(builtUri.toString()).into(imageView);
   Picasso.with(this).load(builtUri.toString()).into(viewHolder.moviePosterImageView);
 }
예제 #2
0
 private void updateDetails() {
   viewHolder.titleTextView.setText(mMovie.getTitle());
   viewHolder.plotSynopsisTextView.setText(this.getText(R.string.not_available));
   viewHolder.releaseDateTextView.setText(this.getText(R.string.not_available));
   if (mMovie.getPlotSynopsis() != null && !mMovie.getPlotSynopsis().equals("null")) {
     viewHolder.plotSynopsisTextView.setText(mMovie.getPlotSynopsis());
   }
   if (mMovie.getReleaseDate() != null && !mMovie.getReleaseDate().equals("null")) {
     viewHolder.releaseDateTextView.setText(mMovie.getReleaseDate());
   }
   viewHolder.userRatingBar.setRating(mMovie.getVoteAverage().floatValue() / 2);
 }
예제 #3
0
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_detail);
    mMovie = (Movie) getIntent().getParcelableExtra(this.getString(R.string.movie_key));
    DetailFragment fragment =
        (DetailFragment) getSupportFragmentManager().findFragmentById(R.id.fragment_detail);
    fragment.setMovie(mMovie);
    final Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
    setSupportActionBar(toolbar);
    getSupportActionBar().setDisplayHomeAsUpEnabled(true);

    CollapsingToolbarLayout collapsingToolbar =
        (CollapsingToolbarLayout) findViewById(R.id.collapsing_toolbar);
    collapsingToolbar.setTitle(mMovie.getTitle());
  }
예제 #4
0
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_detail);
    Bundle movieBundle = getIntent().getExtras();
    mMovie = new Movie(movieBundle);
    final Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
    setSupportActionBar(toolbar);
    getSupportActionBar().setDisplayHomeAsUpEnabled(true);

    CollapsingToolbarLayout collapsingToolbar =
        (CollapsingToolbarLayout) findViewById(R.id.collapsing_toolbar);
    collapsingToolbar.setTitle(mMovie.getTitle());

    viewHolder = new ViewHolder();
    viewHolder.titleTextView = (TextView) findViewById(R.id.movie_title_textview);
    viewHolder.moviePosterImageView = (ImageView) findViewById(R.id.movie_poster_imageview);
    viewHolder.plotSynopsisTextView = (TextView) findViewById(R.id.plot_synopsis_textview);
    viewHolder.releaseDateTextView = (TextView) findViewById(R.id.release_date_textview);
    viewHolder.userRatingBar = (RatingBar) findViewById(R.id.user_rating_bar);

    updateDetails();
    loadImages();
  }