Skip to content

App illustrating the Tour Guide App Project, done as part of Udacity's Android Basics Nanodegree course.

License

Notifications You must be signed in to change notification settings

kaushiknsanji/XploreMysuru

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

XploreMysuru - The Tour Guide App for "Mysore, Karnataka, India"

GitHub GitHub code size in bytes GitHub repo size GitHub release (latest by date) GitHub All Releases GitHub search hit counter Minimum API level

This App has been developed as part of the Udacity Android Basics Nanodegree Course for the Exercise Project "Tour Guide App". App guides the user in exploring the "City of Palaces"/"Mysore".


App Compatibility

Android device running with Android OS 4.0.4 (API Level 15) or above. Best experienced on Android Nougat 7.1 and above. Designed for Phones and NOT for Tablets.


Rubric followed for the Project

  • Contains at least 4 lists of relevant attractions for a location.
  • Navigates between lists using a central screen / Navigation Drawer / View Pager / Bottom Navigation View.
  • Each list contains information about restaurants / historical sites or similar.
  • At least one list includes pictures of the location.
  • Contains Java objects for storing location information.
  • Uses Custom Adapter to populate the layout with the views based on the instance of the Custom class.
  • Images are stored as drawables in multiple densities.
  • Strings are stored in strings.xml resource file.

Stuff explored/developed in addition to the above defined Rubric

  • Used ConstraintLayout heavily for most of the layouts along with custom styles.
  • Implemented MVP + Repository pattern with App Resources.
  • Explored BottomNavigationView for Navigating between the lists of attraction.
  • Implemented Snap Behavior for BottomNavigationView that hides the BottomNavigationView when more than or equal to half of its height is translated away. The Behavior also takes care of docking the Snackbar on top of the BottomNavigationView when shown.
  • Used CardView for displaying each place of attraction.
  • Implemented Loading of Images in a background thread through a Headless Fragment.
  • Developed BitmapImageCache utility that uses android.util.LruCache to cache the recent Bitmap Images decoded.
  • Carried out Image decoding in a background thread using ImageDecoder that extends AsyncTaskLoader.
  • Developed BitmapUtility to extract Palette Swatches from the Images.

Design Workflow

The Home Screen or the Main Activity of the App

The MainActivity of the App has a BottomNavigationView to navigate between the lists of attraction for the city. Lists of Attractions comprises of Places, Parks, Hotels, Restaurants and Shops, which are loaded using Fragments.

Bottom Navigation Menu : Places - PlaceListFragment

Portrait & Landscape view - Collapsed Items Portrait view - Expanded Items
place_portrait
place_landscape
place_item_expand_1
place_item_expand_2
  • Displays list of interesting "Places to visit" in Mysore.
  • Reads and prepares Place data from place_arrays.xml for the place_list_entries mentioned in arrays.xml.
  • Each Item View displays the following data for Places -
    • Name
    • Rating
    • Place Type in text and icon representation
    • Image of the Place
    • Place Timings
    • Entry Fee
    • Location address in text (expanded form) and as an action button (collapsed form)
    • Description of the Place (expanded form)
  • Clicking on the Item View takes the user to the Website of the Place if present. When not present, a snackbar with message, "No link available!" will be displayed.
  • Clicking on the Location Icon button (in collapsed form) or on the Location text (in expanded form) will launch the Google Maps for the location.
  • On Long press of Location text in expanded form, allows the user to copy/share the location address via any application compatible for sharing the text data.

Bottom Navigation Menu : Parks - ParkListFragment

