List of usage examples for android.os Bundle putParcelable
public void putParcelable(@Nullable String key, @Nullable Parcelable value)
From source file:click.kobaken.rxirohaandroid_sample.view.fragment.WalletFragment.java
@Override public void onSaveInstanceState(Bundle outState) { super.onSaveInstanceState(outState); outState.putParcelable(TransactionHistory.TAG, transactionHistory); }
From source file:pt.up.mobile.authenticator.Authenticator.java
@Override public Bundle getAuthToken(AccountAuthenticatorResponse response, Account account, String authTokenType, Bundle loginOptions) throws NetworkErrorException { Log.v(TAG, "getAuthToken()"); // If the caller requested an authToken type we don't support, then // return an error if (!authTokenType.equals(Constants.AUTHTOKEN_TYPE)) { final Bundle result = new Bundle(); result.putString(AccountManager.KEY_ERROR_MESSAGE, "invalid authTokenType"); return result; }/*from w w w . ja v a2s . c o m*/ try { final AccountManager am = AccountManager.get(mContext); final String peek = am.peekAuthToken(account, authTokenType); if (peek != null) { final Bundle result = new Bundle(); result.putString(AccountManager.KEY_ACCOUNT_NAME, account.name); result.putString(AccountManager.KEY_ACCOUNT_TYPE, Constants.ACCOUNT_TYPE); result.putString(AccountManager.KEY_AUTHTOKEN, peek); return result; } // Extract the username and password from the Account Manager, and // ask // the server for an appropriate AuthToken. final String password = am.getPassword(account); if (password != null) { String[] reply; reply = SifeupAPI.authenticate(account.name, password, mContext); final String authToken = reply[1]; if (!TextUtils.isEmpty(authToken)) { final Bundle result = new Bundle(); result.putString(AccountManager.KEY_ACCOUNT_NAME, account.name); result.putString(AccountManager.KEY_ACCOUNT_TYPE, Constants.ACCOUNT_TYPE); result.putString(AccountManager.KEY_AUTHTOKEN, authToken); return result; } } } catch (AuthenticationException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); throw new NetworkErrorException(); } // If we get here, then we couldn't access the user's password - so we // need to re-prompt them for their credentials. We do that by creating // an intent to display our AuthenticatorActivity panel. final Intent intent = new Intent(mContext, AuthenticatorActivity.class); intent.putExtra(AuthenticatorActivity.PARAM_CONFIRM_CREDENTIALS, true); intent.putExtra(AuthenticatorActivity.PARAM_USERNAME, account.name); intent.putExtra(AuthenticatorActivity.PARAM_AUTHTOKEN_TYPE, authTokenType); intent.putExtra(AccountManager.KEY_ACCOUNT_AUTHENTICATOR_RESPONSE, response); final Bundle bundle = new Bundle(); bundle.putParcelable(AccountManager.KEY_INTENT, intent); return bundle; }
From source file:com.android.settings.profiles.SetupTriggersFragment.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { // Inflate the layout for this fragment View root = inflater.inflate(R.layout.fragment_setup_triggers, container, false); mPager = (ViewPager) root.findViewById(R.id.view_pager); mAdapter = new TriggerPagerAdapter(getActivity(), getChildFragmentManager()); Bundle profileArgs = new Bundle(); profileArgs.putParcelable(ProfilesSettings.EXTRA_PROFILE, mProfile); final TriggerPagerAdapter.TriggerFragments[] fragments = TriggerPagerAdapter.TriggerFragments.values(); for (final TriggerPagerAdapter.TriggerFragments fragment : fragments) { if (fragment.getFragmentClass() == NfcTriggerFragment.class) { if (!getActivity().getPackageManager().hasSystemFeature(PackageManager.FEATURE_NFC)) { // device doesn't have NFC continue; }//from w w w .ja v a 2 s. c o m } mAdapter.add(fragment.getFragmentClass(), profileArgs, fragment.getTitleRes()); } mPager.setAdapter(mAdapter); PagerTabStrip tabs = (PagerTabStrip) root.findViewById(R.id.tabs); tabs.setTabIndicatorColorResource(R.color.theme_accent); if (mNewProfileMode) { Button nextButton = (Button) root.findViewById(R.id.next); nextButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { Bundle args = new Bundle(); args.putParcelable(ProfilesSettings.EXTRA_PROFILE, mProfile); args.putBoolean(ProfilesSettings.EXTRA_NEW_PROFILE, mNewProfileMode); SubSettings pa = (SubSettings) getActivity(); pa.startPreferencePanel(SetupActionsFragment.class.getCanonicalName(), args, R.string.profile_profile_manage, null, SetupTriggersFragment.this, REQUEST_SETUP_ACTIONS); } }); // back button root.findViewById(R.id.back).setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { finishFragment(); } }); } else { root.findViewById(R.id.bottom_buttons).setVisibility(View.GONE); } return root; }
From source file:ch.epfl.sweng.evento.gui.infinite_pager_adapter.InfiniteViewPager.java
@Override public Parcelable onSaveInstanceState() { final InfinitePagerAdapter adapter = (InfinitePagerAdapter) getAdapter(); if (adapter == null) { Log.d(LOG_TAG, " onSaveInstanceState adapter == null"); return super.onSaveInstanceState(); }//from w ww. j av a2 s . co m Bundle bundle = new Bundle(); bundle.putParcelable(SUPER_STATE, super.onSaveInstanceState()); bundle.putString(ADAPTER_STATE, adapter.getStringRepresentation(adapter.getCurrentIndicator())); return bundle; }
From source file:ar.com.martineo14.spotifystreamer2.ui.fragment.TrackPlayerActivityFragment.java
@Override public void onSaveInstanceState(Bundle outState) { outState.putParcelable(Constants.TRACK_MODEL, trackModel); outState.putInt(Constants.ACTUAL_POSITION, mActualTrackPosition); super.onSaveInstanceState(outState); }
From source file:com.appunite.helpers.EditFragment.java
@Override public void onSaveInstanceState(Bundle outState) { outState.putBoolean(STATE_IS_EDIT, mIsEdit); outState.putParcelable(STATE_URI, mUri); super.onSaveInstanceState(outState); }
From source file:com.kennethmaffei.infinitegrid.HTTPCommManager.java
/** * Sets up a headless fragment that calls an asynctask to retrieve an image from a url * /* ww w . jav a 2s. co m*/ * @param url - the url which we will get data back from */ public void getURL(RecordDescriptor record) { if (activity == null) return; FragmentManager fm = activity.getFragmentManager(); //Use the url as the fragment tag TaskFragment taskFragment = (TaskFragment) fm.findFragmentByTag(record.url); //If the Fragment is non-null, then it is currently being retained across a configuration change. if (taskFragment == null) { taskFragment = new TaskFragment(); Bundle args = new Bundle(); args.putInt("type", CALLTYPE.IMAGE.ordinal()); args.putParcelable("record", record); taskFragment.setArguments(args); fm.beginTransaction().add(taskFragment, record.url).commit(); } }
From source file:de.wikilab.android.friendica01.FileUploadService.java
private void showFailMsg(Context ctx, String txt) { NotificationManager mNotificationManager = (NotificationManager) getSystemService( Context.NOTIFICATION_SERVICE); Log.e("Andfrnd/UploadFile", "Upload FAILED: " + txt); //Instantiate the Notification: CharSequence tickerText = "Upload failed, please retry!"; Notification notification = new Notification(R.drawable.arrow_up, tickerText, System.currentTimeMillis()); notification.flags |= Notification.FLAG_AUTO_CANCEL; //Define the Notification's expanded message and Intent: Context context = getApplicationContext(); CharSequence contentTitle = "Upload failed, click to retry!"; CharSequence contentText = txt; Intent notificationIntent = new Intent(this, FriendicaImgUploadActivity.class); Bundle b = new Bundle(); b.putParcelable(Intent.EXTRA_STREAM, fileToUpload); b.putString(Intent.EXTRA_SUBJECT, subject); b.putString(EXTRA_DESCTEXT, descText); notificationIntent.putExtras(b);//w w w . j ava 2 s. c o m PendingIntent contentIntent = PendingIntent.getActivity(this, 0, notificationIntent, 0); notification.setLatestEventInfo(context, contentTitle, contentText, contentIntent); //Pass the Notification to the NotificationManager: mNotificationManager.notify(UPLOAD_FAILED_ID, notification); //Toast.makeText(ctx, "Upload failed, please retry:\n" + txt, Toast.LENGTH_LONG).show(); }
From source file:com.artemchep.horario.ui.fragments.master.TimetablesFragment.java
@Override public void onItemClick(@NonNull View view, @NonNull Timetable item) { super.onItemClick(view, item); Bundle args = new Bundle(); args.putString(TimetableDetailsFragment.EXTRA_USER_ID, mUserId); args.putParcelable(TimetableDetailsFragment.EXTRA_TIMETABLE, item); Fragment fragment = new TimetableDetailsFragment(); fragment.setArguments(args);/*from w ww.j av a 2 s . com*/ MainActivity activity = (MainActivity) getActivity(); activity.navigateDetailsFrame(fragment); }
From source file:com.android.madpausa.cardnotificationviewer.MainActivity.java
private void openNotificationDialog(StatusBarNotification sbn) { Log.d(TAG, "opening dialog!"); Bundle bun = new Bundle(); bun.putParcelable(NotificationDialogFragment.NOTIFICATION_BUNDLE, sbn); int colorMode = NotificationDialogFragment.DEFAULT_COLOR; if (nFragment.notificationAdapter.forceDarkBackground.matchFilter(sbn, null, true)) { colorMode = NotificationDialogFragment.FORCE_DARK; } else if (nFragment.notificationAdapter.forceLightBackground.matchFilter(sbn, null, true)) { colorMode = NotificationDialogFragment.FORCE_LIGHT; }//from w w w .j a v a 2 s. co m bun.putInt(NotificationDialogFragment.COLOR_BUNDLE, colorMode); int archiveMode = NotificationDialogFragment.DEFAULT_ARCHIVE; if (nService.isAlwaysArchived(sbn)) archiveMode = NotificationDialogFragment.FORCE_ARCHIVE; bun.putInt(NotificationDialogFragment.ARCHIVE_BUNDLE, archiveMode); NotificationDialogFragment dialog = new NotificationDialogFragment(); dialog.setArguments(bun); dialog.show(getFragmentManager(), NotificationDialogFragment.class.getSimpleName()); }