当前位置: 首页>>代码示例>>Java>>正文


Java Status类代码示例

本文整理汇总了Java中android.os.AsyncTask.Status的典型用法代码示例。如果您正苦于以下问题:Java Status类的具体用法?Java Status怎么用?Java Status使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


Status类属于android.os.AsyncTask包,在下文中一共展示了Status类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: startRecordingCellInfo

import android.os.AsyncTask.Status; //导入依赖的package包/类
/**
 * 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;
}
 
开发者ID:ddinsight,项目名称:dd-collector,代码行数:27,代码来源:AirplugAnalyticTracker.java

示例2: onContextItemSelected

import android.os.AsyncTask.Status; //导入依赖的package包/类
@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);
    }
}
 
开发者ID:jabstone,项目名称:JABtalk,代码行数:17,代码来源:BrowserActivity.java

示例3: restoreProgressDialog

import android.os.AsyncTask.Status; //导入依赖的package包/类
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();
    }
}
 
开发者ID:jabstone,项目名称:JABtalk,代码行数:17,代码来源:ManageActivity.java

示例4: lookupPatient

import android.os.AsyncTask.Status; //导入依赖的package包/类
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);
		}
	}
}
 
开发者ID:SahilArora92,项目名称:vit-04,代码行数:18,代码来源:ProcedureRunner.java

示例5: saveLocalTaskState

import android.os.AsyncTask.Status; //导入依赖的package包/类
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);
     }
 }
 
开发者ID:SahilArora92,项目名称:vit-04,代码行数:17,代码来源:ProcedureRunner.java

示例6: saveLocalTaskState

import android.os.AsyncTask.Status; //导入依赖的package包/类
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);
    }
}
 
开发者ID:SahilArora92,项目名称:vit-04,代码行数:18,代码来源:Moca.java

示例7: getDataSources

import android.os.AsyncTask.Status; //导入依赖的package包/类
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));
	}
}
 
开发者ID:52North,项目名称:geoar-app,代码行数:17,代码来源:PluginDownloader.java

示例8: onBackPressed

import android.os.AsyncTask.Status; //导入依赖的package包/类
@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();
    }
}
 
开发者ID:bitcraze,项目名称:crazyflie-android-client,代码行数:22,代码来源:BootloaderActivity.java

示例9: canReport

import android.os.AsyncTask.Status; //导入依赖的package包/类
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;
}
 
开发者ID:tchx84,项目名称:analytics-client,代码行数:27,代码来源:HarvestReporter.java

示例10: handleTaskStatusChange

import android.os.AsyncTask.Status; //导入依赖的package包/类
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);
}
 
开发者ID:SanaMobile,项目名称:sana.mobile,代码行数:23,代码来源:MainActivity.java

示例11: markTaskStatusInProgress

import android.os.AsyncTask.Status; //导入依赖的package包/类
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);
}
 
开发者ID:SanaMobile,项目名称:sana.mobile,代码行数:21,代码来源:MainActivity.java

示例12: markTaskStatusCompleted

import android.os.AsyncTask.Status; //导入依赖的package包/类
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);
}
 
开发者ID:SanaMobile,项目名称:sana.mobile,代码行数:23,代码来源:MainActivity.java

示例13: checkDroneConnectivity

import android.os.AsyncTask.Status; //导入依赖的package包/类
@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);
        }
}
 
开发者ID:fblandroidhackathon,项目名称:persontracker,代码行数:23,代码来源:DashboardActivity.java

示例14: inverseTask

import android.os.AsyncTask.Status; //导入依赖的package包/类
/**
 * 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);
		}
	}
}
 
开发者ID:Draluy,项目名称:HFRFirefoxOS,代码行数:21,代码来源:PostsActivity.java

示例15: testDownloadTitleAuthors

import android.os.AsyncTask.Status; //导入依赖的package包/类
/**
 * 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);
}
 
开发者ID:Team-CMPUT301F13T12,项目名称:301-Project,代码行数:31,代码来源:DownloadTasksTestCases.java


注:本文中的android.os.AsyncTask.Status类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。