List of usage examples for android.os Bundle putBoolean
public void putBoolean(@Nullable String key, boolean value)
From source file:cn.kangeqiu.kq.activity.MainActivity.java
@Override public void onSaveInstanceState(Bundle outState) { super.onSaveInstanceState(outState); getSupportFragmentManager().putFragment(outState, "mContent", mContent); outState.putBoolean("isConflict", isConflict); outState.putBoolean(Constant.ACCOUNT_REMOVED, isCurrentAccountRemoved); }
From source file:se.leap.bitmaskclient.ProviderAPI.java
private Bundle tryToRegister(Bundle task) { Bundle result = new Bundle(); int progress = 0; String username = User.userName(); String password = task.getString(SessionDialog.PASSWORD); if (validUserLoginData(username, password)) { result = register(username, password); broadcastProgress(progress++);/* w w w. ja va2 s . co m*/ } else { if (!wellFormedPassword(password)) { result.putBoolean(RESULT_KEY, false); result.putString(SessionDialog.USERNAME, username); result.putBoolean(SessionDialog.ERRORS.PASSWORD_INVALID_LENGTH.toString(), true); } if (!validUsername(username)) { result.putBoolean(RESULT_KEY, false); result.putBoolean(SessionDialog.ERRORS.USERNAME_MISSING.toString(), true); } } return result; }
From source file:se.leap.bitmaskclient.ProviderAPI.java
/** * Starts the authentication process using SRP protocol. * * @param task containing: username, password and api url. * @return a bundle with a boolean value mapped to a key named RESULT_KEY, and which is true if authentication was successful. *///from w w w . j ava2 s . com private Bundle tryToAuthenticate(Bundle task) { Bundle result = new Bundle(); int progress = 0; String username = User.userName(); String password = task.getString(SessionDialog.PASSWORD); if (validUserLoginData(username, password)) { result = authenticate(username, password); broadcastProgress(progress++); } else { if (!wellFormedPassword(password)) { result.putBoolean(RESULT_KEY, false); result.putString(SessionDialog.USERNAME, username); result.putBoolean(SessionDialog.ERRORS.PASSWORD_INVALID_LENGTH.toString(), true); } if (!validUsername(username)) { result.putBoolean(RESULT_KEY, false); result.putBoolean(SessionDialog.ERRORS.USERNAME_MISSING.toString(), true); } } return result; }
From source file:com.android.providers.contacts.ContactsSyncAdapter.java
@Override public void onSyncEnding(SyncContext context, boolean success) { final ContentResolver cr = getContext().getContentResolver(); if (success && mPerformedGetServerDiffs && !mSyncCanceled) { Cursor cursor = cr.query(Photos.CONTENT_URI, new String[] { Photos._SYNC_ID, Photos._SYNC_VERSION, Photos.PERSON_ID, Photos.DOWNLOAD_REQUIRED }, "" + "_sync_account=? AND download_required != 0", new String[] { getAccount() }, null); try {/*from w ww . j av a 2 s .co m*/ if (cursor.getCount() != 0) { Bundle extras = new Bundle(); extras.putString(ContentResolver.SYNC_EXTRAS_ACCOUNT, getAccount()); extras.putBoolean(ContentResolver.SYNC_EXTRAS_FORCE, mSyncForced); extras.putString("feed", ContactsSyncAdapter.getPhotosFeedForAccount(getAccount())); getContext().getContentResolver().startSync(Contacts.CONTENT_URI, extras); } } finally { cursor.close(); } } super.onSyncEnding(context, success); }
From source file:com.android.incallui.CallCardFragment.java
@Override public void onSaveInstanceState(Bundle outState) { outState.putBoolean(IS_DIALPAD_SHOWING_KEY, mIsDialpadShowing); super.onSaveInstanceState(outState); }
From source file:be.billington.calendar.recurrencepicker.RecurrencePickerDialog.java
@Override public void onSaveInstanceState(Bundle outState) { super.onSaveInstanceState(outState); outState.putParcelable(BUNDLE_MODEL, mModel); if (mEndCount.hasFocus()) { outState.putBoolean(BUNDLE_END_COUNT_HAS_FOCUS, true); }/* w w w .ja va 2 s .co m*/ }
From source file:com.dwdesign.tweetings.fragment.StatusFragment.java
@SuppressLint({ "NewApi", "NewApi", "NewApi" }) @Override//from ww w .j av a 2 s . co m public boolean onMenuItemClick(final MenuItem item) { if (mStatus == null) return false; final String text_plain = mStatus.text_plain; final String screen_name = mStatus.screen_name; final String name = mStatus.name; switch (item.getItemId()) { case MENU_SHARE: { final Intent intent = new Intent(Intent.ACTION_SEND); intent.setType("text/plain"); intent.putExtra(Intent.EXTRA_TEXT, "@" + mStatus.screen_name + ": " + text_plain); startActivity(Intent.createChooser(intent, getString(R.string.share))); break; } case MENU_RETWEET: { if (isMyRetweet(mStatus)) { mService.destroyStatus(mAccountId, mStatus.retweet_id); } else { final long id_to_retweet = mStatus.is_retweet && mStatus.retweet_id > 0 ? mStatus.retweet_id : mStatus.status_id; mService.retweetStatus(mAccountId, id_to_retweet); } break; } case MENU_TRANSLATE: { translate(mStatus); break; } case MENU_QUOTE_REPLY: { final Intent intent = new Intent(INTENT_ACTION_COMPOSE); final Bundle bundle = new Bundle(); bundle.putLong(INTENT_KEY_ACCOUNT_ID, mAccountId); bundle.putLong(INTENT_KEY_IN_REPLY_TO_ID, mStatusId); bundle.putString(INTENT_KEY_IN_REPLY_TO_SCREEN_NAME, screen_name); bundle.putString(INTENT_KEY_IN_REPLY_TO_NAME, name); bundle.putBoolean(INTENT_KEY_IS_QUOTE, true); bundle.putString(INTENT_KEY_TEXT, getQuoteStatus(getActivity(), screen_name, text_plain)); intent.putExtras(bundle); startActivity(intent); break; } case MENU_QUOTE: { final Intent intent = new Intent(INTENT_ACTION_COMPOSE); final Bundle bundle = new Bundle(); bundle.putLong(INTENT_KEY_ACCOUNT_ID, mAccountId); bundle.putBoolean(INTENT_KEY_IS_QUOTE, true); bundle.putString(INTENT_KEY_TEXT, getQuoteStatus(getActivity(), screen_name, text_plain)); intent.putExtras(bundle); startActivity(intent); break; } case MENU_ADD_TO_BUFFER: { final Intent intent = new Intent(INTENT_ACTION_COMPOSE); final Bundle bundle = new Bundle(); bundle.putLong(INTENT_KEY_ACCOUNT_ID, mAccountId); bundle.putBoolean(INTENT_KEY_IS_BUFFER, true); bundle.putString(INTENT_KEY_TEXT, getQuoteStatus(getActivity(), screen_name, text_plain)); intent.putExtras(bundle); startActivity(intent); break; } case MENU_REPLY: { final Intent intent = new Intent(INTENT_ACTION_COMPOSE); final Bundle bundle = new Bundle(); final List<String> mentions = new Extractor().extractMentionedScreennames(text_plain); mentions.remove(screen_name); mentions.add(0, screen_name); bundle.putStringArray(INTENT_KEY_MENTIONS, mentions.toArray(new String[mentions.size()])); bundle.putLong(INTENT_KEY_ACCOUNT_ID, mAccountId); bundle.putLong(INTENT_KEY_IN_REPLY_TO_ID, mStatusId); bundle.putString(INTENT_KEY_IN_REPLY_TO_TWEET, text_plain); bundle.putString(INTENT_KEY_IN_REPLY_TO_SCREEN_NAME, screen_name); bundle.putString(INTENT_KEY_IN_REPLY_TO_NAME, name); intent.putExtras(bundle); startActivity(intent); break; } case MENU_FAV: { if (mStatus.is_favorite) { mService.destroyFavorite(mAccountId, mStatusId); } else { mService.createFavorite(mAccountId, mStatusId); } break; } case MENU_COPY_CLIPBOARD: { final String textToCopy = "@" + mStatus.screen_name + ": " + mStatus.text_plain; int sdk = android.os.Build.VERSION.SDK_INT; if (sdk < android.os.Build.VERSION_CODES.HONEYCOMB) { android.text.ClipboardManager clipboard = (android.text.ClipboardManager) getSystemService( Context.CLIPBOARD_SERVICE); clipboard.setText(textToCopy); } else { android.content.ClipboardManager clipboard = (android.content.ClipboardManager) getSystemService( Context.CLIPBOARD_SERVICE); android.content.ClipData clip = android.content.ClipData.newPlainText("Status", textToCopy); clipboard.setPrimaryClip(clip); } Toast.makeText(getActivity(), R.string.text_copied, Toast.LENGTH_SHORT).show(); break; } case MENU_DELETE: { mService.destroyStatus(mAccountId, mStatusId); break; } case MENU_EXTENSIONS: { final Intent intent = new Intent(INTENT_ACTION_EXTENSION_OPEN_STATUS); final Bundle extras = new Bundle(); extras.putParcelable(INTENT_KEY_STATUS, mStatus); intent.putExtras(extras); startActivity(Intent.createChooser(intent, getString(R.string.open_with_extensions))); break; } case MENU_MUTE_SOURCE: { final String source = HtmlEscapeHelper.unescape(mStatus.source); if (source == null) return false; final Uri uri = Filters.Sources.CONTENT_URI; final ContentValues values = new ContentValues(); final SharedPreferences.Editor editor = getSharedPreferences(SHARED_PREFERENCES_NAME, Context.MODE_PRIVATE).edit(); final ContentResolver resolver = getContentResolver(); values.put(Filters.TEXT, source); resolver.delete(uri, Filters.TEXT + " = '" + source + "'", null); resolver.insert(uri, values); editor.putBoolean(PREFERENCE_KEY_ENABLE_FILTER, true).commit(); Toast.makeText(getActivity(), getString(R.string.source_muted, source), Toast.LENGTH_SHORT).show(); break; } case MENU_SET_COLOR: { final Intent intent = new Intent(INTENT_ACTION_SET_COLOR); startActivityForResult(intent, REQUEST_SET_COLOR); break; } case MENU_CLEAR_COLOR: { clearUserColor(getActivity(), mStatus.user_id); updateUserColor(); break; } case MENU_RECENT_TWEETS: { openUserTimeline(getActivity(), mAccountId, mStatus.user_id, mStatus.screen_name); break; } case MENU_FIND_RETWEETS: { openUserRetweetedStatus(getActivity(), mStatus.account_id, mStatus.retweet_id > 0 ? mStatus.retweet_id : mStatus.status_id); break; } default: return false; } return super.onOptionsItemSelected(item); }
From source file:org.nla.tarotdroid.lib.ui.GameSetHistoryActivity.java
@Override protected void onSaveInstanceState(Bundle outState) { super.onSaveInstanceState(outState); outState.putBoolean(PENDING_REAUTH_KEY, this.pendingReauthRequest); this.uiHelper.onSaveInstanceState(outState); }
From source file:com.wirelessmoves.cl.MainActivity.java
@Override public void onSaveInstanceState(Bundle savedInstanceState) { super.onSaveInstanceState(savedInstanceState); /* save variables */ savedInstanceState.putLong("NumberOfSignalStrengthUpdates", NumberOfSignalStrengthUpdates); savedInstanceState.putLong("LastCellId", LastCellId); savedInstanceState.putLong("NumberOfCellChanges", NumberOfCellChanges); savedInstanceState.putLong("LastLacId", LastLacId); savedInstanceState.putLong("NumberOfLacChanges", NumberOfLacChanges); savedInstanceState.putLongArray("PreviousCells", PreviousCells); savedInstanceState.putInt("PreviousCellsIndex", PreviousCellsIndex); savedInstanceState.putLong("NumberOfUniqueCellChanges", NumberOfUniqueCellChanges); savedInstanceState.putBoolean("outputDebugInfo", outputDebugInfo); savedInstanceState.putDouble("CurrentLocationLong", CurrentLocationLong); savedInstanceState.putDouble("CurrentLocationLat", CurrentLocationLat); /* save the trace data still in the write buffer into a file */ saveDataToFile(FileWriteBufferStr,//from w w w .j av a 2 s. com "---in save instance, " + DateFormat.getTimeInstance().format(new Date()) + "\r\n"); FileWriteBufferStr = ""; }