This is a repository for Stage Two of the Popular Movies assignment found in Udacity's Android Nanodegree course.
The Android app made here fetches movie data from The Movie Database website and displays it.
It adds to the functionality of Popular Movies: Stage One by, among other things:
- Letting the user select favorite movies.
- Storing all movie data in a local database.
- Looking decent on a tablet.
0️⃣ Build and run. 😄
1️⃣ On phones you'll see a screen showing posters of the latest movies. Something like this:
Select a movie poster to see the movie's details. When you do so, you'll see a screen that looks similar to this:
In the details section, you can
- choose to make that movie a favorite by tapping the
Mark As Favorite
button. - see a list of movie trailers and teasers if they available. Watch a trailer by tapping on it.
- go through a list of reviews by folks over at www.themoviedb.org. The reviews are rated by www.themoviedb.org.
- share the movie's first trailer, if available. Just tap the share icon. You'll see something like this:
The app has similar features on tablet but looks slightly different. Movie posters and details are shown together to make use of the larger screen size.
Here is how it appears on tablets held horizontally:
PopMov has this appearance on tablets held vertically:
2️⃣ In settings, choose between seeing the highest rated, the most popular, or your favorite movie posters.
By default, movies are sorted based on how popular they are. (Very subjective, right? 😁)
You can find settings in the posters screen's app bar menu on phones, or simply on the app bar menu in tablets.
Settings appears this way on phones:
Below are the steps:
-
Fetch movie JSON from The Movie Database(or TMDB) using a Sync Adapter based on the user's preference as stored in settings (although we won't do any syncing if the user wants to see favorites. More on that in a minute)
-
Store fetched movie data in a SQLite database. All movie data is stored in a table called
Movies
. If the user selects a favorite, the movie's unique id is stored in a table calledFavorites
. More info in the database source folder. -
Display movie data using posters from TMDB.
-
For the transition between the various posters to a specific movie detail, pass the movie data as a Uri.
-
Share trailer information using a ShareActionProvider and Intents.
- Fetches movie JSON.
- Sorts movies based on user choice.
- Lets user choose favorites.
- Works well on tablets.
- Shows trailers and reviews.
- Posters do not scroll to where the user was when the user comes back from details.
-
Posters should know where the user was!
-
Use transition animations
-
For this app to run, one needs to have an API key from TMDB. To get one:
- Register with TMBD here and get the API key. API keys for non-commerical use are free as of when I got mine.
- For Linux users, please do the following:
-
Open ~/.gradle/gradle.properties. (Create a new file if there is no such file there.)
-
In the file add a line containing the name of the API key you want to store followed by an
=
and then the key itself. The name will be the way you will refer to the API key in your gradle code. An example line is:MyAwesomeAPIKey=TH1sIsanAWESOMEAP1K3y
-
Go to your Android Studio code.
-
Go the module's
build.gradle
file (for exampleapp/build.gradle
). -
type the following inside the
android{...}
section.buildTypes.each { it.buildConfigField 'String', 'REFERENCE_TO_API_KEY_IN_CODE', NameOfAPIKey }
for example:
buildTypes.each { it.buildConfigField 'String', 'AWESOME_API_KEY_IN_CODE', MyAwesomeAPIKey }
-
In Android code, reference the key using:
BuildConfig.REFERENCE_TO_API_KEY_IN_CODE
for example:BuildConfig.AWESOME_API_KEY_IN_CODE
-
-
A lot of gratitude to TMBD for the Movie API.
This product uses the TMDb API but is not endorsed or certified by TMDb.
- The following libraries were used to make this app, and we'd like to say thanks to all of their makers and users. 👍:
- RxPermissions, for acquiring permissions in a reactive way.
- Retrofit, RxJava, Gson, RxAndroid, for fetching movie trailers and reviews painlessly.
- ConstraintLayout for laying out views simply.
- Multidex, for 64K method support, brought about by 👇
- Stetho, for debugging the database. Really helped sort out issues with upgrade.
- Schematic, for autogenerating ContentProviders.
- The Android Support Library, because it is the Android support library.
This repository is licensed under the GNU General Public License Version 3.