private void loadFromCache() {
   // mParties = mPartyDao.getAllPartyData();
   mParties = mPartyAPIHelper.getPartiesFromCache();
   if (mParties != null && mParties.size() > 0) {
     viewUtils.showProgress(mPartyListRecyclerView, mProgressView, false);
     mPartyAdapter.setParties(mParties);
     mPartyAdapter.setOnItemClickListener(PartyListActivity.this);
   } else {
     viewUtils.showProgress(mPartyListRecyclerView, mProgressView, false);
     mErrorView.setVisibility(View.VISIBLE);
   }
 }
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_party_list);

    Toolbar mToolbar = (Toolbar) findViewById(R.id.party_list_toolbar);
    View mToolbarShadow = findViewById(R.id.party_list_toolbar_shadow);
    mErrorView = findViewById(R.id.party_list_error_view);
    mPartyListRecyclerView = (RecyclerView) findViewById(R.id.party_list_recycler_view);
    mProgressView = (ProgressBar) findViewById(R.id.party_list_progress_bar);
    mRetryBtn = (Button) mErrorView.findViewById(R.id.error_view_retry_btn);

    mProgressView
        .getIndeterminateDrawable()
        .setColorFilter(getResources().getColor(R.color.primary), PorterDuff.Mode.SRC_ATOP);

    mToolbar.setTitle(getString(R.string.PartyList));
    hideToolBarShadowForLollipop(mToolbar, mToolbarShadow);

    setSupportActionBar(mToolbar);

    ActionBar mActionBar = getSupportActionBar();
    if (mActionBar != null) {
      // Showing Back Arrow  <-
      mActionBar.setDisplayHomeAsUpEnabled(true);
    }

    viewUtils = new ViewUtils(this);

    // Show Progress on start
    viewUtils.showProgress(mPartyListRecyclerView, mProgressView, true);
    LinearLayoutManager mLayoutManager = new LinearLayoutManager(this);
    mPartyListRecyclerView.setLayoutManager(mLayoutManager);
    mPartyAdapter = new PartyAdapter();
    mPartyListRecyclerView.setAdapter(mPartyAdapter);
    MaePaySohApiWrapper wrapper = MaePaySoh.getMaePaySohWrapper();
    mPartyAPIHelper = wrapper.getPartyApiHelper();
    mPartyDao = new PartyDao(this);
    if (InternetUtils.isNetworkAvailable(this)) {
      // downloadPartyList();
      downloadListSync();
    } else {
      loadFromCache();
    }

    mRetryBtn.setOnClickListener(
        new View.OnClickListener() {
          @Override
          public void onClick(View v) {
            downloadListSync();
          }
        });
  }