List of usage examples for android.os Bundle putAll
public void putAll(Bundle bundle)
From source file:com.andrew.apollo.ui.fragments.profile.ApolloFragment.java
@Override public void onSaveInstanceState(final Bundle outState) { super.onSaveInstanceState(outState); outState.putAll(getArguments() != null ? getArguments() : new Bundle()); }
From source file:com.andrew.apollo.ui.activities.ProfileActivity.java
/** * {@inheritDoc}/* w w w .j a v a 2s . c om*/ */ @Override protected void onSaveInstanceState(final Bundle outState) { super.onSaveInstanceState(outState); outState.putAll(mArguments); }
From source file:com.github.rubensousa.navigationmanager.NavigationManager.java
@Override public boolean onNavigationItemSelected(MenuItem item) { if (mNavigationListener != null) { mNavigationListener.onItemSelected(item); }//w ww . j a v a 2s. c o m closeDrawer(); boolean firstStart = mCurrentId == 0; if (item.getItemId() == mCurrentId) { mNavigating = false; return false; } mCurrentId = item.getItemId(); mTitle = item.getTitle().toString(); // If an item is checkable, then a fragment should be used if (item.isCheckable()) { mNavigationView.setCheckedItem(mCurrentId); if (mNavigationListener != null && mCurrentFragment != null) { mNavigationListener.onSectionChange(mCurrentFragment); } mCurrentFragment = createFragment(item.getItemId()); // Check if we have an Intent to pass to the fragment if (mIntent != null) { Bundle args = mCurrentFragment.getArguments(); Bundle extras = mIntent.getExtras(); // If no arguments were passed to the fragment, the bundle must be created if (args == null) { args = new Bundle(); } // Add the fragment's arguments to the new Intent if (extras != null) { args.putAll(extras); } mCurrentFragment.setArguments(args); mIntent = null; } if (!shouldDelayTransaction(mCurrentId) || firstStart || mNavigating) { commitFragmentTransaction(createFragmentTransaction(mCurrentFragment)); } else { mDrawerLayout.setDrawerLockMode(DrawerLayout.LOCK_MODE_LOCKED_CLOSED); mFragmentTransaction = createFragmentTransaction(mCurrentFragment); } mNavigating = false; return true; } mNavigating = false; return false; }
From source file:org.mariotaku.twidere.activity.SignInActivity.java
private void doLogin(final boolean is_browser_sign_in, final Bundle extras) { final LoaderManager lm = getSupportLoaderManager(); final Bundle args = new Bundle(); if (extras != null) { args.putAll(extras); }// ww w. j av a2 s . c om args.putBoolean(INTENT_KEY_IS_BROWSER_SIGN_IN, is_browser_sign_in); lm.destroyLoader(0); if (mLoaderInitialized) { lm.restartLoader(0, args, this); } else { lm.initLoader(0, args, this); mLoaderInitialized = true; } }
From source file:com.ruesga.rview.wizard.WizardActivity.java
private void savePagesState(Bundle outState) { for (WizardPageFragment page : mPages) { Bundle bundle = page.savedState(); if (bundle != null) { outState.putAll(bundle); }// w w w.ja v a2 s . c om } }
From source file:com.dwdesign.tweetings.activity.LinkHandlerActivity.java
private boolean setFragment(final Uri uri) { final Bundle extras = getIntent().getExtras(); Fragment fragment = null;//from ww w . j a v a2s .c om if (uri != null) { final Bundle bundle = new Bundle(); if (extras != null) { bundle.putAll(extras); } switch (matchLinkId(uri)) { case LINK_ID_STATUS: { setTitle(R.string.view_status); fragment = new StatusFragment(); final String param_status_id = uri.getQueryParameter(QUERY_PARAM_STATUS_ID); bundle.putLong(INTENT_KEY_STATUS_ID, parseLong(param_status_id)); break; } case LINK_ID_USER: { setTitle(R.string.view_user_profile); fragment = new UserProfileFragment(); final String param_screen_name = uri.getQueryParameter(QUERY_PARAM_SCREEN_NAME); final String param_user_id = uri.getQueryParameter(QUERY_PARAM_USER_ID); if (!isNullOrEmpty(param_screen_name)) { bundle.putString(INTENT_KEY_SCREEN_NAME, param_screen_name); } if (!isNullOrEmpty(param_user_id)) { bundle.putLong(INTENT_KEY_USER_ID, parseLong(param_user_id)); } break; } case LINK_ID_USER_TIMELINE: { setTitle(R.string.tweets); fragment = new UserTimelineFragment(); final String param_screen_name = uri.getQueryParameter(QUERY_PARAM_SCREEN_NAME); final String param_user_id = uri.getQueryParameter(QUERY_PARAM_USER_ID); if (!isNullOrEmpty(param_screen_name)) { bundle.putString(INTENT_KEY_SCREEN_NAME, param_screen_name); } if (!isNullOrEmpty(param_user_id)) { bundle.putLong(INTENT_KEY_USER_ID, parseLong(param_user_id)); } break; } case LINK_ID_USER_FAVORITES: { setTitle(R.string.favorites); fragment = new UserFavoritesFragment(); final String param_screen_name = uri.getQueryParameter(QUERY_PARAM_SCREEN_NAME); final String param_user_id = uri.getQueryParameter(QUERY_PARAM_USER_ID); if (!isNullOrEmpty(param_screen_name)) { bundle.putString(INTENT_KEY_SCREEN_NAME, param_screen_name); } if (!isNullOrEmpty(param_user_id)) { bundle.putLong(INTENT_KEY_USER_ID, parseLong(param_user_id)); } break; } case LINK_ID_USER_FOLLOWERS: { setTitle(R.string.followers); fragment = new UserFollowersFragment(); final String param_screen_name = uri.getQueryParameter(QUERY_PARAM_SCREEN_NAME); final String param_user_id = uri.getQueryParameter(QUERY_PARAM_USER_ID); if (!isNullOrEmpty(param_screen_name)) { bundle.putString(INTENT_KEY_SCREEN_NAME, param_screen_name); } if (!isNullOrEmpty(param_user_id)) { bundle.putLong(INTENT_KEY_USER_ID, parseLong(param_user_id)); } break; } case LINK_ID_USER_FRIENDS: { setTitle(R.string.following); fragment = new UserFriendsFragment(); final String param_screen_name = uri.getQueryParameter(QUERY_PARAM_SCREEN_NAME); final String param_user_id = uri.getQueryParameter(QUERY_PARAM_USER_ID); if (!isNullOrEmpty(param_screen_name)) { bundle.putString(INTENT_KEY_SCREEN_NAME, param_screen_name); } if (!isNullOrEmpty(param_user_id)) { bundle.putLong(INTENT_KEY_USER_ID, parseLong(param_user_id)); } break; } case LINK_ID_USER_BLOCKS: { setTitle(R.string.blocked_users); fragment = new UserBlocksListFragment(); break; } case LINK_ID_CONVERSATION: { setTitle(R.string.view_conversation); fragment = new ConversationFragment(); final String param_status_id = uri.getQueryParameter(QUERY_PARAM_STATUS_ID); bundle.putLong(INTENT_KEY_STATUS_ID, parseLong(param_status_id)); break; } case LINK_ID_DIRECT_MESSAGES_CONVERSATION: { setTitle(R.string.direct_messages); fragment = new DMConversationFragment(); final String param_conversation_id = uri.getQueryParameter(QUERY_PARAM_CONVERSATION_ID); final String param_screen_name = uri.getQueryParameter(QUERY_PARAM_SCREEN_NAME); final long conversation_id = parseLong(param_conversation_id); if (conversation_id > 0) { bundle.putLong(INTENT_KEY_CONVERSATION_ID, conversation_id); } else if (param_screen_name != null) { bundle.putString(INTENT_KEY_SCREEN_NAME, param_screen_name); } break; } case LINK_ID_LIST_DETAILS: { setTitle(R.string.user_list); fragment = new UserListDetailsFragment(); final String param_screen_name = uri.getQueryParameter(QUERY_PARAM_SCREEN_NAME); final String param_user_id = uri.getQueryParameter(QUERY_PARAM_USER_ID); final String param_list_id = uri.getQueryParameter(QUERY_PARAM_LIST_ID); final String param_list_name = uri.getQueryParameter(QUERY_PARAM_LIST_NAME); if (isNullOrEmpty(param_list_id) && (isNullOrEmpty(param_list_name) || isNullOrEmpty(param_screen_name) && isNullOrEmpty(param_user_id))) { finish(); return false; } bundle.putInt(INTENT_KEY_LIST_ID, parseInt(param_list_id)); bundle.putLong(INTENT_KEY_USER_ID, parseLong(param_user_id)); bundle.putString(INTENT_KEY_SCREEN_NAME, param_screen_name); bundle.putString(INTENT_KEY_LIST_NAME, param_list_name); break; } case LINK_ID_LIST_TYPES: { setTitle(R.string.user_list); fragment = new UserListTypesFragment(); final String param_screen_name = uri.getQueryParameter(QUERY_PARAM_SCREEN_NAME); final String param_user_id = uri.getQueryParameter(QUERY_PARAM_USER_ID); if (isNullOrEmpty(param_screen_name) && isNullOrEmpty(param_user_id)) { finish(); return false; } bundle.putLong(INTENT_KEY_USER_ID, parseLong(param_user_id)); bundle.putString(INTENT_KEY_SCREEN_NAME, param_screen_name); break; } case LINK_ID_LIST_TIMELINE: { setTitle(R.string.list_timeline); fragment = new UserListTimelineFragment(); final String param_screen_name = uri.getQueryParameter(QUERY_PARAM_SCREEN_NAME); final String param_user_id = uri.getQueryParameter(QUERY_PARAM_USER_ID); final String param_list_id = uri.getQueryParameter(QUERY_PARAM_LIST_ID); final String param_list_name = uri.getQueryParameter(QUERY_PARAM_LIST_NAME); if (isNullOrEmpty(param_list_id) && (isNullOrEmpty(param_list_name) || isNullOrEmpty(param_screen_name) && isNullOrEmpty(param_user_id))) { finish(); return false; } bundle.putInt(INTENT_KEY_LIST_ID, parseInt(param_list_id)); bundle.putLong(INTENT_KEY_USER_ID, parseLong(param_user_id)); bundle.putString(INTENT_KEY_SCREEN_NAME, param_screen_name); bundle.putString(INTENT_KEY_LIST_NAME, param_list_name); break; } case LINK_ID_LIST_MEMBERS: { setTitle(R.string.list_members); fragment = new UserListMembersFragment(); final String param_screen_name = uri.getQueryParameter(QUERY_PARAM_SCREEN_NAME); final String param_user_id = uri.getQueryParameter(QUERY_PARAM_USER_ID); final String param_list_id = uri.getQueryParameter(QUERY_PARAM_LIST_ID); final String param_list_name = uri.getQueryParameter(QUERY_PARAM_LIST_NAME); if (isNullOrEmpty(param_list_id) && (isNullOrEmpty(param_list_name) || isNullOrEmpty(param_screen_name) && isNullOrEmpty(param_user_id))) { finish(); return false; } bundle.putInt(INTENT_KEY_LIST_ID, parseInt(param_list_id)); bundle.putLong(INTENT_KEY_USER_ID, parseLong(param_user_id)); bundle.putString(INTENT_KEY_SCREEN_NAME, param_screen_name); bundle.putString(INTENT_KEY_LIST_NAME, param_list_name); break; } case LINK_ID_LIST_SUBSCRIBERS: { setTitle(R.string.list_subscribers); fragment = new UserListSubscribersFragment(); final String param_screen_name = uri.getQueryParameter(QUERY_PARAM_SCREEN_NAME); final String param_user_id = uri.getQueryParameter(QUERY_PARAM_USER_ID); final String param_list_id = uri.getQueryParameter(QUERY_PARAM_LIST_ID); final String param_list_name = uri.getQueryParameter(QUERY_PARAM_LIST_NAME); if (isNullOrEmpty(param_list_id) && (isNullOrEmpty(param_list_name) || isNullOrEmpty(param_screen_name) && isNullOrEmpty(param_user_id))) { finish(); return false; } bundle.putInt(INTENT_KEY_LIST_ID, parseInt(param_list_id)); bundle.putLong(INTENT_KEY_USER_ID, parseLong(param_user_id)); bundle.putString(INTENT_KEY_SCREEN_NAME, param_screen_name); bundle.putString(INTENT_KEY_LIST_NAME, param_list_name); break; } case LINK_ID_LIST_CREATED: { setTitle(R.string.list_created_by_user); fragment = new UserListCreatedFragment(); final String param_screen_name = uri.getQueryParameter(QUERY_PARAM_SCREEN_NAME); final String param_user_id = uri.getQueryParameter(QUERY_PARAM_USER_ID); if (isNullOrEmpty(param_screen_name) && isNullOrEmpty(param_user_id)) { finish(); return false; } bundle.putLong(INTENT_KEY_USER_ID, parseLong(param_user_id)); bundle.putString(INTENT_KEY_SCREEN_NAME, param_screen_name); break; } case LINK_ID_LIST_SUBSCRIPTIONS: { setTitle(R.string.list_user_followed); fragment = new UserListSubscriptionsFragment(); final String param_screen_name = uri.getQueryParameter(QUERY_PARAM_SCREEN_NAME); final String param_user_id = uri.getQueryParameter(QUERY_PARAM_USER_ID); if (isNullOrEmpty(param_screen_name) && isNullOrEmpty(param_user_id)) { finish(); return false; } bundle.putLong(INTENT_KEY_USER_ID, parseLong(param_user_id)); bundle.putString(INTENT_KEY_SCREEN_NAME, param_screen_name); break; } case LINK_ID_LIST_MEMBERSHIPS: { setTitle(R.string.list_following_user); fragment = new UserListMembershipsFragment(); final String param_screen_name = uri.getQueryParameter(QUERY_PARAM_SCREEN_NAME); final String param_user_id = uri.getQueryParameter(QUERY_PARAM_USER_ID); if (isNullOrEmpty(param_screen_name) && isNullOrEmpty(param_user_id)) { finish(); return false; } bundle.putLong(INTENT_KEY_USER_ID, parseLong(param_user_id)); bundle.putString(INTENT_KEY_SCREEN_NAME, param_screen_name); break; } case LINK_ID_USERS_RETWEETED_STATUS: { setTitle(R.string.users_retweeted_this); fragment = new UserRetweetedStatusFragment(); final String param_status_id = uri.getQueryParameter(QUERY_PARAM_STATUS_ID); bundle.putLong(INTENT_KEY_STATUS_ID, parseLong(param_status_id)); break; } case LINK_ID_SAVED_SEARCHES: { setTitle(R.string.saved_searches); fragment = new SavedSearchesListFragment(); break; } case LINK_ID_RETWEETED_TO_ME: { setTitle(R.string.retweets_of_me); fragment = new RetweetedToMeFragment(); break; } case LINK_ID_NEARBY: { setTitle(R.string.nearby_tweets); fragment = new NativeNearbyMapFragment(); break; } case LINK_ID_TRENDS: { setTitle(R.string.trends); fragment = new TrendsFragment(); break; } case LINK_ID_USER_MENTIONS: { setTitle(R.string.user_mentions); fragment = new UserMentionsFragment(); final String param_screen_name = uri.getQueryParameter(QUERY_PARAM_SCREEN_NAME); if (!isNullOrEmpty(param_screen_name)) { bundle.putString(INTENT_KEY_SCREEN_NAME, param_screen_name); } else { finish(); return false; } break; } case LINK_ID_MENTIONS: { setTitle(R.string.mentions); fragment = new MentionsFragment(); break; } case LINK_ID_INCOMING_FRIENDSHIPS: { setTitle(R.string.incoming_friendships); fragment = new IncomingFriendshipsFragment(); break; } case LINK_ID_BUFFERAPP: { final String param_code = uri.getQueryParameter(QUERY_PARAM_CODE); setTitle(R.string.accounts); fragment = new AccountsFragment(); bundle.putString(INTENT_KEY_BUFFERAPP_CODE, param_code); break; } default: { break; } } final String param_account_id = uri.getQueryParameter(QUERY_PARAM_ACCOUNT_ID); if (param_account_id != null) { bundle.putLong(INTENT_KEY_ACCOUNT_ID, parseLong(param_account_id)); } else { final String param_account_name = uri.getQueryParameter(QUERY_PARAM_ACCOUNT_NAME); if (param_account_name != null) { bundle.putLong(INTENT_KEY_ACCOUNT_ID, getAccountId(this, param_account_name)); } else { final long account_id = getDefaultAccountId(this); if (isMyAccount(this, account_id)) { bundle.putLong(INTENT_KEY_ACCOUNT_ID, account_id); } else { finish(); return false; } } } if (fragment != null) { fragment.setArguments(bundle); } } mFragment = fragment; return true; }
From source file:dev.drsoran.moloko.activities.base.MolokoFragmentActivity.java
public Bundle getFragmentConfigurations(int... fragmentIds) { final Bundle config = new Bundle(); for (int i = 0; i < fragmentIds.length; i++) { final int fragId = fragmentIds[i]; final Fragment fragment = getSupportFragmentManager().findFragmentById(fragId); if (fragment instanceof IConfigurable) config.putAll(((IConfigurable) fragment).getConfiguration()); }/*from w w w . j a v a2 s . com*/ return config; }
From source file:com.google.samples.apps.iosched.ui.BaseActivity.java
/** * Converts an intent and a {@link Bundle} into a {@link Bundle} suitable for use as fragment arguments. */// ww w . j a v a 2 s .co m public static Bundle intentToFragmentArguments(Intent intent, Bundle extras) { Bundle arguments = new Bundle(); if (intent == null) { return arguments; } final Uri data = intent.getData(); if (data != null) { arguments.putParcelable("_uri", data); } if (extras != null) { arguments.putAll(intent.getExtras()); } return arguments; }
From source file:com.softminds.matrixcalculator.MainActivity.java
@Override protected void onActivityResult(int requestcode, int resultCode, Intent data) { super.onActivityResult(requestcode, resultCode, data); if (resultCode == RESULT) { if (data != null) { Bundle AllData = new Bundle(); AllData.putAll(data.getExtras()); try { MatrixV2 m = MatrixV2.constructFromBundle(AllData); ((GlobalValues) getApplication()).AddToGlobal(m); //Sending the things to Global Reference if (actionBar.getSubtitle() == null) actionBar.setSubtitle(R.string.MainSubtitle); t.setText(null);/*w w w .j a v a2s .co m*/ Toast.makeText(getApplicationContext(), R.string.Created, Toast.LENGTH_SHORT).show(); } catch (NullPointerException e2) { e2.printStackTrace(); Log.d("NullException:", "The Adapter was Null Forcing user to Refresh"); EnforceRefresh(); } catch (Exception ignored) { //catch Exception apart fro above two and ignore it } } } if (resultCode == 100) this.recreate(); // Recreate this Activity if a Change in Theme has been marked }
From source file:com.softminds.matrixcalculator.OperationFragments.InverseFragment.java
public void RunAndGetDeterminantWithAdjoint(final int i, final ProgressDialog progressDialog) { Runnable runnable = new Runnable() { @Override// w ww .j a v a 2s .co m public void run() { Message message = new Message(); Bundle bundle = new Bundle(); float detr = (float) SquareList.get(i).getDeterminant(progressDialog); if (detr == 0.0f) { myHandler.postDelayed(new Runnable() { @Override public void run() { Toast.makeText(getContext(), R.string.NoInverse, Toast.LENGTH_SHORT).show(); } }, 0); progressDialog.dismiss(); } else { progressDialog.setProgress(0); bundle.putFloat("DETERMINANT", detr); MatrixV2 res = SquareList.get(i).getAdjoint(progressDialog); bundle.putAll(res.getDataBundled()); message.setData(bundle); myHandler.sendMessage(message); } } }; Thread thread = new Thread(runnable); thread.start(); }