List of usage examples for android.os Bundle putParcelable
public void putParcelable(@Nullable String key, @Nullable Parcelable value)
From source file:edu.stanford.mobisocial.dungbeetle.ui.wizard.ChangePictureActivity.java
public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_feed_home); checked = new boolean[filterTypes.length]; for (int x = 0; x < filterTypes.length; x++) { checked[x] = true;//w w w . j a va 2 s . c o m } findViewById(R.id.btn_broadcast).setVisibility(View.GONE); mContactId = getIntent().getLongExtra("contact_id", -1); if (mContactId == -1) { Uri data = getIntent().getData(); if (data != null) { try { mContactId = Long.parseLong(data.getLastPathSegment()); } catch (NumberFormatException e) { } } } Bundle args = new Bundle(); args.putLong("contact_id", mContactId); Fragment profileFragment = new ViewProfileFragment(); profileFragment.setArguments(args); doTitleBar(this, "My Profile"); mLabels.add("View"); mLabels.add("Edit"); mFragments.add(profileFragment); mFragments.add(new EditProfileFragment()); Uri privateUri = Uri.parse(DungBeetleContentProvider.CONTENT_URI + "/feeds/private"); mLabels.add("Notes"); Fragment feedView = new FeedViewFragment(); args = new Bundle(args); args.putParcelable(FeedViewFragment.ARG_FEED_URI, privateUri); feedView.setArguments(args); //mFragments.add(feedView); PagerAdapter adapter = new ViewFragmentAdapter(getSupportFragmentManager(), mFragments); mViewPager = (ViewPager) findViewById(R.id.feed_pager); mViewPager.setAdapter(adapter); mViewPager.setOnPageChangeListener(this); ViewGroup group = (ViewGroup) findViewById(R.id.tab_frame); int i = 0; for (String s : mLabels) { Button button = new Button(this); button.setText(s); button.setTextSize(18f); button.setLayoutParams(CommonLayouts.FULL_HEIGHT); button.setTag(i++); button.setOnClickListener(mViewSelected); group.addView(button); mButtons.add(button); } // Listen for future changes Uri feedUri; if (mContactId == Contact.MY_ID) { feedUri = Uri.parse(DungBeetleContentProvider.CONTENT_URI + "/feeds/me"); } else { feedUri = Uri.parse(DungBeetleContentProvider.CONTENT_URI + "/contacts"); } mProfileContentObserver = new ProfileContentObserver(mHandler); getContentResolver().registerContentObserver(feedUri, true, mProfileContentObserver); onPageSelected(0); AlertDialog.Builder builder = new AlertDialog.Builder(this); builder.setMessage("Click on the avatar to take a profile picture of yourself.").setCancelable(false) .setPositiveButton("Ok", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { } }); AlertDialog alert = builder.create(); alert.show(); }
From source file:com.android.contacts.group.GroupMembersFragment.java
@Override public void onSaveInstanceState(Bundle outState) { super.onSaveInstanceState(outState); if (mActionBarAdapter != null) { mActionBarAdapter.setListener(null); mActionBarAdapter.onSaveInstanceState(outState); }/*from w w w . jav a 2 s. co m*/ outState.putBoolean(KEY_IS_EDIT_MODE, mIsEditMode); outState.putParcelable(KEY_GROUP_URI, mGroupUri); outState.putParcelable(KEY_GROUP_METADATA, mGroupMetaData); }
From source file:co.ceryle.radiorealbutton.library.RadioRealButtonGroup.java
@Override protected Parcelable onSaveInstanceState() { Bundle bundle = new Bundle(); bundle.putParcelable("state", super.onSaveInstanceState()); bundle.putInt("position", lastPosition); return bundle; }
From source file:com.krayzk9s.imgurholo.ui.SingleImageFragment.java
@Override public void onSaveInstanceState(Bundle savedInstanceState) { savedInstanceState.putParcelable("imageData", imageData); savedInstanceState.putParcelableArrayList("commentData", commentArray); savedInstanceState.putBoolean("inGallery", inGallery); // Always call the superclass so it can save the view hierarchy state super.onSaveInstanceState(savedInstanceState); }
From source file:com.dwdesign.tweetings.fragment.StatusFragment.java
@SuppressLint({ "NewApi", "NewApi", "NewApi" }) @Override//from w ww. j av a2 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:com.synox.android.ui.activity.FileActivity.java
/** * {@inheritDoc}/*from w w w .java2s .c o m*/ */ @Override protected void onSaveInstanceState(Bundle outState) { outState.putParcelable(FileActivity.EXTRA_FILE, mFile); outState.putBoolean(FileActivity.EXTRA_FROM_NOTIFICATION, mFromNotification); outState.putLong(KEY_WAITING_FOR_OP_ID, mFileOperationsHelper.getOpIdWaitingFor()); if (getSupportActionBar() != null && getSupportActionBar().getTitle() != null) { // Null check in case the actionbar is used in ActionBar.NAVIGATION_MODE_LIST // since it doesn't have a title then outState.putString(KEY_ACTION_BAR_TITLE, getSupportActionBar().getTitle().toString()); } super.onSaveInstanceState(outState); }
From source file:com.qiscus.sdk.ui.fragment.QiscusBaseChatFragment.java
@Override public void onSaveInstanceState(Bundle outState) { super.onSaveInstanceState(outState); outState.putParcelable(CHAT_ROOM_DATA, qiscusChatRoom); ArrayList<QiscusComment> comments = new ArrayList<>(); int size = chatAdapter.getData().size(); for (int i = 0; i < size; i++) { comments.add((QiscusComment) chatAdapter.getData().get(i)); }/*w w w . java2 s . com*/ outState.putParcelableArrayList(COMMENTS_DATA, comments); }
From source file:com.skubit.android.billing.BillingServiceBinder.java
@Override public Bundle getAuthorizationIntent(int apiVersion, String packageName, String scopes) throws RemoteException { Bundle bundle = new Bundle(); if (apiVersion != 1) { bundle.putInt("RESPONSE_CODE", BillingResponseCodes.RESULT_BILLING_UNAVAILABLE); return bundle; }//from ww w .j ava2 s .co m int packValidate = validatePackageIsOwnedByCaller(packageName); if (packValidate != BillingResponseCodes.RESULT_OK) { Log.d(TAG, "Package is not owned by caller: " + packageName); bundle.putInt("RESPONSE_CODE", packValidate); return bundle; } Intent authorizationIntent = makeAuthorizationIntent(packageName, scopes); PendingIntent pending = PendingIntent.getActivity(mContext, (packageName + ":").hashCode(), authorizationIntent, 0); bundle.putParcelable("AUTHORIZATION_INTENT", pending); bundle.putInt("RESPONSE_CODE", BillingResponseCodes.RESULT_OK); return bundle; }
From source file:com.github.chenxiaolong.dualbootpatcher.patcher.PatchFileFragment.java
/** * {@inheritDoc}/*w w w .j a v a 2 s. c o m*/ */ @Override public void onSaveInstanceState(Bundle outState) { super.onSaveInstanceState(outState); outState.putString(EXTRA_SELECTED_PATCHER_ID, mSelectedPatcherId); outState.putParcelable(EXTRA_SELECTED_INPUT_URI, mSelectedInputUri); outState.putParcelable(EXTRA_SELECTED_OUTPUT_URI, mSelectedOutputUri); outState.putString(EXTRA_SELECTED_INPUT_FILE_NAME, mSelectedInputFileName); outState.putLong(EXTRA_SELECTED_INPUT_FILE_SIZE, mSelectedInputFileSize); outState.putInt(EXTRA_SELECTED_TASK_ID, mSelectedTaskId); outState.putParcelable(EXTRA_SELECTED_DEVICE, mSelectedDevice); outState.putString(EXTRA_SELECTED_ROM_ID, mSelectedRomId); outState.putBoolean(EXTRA_QUERYING_METADATA, mQueryingMetadata); }