List of usage examples for android.os Bundle EMPTY
Bundle EMPTY
To view the source code for android.os Bundle EMPTY.
Click Source Link
From source file:nuclei.media.MediaService.java
@Override public void onTimerCount(long timeRemainingMs) { mSession.sendSessionEvent(createTimerEvent(timeRemainingMs), Bundle.EMPTY); }
From source file:net.lp.actionbarpoirot.helpers.ActivityHelper.java
/** * Invoke "search" action, triggering a default search. */ public void goSearch() { mActivity.startSearch(null, false, Bundle.EMPTY, false); }
From source file:com.silentcircle.contacts.list.ScContactEntryListAdapter.java
/** * Updates the indexer, which is used to produce section headers. */// w ww .j a v a 2 s. c o m @TargetApi(Build.VERSION_CODES.HONEYCOMB) private void updateIndexer(Cursor cursor) { if (cursor == null) { setIndexer(null); return; } Bundle bundle = cursor.getExtras(); if (bundle == Bundle.EMPTY && Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) // try the dirty trick bundle = mContext.getContentResolver().call(ScContactsContract.AUTHORITY_URI, "INDEX", null, null); if (bundle != null && bundle.containsKey(ScContactsContract.ContactCounts.EXTRA_ADDRESS_BOOK_INDEX_TITLES)) { String sections[] = bundle .getStringArray(ScContactsContract.ContactCounts.EXTRA_ADDRESS_BOOK_INDEX_TITLES); int counts[] = bundle.getIntArray(ScContactsContract.ContactCounts.EXTRA_ADDRESS_BOOK_INDEX_COUNTS); setIndexer(new ContactsSectionIndexer(sections, counts)); } else { setIndexer(null); } }
From source file:com.sefford.beauthentic.activities.LoginActivity.java
void createGoogleAccount(final GoogleSignInAccount acct) { final Account account = new Account(acct.getDisplayName(), AuthenticAuthenticator.ACCOUNT_TYPE); final AccountManager am = AccountManager.get(this); final Bundle data = new Bundle(); data.putInt(AuthenticAuthenticator.EXTRA_TYPE, AuthenticAuthenticator.Type.GOOGLE.ordinal()); data.putString(AccountManager.KEY_ACCOUNT_NAME, acct.getDisplayName()); data.putString(AccountManager.KEY_AUTHTOKEN, acct.getIdToken()); am.confirmCredentials(account, data, null, new AccountManagerCallback<Bundle>() { @Override// w ww . j av a 2 s .com public void run(AccountManagerFuture<Bundle> future) { try { final Bundle result = future.getResult(); if (result.getBoolean(AccountManager.KEY_BOOLEAN_RESULT)) { Sessions.addAccount(am, account, "", Bundle.EMPTY); am.setAuthToken(account, AuthenticAuthenticator.AUTHTOKEN_TYPE, result.getString(AccountManager.KEY_AUTHTOKEN)); am.setUserData(account, AuthenticAuthenticator.EXTRA_TYPE, Integer.toString(AuthenticAuthenticator.Type.GOOGLE.ordinal())); notifyLoginToGCM(AuthenticAuthenticator.Type.GOOGLE.ordinal(), account.name, "", result.getString(AccountManager.KEY_AUTHTOKEN)); googleApi.saveCredential(new Credential.Builder(acct.getEmail()) .setAccountType(IdentityProviders.GOOGLE).setName(acct.getDisplayName()) .setProfilePictureUri(acct.getPhotoUrl()).build(), new SmartlockCredentialCallback()); } } catch (OperationCanceledException e) { Snackbar.make(vLoginForm, R.string.error_operation_cancelled, Snackbar.LENGTH_LONG).show(); } catch (IOException e) { Snackbar.make(vLoginForm, R.string.error_not_connected_to_internet, Snackbar.LENGTH_LONG) .show(); } catch (AuthenticatorException e) { Snackbar.make(vLoginForm, R.string.error_invalid_credentials, Snackbar.LENGTH_LONG).show(); } } }, null); }
From source file:com.ubuntuone.android.files.service.MetaService.java
private void createVolume(final String resourcePath, final ResultReceiver receiver) { api.createVolume(resourcePath, new U1VolumeListener() { @Override/*from w w w . j av a 2 s . co m*/ public void onStart() { if (receiver != null) receiver.send(Status.RUNNING, Bundle.EMPTY); } @Override public void onSuccess(U1Volume volume) { onCreateVolumeSuccess(volume); } @Override public void onUbuntuOneFailure(U1Failure failure) { MetaService.this.onUbuntuOneFailure(failure, receiver); } @Override public void onFailure(U1Failure failure) { MetaService.this.onFailure(failure, receiver); } @Override public void onFinish() { if (receiver != null) { Bundle data = new Bundle(); data.putString(EXTRA_RESOURCE_PATH, resourcePath); receiver.send(Status.FINISHED, data); } } }); }
From source file:com.gh.bmd.jrt.android.v4.core.LoaderInvocation.java
@Override @SuppressWarnings("unchecked") @SuppressFBWarnings(value = "BC_UNCONFIRMED_CAST_OF_RETURN_VALUE", justification = "class comparison with == is done") public void onCall(@Nonnull final List<? extends INPUT> inputs, @Nonnull final ResultChannel<OUTPUT> result) { final Logger logger = mLogger; final Object context = mContext.get(); if (context == null) { logger.dbg("avoiding running invocation since context is null"); return;/*from ww w . j a va 2s . c o m*/ } final Context loaderContext; final LoaderManager loaderManager; if (context instanceof FragmentActivity) { final FragmentActivity activity = (FragmentActivity) context; loaderContext = activity.getApplicationContext(); loaderManager = activity.getSupportLoaderManager(); logger.dbg("running invocation bound to activity: %s", activity); } else if (context instanceof Fragment) { final Fragment fragment = (Fragment) context; loaderContext = fragment.getActivity().getApplicationContext(); loaderManager = fragment.getLoaderManager(); logger.dbg("running invocation bound to fragment: %s", fragment); } else { throw new IllegalArgumentException("invalid context type: " + context.getClass().getCanonicalName()); } int loaderId = mLoaderId; if (loaderId == ContextRoutineBuilder.AUTO) { loaderId = mConstructor.getDeclaringClass().hashCode(); for (final Object arg : mArgs) { loaderId = 31 * loaderId + recursiveHashCode(arg); } loaderId = 31 * loaderId + inputs.hashCode(); logger.dbg("generating invocation ID: %d", loaderId); } final Loader<InvocationResult<OUTPUT>> loader = loaderManager.getLoader(loaderId); final boolean isClash = isClash(loader, loaderId, inputs); final WeakIdentityHashMap<Object, SparseArray<WeakReference<RoutineLoaderCallbacks<?>>>> callbackMap = sCallbackMap; SparseArray<WeakReference<RoutineLoaderCallbacks<?>>> callbackArray = callbackMap.get(context); if (callbackArray == null) { callbackArray = new SparseArray<WeakReference<RoutineLoaderCallbacks<?>>>(); callbackMap.put(context, callbackArray); } final WeakReference<RoutineLoaderCallbacks<?>> callbackReference = callbackArray.get(loaderId); RoutineLoaderCallbacks<OUTPUT> callbacks = (callbackReference != null) ? (RoutineLoaderCallbacks<OUTPUT>) callbackReference.get() : null; if ((callbacks == null) || (loader == null) || isClash) { final RoutineLoader<INPUT, OUTPUT> routineLoader; if (!isClash && (loader != null) && (loader.getClass() == RoutineLoader.class)) { routineLoader = (RoutineLoader<INPUT, OUTPUT>) loader; } else { routineLoader = null; } final RoutineLoaderCallbacks<OUTPUT> newCallbacks = createCallbacks(loaderContext, loaderManager, routineLoader, inputs, loaderId); if (callbacks != null) { logger.dbg("resetting existing callbacks [%d]", loaderId); callbacks.reset(); } callbackArray.put(loaderId, new WeakReference<RoutineLoaderCallbacks<?>>(newCallbacks)); callbacks = newCallbacks; } logger.dbg("setting result cache type [%d]: %s", loaderId, mCacheStrategyType); callbacks.setCacheStrategy(mCacheStrategyType); final OutputChannel<OUTPUT> outputChannel = callbacks.newChannel(); if (isClash) { logger.dbg("restarting loader [%d]", loaderId); loaderManager.restartLoader(loaderId, Bundle.EMPTY, callbacks); } else { logger.dbg("initializing loader [%d]", loaderId); loaderManager.initLoader(loaderId, Bundle.EMPTY, callbacks); } result.pass(outputChannel); }
From source file:com.ubuntuone.android.files.service.MetaService.java
private void makeDirectory(final String resourcePath, final ResultReceiver receiver) { final Bundle data = new Bundle(); data.putString(EXTRA_RESOURCE_PATH, resourcePath); api.makeDirectory(resourcePath, new U1NodeListener() { @Override//from www . j av a 2 s. c om public void onStart() { if (receiver != null) receiver.send(Status.RUNNING, Bundle.EMPTY); } @Override public void onSuccess(U1Node node) { onMakeDirectorySuccess(node); } @Override public void onUbuntuOneFailure(U1Failure failure) { MetaService.this.onUbuntuOneFailure(failure, receiver); } @Override public void onFailure(U1Failure failure) { MetaService.this.onFailure(failure, receiver); } @Override public void onFinish() { if (receiver != null) receiver.send(Status.FINISHED, data); } }); }
From source file:android.support.content.ContentPager.java
/** * @return Bundle populated with existing extras (if any) as well as * all usefule paging related extras./* w ww . j a v a 2s.co m*/ */ static Bundle buildExtras(@Nullable Bundle extras, int recordCount, @CursorDisposition int cursorDisposition) { if (extras == null || extras == Bundle.EMPTY) { extras = new Bundle(); } else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { extras = extras.deepCopy(); } // else we modify cursor extras directly, cuz that's our only choice. extras.putInt(CURSOR_DISPOSITION, cursorDisposition); if (!extras.containsKey(EXTRA_TOTAL_COUNT)) { extras.putInt(EXTRA_TOTAL_COUNT, recordCount); } if (!extras.containsKey(EXTRA_HONORED_ARGS)) { extras.putStringArray(EXTRA_HONORED_ARGS, new String[] { ContentPager.QUERY_ARG_OFFSET, ContentPager.QUERY_ARG_LIMIT }); } return extras; }
From source file:android.support.content.ContentPager.java
/** * @return true if the cursor extras contains all of the signs of being paged. * Technically we could also check SDK version since facilities for paging * were added in SDK 26, but if it looks like a duck and talks like a duck * itsa duck (especially if it helps with testing). *//*w ww .ja va2s . co m*/ @WorkerThread private boolean isProviderPaged(Cursor cursor) { Bundle extras = cursor.getExtras(); extras = extras != null ? extras : Bundle.EMPTY; String[] honoredArgs = extras.getStringArray(EXTRA_HONORED_ARGS); return (extras.containsKey(EXTRA_TOTAL_COUNT) && honoredArgs != null && contains(honoredArgs, QUERY_ARG_OFFSET) && contains(honoredArgs, QUERY_ARG_LIMIT)); }
From source file:com.ubuntuone.android.files.service.MetaService.java
private void updateNode(final String resourcePath, Boolean isPublic, final ResultReceiver receiver) { final Bundle data = new Bundle(); data.putString(EXTRA_RESOURCE_PATH, resourcePath); api.setFilePublic(resourcePath, isPublic, new U1NodeListener() { @Override//from ww w . j a va 2s . c o m public void onStart() { if (receiver != null) receiver.send(Status.RUNNING, Bundle.EMPTY); } @Override public void onSuccess(U1Node node) { onUpdateNodeAccessSuccess(node); } @Override public void onUbuntuOneFailure(U1Failure failure) { MetaService.this.onUbuntuOneFailure(failure, receiver); } @Override public void onFailure(U1Failure failure) { MetaService.this.onFailure(failure, receiver); } @Override public void onFinish() { if (receiver != null) receiver.send(Status.FINISHED, data); } }); }