List of usage examples for android.os Bundle putAll
public void putAll(Bundle bundle)
From source file:dev.drsoran.moloko.activities.base.MolokoFragmentActivity.java
public Bundle getActivityAndFragmentsConfiguration(int... fragmentIds) { final Bundle config = new Bundle(); config.putAll(getConfiguration()); config.putAll(getFragmentConfigurations(fragmentIds)); return config; }
From source file:com.softminds.matrixcalculator.base_activities.FillingMatrix.java
@Override public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { case R.id.ConfirmCreate: if (!MatrixError()) { double variable[][] = GetIntoFloat(); Bundle bundle = new Bundle(); bundle.putAll(getIntent().getExtras()); //bundle.putSerializable("VALUES",variable); bundle.putDoubleArray("VALUES", MatrixV2.flattenValues(variable, getIntent().getIntExtra("ROW", -1), getIntent().getIntExtra("COL", -1))); Intent intnt = new Intent(); intnt.putExtras(bundle);/*w ww . j av a 2 s . c om*/ setResult(0, intnt); finish(); return true; } else break; case R.id.Input1Empty: EmptyInput(1); return true; case R.id.ClearAll: ClearAllValues(); return true; case R.id.FillAllZero: EmptyInput(0); return true; case R.id.InputRandom: InputRandomInt(); return true; case R.id.InputRandomFloat: if (!PreferenceManager.getDefaultSharedPreferences(getApplicationContext()).getBoolean("DECIMAL_USE", true)) Toast.makeText(getApplicationContext(), R.string.AllowDecimals, Toast.LENGTH_SHORT).show(); else InputRandomFloat(); return true; case R.id.FillCustom: startActivityForResult(new Intent(getApplicationContext(), CustomValueFiller.class), RESULT); return true; } return super.onOptionsItemSelected(item); }
From source file:com.softminds.matrixcalculator.base_activities.FillingMatrix.java
public void MakeType(Type type) { switch (type) { case Null:/*from www .j a v a 2 s . co m*/ for (int i = 0; i < row; i++) for (int j = 0; j < col; j++) { EditText editText = findViewById(i * 10 + j); editText.setText(String.valueOf(0.0)); } double variable[][] = GetIntoFloat(); Bundle bundle = new Bundle(); bundle.putAll(getIntent().getExtras()); //bundle.putSerializable("VALUES",variable); bundle.putDoubleArray("VALUES", MatrixV2.flattenValues(variable, getIntent().getIntExtra("ROW", -1), getIntent().getIntExtra("COL", -1))); Intent intnt = new Intent(); intnt.putExtras(bundle); setResult(0, intnt); finish(); break; case Diagonal: for (int i = 0; i < row; i++) for (int j = 0; j < col; j++) { EditText editText = findViewById(i * 10 + j); if (i != j) { editText.setText(String.valueOf(0.0)); } } break; case Identity: for (int i = 0; i < row; i++) for (int j = 0; j < col; j++) { EditText editText = findViewById(i * 10 + j); if (i == j) editText.setText(String.valueOf(1.0)); else editText.setText(String.valueOf(0.0)); } double vari[][] = GetIntoFloat(); Bundle bundle2 = new Bundle(); bundle2.putAll(getIntent().getExtras()); //bundle2.putSerializable("VALUES",vari); bundle2.putDoubleArray("VALUES", MatrixV2.flattenValues(vari, getIntent().getIntExtra("ROW", -1), getIntent().getIntExtra("COL", -1))); Intent intn = new Intent(); intn.putExtras(bundle2); setResult(0, intn); finish(); break; } }
From source file:org.odk.collect.android.views.ODKView.java
public Bundle getState() { Bundle state = new Bundle(); for (QuestionWidget qw : getWidgets()) { state.putAll(qw.getCurrentState()); }/*w ww .ja v a 2 s . c om*/ return state; }
From source file:com.odoo.MainActivity.java
private void updateAccount() { OUser userdata = OUser.current(mContext); if (userdata != null) { AccountCreate account = new AccountCreate(); Bundle args = new Bundle(); args.putBoolean("no_config_wizard", true); args.putAll(userdata.getAsBundle()); account.setArguments(args);// w ww . ja v a 2 s . c o m startMainFragment(account, false); } else { List<OUser> accounts = OdooAccountManager.fetchAllAccounts(this); if (accounts.size() <= 0) { getActionBar().setDisplayHomeAsUpEnabled(false); getActionBar().setHomeButtonEnabled(false); initDrawerControls(); lockDrawer(true); LoginSignup loginSignUp = new LoginSignup(); startMainFragment(loginSignUp, false); } } }
From source file:eltos.simpledialogfragment.SimpleDialog.java
boolean callResultListener(int which, Bundle extras) { if (extras == null) extras = new Bundle(); if (getArguments().getBundle(BUNDLE) != null) { extras.putAll(getArguments().getBundle(BUNDLE)); }//from w w w . j a va 2 s.c om boolean handled = false; if (getTag() != null) { if (getTargetFragment() instanceof OnDialogResultListener) { handled = ((OnDialogResultListener) getTargetFragment()).onResult(getTag(), which, extras); } if (!handled && getActivity() instanceof OnDialogResultListener) { handled = ((OnDialogResultListener) getActivity()).onResult(getTag(), which, extras); } } return handled; }
From source file:dev.drsoran.moloko.activities.AbstractTasksListActivity.java
@Override public boolean onNavigationItemSelected(int itemPosition, long itemId) { final boolean hasChangedSelectedItemId = itemId != selectedNavigationItem.id; final boolean handled = hasChangedSelectedItemId || itemPosition != selectedNavigationItem.position; if (handled) { final Bundle newConfig = getCurrentTasksListFragmentConfiguration(); newConfig.putAll(actionBarNavigationAdapter.getTasksListConfigForItem(itemPosition)); // We set the selected position to 0 in the case of an ID change because the back stack change (see // onBackStackChanged() will cause a recreation of the spinner adapter what causes the selected // item position to be 0 and we do not want a reload again due to changed position. if (hasChangedSelectedItemId) { itemPosition = 0;// www . j a v a 2s .c o m } selectedNavigationItem = new SelectedNavigationItem(itemId, itemPosition); updateNavigationAdapter = hasChangedSelectedItemId; reloadTasksListWithConfiguration(newConfig); } return handled; }
From source file:de.elanev.studip.android.app.frontend.courses.CourseDocumentsFragment.java
@Override public void onSaveInstanceState(Bundle outState) { outState.putAll(getArguments()); super.onSaveInstanceState(outState); }
From source file:org.mariotaku.twidere.activity.LinkHandlerActivity.java
private boolean setFragment(final Uri uri) { final Bundle extras = getIntent().getExtras(); Fragment fragment = null;/*from w ww .j av a2s . c o m*/ 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 (!isEmpty(param_screen_name)) { bundle.putString(INTENT_KEY_SCREEN_NAME, param_screen_name); } if (!isEmpty(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 (!isEmpty(param_screen_name)) { bundle.putString(INTENT_KEY_SCREEN_NAME, param_screen_name); } if (!isEmpty(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 (!isEmpty(param_screen_name)) { bundle.putString(INTENT_KEY_SCREEN_NAME, param_screen_name); } if (!isEmpty(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 (!isEmpty(param_screen_name)) { bundle.putString(INTENT_KEY_SCREEN_NAME, param_screen_name); } if (!isEmpty(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 (!isEmpty(param_screen_name)) { bundle.putString(INTENT_KEY_SCREEN_NAME, param_screen_name); } if (!isEmpty(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_DIRECT_MESSAGES_CONVERSATION: { setTitle(R.string.direct_messages); fragment = new DirectMessagesConversationFragment(); 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 (isEmpty(param_list_id) && (isEmpty(param_list_name) || isEmpty(param_screen_name) && isEmpty(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_LISTS: { setTitle(R.string.user_list); fragment = new UserListsListFragment(); final String param_screen_name = uri.getQueryParameter(QUERY_PARAM_SCREEN_NAME); final String param_user_id = uri.getQueryParameter(QUERY_PARAM_USER_ID); if (isEmpty(param_screen_name) && isEmpty(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 (isEmpty(param_list_id) && (isEmpty(param_list_name) || isEmpty(param_screen_name) && isEmpty(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 (isEmpty(param_list_id) && (isEmpty(param_list_name) || isEmpty(param_screen_name) && isEmpty(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 (isEmpty(param_list_id) && (isEmpty(param_list_name) || isEmpty(param_screen_name) && isEmpty(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_SAVED_SEARCHES: { setTitle(R.string.saved_searches); fragment = new SavedSearchesListFragment(); 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 (!isEmpty(param_screen_name)) { bundle.putString(INTENT_KEY_SCREEN_NAME, param_screen_name); } else { finish(); return false; } break; } case LINK_ID_INCOMING_FRIENDSHIPS: { setTitle(R.string.incoming_friendships); fragment = new IncomingFriendshipsFragment(); 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:com.odoo.MainActivity.java
/** * Request sync./*from www . ja v a 2 s . c o m*/ * * @param authority * the authority * @param bundle * the extra data */ public void requestSync(String authority, Bundle bundle) { Account account = OdooAccountManager.getAccount(getApplicationContext(), OUser.current(getApplicationContext()).getAndroidName()); Bundle settingsBundle = new Bundle(); settingsBundle.putBoolean(ContentResolver.SYNC_EXTRAS_MANUAL, true); settingsBundle.putBoolean(ContentResolver.SYNC_EXTRAS_EXPEDITED, true); if (bundle != null) { settingsBundle.putAll(bundle); } ContentResolver.requestSync(account, authority, settingsBundle); }