Java Code Examples for android.os.AsyncTask.Status#FINISHED
The following examples show how to use
android.os.AsyncTask.Status#FINISHED .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: TaskFragment.java From edslite with GNU General Public License v2.0 | 6 votes |
private void initCallbacks() { _callbacks = getTaskCallbacks(getActivity()); if (_callbacks != null) { if(_task.getStatus() != Status.FINISHED) _callbacks.onPrepare(getArguments()); else try { _callbacks.onCompleted(getArguments(), _task.get()); } catch (Exception ignored) { } } }
Example 2
Source File: PluginDownloader.java From geoar-app with Apache License 2.0 | 6 votes |
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)); } }
Example 3
Source File: LNReaderApplication.java From coolreader with MIT License | 5 votes |
public boolean addTask(String key, AsyncTask<?, ?, ?> task) { synchronized (lock) { if (runningTasks.containsKey(key)) { AsyncTask<?, ?, ?> tempTask = runningTasks.get(key); if (tempTask != null && tempTask.getStatus() != Status.FINISHED) return false; } runningTasks.put(key, task); return true; } }
Example 4
Source File: DownloadCartridgeActivity.java From WhereYouGo with GNU General Public License v3.0 | 5 votes |
@Override public void onDestroy() { super.onDestroy(); if (downloadTask != null && downloadTask.getStatus() != Status.FINISHED) { downloadTask.cancel(true); downloadTask = null; } }
Example 5
Source File: NavigationActivity.java From sana.mobile with BSD 3-Clause "New" or "Revised" License | 5 votes |
private void saveLocalTaskState(Bundle outState) { 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); } }
Example 6
Source File: NavigationActivity.java From sana.mobile with BSD 3-Clause "New" or "Revised" License | 5 votes |
/** * Executes a task to clear out the database */ private void doClearDatabase() { // TODO: context leak if (mResetDatabaseTask != null && mResetDatabaseTask.getStatus() != Status.FINISHED) return; mResetDatabaseTask = (ResetDatabaseTask) new ResetDatabaseTask(this).execute(this); }
Example 7
Source File: Sana.java From sana.mobile with BSD 3-Clause "New" or "Revised" License | 5 votes |
private void saveLocalTaskState(Bundle outState) { 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); } }
Example 8
Source File: Sana.java From sana.mobile with BSD 3-Clause "New" or "Revised" License | 5 votes |
/** * Executes a task to clear out the database */ private void doClearDatabase() { // TODO: context leak if (mResetDatabaseTask != null && mResetDatabaseTask.getStatus() != Status.FINISHED) return; mResetDatabaseTask = (ResetDatabaseTask) new ResetDatabaseTask(this).execute(this); }
Example 9
Source File: MainActivity.java From sana.mobile with BSD 3-Clause "New" or "Revised" License | 5 votes |
private void saveLocalTaskState(Bundle outState) { final ResetDatabaseTask rTask = mResetDatabaseTask; if (rTask != null && rTask.getStatus() != Status.FINISHED) { rTask.cancel(true); outState.putBoolean("_resetdb", true); } }
Example 10
Source File: MainActivity.java From sana.mobile with BSD 3-Clause "New" or "Revised" License | 5 votes |
private void doClearDatabase(Uri[] uris) { // TODO: context leak if (mResetDatabaseTask != null && mResetDatabaseTask.getStatus() != Status.FINISHED) return; mResetDatabaseTask = (ResetDatabaseTask) new ResetDatabaseTask(this, true, uris).execute(this); }
Example 11
Source File: MainActivity.java From sana.mobile with BSD 3-Clause "New" or "Revised" License | 5 votes |
/** * Executes a task to clear out the database */ private void doClearDatabase() { // TODO: context leak if (mResetDatabaseTask != null && mResetDatabaseTask.getStatus() != Status.FINISHED) return; mResetDatabaseTask = (ResetDatabaseTask) new ResetDatabaseTask(this, true).execute(this); }
Example 12
Source File: BaseRunnerFragment.java From sana.mobile with BSD 3-Clause "New" or "Revised" License | 5 votes |
private void lookupPatient(String patientId) { logEvent(EventType.ENCOUNTER_LOOKUP_PATIENT_START, patientId); // Display progress dialog String message = String.format(getString(R.string.dialog_look_up_patient), patientId); showProgressDialogFragment(message); if (patientLookupTask == null || patientLookupTask.getStatus() == Status.FINISHED) { patientLookupTask = new PatientLookupTask(getActivity()); patientLookupTask.setPatientLookupListener(this); patientLookupTask.execute(patientId); } }
Example 13
Source File: NetworkFragment.java From upcKeygen with GNU General Public License v2.0 | 5 votes |
@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); } } }
Example 14
Source File: TaskManager.java From samba-documents-provider with GNU General Public License v3.0 | 5 votes |
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."); } } }
Example 15
Source File: DocumentCursor.java From samba-documents-provider with GNU General Public License v3.0 | 5 votes |
@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); } }
Example 16
Source File: Sana.java From sana.mobile with BSD 3-Clause "New" or "Revised" License | 4 votes |
/** * Syncs the Patient database with MDS */ private void doUpdatePatientDatabase() { if (mSyncTask != null && mSyncTask.getStatus() != Status.FINISHED) return; mSyncTask = (MDSSyncTask) new MDSSyncTask(this).execute(this); }
Example 17
Source File: IncompleteFormListAdapter.java From commcare-android with Apache License 2.0 | 4 votes |
/** * Reload form record list for current filter status and collect pertinent * text data using FormRecordLoaderTask; results will then be re-filtered * and displayed via callbacks. */ public void resetRecords() { // reload the form records, even if they are currently being loaded if (loader.getStatus() == Status.RUNNING) { loader.cancel(false); loader = loader.spawn(); } else if (loader.getStatus() == Status.FINISHED) { loader = loader.spawn(); } SqlStorage<FormRecord> storage = CommCareApplication.instance().getUserStorage(FormRecord.class); // choose a default filter if none set if (filter == null) { filter = FormRecordFilter.SubmittedAndPending; } records.clear(); String currentAppId = CommCareApplication.instance().getCurrentApp().getAppRecord().getApplicationId(); Vector recordsVector = new Vector(); // Grab all form records that satisfy ANY of the statuses in the filter, AND belong to the // currently seated app for (String status : filter.getStatus()) { recordsVector.addAll(storage.getRecordsForValues( new String[]{FormRecord.META_STATUS, FormRecord.META_APP_ID}, new Object[]{status, currentAppId})); } if (filter.equals(FormRecordFilter.Pending)) { StorageUtils.sortRecordsBySubmissionOrderingNumber(recordsVector); } else { StorageUtils.sortRecordsByLastModifiedTimeDescending(recordsVector); } records.addAll(recordsVector); searchCache.clear(); current.clear(); notifyDataSetChanged(); // load specific data about the 'records' into the searchCache, such as // record title, form name, modified date loader.init(searchCache, names); loader.executeParallel(records.toArray(new FormRecord[records.size()])); }
Example 18
Source File: NavigationActivity.java From sana.mobile with BSD 3-Clause "New" or "Revised" License | 4 votes |
/** * Syncs the Patient database with MDS */ private void doUpdatePatientDatabase() { if (mSyncTask != null && mSyncTask.getStatus() != Status.FINISHED) return; mSyncTask = (MDSSyncTask) new MDSSyncTask(this).execute(this); }