Portrait & Landscape view - Collapsed Items Portrait view - Expanded Items
park_portrait
park_landscape
park_item_expand_1
park_item_expand_2
  • Displays list of interesting "Parks to visit" in Mysore.
  • Reads and prepares Park data from park_arrays.xml for the park_list_entries mentioned in arrays.xml.
  • Each Item View displays the following data for Parks -
    • Name
    • Rating
    • Image of the Park
    • Park Timings
    • Entry Fee
    • Location address in text (expanded form) and as an action button (collapsed form)
    • Description of the Park (expanded form)
  • Clicking on the Item View takes the user to the Website of the Park if present. When not present, a snackbar with message, "No link available!" will be displayed.
  • Clicking on the Location Icon button (in collapsed form) or on the Location text (in expanded form) will launch the Google Maps for the location.
  • On Long press of Location text in expanded form, allows the user to copy/share the location address via any application compatible for sharing the text data.

Bottom Navigation Menu : Hotels - HotelListFragment

Portrait & Landscape view - Collapsed Items Portrait view - Expanded Items
hotel_portrait
hotel_landscape
hotel_item_expand
  • Displays list of "Hotels to stay" in Mysore.
  • Reads and prepares Hotel data from hotel_arrays.xml for the hotel_list_entries mentioned in arrays.xml.
  • Each Item View displays the following data for Hotels -
    • Name
    • Traveller Rating
    • Hotel Star Rating using icon representation
    • Image of the Hotel
    • Rate per Night for a couple to stay
    • Location address in text (expanded form) and as an action button (collapsed form)
    • Contact Number in text (expanded form) and as an action button (collapsed form)
  • Clicking on the Item View takes the user to the Website of the Hotel if present. When not present, a snackbar with message, "No link available!" will be displayed.
  • Clicking on the Location Icon button (in collapsed form) or on the Location text (in expanded form) will launch the Google Maps for the location.
  • Clicking on the Phone Icon button (in collapsed form) or on the Contact Number text (in expanded form) will launch the Dialer for the Contact Number.
  • If Contact Number is absent, Phone Icon button (in collapsed form) will be hidden away and the Contact Number text field (in expanded form) will display, "No contact available!".
  • On Long press of Location text in expanded form, allows the user to copy/share the location address via any application compatible for sharing the text data.
  • On Long press of Contact Number text in expanded form, allows the user to copy/share the contact number via any application compatible for sharing the text data.

Bottom Navigation Menu : Restaurants - RestaurantListFragment

Portrait & Landscape view - Collapsed Items Portrait view - Expanded Items
restaurant_portrait
restaurant_landscape
restaurant_item_expand
  • Displays list of "Restaurants to dine" in Mysore.
  • Reads and prepares Restaurant data from restaurant_arrays.xml for the restaurant_list_entries mentioned in arrays.xml.
  • Each Item View displays the following data for Restaurants -
    • Name
    • Cuisine Types
    • Foodie Rating
    • Image of the Restaurant
    • Restaurant Timings
    • Cost of dining, averaged for two persons
    • Location address in text (expanded form) and as an action button (collapsed form)
    • Contact Number in text (expanded form) and as an action button (collapsed form)
  • Clicking on the Item View takes the user to the Website of the Restaurant if present. When not present, a snackbar with message, "No link available!" will be displayed.
  • Clicking on the Location Icon button (in collapsed form) or on the Location text (in expanded form) will launch the Google Maps for the location.
  • Clicking on the Phone Icon button (in collapsed form) or on the Contact Number text (in expanded form) will launch the Dialer for the Contact Number.
  • If Contact Number is absent, Phone Icon button (in collapsed form) will be hidden away and the Contact Number text field (in expanded form) will display, "No contact available!".
  • On Long press of Location text in expanded form, allows the user to copy/share the location address via any application compatible for sharing the text data.
  • On Long press of Contact Number text in expanded form, allows the user to copy/share the contact number via any application compatible for sharing the text data.

Bottom Navigation Menu : Shops - ShopListFragment

