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

The following examples show how to use android.os.Bundle#putAll() . These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source Project: v2ex   File: BaseActivity.java    License: Apache License 2.0 6 votes vote down vote up
/**
 * 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 2
/**
 * Converts an intent into a {@link Bundle} suitable for use as fragment
 * arguments.
 */
public static Bundle intentToFragmentArguments(final Intent intent) {
    final 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 3
Source Project: MiBandDecompiled   File: SocialApiIml.java    License: Apache License 2.0 5 votes vote down vote up
public void challenge(Activity activity, Bundle bundle, IUiListener iuilistener)
{
    b = activity;
    Intent intent = getAgentIntentWithTarget("com.tencent.open.agent.ChallengeActivity");
    bundle.putAll(composeActivityParams());
    a(activity, intent, "action_challenge", bundle, ServerSetting.getInstance().getEnvUrl(mContext, "http://qzs.qq.com/open/mobile/brag/sdk_brag.html?"), iuilistener);
}
 
Example 4
static BricksListDialogFragment newInstance(String dialogId, String[] brickNames, Bundle args) {
    BricksListDialogFragment f = new BricksListDialogFragment();
    Bundle arguments = new Bundle();
    arguments.putStringArray(BRICK_NAMES_KEY, brickNames);
    arguments.putString(DIALOG_ID_KEY, dialogId);
    if (args != null)
        arguments.putAll(args);
    f.setArguments(arguments);
    return f;
}
 
Example 5
Source Project: COCOFramework   File: CocoDialog.java    License: Apache License 2.0 5 votes vote down vote up
public Builder show(final FragmentManager fragmentManager) {
    final Bundle b = new Bundle();
    b.putString("_fragment", fragment.getName());
    if (arg != null) {
        b.putAll(arg);
    }
    final CocoDialog d = new CocoDialog(style);
    d.setArguments(b);
    BaseDialog.show(fragmentManager, d);
    return this;
}
 
Example 6
Source Project: MiBandDecompiled   File: SocialApiIml.java    License: Apache License 2.0 5 votes vote down vote up
public void brag(Activity activity, Bundle bundle, IUiListener iuilistener)
{
    b = activity;
    Intent intent = getAgentIntentWithTarget("com.tencent.open.agent.BragActivity");
    bundle.putAll(composeActivityParams());
    a(activity, intent, "action_brag", bundle, ServerSetting.getInstance().getEnvUrl(mContext, "http://qzs.qq.com/open/mobile/brag/sdk_brag.html?"), iuilistener);
}
 
Example 7
/**
 * Retrieves the {@link TaskParameters} from the {@link JobParameters}, which are passed as
 * one of the keys. Only values valid for {@link android.os.BaseBundle} are supported, and other
 * values are stripped at the time when the task is scheduled.
 *
 * @param jobParameters the {@link JobParameters} to extract the {@link TaskParameters} from.
 * @return the {@link TaskParameters} for the current job.
 */
static TaskParameters getTaskParametersFromJobParameters(JobParameters jobParameters) {
    TaskParameters.Builder builder = TaskParameters.create(jobParameters.getJobId());

    PersistableBundle jobExtras = jobParameters.getExtras();
    PersistableBundle persistableTaskExtras =
            jobExtras.getPersistableBundle(BACKGROUND_TASK_EXTRAS_KEY);

    Bundle taskExtras = new Bundle();
    taskExtras.putAll(persistableTaskExtras);
    builder.addExtras(taskExtras);

    return builder.build();
}
 
Example 8
/**
 * 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 9
@Override
public void saveState(Bundle outState) {
    Bundle bundle = (Bundle) super.onSaveInstanceState();
    if (bundle != null) {
        bundle.putIntegerArrayList(BUNDLE_DELETED_IMAGES, new ArrayList<>(getDeletedAttaches()));
        bundle.remove("instanceState");
        outState.putAll(bundle);
    }
}
 
Example 10
Source Project: letv   File: KVUtils.java    License: Apache License 2.0 5 votes vote down vote up
public static String toString(Bundle b) {
    if (b == null) {
        return "";
    }
    Bundle bundle = new Bundle();
    bundle.putAll(b);
    return bundle.toString();
}
 
Example 11
Source Project: KlyphMessenger   File: Util.java    License: MIT License 5 votes vote down vote up
/**
 * 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 12
Source Project: PictureSelector   File: ConstantData.java    License: Apache License 2.0 4 votes vote down vote up
public static Bundle toEditBundle(Bundle baseBundle, FileEntity item) {
    Bundle bundle = new Bundle();
    bundle.putAll(baseBundle);
    bundle.putParcelable(KEY_CURR_ITEM, item);
    return bundle;
}
 
Example 13
public Builder(Context context, Notification n,
        CharSequence contentTitle, CharSequence contentText, CharSequence contentInfo,
        RemoteViews tickerView, int number,
        PendingIntent contentIntent, PendingIntent fullScreenIntent, Bitmap largeIcon,
        int progressMax, int progress, boolean progressIndeterminate, boolean showWhen,
        boolean useChronometer, int priority, CharSequence subText, boolean localOnly,
        ArrayList<String> people, Bundle extras, String groupKey, boolean groupSummary,
        String sortKey) {
    b = new Notification.Builder(context)
        .setWhen(n.when)
        .setShowWhen(showWhen)
        .setSmallIcon(n.icon, n.iconLevel)
        .setContent(n.contentView)
        .setTicker(n.tickerText, tickerView)
        .setSound(n.sound, n.audioStreamType)
        .setVibrate(n.vibrate)
        .setLights(n.ledARGB, n.ledOnMS, n.ledOffMS)
        .setOngoing((n.flags & Notification.FLAG_ONGOING_EVENT) != 0)
        .setOnlyAlertOnce((n.flags & Notification.FLAG_ONLY_ALERT_ONCE) != 0)
        .setAutoCancel((n.flags & Notification.FLAG_AUTO_CANCEL) != 0)
        .setDefaults(n.defaults)
        .setContentTitle(contentTitle)
        .setContentText(contentText)
        .setSubText(subText)
        .setContentInfo(contentInfo)
        .setContentIntent(contentIntent)
        .setDeleteIntent(n.deleteIntent)
        .setFullScreenIntent(fullScreenIntent,
                (n.flags & Notification.FLAG_HIGH_PRIORITY) != 0)
        .setLargeIcon(largeIcon)
        .setNumber(number)
        .setUsesChronometer(useChronometer)
        .setPriority(priority)
        .setProgress(progressMax, progress, progressIndeterminate);
    mExtras = new Bundle();
    if (extras != null) {
        mExtras.putAll(extras);
    }
    if (people != null && !people.isEmpty()) {
        mExtras.putStringArray(Notification.EXTRA_PEOPLE,
                people.toArray(new String[people.size()]));
    }
    if (localOnly) {
        mExtras.putBoolean(NotificationCompatJellybean.EXTRA_LOCAL_ONLY, true);
    }
    if (groupKey != null) {
        mExtras.putString(NotificationCompatJellybean.EXTRA_GROUP_KEY, groupKey);
        if (groupSummary) {
            mExtras.putBoolean(NotificationCompatJellybean.EXTRA_GROUP_SUMMARY, true);
        } else {
            mExtras.putBoolean(NotificationCompatJellybean.EXTRA_USE_SIDE_CHANNEL, true);
        }
    }
    if (sortKey != null) {
        mExtras.putString(NotificationCompatJellybean.EXTRA_SORT_KEY, sortKey);
    }
}
 
Example 14
Source Project: delion   File: FirstRunPage.java    License: Apache License 2.0 4 votes vote down vote up
@Override
public void onSaveInstanceState(Bundle outState) {
    super.onSaveInstanceState(outState);
    outState.putAll(mProperties);
}
 
Example 15
public Builder(Context context, Notification n,
        CharSequence contentTitle, CharSequence contentText, CharSequence contentInfo,
        RemoteViews tickerView, int number,
        PendingIntent contentIntent, PendingIntent fullScreenIntent, Bitmap largeIcon,
        int progressMax, int progress, boolean progressIndeterminate,
        boolean useChronometer, int priority, CharSequence subText, boolean localOnly,
        Bundle extras, String groupKey, boolean groupSummary, String sortKey) {
    b = new Notification.Builder(context)
        .setWhen(n.when)
        .setSmallIcon(n.icon, n.iconLevel)
        .setContent(n.contentView)
        .setTicker(n.tickerText, tickerView)
        .setSound(n.sound, n.audioStreamType)
        .setVibrate(n.vibrate)
        .setLights(n.ledARGB, n.ledOnMS, n.ledOffMS)
        .setOngoing((n.flags & Notification.FLAG_ONGOING_EVENT) != 0)
        .setOnlyAlertOnce((n.flags & Notification.FLAG_ONLY_ALERT_ONCE) != 0)
        .setAutoCancel((n.flags & Notification.FLAG_AUTO_CANCEL) != 0)
        .setDefaults(n.defaults)
        .setContentTitle(contentTitle)
        .setContentText(contentText)
        .setSubText(subText)
        .setContentInfo(contentInfo)
        .setContentIntent(contentIntent)
        .setDeleteIntent(n.deleteIntent)
        .setFullScreenIntent(fullScreenIntent,
                (n.flags & Notification.FLAG_HIGH_PRIORITY) != 0)
        .setLargeIcon(largeIcon)
        .setNumber(number)
        .setUsesChronometer(useChronometer)
        .setPriority(priority)
        .setProgress(progressMax, progress, progressIndeterminate);
    mExtras = new Bundle();
    if (extras != null) {
        mExtras.putAll(extras);
    }
    if (localOnly) {
        mExtras.putBoolean(EXTRA_LOCAL_ONLY, true);
    }
    if (groupKey != null) {
        mExtras.putString(EXTRA_GROUP_KEY, groupKey);
        if (groupSummary) {
            mExtras.putBoolean(EXTRA_GROUP_SUMMARY, true);
        } else {
            mExtras.putBoolean(EXTRA_USE_SIDE_CHANNEL, true);
        }
    }
    if (sortKey != null) {
        mExtras.putString(EXTRA_SORT_KEY, sortKey);
    }
}
 
Example 16
Source Project: NetBare   File: CertificateInstallActivity.java    License: MIT License 4 votes vote down vote up
@Override
protected void onSaveInstanceState(Bundle outState) {
    super.onSaveInstanceState(outState);
    outState.putAll(getIntent().getExtras());
}
 
Example 17
Source Project: xDrip   File: TaskerPlugin.java    License: GNU General Public License v3.0 1 votes vote down vote up
/**
 * Specify a bundle of data (probably representing whatever change happened in the condition)
 * which will be included in the QUERY_CONDITION broadcast sent by the host for each
 * event instance of the plugin.
 * 
 * The minimal purpose is to enable the plugin to associate a QUERY_CONDITION to the
 * with the REQUEST_QUERY that caused it.
 * 
 * Note that for security reasons it is advisable to also store a message ID with the bundle
 * which can be compared to known IDs on receipt. The host cannot validate the source of
 * REQUEST_QUERY intents so fake data may be passed. Replay attacks are also possible.
 * addPassThroughMesssageID() can be used to add an ID if the plugin doesn't wish to add it's
 * own ID to the pass through bundle.
 * 
 * Note also that there are several situations where REQUEST_QUERY will not result in a
 * QUERY_CONDITION intent (e.g. event throttling by the host), so plugin-local data
 * indexed with a message ID needs to be timestamped and eventually timed-out.
 * 
 * This function can be called multiple times, each time all keys in data will be added to
 * that of previous calls.
 * 
 * @param requestQueryIntent intent being sent to the host
 * @param data the data to be passed-through
 * @see #hostSupportsRequestQueryDataPassThrough(Bundle)
 * @see #retrievePassThroughData(Intent)
 * @see #addPassThroughMessageID
 * 
*/
public static void addPassThroughData( Intent requestQueryIntent, Bundle data ) {
	
	Bundle passThroughBundle = retrieveOrCreatePassThroughBundle(requestQueryIntent);
	
	passThroughBundle.putAll( data );
}
 
Example 18
/**
 * Specify a bundle of data (probably representing whatever change happened in the condition)
 * which will be included in the QUERY_CONDITION broadcast sent by the host for each
 * event instance of the plugin.
 * <p>
 * The minimal purpose is to enable the plugin to associate a QUERY_CONDITION to the
 * with the REQUEST_QUERY that caused it.
 * <p>
 * Note that for security reasons it is advisable to also store a message ID with the bundle
 * which can be compared to known IDs on receipt. The host cannot validate the source of
 * REQUEST_QUERY intents so fake data may be passed. Replay attacks are also possible.
 * addPassThroughMesssageID() can be used to add an ID if the plugin doesn't wish to add it's
 * own ID to the pass through bundle.
 * <p>
 * Note also that there are several situations where REQUEST_QUERY will not result in a
 * QUERY_CONDITION intent (e.g. event throttling by the host), so plugin-local data
 * indexed with a message ID needs to be timestamped and eventually timed-out.
 * <p>
 * This function can be called multiple times, each time all keys in data will be added to
 * that of previous calls.
 *
 * @param requestQueryIntent intent being sent to the host
 * @param data               the data to be passed-through
 * @see #hostSupportsRequestQueryDataPassThrough(Bundle)
 * @see #retrievePassThroughData(Intent)
 * @see #addPassThroughMessageID
 */
public static void addPassThroughData(Intent requestQueryIntent, Bundle data) {

    Bundle passThroughBundle = retrieveOrCreatePassThroughBundle(requestQueryIntent);

    passThroughBundle.putAll(data);
}
 
Example 19
/**
 * Specify a bundle of data (probably representing whatever change happened in the condition)
 * which will be included in the QUERY_CONDITION broadcast sent by the host for each
 * event instance of the plugin.
 *
 * The minimal purpose is to enable the plugin to associate a QUERY_CONDITION to the
 * with the REQUEST_QUERY that caused it.
 *
 * Note that for security reasons it is advisable to also store a message ID with the bundle
 * which can be compared to known IDs on receipt. The host cannot validate the source of
 * REQUEST_QUERY intents so fake data may be passed. Replay attacks are also possible.
 * addPassThroughMesssageID() can be used to add an ID if the plugin doesn't wish to add it's
 * own ID to the pass through bundle.
 *
 * Note also that there are several situations where REQUEST_QUERY will not result in a
 * QUERY_CONDITION intent (e.g. event throttling by the host), so plugin-local data
 * indexed with a message ID needs to be timestamped and eventually timed-out.
 *
 * This function can be called multiple times, each time all keys in data will be added to
 * that of previous calls.
 *
 * @param requestQueryIntent intent being sent to the host
 * @param data the data to be passed-through
 * @see #hostSupportsRequestQueryDataPassThrough(Bundle)
 * @see #retrievePassThroughData(Intent)
 * @see #addPassThroughMessageID
 *
 */
public static void addPassThroughData( Intent requestQueryIntent, Bundle data ) {

    Bundle passThroughBundle = retrieveOrCreatePassThroughBundle( requestQueryIntent );

    passThroughBundle.putAll( data );
}
 
Example 20
/**
 * Specify a bundle of data (probably representing whatever change happened in the condition)
 * which will be included in the QUERY_CONDITION broadcast sent by the localHost for each
 * event instance of the plugin.
 * <p/>
 * The minimal purpose is to enable the plugin to associate a QUERY_CONDITION to the
 * with the REQUEST_QUERY that caused it.
 * <p/>
 * Note that for security reasons it is advisable to also store a message ID with the bundle
 * which can be compared to known IDs on receipt. The localHost cannot validate the source of
 * REQUEST_QUERY intents so fake data may be passed. Replay attacks are also possible.
 * addPassThroughMesssageID() can be used to add an ID if the plugin doesn't wish to add it's
 * own ID to the pass through bundle.
 * <p/>
 * Note also that there are several situations where REQUEST_QUERY will not result in a
 * QUERY_CONDITION intent (e.g. event throttling by the localHost), so plugin-local data
 * indexed with a message ID needs to be timestamped and eventually timed-out.
 * <p/>
 * This function can be called multiple times, each time all keys in data will be added to
 * that of previous calls.
 *
 * @param requestQueryIntent intent being sent to the localHost
 * @param data               the data to be passed-through
 * @see #hostSupportsRequestQueryDataPassThrough(Bundle)
 * @see #retrievePassThroughData(Intent)
 * @see #addPassThroughMessageID
 */
public static void addPassThroughData(Intent requestQueryIntent, Bundle data) {

    Bundle passThroughBundle = retrieveOrCreatePassThroughBundle(requestQueryIntent);

    passThroughBundle.putAll(data);
}