Git Product home page Git Product logo

and_popular_movies's Introduction

Udacity Android Developer Nanodegree - Project 2 & 3

The Movie Database API Key should be added to gradle.properties file

API_KEY="[TMDB API KEY HERE]"

Eventualy change constatnt in TmdbClient.java file:

private static final String API_KEY = "[TMDB API KEY HERE]";

Hiding API key solution based on blogpost:

"Hiding secret api keys from git" blogpost by Richard Rose

MovieProvider (ContentProvider) implementation is based on Sunshine app realized during Android Nanodegree Scholarship Challenge and available here:

piotrserafin/ud851-Sunshine

and_popular_movies's People

Contributors

piotrserafin avatar

Watchers

 avatar

and_popular_movies's Issues

Command Pattern for different fetching strategies

Currently sort strategy (Top Rated, Most Popular) is realized through Strategy Pattern tightly coupled to TMDBClient. This approach should be changed to command pattern. It will let us to use TmdbClient and LoaderManager (for retrieving data from content provider) through one common interface.

This task is blocking #16

Extend favorites ContentProvider

Extend the favorites ContentProvider to store the movie poster, synopsis, user rating, and release date, and display them even when offline.

Sharing functionality

Implement sharing functionality to allow the user to share the first trailer’s YouTube URL from the movie details screen.

App state is not restored when the device is rotated (in offline mode)

20180525_045709

According to the Android Nanodegree General Project Guidelines:

image

App correctly preserves and restores user or app state, that is , student uses a bundle to save app state and restores it via onSaveInstanceState/onRestoreInstanceState.

So you should save the entire movie list (poster urls, etc.) of the correct sort order so that if there is a configuration change going on, the movie list can be properly restored (even if the device is offline, thanks to the fact that our cool Picasso library caches images. Besides the movie list doesn't really need to be re-downloaded just because the user has (accidentally, or not) rotated the device 😄)! You can learn more about how to recreate an Activity in Android here. Depending on what you want to save, you might also need this and this.

Besides, if you correctly preserve and restore the app state on configuration change (screen rotation), when the app is relaunched from Home, All Apps or Recents Screen (whether or not the Operating System had killed our app to free up resources), the app will also be able to restore the app state as closely as possible to the previous state.

Here is how to reproduce the issue on a real device under real scenarios (You can learn more here from the Udacity lesson: App Termination):

Launch our app.
Disable network connection.
Hit the Home Button to go to the Home Screen or hit the Recent Apps Button to go to the Recents Screen (if you have opened a lot of apps before).
Launch some other apps before re-launching ours (Try and pick apps with large memory footprints, such as Google+, Google Maps, Google Street View.).
Re-launch our app.
PRO-TIP: Step 4 (system destroying app process) could be simulated by clicking the "Terminate Application" button inside Android Studio.

image

If you properly save the state, then the movie list can be restored when it's re-launched.

You can learn more about why we, as app developers, should maintain app state from the Udacity lesson: Preparing for Termination. You can also check out this article.

NOTE: the approach of saving the movie lists into the onSaveInstanceState handler is discouraged as it is only suitable for small amounts of data like UI state, not for potentially large amounts of data like a list of movies (you can learn more here).

I'd suggest that you persist all the movie items. Then you only have to save the sort criteria in onSaveInstanceState handler (I'd suggest that you save it into the SharedPreferences so that it can persist across user sessions (even if your application is killed).) and you are good to go.

So your app could be implemented like this:

Use IntentService as a background service for data fetching from the remote server.
Save ALL movie items of both sort types locally into the Content Provider.
Use CursorLoader for data loading + onSaveInstanceState/SharedPreferences.

Sharing functionality

Sharing functionality to allow the user to share the first trailer’s YouTube URL from the movie details screen.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.