Last active
October 12, 2016 03:47
-
-
Save fnk0/3c4d178d3a8c6f6a30db9ff009532bc7 to your computer and use it in GitHub Desktop.
MovieDetailsActivity
This file contains hidden or 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
public class MovieDetailsActivity extends BaseTvActivity { | |
GlideBackgroundManager mBackgroundManager; | |
@Override | |
protected void onCreate(Bundle savedInstanceState) { | |
super.onCreate(savedInstanceState); | |
// Retrieve the movie through the intent | |
Movie movie = getIntent().getExtras().getParcelable(Movie.class.getSimpleName()); | |
MovieDetailsFragment detailsFragment = MovieDetailsFragment.newInstance(movie); | |
addFragment(detailsFragment); // Method from BaseTvActivity | |
// Sets the background of the activity to the backdrop of the movie | |
mBackgroundManager = new GlideBackgroundManager(this); | |
if (movie != null && movie.getBackdropPath() != null) { | |
mBackgroundManager.loadImage(HttpClientModule.BACKDROP_URL + movie.getBackdropPath()); | |
} else { | |
mBackgroundManager.setBackground(ContextCompat.getDrawable(this, R.drawable.material_bg)); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment