Java 类android.os.AsyncTask.Status 实例源码

项目:dd-collector    文件:AirplugAnalyticTracker.java   
/**
 * cell recording을 위한 thread를 실행한다. <p/>
 * cell recording task는 오직 한개만 실행 가능하고, 일정한 주기로 cell 정보를 수집하여 저장한다. <p/>
 * @return cell recording task 실행결과.
 */
public boolean startRecordingCellInfo() {
    if (mCellInfoTask == null) {
        mCellInfoTask = new CellInfoTask();
    }

    mCellInfoTask.clearCellInfo();

    Status status = mCellInfoTask.getStatus();
    if (status == Status.PENDING) {
        mCellInfoTask.execute();
        return true;
    } else if (status == Status.RUNNING) {
        return true;
    } else if (status == Status.FINISHED) {
        mCellInfoTask = new CellInfoTask();
        mCellInfoTask.execute();
        return true;
    }

    return false;
}
项目:JABtalk    文件:BrowserActivity.java   
@Override
public boolean onContextItemSelected(MenuItem item) {
    switch (item.getItemId()) {
        case R.id.menu_download:
            if (downloadTask == null || downloadTask.getStatus() == Status.FINISHED) {
                downloadTask = new DownloadTask();
                downloadTask.execute();
            } else {
                JTApp.logMessage(TAG, JTApp.LOG_SEVERITY_ERROR,
                        "Download Task in invalid state");
            }
            return true;
        default:
            return super.onContextItemSelected(item);
    }
}
项目:JABtalk    文件:ManageActivity.java   
private void restoreProgressDialog() {
    if (restoreTask != null && restoreTask.getStatus() == AsyncTask.Status.RUNNING) {
        progressDialog.setMessage(getString(R.string.dialog_message_restoring));
        progressDialog.show();
    }

    if (saveTask != null && saveTask.getStatus() == AsyncTask.Status.RUNNING) {
        progressDialog.setMessage(getString(R.string.dialog_message_saving));
        progressDialog.show();
    }

    if (backupTask != null && backupTask.getStatus() == AsyncTask.Status.RUNNING) {
        progressDialog.setMessage(getString(R.string.dialog_message_backup));
        progressDialog.show();
    }
}
项目:vit-04    文件:ProcedureRunner.java   
private void lookupPatient(String patientId) {
    logEvent(EventType.ENCOUNTER_LOOKUP_PATIENT_START, patientId);
    if (lookupProgress == null) {
        lookupProgress = new ProgressDialog(this);
        lookupProgress.setMessage("Looking up patient \""+patientId +"\""); // TODO i18n
        lookupProgress.setProgressStyle(ProgressDialog.STYLE_SPINNER);
        if(!isFinishing())
            lookupProgress.show();

        if(patientLookupTask == null || 
                patientLookupTask.getStatus() == Status.FINISHED){
            patientLookupTask = new PatientLookupTask(this);
            patientLookupTask.setPatientLookupListener(this);
            patientLookupTask.execute(patientId);
        }
    }
}
项目:vit-04    文件:ProcedureRunner.java   
private void saveLocalTaskState(Bundle outState){
    final ProcedureLoaderTask task = procedureLoaderTask;
     if (task != null && task.getStatus() != Status.FINISHED) {
        task.cancel(true);
        outState.putBoolean(STATE_LOAD_PROCEDURE, true);
        outState.putParcelable(STATE_PROC_LOAD_BUNDLE, task.instance);
        outState.putParcelable(STATE_PROC_LOAD_INTENT, task.intent);
     }

    final PatientLookupTask pTask = patientLookupTask;
     if (pTask != null && pTask.getStatus() != Status.FINISHED) {
        pTask.cancel(true);
        outState.putBoolean(STATE_LOOKUP_PATIENT, true);
outState.putString(STATE_PATIENT_ID, pTask.patientId);
     }
 }
项目:vit-04    文件:Moca.java   
private void saveLocalTaskState(Bundle outState){
    final CheckCredentialsTask task = mCredentialsTask;
    if (task != null && task.getStatus() != Status.FINISHED) {
        task.cancel(true);
        outState.putBoolean(STATE_CHECK_CREDENTIALS, true);
    }
    final MDSSyncTask mTask = mSyncTask;
    if (mTask != null && mTask.getStatus() != Status.FINISHED) {
        mTask.cancel(true);
        outState.putBoolean(STATE_MDS_SYNC, true);
    }
    final ResetDatabaseTask rTask = mResetDatabaseTask;
    if (rTask != null && rTask.getStatus() != Status.FINISHED) {
        rTask.cancel(true);
        outState.putBoolean(STATE_RESET_DB, true);
    }
}
项目:geoar-app    文件:PluginDownloader.java   
public static void getDataSources(OnDataSourceResultListener listener,
        boolean force) {
    if (mDownloadTask == null
            || mDownloadTask.getStatus() != Status.FINISHED || force) {
        mCurrentListeners.add(listener);

        if (mDownloadTask == null
                || mDownloadTask.getStatus() == Status.FINISHED) {
            mDownloadTask = new DownloadTask();
            mDownloadTask.execute((Void) null);
        }
    } else {
        listener.onDataSourceResult(new ArrayList<PluginDownloadHolder>(
                mDownloadableDataSources));
    }
}
项目:crazyflie-android-client    文件:BootloaderActivity.java   
@Override
public void onBackPressed() {
    if (mFlashFirmwareTask != null && mFlashFirmwareTask.getStatus().equals(Status.RUNNING)) {
        if (mDoubleBackToExitPressedOnce) {
            super.onBackPressed();
            return;
        }
        this.mDoubleBackToExitPressedOnce = true;
        Toast.makeText(this, "Please click BACK again to cancel flashing and exit", Toast.LENGTH_SHORT).show();
        new Handler().postDelayed(new Runnable() {

            @Override
            public void run() {
                mDoubleBackToExitPressedOnce = false;

            }
        }, 2000);
    } else {
        super.onBackPressed();
    }
}
项目:analytics-client    文件:HarvestReporter.java   
public Boolean canReport() {
    Log.d("HarvestReporter", "canReport");

    ConnectivityManager manager = (ConnectivityManager)context.getSystemService(Context.CONNECTIVITY_SERVICE);
    NetworkInfo info = manager.getActiveNetworkInfo();
    if (info == null || !info.isAvailable() || !info.isConnected()) {
        Log.d("HarvestReporter", "canReport: not connected");
        return false;
    }

    if ((settings.getRealNowSeconds() - lastAttempt) < HarvestSettings.ATTEMPT_INTERVAL) {
        Log.d("HarvestReporter", "canReport: too soon to try");
        return false;
    }
    if ((settings.getClockNowSeconds() - settings.getLastReported()) < HarvestSettings.REPORT_INTERVAL) {
        Log.d("HarvestReporter", "canReport: too son to report");
        return false;
    }

    if (previousTask != null && previousTask.getStatus() != Status.FINISHED){
        Log.d("HarvestReporter", "canReport: previous task is still running");
        return false;
    }

    return true;
}
项目:sana.mobile    文件:MainActivity.java   
public void handleTaskStatusChange(Uri task, org.sana.api.task.Status status, String now, ContentValues values){
    if(now == null) now = timeStamp();
    if(values == null)
        values = new ContentValues();
    Log.i(TAG, "Updating status: " + now + " --> " + status + " --> " + values.size() + " --> " + task);

    // update in db
    values.put(Tasks.Contract.STATUS, status.toString());
    values.put(Tasks.Contract.MODIFIED, now);

    // Convert to a Bundle so that we can pass it
    Log.d(TAG, "FORM data");
    Bundle form = new Bundle();
    form.putString(Tasks.Contract.STATUS,String.valueOf(status.code));
    form.putString(Tasks.Contract.MODIFIED,now);
    getContentResolver().update(task,values,null,null);

    // send to sync
    Intent intent = new Intent(Intents.ACTION_UPDATE,task);
    intent.putExtra("form", form);
    startService(intent);
}
项目:sana.mobile    文件:MainActivity.java   
public void markTaskStatusInProgress(Uri task){
    Log.i(TAG, "markStatusInProgress(): " + task);
    org.sana.api.task.Status status = org.sana.api.task.Status.IN_PROGRESS;
    String now = timeStamp();
    ContentValues values = new ContentValues();
    values.put(Tasks.Contract.STATUS, "In Progress");
    values.put(Tasks.Contract.MODIFIED, now);
    values.put(Tasks.Contract.STARTED, now);
    getContentResolver().update(task,values,null,null);

    Bundle form = new Bundle();
    form.putString(Tasks.Contract.STATUS, "In Progress");
    form.putString(Tasks.Contract.MODIFIED,now);
    form.putString(Tasks.Contract.STARTED,now);

    // send to sync
    Intent intent = new Intent(Intents.ACTION_UPDATE,task);
    intent.putExtra("form", form);
    startService(intent);
}
项目:sana.mobile    文件:MainActivity.java   
public void markTaskStatusCompleted(Uri task, Uri encounter){
    Log.i(TAG, "markStatusCompleted(): " + task);
    org.sana.api.task.Status status = org.sana.api.task.Status.COMPLETED;
    String now = timeStamp();
    String uuid = ModelWrapper.getUuid(encounter,getContentResolver());
    ContentValues values = new ContentValues();
    values.put(Tasks.Contract.STATUS, status.toString());
    values.put(Tasks.Contract.COMPLETED, now);
    values.put(EncounterTasks.Contract.ENCOUNTER, uuid);
    values.put(Tasks.Contract.MODIFIED, now);

    Bundle form = new Bundle();
    form.putString(Tasks.Contract.STATUS, status.toString());
    form.putString(Tasks.Contract.MODIFIED,now);
    form.putString(Tasks.Contract.COMPLETED,now);
    form.putString(EncounterTasks.Contract.ENCOUNTER, uuid);

    // send to sync
    Intent intent = new Intent(Intents.ACTION_UPDATE,task);
    intent.putExtra("form", form);
    startService(intent);
}
项目:persontracker    文件:DashboardActivity.java   
@SuppressLint("NewApi")
private void checkDroneConnectivity()
{
    if (checkDroneConnectionTask != null && checkDroneConnectionTask.getStatus() != Status.FINISHED) {
        checkDroneConnectionTask.cancel(true);
    }

    checkDroneConnectionTask = new CheckDroneNetworkAvailabilityTask() {

            @Override
            protected void onPostExecute(Boolean result) {
               onDroneAvailabilityChanged(result);
            } 

        };

        if (Build.VERSION.SDK_INT >= 11) {
            checkDroneConnectionTask.executeOnExecutor(CheckDroneNetworkAvailabilityTask.THREAD_POOL_EXECUTOR, this);
        } else {
            checkDroneConnectionTask.execute(this);
        }
}
项目:HFRFirefoxOS    文件:PostsActivity.java   
/**
 * Permet de changer l'ordre de chargement des pages
 * @param targetPageNumber
 */
private void inverseTask(int targetPageNumber)
{
    // Si une t�che est en cours
    if (preLoadingPostsAsyncTask != null && preLoadingPostsAsyncTask.getStatus() == Status.RUNNING)
    {
        // si la page pr�c�dente n'est en cours de chargement
        if (preLoadingPostsAsyncTask.getPageNumber() != targetPageNumber)
        {
            // Sinon on force le chargement de la page pr�c�dente
            int interruptedPageNumber = preLoadingPostsAsyncTask.getPageNumber();
            preLoadingPostsAsyncTask.cancel(true);
            preLoadingPostsAsyncTask = new PreLoadingPostsAsyncTask(PostsActivity.this, interruptedPageNumber);
            preLoadingPostsAsyncTask.execute(targetPageNumber, topic);
        }
    }
}
项目:301-Project    文件:DownloadTasksTestCases.java   
/**
 * This test downloads the list of title authors from the repo of stories.
 * This data would be displayed in the online mode's list of stories to
 * download or cache.
 */
public void testDownloadTitleAuthors() throws Throwable {
    final SampleOViewClass sampleClass = new SampleOViewClass();
    this.downloadTitleAuthors = new DownloadTitleAuthorsTask(context, sampleClass);

    runTestOnUiThread(new Runnable() {
        @Override
        public void run() {
            downloadTitleAuthors.execute(new String[] {});
        }
    });

    if (!downloadTitleAuthors.get()) {
        // Download failed
        fail("Download failed");
    }

    // Wait til onPostExecute finishes and we get updated
    while (downloadTitleAuthors.getStatus() != Status.FINISHED && !sampleClass.updated) {
        if (downloadTitleAuthors.isCancelled())
            fail("We were cancelled");
    }
    assertNotNull(sampleClass.titleAuthors);
    assertTrue("There are no stories in the sampleClass",
            sampleClass.titleAuthors.size() > 0);
}
项目:tehran_traffic_map    文件:MainActivity.java   
private void showUpdateDialog() {
    if (updateDialog == null || !updateDialog.isShowing()) {
        if (loader != null
                && (loader.isCancelled() || loader.getStatus() == Status.PENDING)
                && Utils.isConnected(context)) {
            AlertDialog.Builder builder = new AlertDialog.Builder(this);
            updateDialog = builder
                    .setMessage(getString(R.string.msg_updatemap))
                    .setPositiveButton(getString(R.string.msg_yes),
                            MainActivity.this)
                    .setNegativeButton(getString(R.string.msg_no),
                            MainActivity.this).show();
        } else {
            Log.wtf(TAG, "WTF!");
        }
    }
}
项目:tehran_traffic_map    文件:MainActivity.java   
public void showRoadMap() {
    appState = ApplicationState.Road;

    findViewById(R.id.inMap).setVisibility(View.VISIBLE);

    ibPrev.setVisibility(View.GONE);
    ibNext.setVisibility(View.GONE);
    ibRefresh.setVisibility(View.VISIBLE);
    ibBack.setVisibility(View.GONE);
    nvMap.setVisibility(View.GONE);
    ivRoadsHelp.setVisibility(View.VISIBLE);
    spState.setVisibility(View.VISIBLE);

    if (loader == null || loader.isCancelled()
            || loader.getStatus() == Status.FINISHED) {
        loader = new DataLoader(this, tivMap, tvError);
    }
    loader.loadRoad(getState(), false);

    findViewById(R.id.ibTabRoad).setEnabled(false);

    tivMap.setBackgroundResource(R.drawable.shape_page_bg_white);

    checkLastUpdate();

}
项目:PhotoPhase    文件:MediaPictureDiscoverer.java   
/**
 * Method that request an asynchronous reload of the media store picture data.
 *
 * @param userRequest If the request was generated by the user
 * @param cb Asynchronous callback
 */
