Java Code Examples for android.os.AsyncTask.Status#RUNNING
The following examples show how to use
android.os.AsyncTask.Status#RUNNING .
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: NaviEngine.java From PocketMaps with MIT License | 6 votes |
@UiThread private void calculatePositionAsync(Activity activity, GeoPoint curPos) { if (naviEngineTask == null) { createNaviEngineTask(activity); } updateDirectTargetDir(curPos); if (naviEngineTask.getStatus() == Status.RUNNING) { log("Error, NaviEngineTask is still running! Drop job ..."); } else if (naviEngineTask.hasError()) { naviEngineTask.getError().printStackTrace(); } else { createNaviEngineTask(activity); //TODO: Recreation of Asynctask seems necessary?! naviEngineTask.execute(curPos); } }
Example 2
Source File: LivePlayerController.java From letv with Apache License 2.0 | 5 votes |
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"); }
Example 3
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 4
Source File: HadithFragment.java From prayer-times-android with Apache License 2.0 | 5 votes |
@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; }
Example 5
Source File: HadithFragment.java From prayer-times-android with Apache License 2.0 | 5 votes |
@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; }
Example 6
Source File: MainActivity.java From ImageChooser with Apache License 2.0 | 5 votes |
/** * 加载图片 */ private void loadImages() { mLoadingLayout.showLoading(true); if (!SDcardUtil.hasExternalStorage()) { mLoadingLayout.showEmpty(getString(R.string.donot_has_sdcard)); return; } // 线程正在执行 if (mLoadTask != null && mLoadTask.getStatus() == Status.RUNNING) { return; } mLoadTask = new ImageLoadTask(this, new OnTaskResultListener() { @SuppressWarnings("unchecked") @Override public void onResult(boolean success, String error, Object result) { mLoadingLayout.showLoading(false); // 如果加载成功 if (success && result != null && result instanceof ArrayList) { setImageAdapter((ArrayList<ImageGroup>)result); } else { // 加载失败,显示错误提示 mLoadingLayout.showFailed(getString(R.string.loaded_fail)); } } }); TaskUtil.execute(mLoadTask); }
Example 7
Source File: ContactsHelper.java From PinyinSearchLibrary with Apache License 2.0 | 4 votes |
private boolean isLoading() { return (mLoadTask != null && mLoadTask.getStatus() == Status.RUNNING); }
Example 8
Source File: AppInfoHelper.java From PinyinSearchLibrary with Apache License 2.0 | 4 votes |
private boolean isLoading(){ return ((null!=mLoadAppInfoTask)&&(mLoadAppInfoTask.getStatus()==Status.RUNNING)); }
Example 9
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 10
Source File: IncompleteFormListAdapter.java From commcare-android with Apache License 2.0 | 4 votes |
public void release() { if (loader.getStatus() == Status.RUNNING) { loader.cancel(false); } }
Example 11
Source File: ChatService.java From barterli_android with Apache License 2.0 | 4 votes |
/** * Connects to the Chat Service */ private void connectChatService() { //If there already is a pending connect task, remove it since we have a newer one if (mConnectRunnable != null) { mHandler.removeCallbacks(mConnectRunnable); } if (isLoggedIn() && !mMessageConsumer.isRunning()) { mConnectRunnable = new Runnable() { @Override public void run() { if (!isLoggedIn() || !DeviceInfo.INSTANCE .isNetworkConnected()) { //If there is no internet connection or we are not logged in, we need not attempt to connect mConnectRunnable = null; return; } mQueueName = generateQueueNameFromUserEmailAndDeviceId(UserInfo.INSTANCE .getEmail(), UserInfo.INSTANCE .getDeviceId() ); if (mConnectTask == null) { mConnectTask = new ConnectToChatAsyncTask(); mConnectTask.execute(USERNAME, PASSWORD, mQueueName, UserInfo.INSTANCE .getId()); } else { final Status connectingStatus = mConnectTask .getStatus(); if (connectingStatus != Status.RUNNING) { // We are not already attempting to connect, let's try connecting if (connectingStatus == Status.PENDING) { //Cancel a pending task mConnectTask.cancel(false); } mConnectTask = new ConnectToChatAsyncTask(); mConnectTask.execute(USERNAME, PASSWORD, mQueueName, UserInfo.INSTANCE .getId()); } } mConnectRunnable = null; } }; mHandler.postDelayed(mConnectRunnable, mCurrentConnectMultiplier * CONNECT_BACKOFF_INTERVAL * 1000); mCurrentConnectMultiplier = (++mCurrentConnectMultiplier > MAX_CONNECT_MULTIPLIER) ? MAX_CONNECT_MULTIPLIER : mCurrentConnectMultiplier; } }