Tuesday, August 23, 2016

Popular Movies App: A Technical Look

After several weeks and many hours of work, it's complete: my first Android app for the Udacity Nanodegree. It's been a steep learning curve coming from iOS with no prior Java knowledge, but the project's challenges have made its completion even more rewarding.

As much as I enjoy the accomplishment, the journey has been the most important part. From reading the specification to receiving the code review, the last two months have been a great experience. The finished project isn't just a completed app, but a culmination of technical skills that demonstrate the Android framework, and what its developers, can do. This post showcases a few of the more interesting aspects of the Popular Movies app, how I chose to implement them, and the challenges faced along the way. 





The User Interface

According to the specification, the project displays a grid of posters for movies that are currently popular or highly rated among viewers. Tapping on a movie shows a screen that includes details such as release data, average rating, trailers, and reviews. There's also an option to mark a movie as a "favorite" for offline viewing.


When looking for movies, people are generally searching for a specific type, so in addition to the options to view "popular" and "top rated" movies, I also allow users to filter by genre. The number of available genres wouldn't be suitable for a tab-based layout or a spinner, so the filtering options are shown in a navigation drawer. 


Genres can be selected from the navigation drawer.

The actual movies themselves were displayed without borders, in a GridView. The image thumbnails also have text containing the movie's title. 


The details page is where things get interesting. It primarily consists of LinearLayouts and is designed for vertical scrolling. For version 2 of the project, I was required to display trailers and reviews for the selected movie. Although the built-in views are suitable for displaying this data, reusing multiple views would make the coding process much easier. For this reason, I created a compound view by subclassing view groups. Doing so allowed the reuse of multiple views, simplifying the code, without compromising the visual appearance. 



Custom views for trailers and reviews.

The Data Model


Data for the app is supplied by The Movie Database API. While I initially used standard HttpUrlConnections for version 1 of the project, part 2 demanded more requests than simply fetching movies. The first code review suggested I try the Retrofit library to help with networking, but because of its simplicity, I opted to use Volley for this project instead.

The data model was another important aspect of the user experience. By tapping the "favorite" button, movies would be saved to the device storage for offline viewing.

Although the requirements only asked for the movie data to be stored, I thought it would be the best experience to also persist trailers and reviews. That way, this information would still be available if the connection was offline, since no additional downloads would be required.

Each movie can have multiple trailers and multiple reviews, so this task is best solved with a relational database. Knowing the difficulty of working with raw SQLite, I decided to implement the data model using GreenDAO. The library had a few nuances making it more difficult to work with than my previous experience with Apple's Core Data, but it did its job well. I'm glad I gave it a try, though I intend to try out other ORM solutions before recommending its use.

The Challenges


Tackling a project of this scale is a challenge of its own, but there were a few specific challenges that I faced when building the app.

Because of the way Android manages the lifecycle of activities and fragments, they can be destroyed and recreated several times during the lifetime of an app. Events like rotating the device or moving an app to the background can cause these changes in the activity's lifecycle. As a result, it's important for developers to save and restore the UI state.

Doing so is a straightforward process but it's important to get it right. Because the app makes use of custom views, restoring these views' state is an added challenge. Saving and restoring each fragment can be tedious at times, but it's definitely worth it to provide the best user experience.

Another consideration in producing a quality app is handling edge cases. Because I wanted to persist movies and trailers along with the movie data, the potential for additional bugs was introduced. For example, a user could mark a movie as a "favorite" before the movies and trailers are downloaded. If the network were to go down before these downloads complete, the app would need to remember to download this data next time the network is available. These scenarios don't always happen, but when they do, a high quality app should handle them accordingly.

A final challenge involved adapting the UI for tablets with the master-detail flow. The two pane layout works well in landscape but most tablets in portrait mode don't have enough screen space. For the alternate, portrait mode layout, I took a less conventional approach, displaying the detail view as a popover. Perhaps it won't be the next UI design craze, though I still think it's an interesting solution to for two-pane layouts in portrait mode. Implementing it this way, the detail fragment can be reused across orientation changes, since it won't be tied to a separate activity like in the phone layout. 



The details page on a tablet in portrait mode.

Overall it was an incredible learning experience and the end product turned out great. In just 2 months, the great folks at Udacity took me from no Java knowledge to building a polished Android app. It's been an excellent journey so far and I can't wait to see what comes next.

