private void searchFromCache(String keyword) { TextView errorText = (TextView) mErrorView.findViewById(R.id.error_view_error_text); errorText.setText(getString(R.string.PleaseCheckNetworkAndTryAgain)); mRetryBtn.setVisibility(View.VISIBLE); if (mErrorView.getVisibility() == View.VISIBLE) { mErrorView.setVisibility(View.GONE); } if (keyword.length() > 0) { mPartyListRecyclerView.setVisibility(View.VISIBLE); mErrorView.setVisibility(View.GONE); mParties = mPartyAPIHelper.searchPartiesFromCache(keyword); if (mParties != null && mParties.size() > 0) { mPartyAdapter.setParties(mParties); mPartyAdapter.setOnItemClickListener(PartyListActivity.this); } else { mPartyListRecyclerView.setVisibility(View.GONE); mErrorView.setVisibility(View.VISIBLE); mRetryBtn.setVisibility(View.GONE); errorText.setText(R.string.search_not_found); } } else { downloadPartyList(); } }
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); } }