public synchronized void discover(boolean userRequest, OnMediaPictureDiscoveredListener cb) {
    if (mTask != null && mTask.getStatus().compareTo(Status.FINISHED) != 0 &&
            !mTask.isCancelled()) {
        mTask.cancel(true);
        mTask = null;
    }

    if (AndroidHelper.hasReadExternalStoragePermissionGranted(mContext)) {
        mTask = new AsyncDiscoverTask(mContext.getContentResolver(), cb, userRequest);
        mTask.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
    } else {
        // Notify that we don't have any files
        cb.onEndMediaDiscovered(new File[0], userRequest);
    }
}
项目:letv    文件:LivePlayerController.java   
private void fullScreenClickShowAndHide(boolean show) {
    LogInfo.log(RxBus.TAG, "全屏控制栏显示:" + show);
    if (show) {
        this.mTopBar.setVisibility(0);
        this.mBottomBar.setVisibility(0);
        if (LiveLunboUtils.isLunBoWeiShiType(this.pageIndex)) {
            this.mChannelBtn.setVisibility(0);
        }
        if (this.mLiveBarrageController == null || !this.mLiveBarrageController.getBarrageControl().isOpenBarrage()) {
            this.mBarrageInputBtn.setVisibility(4);
        } else {
            this.mBarrageInputBtn.setVisibility(0);
        }
        if (this.mCanWatchAndBuy) {
            this.mCartLayout.setVisibility(0);
            if (this.mCartShowingSubscription != null) {
                LogInfo.log(RxBus.TAG, "取消监听购物车按钮消失的通知");
                this.mCartShowingSubscription.unsubscribe();
            }
        }
        if (!(LiveLunboUtils.isLunBoWeiShiType(this.pageIndex) || this.mBaseBean == null || this.mBaseBean.branchType <= 0 || this.mBaseBean.isBranch != 1 || BaseTypeUtils.isListEmpty(this.mBaseBean.branches))) {
            this.mBtnMultiProgram.setVisibility(0);
        }
    } else {
        this.mTopBar.setVisibility(8);
        this.mBottomBar.setVisibility(8);
        if (LiveLunboUtils.isLunBoWeiShiType(this.pageIndex)) {
            this.mChannelBtn.setVisibility(8);
        }
        this.mBarrageInputBtn.setVisibility(4);
        hideFloatView();
        setLevelTipVisible(false);
        if (this.mCartLayout.getVisibility() == 0 && !this.mWacthAndBuyFloatView.isShowing() && this.mWatchAndBuyCartListView.getVisibility() != 0 && ((this.mCartTask == null || this.mCartTask.getStatus() != Status.RUNNING) && this.mWatchAndBuyCartListView.getVisibility() != 0)) {
            this.mCartLayout.setVisibility(8);
        }
        this.mBtnMultiProgram.setVisibility(8);
    }
    RxBus.getInstance().send("rx_bus_live_home_action_update_system_ui");
}
项目:emerald    文件:Apps.java   
@Override
public boolean onOptionsItemSelected(MenuItem item) {
    //Log.v(APP_TAG, "Menu item is selected");
    switch(item.getItemId()) {
    //      case R.id.scan:
    //          (new GetApps(this, false)).execute();
    //          return true;
    case R.id.full_scan:
        if (scanner != null && scanner.getStatus() == AsyncTask.Status.RUNNING)
            return true;
        scanner = new GetApps(this);
        scanner.execute(true);
        return true;
    case R.id.change_wallpaper:
        startActivity(new Intent(Intent.ACTION_SET_WALLPAPER));
        return true;
    case R.id.options:
        startActivity(new Intent(this, Options.class));
        return true;
    case R.id.access_hidden:
        categories.setCurCategory(CategoryManager.HIDDEN);
        findViewById(R.id.searchBar).setVisibility(View.GONE);
        findViewById(R.id.tabs).setVisibility(View.GONE);
        findViewById(R.id.quit_hidden_apps).setVisibility(View.VISIBLE);
        if (searchIsOpened) {
            closeSearch();
        }
        loadFilteredApps();
        return true;
    default:
        return false;
    }
}
项目:boohee_v5.6    文件:ShareActivity.java   
private void l() {
    if (this.y == null) {
        c();
    }
    if (!(this.G == null || this.G.getStatus() == Status.FINISHED)) {
        this.G.cancel(true);
    }
    this.G = new y(this, this.y);
    this.G.execute(new Void[0]);
}
项目:yaacc-code    文件:ImageViewerActivity.java   
/**
 *
 */
