Java Code Examples for android.os.Bundle.putAll()

The following are Jave code examples for showing how to use putAll() of the android.os.Bundle class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
+ Save this method
Example 1
Project: TPlayer   File: VAccountManager.java   View Source Code Vote up 6 votes
/**
 * Asks the user to add an account of a specified type.  The authenticator
 * for this account type processes this request with the appropriate user
 * interface.  If the user does elect to create a new account, the account
 * name is returned.
 * <p>
 * <p>This method may be called from any thread, but the returned
 * {@link AccountManagerFuture} must not be used on the main thread.
 * <p>
 *
 */
public AccountManagerFuture<Bundle> addAccount(final int userId, final String accountType,
                                               final String authTokenType, final String[] requiredFeatures,
                                               final Bundle addAccountOptions,
                                               final Activity activity, AccountManagerCallback<Bundle> callback, Handler handler) {
    if (accountType == null) throw new IllegalArgumentException("accountType is null");
    final Bundle optionsIn = new Bundle();
    if (addAccountOptions != null) {
        optionsIn.putAll(addAccountOptions);
    }
    optionsIn.putString(KEY_ANDROID_PACKAGE_NAME, "android");

    return new AmsTask(activity, handler, callback) {
        @Override
        public void doWork() throws RemoteException {
            addAccount(userId, mResponse, accountType, authTokenType,
                    requiredFeatures, activity != null, optionsIn);
        }
    }.start();
}
 
Example 2
Project: iosched-reader   File: BaseActivity.java   View Source Code Vote up 6 votes
/**
 * Converts an intent and a {@link Bundle} into a {@link Bundle} suitable for use as fragment arguments.
 */
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;
}
 
Example 3
Project: toolargetool   File: TooLargeTool.java   View Source Code Vote up 6 votes
/**
 * Measure the sizes of all the values in a typed {@link Bundle} when written to a
 * {@link Parcel}. Returns a map from keys to the sizes, in bytes, of the associated values in
 * the Bundle.
 *
 * @param bundle to measure
 * @return a map from keys to value sizes in bytes
 */
public static Map<String, Integer> valueSizes(@NonNull Bundle bundle) {
    Map<String, Integer> result = new HashMap<>(bundle.size());
    // We measure the size of each value by measuring the total size of the bundle before and
    // after removing that value and calculating the difference. We make a copy of the original
    // bundle so we can put all the original values back at the end. It's not possible to
    // carry out the measurements on the copy because of the way Android parcelables work
    // under the hood where certain objects are actually stored as references.
    Bundle copy = new Bundle(bundle);
    try {
        int bundleSize = sizeAsParcel(bundle);
        // Iterate over copy's keys because we're removing those of the original bundle
        for (String key : copy.keySet()) {
            bundle.remove(key);
            int newBundleSize = sizeAsParcel(bundle);
            int valueSize = bundleSize - newBundleSize;
            result.put(key, valueSize);
            bundleSize = newBundleSize;
        }
        return result;
    } finally {
        // Put everything back into original bundle
        bundle.putAll(copy);
    }
}
 
Example 4
Project: letv   File: AppbarAgent.java   View Source Code Vote up 6 votes
private Bundle b(String str) {
    Bundle bundle = new Bundle();
    bundle.putString("pkgName", Global.getContext().getPackageName());
    if (!(TO_APPBAR_DETAIL.equals(str) || TO_APPBAR_SEND_BLOG.equals(str))) {
        if (TO_APPBAR_NEWS.equals(str)) {
            bundle.putString("source", "myapp");
        } else if ("sId".equals(str)) {
            if (this.a != null) {
                bundle.putAll(this.a);
            }
        } else if ("toThread".equals(str)) {
            str = String.format("sId/t/%s", new Object[]{this.b});
        }
    }
    bundle.putString("route", str);
    return bundle;
}
 
Example 5
Project: iosched-reader   File: BaseActivity.java   View Source Code Vote up 6 votes
/**
 * Converts an intent into a {@link Bundle} suitable for use as fragment arguments.
 */
