Example usage for android.os Bundle putBundle

List of usage examples for android.os Bundle putBundle

Introduction

In this page you can find the example usage for android.os Bundle putBundle.

Prototype

public void putBundle(@Nullable String key, @Nullable Bundle value) 

Source Link

Document

Inserts a Bundle value into the mapping of this Bundle, replacing any existing value for the given key.

Usage

From source file:de.stkl.gbgvertretungsplan.fragments.MainFragment.java

@Override
public void onSaveInstanceState(Bundle outState) {
    if (!saveIndicatorObj)
        outState.putBundle(SAVED_BUNDLE_TAG, savedState);
    else//from w  w w.  ja va  2 s  . c  o  m
        outState.putBundle(SAVED_BUNDLE_TAG, createStateInDestroyView ? savedState : saveState());
    createStateInDestroyView = false;

    super.onSaveInstanceState(outState);
}

From source file:com.sharpcart.android.wizardpager.SharpCartLoginActivity.java

@Override
protected void onSaveInstanceState(final Bundle outState) {
    super.onSaveInstanceState(outState);
    outState.putBundle("model", mWizardModel.save());
}

From source file:org.anhonesteffort.flock.EditAutoRenewActivity.java

@Override
public void onSaveInstanceState(Bundle savedInstanceState) {
    savedInstanceState.putBundle(KEY_DAV_ACCOUNT_BUNDLE, davAccount.toBundle());

    if (flockAccount.isPresent())
        savedInstanceState.putBundle(KEY_FLOCK_ACCOUNT_BUNDLE, flockAccount.get().toBundle());

    if (cardInformation.isPresent())
        savedInstanceState.putBundle(KEY_CARD_INFORMATION_BUNDLE, cardInformation.get().toBundle());

    super.onSaveInstanceState(savedInstanceState);
}

From source file:org.apache.cordova.X5PluginManager.java

public Bundle onSaveInstanceState() {
    Bundle state = new Bundle();
    for (X5CordovaPlugin plugin : this.pluginMap.values()) {
        if (plugin != null) {
            Bundle pluginState = plugin.onSaveInstanceState();
            if (pluginState != null) {
                state.putBundle(plugin.getServiceName(), pluginState);
            }//from   w ww.j av a 2 s  . c o m
        }
    }
    return state;
}

From source file:com.rubixconsulting.walletcracker.WalletCrackerMain.java

@Override
protected void onSaveInstanceState(Bundle outState) {
    super.onSaveInstanceState(outState);

    final Bundle state = new Bundle();
    Log.d(TAG, "onSaveInstanceState");
    Log.d(TAG, "saving currentItem: " + pager.getCurrentItem());
    state.putBoolean("initialized", initialized);
    state.putInt("currentItem", pager.getCurrentItem());
    state.putString("logoAnimationState", logoAnimationState.toString());

    outState.putBundle(TAG, state);
}

From source file:com.actionbarsherlock.plus.SherlockDialogPlusFragment.java

@Override
public void onSaveInstanceState(Bundle outState) {
    super.onSaveInstanceState(outState);
    if (mDialog != null) {
        Bundle dialogState = mDialog.onSaveInstanceState();
        if (dialogState != null) {
            outState.putBundle(SAVED_DIALOG_STATE_TAG, dialogState);
        }/*  www .j  av  a2s . com*/
    }
    if (mStyle != STYLE_NORMAL) {
        outState.putInt(SAVED_STYLE, mStyle);
    }
    if (mTheme != 0) {
        outState.putInt(SAVED_THEME, mTheme);
    }
    if (!mCancelable) {
        outState.putBoolean(SAVED_CANCELABLE, mCancelable);
    }
    if (!mShowsDialog) {
        outState.putBoolean(SAVED_SHOWS_DIALOG, mShowsDialog);
    }
    if (mBackStackId != -1) {
        outState.putInt(SAVED_BACK_STACK_ID, mBackStackId);
    }
}

From source file:com.facebook.internal.FacebookWebFallbackDialog.java

@Override
protected Bundle parseResponseUri(String url) {
    Uri responseUri = Uri.parse(url);//from  w  w w.ja va 2  s  . c  om
    Bundle queryParams = Utility.parseUrlQueryString(responseUri.getQuery());

    // Convert Bridge args to the format that the Native dialog code understands.
    String bridgeArgsJSONString = queryParams.getString(ServerProtocol.FALLBACK_DIALOG_PARAM_BRIDGE_ARGS);
    queryParams.remove(ServerProtocol.FALLBACK_DIALOG_PARAM_BRIDGE_ARGS);

    if (!Utility.isNullOrEmpty(bridgeArgsJSONString)) {
        Bundle bridgeArgs;
        try {
            JSONObject bridgeArgsJSON = new JSONObject(bridgeArgsJSONString);
            bridgeArgs = BundleJSONConverter.convertToBundle(bridgeArgsJSON);
            queryParams.putBundle(NativeProtocol.EXTRA_PROTOCOL_BRIDGE_ARGS, bridgeArgs);
        } catch (JSONException je) {
            Utility.logd(TAG, "Unable to parse bridge_args JSON", je);
        }
    }

    // Convert Method results to the format that the Native dialog code understands.
    String methodResultsJSONString = queryParams.getString(ServerProtocol.FALLBACK_DIALOG_PARAM_METHOD_RESULTS);
    queryParams.remove(ServerProtocol.FALLBACK_DIALOG_PARAM_METHOD_RESULTS);

    if (!Utility.isNullOrEmpty(methodResultsJSONString)) {
        methodResultsJSONString = Utility.isNullOrEmpty(methodResultsJSONString) ? "{}"
                : methodResultsJSONString;
        Bundle methodResults;
        try {
            JSONObject methodArgsJSON = new JSONObject(methodResultsJSONString);
            methodResults = BundleJSONConverter.convertToBundle(methodArgsJSON);
            queryParams.putBundle(NativeProtocol.EXTRA_PROTOCOL_METHOD_RESULTS, methodResults);
        } catch (JSONException je) {
            Utility.logd(TAG, "Unable to parse bridge_args JSON", je);
        }
    }

    // The web host does not send a numeric version back. Put the latest known version in there so NativeProtocol
    // can continue parsing the response.
    queryParams.remove(ServerProtocol.FALLBACK_DIALOG_PARAM_VERSION);
    queryParams.putInt(NativeProtocol.EXTRA_PROTOCOL_VERSION, NativeProtocol.getLatestKnownVersion());

    return queryParams;
}