private void loadImage() {
    if (retrieveImageTask != null
            && retrieveImageTask.getStatus() == Status.RUNNING) {
        return;
    }
    retrieveImageTask = new RetrieveImageTask(this);
    Log.d(getClass().getName(),
            "showImage(" + imageUris.get(currentImageIndex) + ")");
    retrieveImageTask.execute(imageUris.get(currentImageIndex));
}
项目:samba-documents-provider    文件:DocumentCursor.java   
@Override
public void close() {
  super.close();
  if (mLoadingTask != null && mLoadingTask.getStatus() != Status.FINISHED) {
    if(BuildConfig.DEBUG) Log.d(TAG, "Cursor is closed. Cancel the loading task " + mLoadingTask);
    // Interrupting the task is not a good choice as it's waiting for the Samba client thread
    // returning the result. Interrupting the task only frees the task from waiting for the
    // result, rather than freeing the Samba client thread doing the hard work.
    mLoadingTask.cancel(false);
  }
}
项目:samba-documents-provider    文件:TaskManager.java   
public <T> void runTask(Uri uri, AsyncTask<T, ?, ?> task, T... args) {
  synchronized (mTasks) {
    if (!mTasks.containsKey(uri) || mTasks.get(uri).getStatus() == Status.FINISHED) {
      mTasks.put(uri, task);
      // TODO: Use different executor for different servers.
      task.executeOnExecutor(mExecutor, args);
    } else {
      Log.i(TAG,
          "Ignore this task for " + uri + " to avoid running multiple updates at the same time.");
    }
  }
}
项目:upcKeygen    文件:NetworkFragment.java   
@TargetApi(Build.VERSION_CODES.HONEYCOMB)
public void onActivityCreated(Bundle savedInstanceState) {
    super.onActivityCreated(savedInstanceState);
    if (passwordList == null) {
        if (thread.getStatus() == Status.FINISHED
                || thread.getStatus() == Status.RUNNING)
            thread = new KeygenThread(wifiNetwork);
        if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.GINGERBREAD_MR1) {
            thread.execute();
        } else {
            thread.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
        }
    }
}
项目:prayer-times-android    文件:HadithFragment.java   
@Override
public boolean onQueryTextSubmit(String query) {
    if ((mTask != null) && (mTask.getStatus() == Status.RUNNING)) {
        return false;
    }

    mQuery = query;


    mTask = new SearchTask(getActivity());
    mTask.execute(query);
    return false;
}
项目:tinylaunch    文件:Apps.java   
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    options = PreferenceManager.getDefaultSharedPreferences(this);

    prefListener = new OnSharedPreferenceChangeListener() {         
        @Override
        public void onSharedPreferenceChanged(SharedPreferences sharedPreferences,
                String key) {
            //Log.v("TinyLaunch", "pref change detected");
            if (key.equals(Options.PREF_DIRTY) && sharedPreferences.getBoolean(Options.PREF_DIRTY, false)) {
                if (scanner == null || scanner.getStatus() != AsyncTask.Status.RUNNING) {
                    scanner = new GetApps(Apps.this);
                    scanner.execute(false);
                }
            }
        }
    };

    options.registerOnSharedPreferenceChangeListener(prefListener);


    if (options.getBoolean(Options.PREF_LIGHT, false))
        setTheme(android.R.style.Theme_Light);

    setContentView(R.layout.apps);

    list = (ListView)findViewById(R.id.apps);

    res = getResources();

    categories = null;
}
项目:tinylaunch    文件:Apps.java   
@Override
public boolean onOptionsItemSelected(MenuItem item) {
    switch(item.getItemId()) {
    //      case R.id.scan:
    //          (new GetApps(this, false)).execute();
    //          return true;
    case R.id.full_scan:
        if (scanner != null && scanner.getStatus() == AsyncTask.Status.RUNNING)
            return true;
        scanner = new GetApps(this);
        scanner.execute(true);
        return true;
    case R.id.options:
        startActivity(new Intent(this, Options.class));
        return true;
    case R.id.new_category:
        newCategory();
        return true;
    case R.id.rename_category:
        renameCategory();
        return true;
    case R.id.delete_category:
        categories.removeCategory();
        loadFilteredApps();
        return true;
    default:
        return false;
    }
}
项目:mobile-android-studio    文件:LoginProxy.java   
public void onPause(org.exoplatform.base.BaseActivity act) {
  if (act == mContext) {
    // TODO implement correct behavior, current only dismissUI and cancel current task
    if (Log.LOGD)
      Log.d(TAG, "onPause cancel task");
    setListener(null);
    if (mLoginTask != null && mLoginTask.getStatus() == Status.RUNNING) {
      mLoginTask.cancel(true);
    }
    dismissDialog();
  }
}
项目:mobile-android-studio    文件:ActivityStreamFragment.java   
/**
 * Load <code>actNums</code> (default 100) newest activities and update the stream of this fragment.
 * @param actNums The number of activities to load.
 */
