List of usage examples for android.os Bundle putLongArray
public void putLongArray(@Nullable String key, @Nullable long[] value)
From source file:com.dwdesign.tweetings.activity.DraftsActivity.java
private void composeDraft(final DraftItem draft) { final Intent intent = new Intent(INTENT_ACTION_COMPOSE); final Bundle bundle = new Bundle(); final Uri image_uri = draft.media_uri == null ? null : Uri.parse(draft.media_uri); bundle.putString(INTENT_KEY_TEXT, draft.text); bundle.putLongArray(INTENT_KEY_IDS, draft.account_ids); bundle.putLong(INTENT_KEY_IN_REPLY_TO_ID, draft.in_reply_to_status_id); bundle.putString(INTENT_KEY_IN_REPLY_TO_NAME, draft.in_reply_to_name); bundle.putString(INTENT_KEY_IN_REPLY_TO_SCREEN_NAME, draft.in_reply_to_screen_name); bundle.putParcelable(INTENT_KEY_IMAGE_URI, image_uri); bundle.putBoolean(INTENT_KEY_IS_IMAGE_ATTACHED, draft.is_image_attached); bundle.putBoolean(INTENT_KEY_IS_PHOTO_ATTACHED, draft.is_photo_attached); bundle.putBoolean(INTENT_KEY_IS_QUOTE, draft.is_quote); intent.putExtras(bundle);//from w w w .j av a 2s . c o m mResolver.delete(Drafts.CONTENT_URI, Drafts._ID + " = " + draft._id, null); startActivityForResult(intent, REQUEST_COMPOSE); }
From source file:com.csipsimple.ui.calllog.CallLogListFragment.java
@Override public void viewDetails(int position, long[] callIds) { ListView lv = getListView();/*from w ww .j a va2 s. c o m*/ if (mMode != null) { lv.setItemChecked(position, !lv.isItemChecked(position)); mMode.invalidate(); // Don't see details in this case return; } if (mDualPane) { // If we are not currently showing a fragment for the new // position, we need to create and install a new one. CallLogDetailsFragment df = new CallLogDetailsFragment(); Bundle bundle = new Bundle(); bundle.putLongArray(CallLogDetailsFragment.EXTRA_CALL_LOG_IDS, callIds); df.setArguments(bundle); // Execute a transaction, replacing any existing fragment // with this one inside the frame. FragmentTransaction ft = getFragmentManager().beginTransaction(); ft.replace(R.id.details, df, null); ft.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_FADE); ft.commit(); getListView().setItemChecked(position, true); } else { Intent it = new Intent(getActivity(), CallLogDetailsActivity.class); it.putExtra(CallLogDetailsFragment.EXTRA_CALL_LOG_IDS, callIds); getActivity().startActivity(it); } }
From source file:org.mariotaku.twidere.fragment.DraftsFragment.java
@Override public boolean onActionItemClicked(final ActionMode mode, final MenuItem item) { switch (item.getItemId()) { case R.id.delete: { final DeleteDraftsConfirmDialogFragment f = new DeleteDraftsConfirmDialogFragment(); final Bundle args = new Bundle(); args.putLongArray(EXTRA_IDS, mListView.getCheckedItemIds()); f.setArguments(args);/*w w w. ja va 2 s . c om*/ f.show(getChildFragmentManager(), "delete_drafts_confirm"); break; } case R.id.send: { final Cursor c = mAdapter.getCursor(); if (c == null || c.isClosed()) return false; final SparseBooleanArray checked = mListView.getCheckedItemPositions(); final List<Draft> list = new ArrayList<>(); final DraftCursorIndices indices = new DraftCursorIndices(c); for (int i = 0, j = checked.size(); i < j; i++) { if (checked.valueAt(i) && c.moveToPosition(checked.keyAt(i))) { list.add(indices.newObject(c)); } } if (sendDrafts(list)) { final Expression where = Expression.in(new Column(Drafts._ID), new RawItemArray(mListView.getCheckedItemIds())); mResolver.delete(Drafts.CONTENT_URI, where.getSQL(), null); } break; } default: { return false; } } mode.finish(); return true; }
From source file:ca.marklauman.dominionpicker.MarketActivity.java
@Override protected void onSaveInstanceState(Bundle outState) { super.onSaveInstanceState(outState); long[] arrStock = new long[stock.size()]; int i = 0;//from ww w . j a v a 2s.c o m for (long card : stock) { arrStock[i] = card; i++; } outState.putLongArray(KEY_STOCK, arrStock); outState.putLongArray(KEY_CHOICES, choices); }
From source file:org.mariotaku.twidere.activity.SelectAccountActivity.java
@Override public void onBackPressed() { if (mSelectedIds.size() <= 0 && !mAllowSelectNone) { Toast.makeText(this, R.string.no_account_selected, Toast.LENGTH_SHORT).show(); return;/*from w ww . ja v a2 s .c om*/ } final Bundle bundle = new Bundle(); final long[] ids = new long[mSelectedIds.size()]; int i = 0; for (final Long id_long : mSelectedIds) { ids[i] = id_long; i++; } bundle.putLongArray(INTENT_KEY_IDS, ids); setResult(RESULT_OK, new Intent().putExtras(bundle)); finish(); }
From source file:org.mariotaku.twidere.activity.AccountSelectorActivity.java
@Override public void onClick(final View view) { switch (view.getId()) { case R.id.save: { if (mSelectedIds.size() <= 0 && !mAllowSelectNone) { Toast.makeText(this, R.string.no_account_selected, Toast.LENGTH_SHORT).show(); return; }//from w w w. j av a 2s . c o m final Bundle bundle = new Bundle(); final long[] ids = new long[mSelectedIds.size()]; int i = 0; for (final Long id_long : mSelectedIds) { ids[i] = id_long; i++; } bundle.putLongArray(INTENT_KEY_IDS, ids); setResult(RESULT_OK, new Intent().putExtras(bundle)); finish(); break; } case R.id.add_account: { final Intent intent = new Intent(INTENT_ACTION_TWITTER_LOGIN); intent.setClass(this, SignInActivity.class); startActivity(intent); finish(); break; } } }
From source file:com.luboganev.dejalist.ui.MainActivity.java
@Override public void deleteProducts(long[] productIds) { if (mUndoBarController.isShown()) { getContentResolver().delete(Products.CONTENT_URI, Products.SELECTION_DELETED, null); }// w w w.ja v a 2s . com ContentValues values = new ContentValues(); values.put(Products.PRODUCT_DELETED, 1); getContentResolver().update(Products.CONTENT_URI, values, Products.buildSelectionIdIn(productIds), null); if (mProductsGalleryActionTaker != null) mProductsGalleryActionTaker.reloadProducts(); Bundle undoExtras = new Bundle(); undoExtras.putLongArray(UNDO_EXTRA_DELETED_PRODUCTS, productIds); mUndoBarController.showUndoBar(false, getString(R.string.undobar_product_deleted_message), undoExtras); }
From source file:org.gnucash.android.ui.transaction.TransactionsListFragment.java
/** * Prepares and displays the dialog for bulk moving transactions to another account *///from w w w . j a v a 2 s .c o m protected void showBulkMoveDialog() { FragmentManager manager = getActivity().getSupportFragmentManager(); FragmentTransaction ft = manager.beginTransaction(); Fragment prev = manager.findFragmentByTag("bulk_move_dialog"); if (prev != null) { ft.remove(prev); } ft.addToBackStack(null); // Create and show the dialog. DialogFragment bulkMoveFragment = new BulkMoveDialogFragment(); Bundle args = new Bundle(); args.putLong(UxArgument.ORIGIN_ACCOUNT_ID, mAccountID); args.putLongArray(UxArgument.SELECTED_TRANSACTION_IDS, getListView().getCheckedItemIds()); bulkMoveFragment.setArguments(args); bulkMoveFragment.setTargetFragment(this, 0); bulkMoveFragment.show(ft, "bulk_move_dialog"); }
From source file:com.kevinread.sortablefragmentpager.SortableFragmentStatePagerAdapter.java
@Override public Parcelable saveState() { Bundle state = null; mItemIds = new long[getCount()]; for (int i = 0; i < mItemIds.length; i++) { mItemIds[i] = getItemId(i);//from www.j a v a 2s .c o m } if (mSavedState.size() > 0) { state = new Bundle(); if (mItemIds.length > 0) { state.putLongArray("itemids", mItemIds); } Fragment.SavedState[] fss = new Fragment.SavedState[mSavedState.size()]; mSavedState.toArray(fss); state.putParcelableArray("states", fss); } for (int i = 0; i < mFragments.size(); i++) { Fragment f = mFragments.get(i); if (f != null) { if (state == null) { state = new Bundle(); } String key = "f" + i; mFragmentManager.putFragment(state, key, f); } } return state; }
From source file:info.shibafu528.gallerymultipicker.MultiPickerActivity.java
@Override protected void onSaveInstanceState(Bundle outState) { super.onSaveInstanceState(outState); outState.putLongArray(EXTRA_URIS, mSelectedIds.toPrimitive()); }