private void doUpdate() {
   AppLockApplication appLockApplication = AppLockApplication.getInstance();
   if (System.currentTimeMillis() - SharedPreferenceUtil.readUpdateTipTime() >= 1000 * 60 * 60 * 20
       && appLockApplication.hasNewVersion()) {
     downLoadFileUrl = appLockApplication.getUpdateVersionUrl();
     showUpdateDialog(appLockApplication.getUpdateVersionIntro());
     SharedPreferenceUtil.editUpdateTipTime(System.currentTimeMillis());
   }
 }
  private void setState(State state) {
    this.state = state;
    switch (state) {
      case PULL_TO_REFRESH:
        spinner.setVisibility(View.INVISIBLE);
        image.setVisibility(View.VISIBLE);
        text.setText(pullToRefreshText);

        if (showLastUpdatedText && lastUpdated != -1) {
          lastUpdatedTextView.setVisibility(View.VISIBLE);
          lastUpdatedTextView.setText(
              String.format(lastUpdatedText, lastUpdatedDateFormat.format(new Date(lastUpdated))));
        }

        break;

      case RELEASE_TO_REFRESH:
        spinner.setVisibility(View.INVISIBLE);
        image.setVisibility(View.VISIBLE);
        text.setText(releaseToRefreshText);
        break;

      case REFRESHING:
        setUiRefreshing();

        lastUpdated = System.currentTimeMillis();
        if (onRefreshListener == null) {
          setState(State.PULL_TO_REFRESH);
        } else {
          onRefreshListener.onRefresh();
        }

        break;
    }
  }
 /**
  * Set the state back to 'pull to refresh'. Call this method when refreshing the data is finished.
  */
 public void onRefreshComplete() {
   state = State.PULL_TO_REFRESH;
   resetHeader();
   lastUpdated = System.currentTimeMillis();
 }