private void onLoad(int actNums) {
   if (ExoConnectionUtils.isNetworkAvailableExt(getActivity())) {
     if (mLoadTask == null || mLoadTask.getStatus() == Status.FINISHED) {
      int currentTab = getThisTabId();
      mLoadTask = getThisLoadTask();
      mLoadTask.execute(actNums, currentTab);
      firstIndex = 0;
      isLoadingMoreActivities = false;
    }
 } else {
     new ConnectionErrorDialog(getActivity()).show();
 }
}
项目:mobile-android-studio    文件:ActivityStreamFragment.java   
/**
 * Load <code>numberOfActivities</code> (default 100) more activities from the end of the list.
 * @param numberOfActivities The number of activities to add to the current list.
 * @param currentPos The position of the 1st newly loaded activity.
 */
public void onLoadMore(int numberOfActivities, int currentPos, int firstVisible) {
 if (ExoConnectionUtils.isNetworkAvailableExt(getActivity())) {
     if (mLoadTask == null || mLoadTask.getStatus() == Status.FINISHED) {
      int currentTab = SocialTabsActivity.instance.mPager.getCurrentItem();
      int lastActivity = 0;
      ArrayList<SocialActivityInfo> list = SocialServiceHelper.getInstance().getSocialListForTab(currentTab);
      mLoadTask = getThisLoadTask();

         Log.d(TAG, "loading more data - flush image cache");
         ((SocialTabsActivity) getActivity()).getGDApplication().getImageCache().flush();
         System.gc();

      if (list != null) { // if we can identify the last activity, we load the previous/older ones
          lastActivity = list.size()-1;
          isLoadingMoreActivities = true;
          currentPosition = currentPos;
          firstIndex = firstVisible;
          mLoadTask.execute(numberOfActivities, currentTab, lastActivity);
      } else {            // otherwise we simply reload the current tab's activities and inform the user
          Toast.makeText(getActivity(), getActivity().getString(R.string.CannotLoadMoreActivities), Toast.LENGTH_LONG).show();
          currentPosition = 0;
          mLoadTask.execute(numberOfActivities, currentTab);
      }
     }
 } else {
     new ConnectionErrorDialog(getActivity()).show();
 }
}
项目:CmoaQuiz    文件:QuestionFragment.java   
public void startCountDown() {
    if (mCountDownTask == null) {
        mCanStartCountDown = true;
    } else if (mCountDownTask.getStatus() == Status.PENDING) {
        mCountDownTask.execute();
    }
}
项目:prayer-times-android    文件:HadithFragment.java   
@Override
public boolean onQueryTextSubmit(String query) {
    if ((mTask != null) && (mTask.getStatus() == Status.RUNNING)) {
        return false;
    }

    mQuery = query;


    mTask = new SearchTask(getActivity());
    mTask.execute(query);
    return false;
}
项目:forum-fiend-osp    文件:SocialFragment.java   
@Override
public void onStop() {
    super.onStop();

    //Stop any running tasks
    if(socialLoader != null) {
        if(socialLoader.getStatus() == Status.RUNNING) {
            socialLoader.cancel(true);
        }
    }
}
项目:forum-fiend-osp    文件:MailFragment.java   
@Override
public void onStop() {
    super.onStop();

    //Stop any running tasks
    if(mailDownloader != null) {
        if(mailDownloader.getStatus() == Status.RUNNING) {
            mailDownloader.cancel(true);
        }
    }
}
项目:forum-fiend-osp    文件:CategoriesFragment.java   
private void endCurrentlyRunning() {
    //Stop any running tasks
    if(categoriesDownloader != null) {
        if(categoriesDownloader.getStatus() == Status.RUNNING) {
            categoriesDownloader.cancel(true);
            Log.i("Forum Fiend","Killed Currently Running");
        }
    }
}
项目:forum-fiend-osp    文件:PostsFragment.java   
private void endCurrentlyRunning() {
    //Stop any running tasks
    if(postsDownloader != null) {
        if(postsDownloader.getStatus() == Status.RUNNING) {
            postsDownloader.cancel(true);
        }
    }
}
项目:JABtalk    文件:EditIdeogramActivity.java   
private void persistChanges() {
    if (saveTask == null || saveTask.getStatus() == Status.FINISHED) {
        saveTask = new SaveDataStoreTask();
        saveTask.execute();
    } else {
        JTApp.logMessage(TAG, JTApp.LOG_SEVERITY_ERROR, "SaveDataStore Task in invalid state");
    }
}
项目:JABtalk    文件:ManageActivity.java   
private void backupData(String fileName) {
    if (backupTask == null || backupTask.getStatus() == Status.FINISHED) {
        backupTask = new BackupTask();
        backupTask.execute(fileName);
    } else {
        JTApp.logMessage(TAG, JTApp.LOG_SEVERITY_ERROR, "BackupTask in invalid state");
    }
}
项目:JABtalk    文件:ManageActivity.java   
private void persistChanges(boolean exitAfterSave) {
    if (saveTask == null || saveTask.getStatus() == Status.FINISHED) {
        saveTask = new SaveDataStoreTask();
        saveTask.execute(exitAfterSave);
    } else {
        JTApp.logMessage(TAG, JTApp.LOG_SEVERITY_ERROR, "SaveDataStore Task in invalid state");
    }
}