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); }
@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()); }
@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(); }