Portrait & Landscape view - Collapsed Items Portrait view - Expanded Items
shop_portrait
shop_landscape
shop_item_expand
  • Displays list of interesting "Shops" for shopping in Mysore.
  • Reads and prepares Shop data from shop_arrays.xml for the shop_list_entries mentioned in arrays.xml.
  • Each Item View displays the following data for Shops -
    • Name
    • Shop Type
    • Rating
    • Image of the Shop
    • Shop Timings
    • Location address in text (expanded form) and as an action button (collapsed form)
  • Clicking on the Item View takes the user to the Website of the Shop if present. When not present, a snackbar with message, "No link available!" will be displayed.
  • Clicking on the Location Icon button (in collapsed form) or on the Location text (in expanded form) will launch the Google Maps for the location.
  • On Long press of Location text in expanded form, allows the user to copy/share the location address via any application compatible for sharing the text data.

Bottom Navigation Behavior - BottomNavigationBehavior

Images of Shop List Item that had no Website information. Snackbar message docks on top of BottomNavigationView when it is shown

  • This behavior hides away the BottomNavigationView when the user scrolls towards the bottom of the View, shown for the Navigation item selected.
  • It checks for the Snackbar dependency and adjusts its layout parameters such that the Snackbar always appears above the BottomNavigationView. Without this, Snackbar always appears behind the BottomNavigationView.
  • It mimics the Snap animation behavior of AppBarLayout for displaying/hiding the BottomNavigationView on scrolling. It hides the BottomNavigationView when more than or equal to half of it is translated away, and shows the BottomNavigationView when less than half of it is translated away.

About Activity

  • Launches via the "About" Menu available in the MainActivity.
  • This page describes in brief about the app, and has links to my bio and the course details hosted by Udacity.

Loading of Images

Loading of Images are carried out in a background thread through a Headless/Viewless Fragment ImageDecoderFragment. Functioning of this fragment is as follows -

  • It first checks whether the image to be loaded is present in the Bitmap Cache, implemented by BitmapImageCache.
  • If present in the cache, it updates the image to the corresponding ImageView passed.
  • If not present in cache, then the image pointed to by the Resource Id is decoded in a background thread using ImageDecoder that extends an AsyncTaskLoader. Once successfully decoded, it updates the image to the corresponding ImageView passed, and also saves the same in the Bitmap Cache.
  • While the Image is being decoded, the ImageView of the item will display the default image layer_all_default_picture. If an error occurs while decoding or if the Resource Id is invalid, then the ImageView of the item will display the error image layer_all_no_picture.

The Identifier of the Loader for each Item View is maintained unique by the Resource Id of the image to be loaded. Hence no duplication of images is possible in the list.

As per the Rubric, no third party library is used for loading images.


App Architecture

Implementation Architecture

  • App follows MVP + Repository pattern with App Resources.
  • Activities that do not need any access to Repository are excluded from the MVP architecture.
    • MainActivity needs to manage only the BottomNavigationView and its fragments.
    • AboutActivity is just a plain Activity and has no specific function.
  • All BottomNavigationView Fragments follow the MVP pattern.
  • Access to the Repository is governed by the AppRepository which interfaces with another repository -
    1. Local App Resources - ResourceRepository
      • To manage communication with the Resources of the App.

Branches in this Repository

  • udacity
    • Contains the code submitted for review, along with review suggestions incorporated.
  • release_v1.0
    • Configured an Activity Alias to launch the MainActivity.
    • Other minor changes to prepare the app for local release.

Icon and Image credits

  • App Icon, the vector illustration of Mysore Palace is a beautiful work of Ranganath Krishnamani. Do check out other designs by his team Liquid Ink.
  • The Place Icons, Hotel Star Rating Icons and other icons, are from Icons8.
  • Listing Images are mainly from Google.

Review from the Reviewer (Udacity)

review


License

Copyright 2019 Kaushik N. Sanji

Licensed under the Apache License, Version 2.0 (the "License"); 
you may not use this file except in compliance with the License. 
You may obtain a copy of the License at

   http://www.apache.org/licenses/LICENSE-2.0
   
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.