List of usage examples for android.os Bundle clone
@Override
public Object clone()
From source file:com.ccs.wedate.common.eventbus.util.ErrorDialogFragmentFactory.java
/** * Prepares the fragment's arguments and creates the fragment. May be overridden to provide custom error fragments. *///from ww w . jav a 2s .c om protected T prepareErrorFragment(ThrowableFailureEvent event, boolean finishAfterDialog, Bundle argumentsForErrorDialog) { if (event.isSuppressErrorUi()) { // Show nothing by default return null; } Bundle bundle; if (argumentsForErrorDialog != null) { bundle = (Bundle) argumentsForErrorDialog.clone(); } else { bundle = new Bundle(); } if (!bundle.containsKey(ErrorDialogManager.KEY_TITLE)) { String title = getTitleFor(event, bundle); bundle.putString(ErrorDialogManager.KEY_TITLE, title); } if (!bundle.containsKey(ErrorDialogManager.KEY_MESSAGE)) { String message = getMessageFor(event, bundle); bundle.putString(ErrorDialogManager.KEY_MESSAGE, message); } if (!bundle.containsKey(ErrorDialogManager.KEY_FINISH_AFTER_DIALOG)) { bundle.putBoolean(ErrorDialogManager.KEY_FINISH_AFTER_DIALOG, finishAfterDialog); } if (!bundle.containsKey(ErrorDialogManager.KEY_EVENT_TYPE_ON_CLOSE) && config.defaultEventTypeOnDialogClosed != null) { bundle.putSerializable(ErrorDialogManager.KEY_EVENT_TYPE_ON_CLOSE, config.defaultEventTypeOnDialogClosed); } if (!bundle.containsKey(ErrorDialogManager.KEY_ICON_ID) && config.defaultDialogIconId != 0) { bundle.putInt(ErrorDialogManager.KEY_ICON_ID, config.defaultDialogIconId); } return createErrorFragment(event, bundle); }
From source file:com.todoroo.astrid.activity.AstridActivity.java
protected Bundle configureIntentAndExtrasWithFilter(Intent intent, Filter filter) { if (filter instanceof FilterWithCustomIntent) { int lastSelectedList = intent.getIntExtra(FilterListFragment.TOKEN_LAST_SELECTED, 0); intent = ((FilterWithCustomIntent) filter).getCustomIntent(); intent.putExtra(FilterListFragment.TOKEN_LAST_SELECTED, lastSelectedList); } else {//from ww w .j a v a 2 s. c om intent.putExtra(TaskListFragment.TOKEN_FILTER, filter); } setIntent(intent); Bundle extras = intent.getExtras(); if (extras != null) extras = (Bundle) extras.clone(); return extras; }
From source file:com.andrada.sitracker.ui.fragment.RemoteAuthorsFragment.java
public void reloadFromArguments(Bundle arguments) { // Load new arguments if (arguments == null) { arguments = new Bundle(); } else {//from w w w . ja v a 2 s . co m // since we might make changes, don't meddle with caller's copy arguments = (Bundle) arguments.clone(); } // save arguments so we can reuse it when reloading from content observer events mArguments = arguments; LOGD(TAG, "SessionsFragment reloading from arguments: " + arguments); mCurrentUri = arguments.getParcelable("_uri"); LOGD(TAG, "SessionsFragment reloading, uri=" + mCurrentUri); reloadSearchData(); }
From source file:org.deviceconnect.android.deviceplugin.host.activity.TouchProfileActivity.java
/** * Send event data.//www. j a v a 2 s . c o m * * @param state MotionEvent state. * @param event MotionEvent. * @param events Event request list. */ private void sendEventData(final String state, final MotionEvent event, final List<Event> events) { List<Event> touchEvents = EventManager.INSTANCE.getEventList(mServiceId, TouchProfile.PROFILE_NAME, null, ATTRIBUTE_ON_TOUCH_CHANGE); Bundle touchdata = new Bundle(); List<Bundle> touchlist = new ArrayList<Bundle>(); Bundle touches = new Bundle(); for (int n = 0; n < event.getPointerCount(); n++) { int pointerId = event.getPointerId(n); touchdata.putInt(TouchProfile.PARAM_ID, pointerId); touchdata.putFloat(TouchProfile.PARAM_X, event.getX(n)); touchdata.putFloat(TouchProfile.PARAM_Y, event.getY(n)); touchlist.add((Bundle) touchdata.clone()); } touches.putParcelableArray(TouchProfile.PARAM_TOUCHES, touchlist.toArray(new Bundle[touchlist.size()])); for (int i = 0; i < events.size(); i++) { Event eventdata = events.get(i); String attr = eventdata.getAttribute(); Intent intent = EventManager.createEventMessage(eventdata); intent.putExtra(TouchProfile.PARAM_TOUCH, touches); intent.setAction(HostTouchProfile.ACTION_TOUCH); LocalBroadcastManager.getInstance(this).sendBroadcast(intent); mApp.setTouchCache(attr, touches); } for (int i = 0; i < touchEvents.size(); i++) { Event eventdata = touchEvents.get(i); String attr = eventdata.getAttribute(); touches.putString("state", state); Intent intent = EventManager.createEventMessage(eventdata); intent.putExtra(TouchProfile.PARAM_TOUCH, touches); intent.setAction(HostTouchProfile.ACTION_TOUCH); LocalBroadcastManager.getInstance(this).sendBroadcast(intent); mApp.setTouchCache(attr, touches); } }
From source file:com.todoroo.astrid.activity.TaskListActivity.java
/** * @see android.app.Activity#onCreate(Bundle) *//*from w w w . j a v a 2 s.c om*/ @Override protected void onCreate(Bundle savedInstanceState) { ThemeService.applyTheme(this); super.onCreate(savedInstanceState); DependencyInjectionService.getInstance().inject(this); int contentView = getContentView(); if (contentView == R.layout.task_list_wrapper_activity) swipeEnabled = true; setContentView(contentView); ActionBar actionBar = getSupportActionBar(); actionBar.setDisplayOptions(0, ActionBar.DISPLAY_SHOW_TITLE); actionBar.setDisplayOptions(ActionBar.DISPLAY_SHOW_CUSTOM); actionBar.setCustomView(getHeaderView()); listsNav = actionBar.getCustomView().findViewById(R.id.lists_nav); listsNavDisclosure = (ImageView) actionBar.getCustomView().findViewById(R.id.list_disclosure_arrow); lists = (TextView) actionBar.getCustomView().findViewById(R.id.list_title); mainMenu = (ImageView) actionBar.getCustomView().findViewById(R.id.main_menu); personStatus = (TextView) actionBar.getCustomView().findViewById(R.id.person_image); commentsButton = (Button) actionBar.getCustomView().findViewById(R.id.comments); if (ThemeService.getTheme() == R.style.Theme_White_Alt) commentsButton.setTextColor(getResources().getColor(R.color.blue_theme_color)); initializeFragments(actionBar); createMainMenuPopover(); mainMenu.setOnClickListener(mainMenuClickListener); commentsButton.setOnClickListener(commentsButtonClickListener); personStatus.setOnClickListener(friendStatusClickListener); Bundle extras = getIntent().getExtras(); if (extras != null) extras = (Bundle) extras.clone(); if (extras == null) extras = new Bundle(); Filter savedFilter = getIntent().getParcelableExtra(TaskListFragment.TOKEN_FILTER); if (Intent.ACTION_SEARCH.equals(getIntent().getAction())) { String query = getIntent().getStringExtra(SearchManager.QUERY).trim(); String title = getString(R.string.FLA_search_filter, query); savedFilter = new Filter(title, title, new QueryTemplate().where(Task.TITLE.like("%" + //$NON-NLS-1$ query + "%")), //$NON-NLS-1$ null); } if (savedFilter == null) { savedFilter = getDefaultFilter(); extras.putAll(configureIntentAndExtrasWithFilter(getIntent(), savedFilter)); } extras.putParcelable(TaskListFragment.TOKEN_FILTER, savedFilter); if (swipeIsEnabled()) { setupPagerAdapter(); } setupTasklistFragmentWithFilter(savedFilter, extras); if (savedFilter != null) setListsTitle(savedFilter.title); if (getIntent().hasExtra(TOKEN_SOURCE)) { trackActivitySource(); } // Have to call this here because sometimes StartupService // isn't called (i.e. if the app was silently alive in the background) abTestEventReportingService.trackUserRetention(this); }
From source file:koma.movieapp.ui.MoviesFragment.java
void reloadFromArguments(Bundle arguments) { // Load new arguments if (arguments == null) { arguments = new Bundle(); } else {/* www . jav a 2 s .com*/ // since we might make changes, don't meddle with caller's copy arguments = (Bundle) arguments.clone(); } // save arguments so we can reuse it when reloading from content observer events mArguments = arguments; mToolbarTitle = arguments.getString("title"); getActivity().setTitle(mToolbarTitle); /*LOGD(TAG, "MoviesFragment reloading from arguments: " + arguments); mCurrentUri = arguments.getParcelable("_uri"); if (mCurrentUri == null) { // if no URI, default to all sessions URI LOGD(TAG, "MoviesFragment did not get a URL, defaulting to all sessions."); //arguments.putParcelable("_uri", ScheduleContract.Sessions.CONTENT_URI); //mCurrentUri = ScheduleContract.Sessions.CONTENT_URI; }*/ mSessionQueryToken = mArguments.getInt("queryType"); mCurrentSearchString = arguments.getString("searchString"); mNoTrackBranding = mArguments.getBoolean(EXTRA_NO_TRACK_BRANDING); //LOGD(TAG, "MoviesFragment reloading, uri=" + mCurrentUri); reloadMovieData(true); // full reload }
From source file:fr.paug.droidcon.ui.SessionsFragment.java
void reloadFromArguments(Bundle arguments) { // Load new arguments if (arguments == null) { arguments = new Bundle(); } else {// w w w . jav a2 s . co m // since we might make changes, don't meddle with caller's copy arguments = (Bundle) arguments.clone(); } // save arguments so we can reuse it when reloading from content observer events mArguments = arguments; LOGD(TAG, "SessionsFragment reloading from arguments: " + arguments); mCurrentUri = arguments.getParcelable("_uri"); if (mCurrentUri == null) { // if no URI, default to all sessions URI LOGD(TAG, "SessionsFragment did not get a URL, defaulting to all sessions."); arguments.putParcelable("_uri", ScheduleContract.Sessions.CONTENT_URI); mCurrentUri = ScheduleContract.Sessions.CONTENT_URI; } if (ScheduleContract.Sessions.isSearchUri(mCurrentUri)) { mSessionQueryToken = SessionsQuery.SEARCH_TOKEN; } else { mSessionQueryToken = SessionsQuery.NORMAL_TOKEN; } LOGD(TAG, "SessionsFragment reloading, uri=" + mCurrentUri + ", expanded=" + useExpandedMode()); reloadSessionData(true); // full reload if (mTagMetadata == null) { reloadTagMetadata(); } }
From source file:com.ncode.android.apps.schedo.ui.EventsFragment.java
void reloadFromArguments(Bundle arguments) { // Load new arguments if (arguments == null) { arguments = new Bundle(); } else {// w w w. ja v a 2 s .c o m // since we might make changes, don't meddle with caller's copy arguments = (Bundle) arguments.clone(); } // save arguments so we can reuse it when reloading from content observer events mArguments = arguments; LOGD(TAG, "EventsFragment reloading from arguments: " + arguments); mCurrentUri = arguments.getParcelable("_uri"); if (mCurrentUri == null) { // if no URI, default to all events URI LOGD(TAG, "EventsFragment did not get a URL, defaulting to all events."); arguments.putParcelable("_uri", ScheduleContract.Events.CONTENT_URI); mCurrentUri = ScheduleContract.Events.CONTENT_URI; } mNoTrackBranding = mArguments.getBoolean(EXTRA_NO_TRACK_BRANDING); if (ScheduleContract.Events.isSearchUri(mCurrentUri)) { mEventQueryToken = EventsQuery.SEARCH_TOKEN; } else { mEventQueryToken = EventsQuery.NORMAL_TOKEN; } LOGD(TAG, "EventsFragment reloading, uri=" + mCurrentUri + ", expanded=" + useExpandedMode()); reloadEventData(true); // full reload if (mTagMetadata == null) { reloadTagMetadata(); } }
From source file:com.google.samples.apps.iosched.ui.SessionsFragment.java
void reloadFromArguments(Bundle arguments) { // Load new arguments if (arguments == null) { arguments = new Bundle(); } else {/*from w w w .ja va 2 s . co m*/ // since we might make changes, don't meddle with caller's copy arguments = (Bundle) arguments.clone(); } // save arguments so we can reuse it when reloading from content observer events mArguments = arguments; LOGD(TAG, "SessionsFragment reloading from arguments: " + arguments); mCurrentUri = arguments.getParcelable("_uri"); if (mCurrentUri == null) { // if no URI, default to all sessions URI LOGD(TAG, "SessionsFragment did not get a URL, defaulting to all sessions."); arguments.putParcelable("_uri", ScheduleContract.Sessions.CONTENT_URI); mCurrentUri = ScheduleContract.Sessions.CONTENT_URI; } mNoTrackBranding = mArguments.getBoolean(EXTRA_NO_TRACK_BRANDING); if (ScheduleContract.Sessions.isSearchUri(mCurrentUri)) { mSessionQueryToken = SessionsQuery.SEARCH_TOKEN; } else { mSessionQueryToken = SessionsQuery.NORMAL_TOKEN; } LOGD(TAG, "SessionsFragment reloading, uri=" + mCurrentUri + ", expanded=" + useExpandedMode()); reloadSessionData(true); // full reload if (mTagMetadata == null) { reloadTagMetadata(); } }
From source file:xyz.template.material.menu.ui.fragment.SessionsFragment.java
public void reloadFromArguments(Bundle arguments) { // Load new arguments if (arguments == null) { arguments = new Bundle(); } else {/*from w w w.ja v a 2 s . c o m*/ // since we might make changes, don't meddle with caller's copy arguments = (Bundle) arguments.clone(); } // save arguments so we can reuse it when reloading from content observer events mArguments = arguments; LOGD(TAG, "SessionsFragment reloading from arguments: " + arguments); mCurrentUri = arguments.getParcelable("_uri"); if (mCurrentUri == null) { // if no URI, default to all sessions URI LOGD(TAG, "SessionsFragment did not get a URL, defaulting to all sessions."); arguments.putParcelable("_uri", ScheduleContract.Sessions.CONTENT_URI); mCurrentUri = ScheduleContract.Sessions.CONTENT_URI; } mNoTrackBranding = mArguments.getBoolean(EXTRA_NO_TRACK_BRANDING); if (ScheduleContract.Sessions.isSearchUri(mCurrentUri)) { mSessionQueryToken = SessionsQuery.SEARCH_TOKEN; } else { mSessionQueryToken = SessionsQuery.NORMAL_TOKEN; } LOGD(TAG, "SessionsFragment reloading, uri=" + mCurrentUri + ", expanded=" + useExpandedMode()); reloadSessionData(true); // full reload if (mTagMetadata == null) { reloadTagMetadata(); } }