public static Bundle intentToFragmentArguments(Intent intent) {
    Bundle arguments = new Bundle();
    if (intent == null) {
        return arguments;
    }

    final Uri data = intent.getData();
    if (data != null) {
        arguments.putParcelable("_uri", data);
    }

    final Bundle extras = intent.getExtras();
    if (extras != null) {
        arguments.putAll(intent.getExtras());
    }

    return arguments;
}
 
Example 6
Project: boohee_v5.6   File: NotificationCompatJellybean.java   View Source Code Vote up 6 votes
public Notification build() {
    Notification notif = this.b.build();
    Bundle extras = NotificationCompatJellybean.getExtras(notif);
    Bundle mergeBundle = new Bundle(this.mExtras);
    for (String key : this.mExtras.keySet()) {
        if (extras.containsKey(key)) {
            mergeBundle.remove(key);
        }
    }
    extras.putAll(mergeBundle);
    SparseArray<Bundle> actionExtrasMap = NotificationCompatJellybean.buildActionExtrasMap(this.mActionExtrasList);
    if (actionExtrasMap != null) {
        NotificationCompatJellybean.getExtras(notif).putSparseParcelableArray("android.support.actionExtras", actionExtrasMap);
    }
    return notif;
}
 
Example 7
Project: kognitivo   File: VideoUploader.java   View Source Code Vote up 5 votes
@Override
public Bundle getParameters() {
    Bundle parameters = new Bundle();
    if (uploadContext.params != null) {
        parameters.putAll(uploadContext.params);
    }
    parameters.putString(PARAM_UPLOAD_PHASE, PARAM_VALUE_UPLOAD_FINISH_PHASE);
    parameters.putString(PARAM_SESSION_ID, uploadContext.sessionId);
    Utility.putNonEmptyString(parameters, PARAM_TITLE, uploadContext.title);
    Utility.putNonEmptyString(parameters, PARAM_DESCRIPTION, uploadContext.description);
    Utility.putNonEmptyString(parameters, PARAM_REF, uploadContext.ref);

    return parameters;
}
 
Example 8
Project: boohee_v5.6   File: SocializeUtils.java   View Source Code Vote up 5 votes
public static Bundle parseUrl(String str) {
    try {
        URL url = new URL(str);
        Bundle decodeUrl = decodeUrl(url.getQuery());
        decodeUrl.putAll(decodeUrl(url.getRef()));
        return decodeUrl;
    } catch (MalformedURLException e) {
        return new Bundle();
    }
}
 
Example 9
Project: AndroidBackendlessChat   File: Util.java   View Source Code Vote up 5 votes
/**
 * Parse a URL query and fragment parameters into a key-value bundle.
 *
 * @param url the URL to parse
 * @return a dictionary bundle of keys and values
 */
@Deprecated
public static Bundle parseUrl(String url) {
    // hack to prevent MalformedURLException
    url = url.replace("fbconnect", "http");
    try {
        URL u = new URL(url);
        Bundle b = decodeUrl(u.getQuery());
        b.putAll(decodeUrl(u.getRef()));
        return b;
    } catch (MalformedURLException e) {
        return new Bundle();
    }
}
 
Example 10
Project: chat-sdk-android-push-firebase   File: Util.java   View Source Code Vote up 5 votes
/**
 * Parse a URL query and fragment parameters into a key-value bundle.
 *
 * @param url the URL to parse
 * @return a dictionary bundle of keys and values
 */
@Deprecated
public static Bundle parseUrl(String url) {
    // hack to prevent MalformedURLException
    url = url.replace("fbconnect", "http");
    try {
        URL u = new URL(url);
        Bundle b = decodeUrl(u.getQuery());
        b.putAll(decodeUrl(u.getRef()));
        return b;
    } catch (MalformedURLException e) {
        return new Bundle();
    }
}
 
Example 11
Project: odoo-work   File: OSyncUtils.java   View Source Code Vote up 5 votes
public void sync(Bundle data) {
    AccountManager manager = (AccountManager) context.getSystemService(Context.ACCOUNT_SERVICE);
    Account[] accounts = manager.getAccountsByType(context.getString(R.string.auth_type));
    if (accounts.length > 0) {
        Bundle settings = new Bundle();
        settings.putBoolean(ContentResolver.SYNC_EXTRAS_MANUAL, true);
        settings.putBoolean(ContentResolver.SYNC_EXTRAS_EXPEDITED, true);
        settings.putString(SyncAdapter.KEY_SYNC_MODEL, model.getModelName());
        if (data != null)
            settings.putAll(data);
        ContentResolver.requestSync(accounts[0], model.getAuthority(), settings);
    }
}
 
