Thursday, January 21, 2016

Understanding Architecture of Nick Butcher's Plaid App - Part-1

This is the first post in the series which will address the architecture of the Plaid app.
The source code is available at : https://github.com/nickbutcher/plaid

 Checkout some screenshots here :


 

HomeActivity

This is the launcher activity.

Three important classes

  • FilterAdapter -  Adapter for showing list of data sources in Drawer
  • DataManager - Responsible for loading data from the various sources.Instantiating classes are responsible for Providing the {codeonDataLoaded} method to do something with the data.
  • FeedAdapter - main adapter responsible for the feeding the data on home screen based on various source 


Lets look at what happens in OnCreate()
  • Inflate the layout from R.layout.activity_home
  • Buttterknife helps binding the indivisual views 
  • // This snippet shows the system bars. It does this by removing all the flags
    // except for the ones that make the content appear under the system bars.
    private void showSystemUI() {
        drawer.setSystemUiVisibility(
                View.SYSTEM_UI_FLAG_LAYOUT_STABLE
                | View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
                | View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN);
    }
  • Set toolbar:  Animate it if we are launching it for the first time
  • Configuring the setOnApplywindowInsetsListener - Still trying out to figure this out :-(
  • Set the icon using setTaskDescription ()
  • Set the listener for filteradapter for filterchange and data source change
  • Ask data manager to load data from all resources
  • Check if the adapter is empty ? - 
     if feedadapter doent have any count then check
       // if grid is empty check whether we're loading or if no filters are selected , if filters selected then show progress bar  else if no filters selected then show that no filters are selected
  • Check if there is network connectivity and appropriately show icons
       

No comments:

Post a Comment