From source file:org.microg.gms.auth.AuthManagerServiceImpl.java

@Override
public Bundle getToken(String accountName, String scope, Bundle extras) throws RemoteException {
    String packageName = extras.getString(KEY_ANDROID_PACKAGE_NAME);
    if (packageName == null || packageName.isEmpty())
        packageName = extras.getString(KEY_CLIENT_PACKAGE_NAME);
    int callerUid = extras.getInt(KEY_CALLER_UID, 0);
    PackageUtils.checkPackageUid(context, packageName, callerUid, getCallingUid());
    boolean notify = extras.getBoolean(KEY_HANDLE_NOTIFICATION, false);

    Log.d(TAG, "getToken: account:" + accountName + " scope:" + scope + " extras:" + extras + ", notify: "
            + notify);//from  w  w  w . j a  va2  s. com

    /*
     * TODO: This scope seems to be invalid (according to https://developers.google.com/oauthplayground/),
     * but is used in some applications anyway. Removing it is unlikely a good solution, but works for now.
     */
    scope = scope.replace("https://www.googleapis.com/auth/identity.plus.page.impersonation ", "");

    AuthManager authManager = new AuthManager(context, accountName, packageName, scope);
    Bundle result = new Bundle();
    result.putString(KEY_ACCOUNT_NAME, accountName);
    result.putString(KEY_ACCOUNT_TYPE, authManager.getAccountType());
    try {
        AuthResponse res = authManager.requestAuth(false);
        if (res.auth != null) {
            Log.d(TAG, "getToken: " + res);
            result.putString(KEY_AUTHTOKEN, res.auth);
            Bundle details = new Bundle();
            details.putParcelable("TokenData",
                    new TokenData(res.auth, res.expiry, scope.startsWith("oauth2:"), getScopes(scope)));
            result.putBundle("tokenDetails", details);
            result.putString(KEY_ERROR, "OK");
        } else {
            result.putString(KEY_ERROR, "NeedPermission");
            Intent i = new Intent(context, AskPermissionActivity.class);
            i.putExtras(extras);
            i.putExtra(KEY_ANDROID_PACKAGE_NAME, packageName);
            i.putExtra(KEY_ACCOUNT_TYPE, authManager.getAccountType());
            i.putExtra(KEY_ACCOUNT_NAME, accountName);
            i.putExtra(KEY_AUTHTOKEN, scope);
            try {
                if (res.consentDataBase64 != null)
                    i.putExtra(EXTRA_CONSENT_DATA, Base64.decode(res.consentDataBase64, Base64.URL_SAFE));
            } catch (Exception e) {
                Log.w(TAG, "Can't decode consent data: ", e);
            }
            if (notify) {
                NotificationManager nm = (NotificationManager) context
                        .getSystemService(Context.NOTIFICATION_SERVICE);
                nm.notify(packageName.hashCode(),
                        new NotificationCompat.Builder(context)
                                .setContentIntent(PendingIntent.getActivity(context, 0, i, 0))
                                .setContentTitle(context.getString(R.string.auth_notification_title))
                                .setContentText(context.getString(R.string.auth_notification_content,
                                        getPackageLabel(packageName, context.getPackageManager())))
                                .setSmallIcon(android.R.drawable.stat_notify_error).build());
            }
            result.putParcelable(KEY_USER_RECOVERY_INTENT, i);
        }
    } catch (IOException e) {
        Log.w(TAG, e);
        result.putString(KEY_ERROR, "NetworkError");
    }
    return result;
}

From source file:tobiass.statedebt.Main.java

public void onSaveInstanceState(Bundle out) {
    Bundle b = new Bundle();
    Iterator<Country> i = cache.iterator();
    int c = 0;/*  w ww .  j  a  v  a 2  s.  c  o m*/
    while (i.hasNext()) {
        b.putBundle(String.valueOf(c), i.next().bundle());
        c++;
    }
    out.putBundle("cache", b);
    out.putBoolean("isConverted", isConverted);
    int s = getSupportActionBar().getSelectedNavigationIndex();
    if (s > -1) {
        out.putInt("country", list.getItem(s).index);
    }
}

From source file:com.example.jonas.materialmockups.activities.ExhibitDetailsActivity.java

@Override
public void onSaveInstanceState(Bundle outState) {
    super.onSaveInstanceState(outState);

    outState.putSerializable(KEY_EXHIBIT_PAGES, (Serializable) exhibitPages);
    outState.putInt(KEY_CURRENT_PAGE_INDEX, currentPageIndex);
    outState.putBoolean(KEY_AUDIO_PLAYING, isAudioPlaying);
    outState.putBoolean(KEY_AUDIO_TOOLBAR_HIDDEN, isAudioToolbarHidden);
    outState.putBundle(KEY_EXTRAS, extras);
}