示例#1
0
 @Override
 public void onDestroy() {
   super.onDestroy();
   if (mFlickDataFetchTask.getStatus() == AsyncTask.Status.RUNNING
       || mFlickDataFetchTask.getStatus() == AsyncTask.Status.PENDING) {
     mFlickDataFetchTask.cancel(true);
   }
 }
示例#2
0
  private void updateFlicks(String sort_order) {
    if (mUtils.isDataAvaialable()) {
      dataState(DATA_STATE_CONNECTED);
      mAlertCancelledState = false;
      mNoDataTextView.setVisibility(View.GONE);
      if (mAlert != null && mAlert.isShowing()) mAlert.dismiss();

      if (!mIsDoneDownloadingData && mSharedPref != null) {
        mFlickDataFetchTask = new FlickDataFetchAsyncTask(getActivity(), sort_order, this);
        mFlickDataFetchTask.execute();
      }
    } else {
      if (!mAlertCancelledState) {
        dataAlert(DATA_STATE_DISCONNECTED);
      } else {
        Toast.makeText(
                mContext,
                getResources().getString(R.string.data_unavailable_msg),
                Toast.LENGTH_SHORT)
            .show();
      }
      mNoDataTextView.setVisibility(View.VISIBLE);
      dataState(DATA_STATE_DISCONNECTED);
      updateGridBasedOnDataConnectionState();
    }
  }