Example 12
Project: letv   File: SocialApiIml.java   View Source Code Vote up 5 votes
public void challenge(Activity activity, Bundle bundle, IUiListener iUiListener) {
    this.b = activity;
    Intent agentIntentWithTarget = getAgentIntentWithTarget(SocialConstants.ACTIVITY_CHALLENGE);
    bundle.putAll(composeActivityParams());
    Activity activity2 = activity;
    a(activity2, agentIntentWithTarget, SocialConstants.ACTION_CHALLENGE, bundle, ServerSetting.getInstance().getEnvUrl(Global.getContext(), ServerSetting.DEFAULT_URL_BRAG), iUiListener, false);
}
 
Example 13
Project: Matrix-Calculator-for-Android   File: InverseFragment.java   View Source Code Vote up 5 votes
public void RunAndGetDeterminantWithAdjoint(final int i, final ProgressDialog progressDialog) {
    Runnable runnable = new Runnable() {
        @Override
        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);
                Matrix res = SquareList.get(i).ReturnAdjoint(progressDialog);
                bundle.putAll(res.GetDataBundled());
                message.setData(bundle);
                myHandler.sendMessage(message);
            }

        }
    };
    Thread thread = new Thread(runnable);
    thread.start();
}
 
Example 14
Project: boohee_v5.6   File: d.java   View Source Code Vote up 4 votes
public void a(Bundle bundle) {
    super.a(bundle);
    bundle.putAll(a.a(this.a));
    bundle.putInt("_wxapi_sendmessagetowx_req_scene", this.b);
}
 
Example 15
Project: boohee_v5.6   File: GetMessageFromWX.java   View Source Code Vote up 4 votes
public void toBundle(Bundle bundle) {
    super.toBundle(bundle);
    bundle.putAll(Builder.toBundle(this.message));
}
 
Example 16
Project: boohee_v5.6   File: f.java   View Source Code Vote up 4 votes
public void b(Bundle bundle) {
    super.b(bundle);
    bundle.putAll(a.a(this.a));
}
 
Example 17
Project: chromium-for-android-56-debug-video   File: FirstRunActivity.java   View Source Code Vote up 4 votes
@Override
protected void onSaveInstanceState(Bundle outState) {
    super.onSaveInstanceState(outState);
    outState.putAll(mFreProperties);
}
 
Example 18
Project: chromium-for-android-56-debug-video   File: FirstRunPage.java   View Source Code Vote up 4 votes
@Override
public void onSaveInstanceState(Bundle outState) {
    super.onSaveInstanceState(outState);
    outState.putAll(mProperties);
}
 
Example 19
Project: android-rxmvp-sandbox   File: RxSaveStateFragment.java   View Source Code Vote up 4 votes
@Override
public void onSaveInstanceState(Bundle outState) {
  super.onSaveInstanceState(outState);
  outState.putAll(state);
}
 
Example 20
Project: Floo   File: Floo.java   View Source Code Vote up 2 votes
/**
 * Inserts all mappings from the given Bundle.
 *
 * @param bundle A Bundle.
 * @return A reference to the {@link Navigation}.
 * @see Navigation
 * @see #putExtra(String, byte)
 * @see #putExtra(String, short)
 * @see #putExtra(String, int)
 * @see #putExtra(String, long)
 * @see #putExtra(String, float)
 * @see #putExtra(String, double)
 * @see #putExtra(String, boolean)
 * @see #putExtra(String, String)
 * @see #putExtra(String, CharSequence)
 * @see #putExtra(String, Parcelable)
 * @see #putExtra(String, Serializable)
 */
@NonNull @Override @CheckResult
public Navigation putExtras(@NonNull Bundle bundle) {
    bundle.putAll(bundle);
    return this;
}