65 comments:

  1. This comment has been removed by a blog administrator.

    ReplyDelete
  2. Hey, that's a nice post. Good work :)

    ReplyDelete
  3. Thanks for sharing nice information with us. i like your post and all you share with us is uptodate and quite informative, i would like to bookmark the page so i can come here again to read you, as you have done a wonderful job. DVD

    ReplyDelete
  4. I haven’t any word to appreciate this post.....Really i am impressed from this post....the person who create this post it was a great human..thanks for shared this with us. Tech Tricks

    ReplyDelete
  5. I am happy to find this post very useful for me, as it contains lot of information. I always prefer to read the quality content and this thing I found in you post. Thanks for sharing. UC mini for android

    ReplyDelete
  6. I am happy to find this post very useful for me, as it contains lot of information. I always prefer to read the quality content and this thing I found in you post. Thanks for sharing. Download 9apps

    ReplyDelete
  7. I recently found many useful information in your website especially this blog page. Among the lots of comments on your articles. Thanks for sharing.
    Allucfree

    ReplyDelete
  8. The blog is a spotlight for individuals, A blog that is so pure, lucky to read it.
    holm law group san diego

    ReplyDelete
  9. Thank you for taking the time to publish this information very useful! free movies online hd

    ReplyDelete
  10. Thank you a bunch for sharing this with all of us you actually realize what you are talking about! Bookmarked. Please also seek advice from my site =). We could have a hyperlink change contract between us! 123movies

    ReplyDelete
  11. Thank you for helping people get the information they need. Great stuff as usual. Keep up the great work!!! ACMarket

    ReplyDelete
  12. Can’t get over the fact that words can be used this beautifully.
    click here

    ReplyDelete
  13. I really loved reading your blog. It was very well authored and easy to understand. Unlike other blogs I have read which are really not that good.Thanks alot! Cydia Impactor

    ReplyDelete
  14. I am very much pleased with the contents you have mentioned. I wanted to thank you for this great article. iFile iOS 11

    ReplyDelete
  15. An essential hotspot for the gathering of people that makes the peruser stride by step.
    source

    ReplyDelete
  16. Just admiring your work and wondering how you managed this blog so well. It’s so remarkable that I can't afford to not go through this valuable information whenever I surf the internet! Download iOS 11.3

    ReplyDelete
  17. Click on a Online free full movies and you will get information about the movie along with the link for streaming. This is the website that you should try first. This online free full movies website is one of its kinds and that’s the reason we have listed it in list of free movies streaming sites. Moreover, there are more than 7 mirrors obtainable for free movie streaming which are sorted on this basis of user rating. It is one of helpful feature of this free movie website which is very handy. . This movie site is not having cluster of pop ads. So, you can enjoy this movie website without an issue and can enjoy free movies without any problem.

    ReplyDelete
  18. I can't clarify the emotions I had while perusing this blog. I was totally entranced.
    https://123movieshub.it/

    ReplyDelete
  19. There was a time, in the not so distant past, when a trip out to your local video store with the family was a weekly or monthly treat. Watch The 100 free online

    ReplyDelete
  20. Best work you have done, this online website is really cool with great facts. vidmate apk

    ReplyDelete
  21. Great post, and great website. Thanks for the information! best edm mastering

    ReplyDelete
  22. I am making a full length motion picture, and I am searching for financial specialists. The monetary allowance is just $100,000, and you can contribute as meager as $5000. I am putting my own cash in the film. Movies

    ReplyDelete
  23. The open air film generation organization you pick ought to have a screen estimate perfectly for your terrace flick night. The organization ought to likewise have the capacity to furnish you with a projector and sound hardware to make your film night an exceptional, peaceful affair much like a drive-in motion picture or motion picture theater. 123movies

    ReplyDelete
  24. This is my first time i visit here. I found so many interesting stuff in your blog especially its discussion. From the tons of comments on your articles, I guess I am not the only one having all the enjoyment here! keep up the good work the good fight season 2

    ReplyDelete
  25. I wanted to thank you for this great read!! I definitely enjoying every little bit of it I have you bookmarked to check out new stuff you post. buy dvd mr. mercedes season 1

    ReplyDelete
  26. Im no expert, but I believe you just made an excellent point. You certainly fully understand what youre speaking about, and I can truly get behind that. watch thank you for your service online free

    ReplyDelete
  27. Movieflix is the newest entertainment mobile movie apps where you can watch unlimited HD Free Movies and Series online and movie box,mobile app

    ReplyDelete
  28. This is my first time i visit here. I found such a substantial https://movgotv.com/movies/ number of interesting stuff in your blog especially its examination. Really its inconceivable article. Keep it up.

    ReplyDelete
  29. On the off chance that there are kids on the house and you need to invest some family energy watching movies together, you may look for the appropriate movie online. all movies free online

    ReplyDelete
  30. Interesting topic for a blog. I have been searching the Internet for fun and came upon your website. Fabulous post. Thanks a ton for sharing your knowledge! It is great to see that some people still put in an effort into managing their websites. I'll be sure to check back again real soon. myla sinanaj

    ReplyDelete
  31. Thanks for another wonderful post. Where else could anybody get that type of info in such an ideal way of writing? film streaming

    ReplyDelete
  32. I recently came across your blog and have been reading along. I thought I would leave my first comment. I don't know what to say except that I have enjoyed reading. Nice blog. I will keep visiting this blog very often. Bogobeats

    ReplyDelete
  33. This comment has been removed by the author.

    ReplyDelete
  34. This is a great inspiring article.I am pretty much pleased with your good work.You put really very helpful information. Keep it up. Keep blogging. Looking to reading your next post. gomovies

    ReplyDelete
  35. Wow, incredible blog layout! How long have you been blogging for? you make blogging look easy. The overall look of your web site is wonderful, as well as the content! 123movies

    ReplyDelete
  36. I’m excited to uncover this page. I need to to thank you for ones time for this particularly fantastic read !! I definitely really liked every part of it and i also have you saved to fav to look at new information in your site.
    123 movies

    ReplyDelete
  37. I have read all the comments and suggestions posted by the visitors for this article are very fine,We will wait for your next article so only.Thanks! https://spider-manfarhomefull.com/

    ReplyDelete
  38. A sumptuous blog, honestly. Valued each and every piece of it.
    Pinoy Teleserye Replay

    ReplyDelete
  39. Hello, I have browsed most of your posts. This post is probably where I got the most useful information for my research. Thanks for posting, maybe we can see more on this. Are you aware of any other websites on this subject. fmovies

    ReplyDelete
  40. Excellent to be visiting your blog again, it has been months for me. Rightly, this article that I've been served for therefore long. I want this article to finish my assignment within the faculty, and it has the same topic together with your article. Thanks for the ton of valuable help, nice share. film streaming

    ReplyDelete
  41. I think this is an informative post and it is very useful and knowledgeable. therefore, I would like to thank you for the efforts you have made in writing this article.
    jadwal film bioskop

    ReplyDelete
  42. Excellent information on your blog, thank you for taking the time to share with us. Amazing insight you have on this, it's nice to find a website that details so much information about different artists. it chapter 2 stream

    ReplyDelete
  43. Thanks for posting this info. I just want to let you know that I just check out your site and I find it very interesting and informative. I can't wait to read lots of your posts. 123movies

    ReplyDelete
  44. Hi there! Nice post! Please tell us when I will see a follow up! click for more info

    ReplyDelete
  45. Hey what a brilliant post I have come across and believe me I have been searching out for this similar kind of post for past a week and hardly came across this. Thank you very much and will look for more postings from you. How To Stream Frozen 2 (2019)

    ReplyDelete
  46. I was reading some of your content on this website and I conceive this internet site is really informative ! Keep on putting up. hdfilme.cc

    ReplyDelete
  47. Thanks for the blog loaded with so many information. Stopping by your blog helped me to get what I was looking for. indoxx1

    ReplyDelete
  48. I love the way you write and share your niche! Very interesting and different! Keep it coming! app development company

    ReplyDelete
  49. Great content material and great layout. Your website deserves all of the positive feedback it’s been getting. filmyzilla

    ReplyDelete
  50. Thanks for picking out the time to discuss this, I feel great about it and love studying more on this topic. It is extremely helpful for me. Thanks for such a valuable help again. cimalight

    ReplyDelete
  51. Im no expert, but I believe you just made an excellent point. You certainly fully understand what youre speaking about, and I can truly get behind that.
    dvds

    ReplyDelete
  52. It would not be reasonable in the event that we compliment all the blog compositions yet not the creator. Incredible Work!
    123 movies

    ReplyDelete
  53. Please continue this great work and I look forward to more of your awesome blog posts. https://t.me/s/disneyplusaccountgenerator

    ReplyDelete
  54. Don’t focus on having a great blog. Focus on producing a blog that’s great for your readers.
    https://t.me/s/tindergoldfree2020
    https://t.me/s/tindergoldfree
    http://online.fliphtml5.com/lwlii/uwfj/
    https://www.teamapp.com/clubs/531861

    ReplyDelete
  55. If you are looking for more information about flat rate locksmith Las Vegas check that right away. dubbed anime

    ReplyDelete
  56. There are no greater treasures than the highest human qualities such as compassion.
    https://t.me/s/freenetflixgiftcode,
    https://www.teamapp.com/clubs/532249,
    https://marketplace.visualstudio.com/publishers/Netflix-Gift-Codes-Generator-2020,
    http://fliphtml5.com/pnzna/ppwh

    ReplyDelete
  57. This bit of blog shows commitment of essayist.
    ดูหนัง

    ReplyDelete
  58. Finally reached the Apex of Standardized Suckitude.
    https://www.ulule.com/chaturbate-free-tokens/#/badges/,
    https://www.bizcommunity.com/Profile/ChaturbateFreeTokensHackOn,
    https://marketplace.visualstudio.com/publishers/HackChaturbateCheatFreeTokens2020,
    https://teespring.com/chaturbate-hack-free-toke?pid=371&cid=6547

    ReplyDelete
  59. People can find it quite beneficial for themselves to download flicks at their homes without having to spend unnecessary money on highly priced DVD movies that can either be bought or rented from retail shops. 123movies.to new site

    ReplyDelete
  60. Getting to Know You - If watching movies is your thing now, movies 123 why not start from the beginning? Each of you chooses your own favorite movie from when you were a child and watch them together.

    ReplyDelete