Example usage for android.os Bundle putStringArrayList

List of usage examples for android.os Bundle putStringArrayList

Introduction

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

Prototype

@Override
public void putStringArrayList(@Nullable String key, @Nullable ArrayList<String> value) 

Source Link

Document

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

Usage

From source file:com.hivewallet.androidclient.wallet.AddressBookProvider.java

@Override
public Bundle call(String method, String arg, Bundle extras) {
    if (method.equals(METHOD_INSERT_OR_UPDATE_PHOTO_URI)) {
        if (arg == null)
            return null;

        boolean alreadyPresent = helper.insertOrUpdatePhotoAsset(arg);
        Bundle bundle = new Bundle();
        bundle.putBoolean(PHOTO_URI_PRESENT, alreadyPresent);

        return bundle;
    } else if (method.equals(METHOD_DELETE_STALE_PHOTO_URIS)) {
        ArrayList<String> stalePhotoUris = helper.deleteStalePhotoAssets();
        Bundle bundle = new Bundle();
        bundle.putStringArrayList(STALE_PHOTO_URIS, stalePhotoUris);

        return bundle;
    } else if (method.equals(METHOD_SET_PHOTO_ASSET_AS_PERMANENT)) {
        if (arg == null)
            return null;

        helper.setPhotoAssetAsPermanent(arg, true);
        return null;
    } else {/* ww  w.jav a2 s . c o m*/
        throw new UnsupportedOperationException("Unknown method: " + method);
    }
}

From source file:com.github.jberkel.pay.me.IabHelper.java

private int querySkuDetails(ItemType itemType, Inventory inv, List<String> moreSkus)
        throws RemoteException, JSONException {
    logDebug("Querying SKU details.");
    ArrayList<String> skuList = new ArrayList<String>();
    skuList.addAll(inv.getAllOwnedSkus(itemType));
    if (moreSkus != null) {
        for (String sku : moreSkus) {
            if (!skuList.contains(sku)) {
                skuList.add(sku);/*from  w ww .  j a v  a 2  s  .  c  o m*/
            }
        }
    }
    if (skuList.isEmpty()) {
        logDebug("querySkuDetails: nothing to do because there are no SKUs.");
        return OK.code;
    }

    // TODO: check for 20 SKU limit + add batching ?
    Bundle querySkus = new Bundle();
    querySkus.putStringArrayList(GET_SKU_DETAILS_ITEM_LIST, skuList);
    Bundle skuDetails = mService.getSkuDetails(API_VERSION, mContext.getPackageName(), itemType.toString(),
            querySkus);
    if (skuDetails == null)
        return IABHELPER_BAD_RESPONSE.code;

    if (!skuDetails.containsKey(RESPONSE_GET_SKU_DETAILS_LIST)) {
        int response = getResponseCodeFromBundle(skuDetails);
        if (response != OK.code) {
            logWarn("getSkuDetails() failed: " + getDescription(response));
            return response;
        } else {
            logError("getSkuDetails() returned a bundle with neither an error nor a detail list.");
            return IABHELPER_BAD_RESPONSE.code;
        }
    }
    ArrayList<String> responseList = skuDetails.getStringArrayList(RESPONSE_GET_SKU_DETAILS_LIST);
    for (String json : responseList) {
        inv.addSkuDetails(new SkuDetails(json));
    }
    return OK.code;
}

From source file:org.proninyaroslav.libretorrent.fragments.DetailTorrentTrackersFragment.java

@Override
public void onSaveInstanceState(Bundle outState) {
    if (layoutManager != null) {
        listTrackerState = layoutManager.onSaveInstanceState();
    }/*w  w w.j  av a2 s  . com*/
    outState.putParcelable(TAG_LIST_TRACKER_STATE, listTrackerState);
    outState.putSerializable(TAG_TRACKER_LIST, trackers);
    if (adapter != null) {
        outState.putIntegerArrayList(TAG_SELECTABLE_ADAPTER, adapter.getSelectedItems());
    }
    outState.putBoolean(TAG_IN_ACTION_MODE, inActionMode);
    outState.putStringArrayList(TAG_SELECTED_TRACKERS, selectedTrackers);

    super.onSaveInstanceState(outState);
}

From source file:com.miz.mizuu.fragments.IdentifyTvShowEpisodeFragment.java

private void updateShow(int id) {
    if (MizLib.isOnline(getActivity())) {
        Toast.makeText(getActivity(), getString(R.string.updatingShowInfo), Toast.LENGTH_LONG).show();

        Intent identifyService = new Intent(getActivity(), IdentifyTvShowEpisodeService.class);
        Bundle b = new Bundle();
        b.putString("oldShowId", mShowId);
        b.putString("newShowId", mAdapter.getItem(id).getId());
        b.putString("language", getSelectedLanguage());
        b.putStringArrayList("filepaths", mFilepaths);
        identifyService.putExtras(b);// ww w . ja  v a 2 s. com

        getActivity().startService(identifyService);

        getActivity().setResult(Activity.RESULT_OK);
        getActivity().finish();
    } else
        Toast.makeText(getActivity(), getString(R.string.noInternet), Toast.LENGTH_SHORT).show();
}

From source file:org.sufficientlysecure.keychain.ui.CertifyKeyActivity.java

/**
 * kicks off the actual signing process on a background thread
 *//*from w  ww.jav  a  2 s  .  c  om*/
private void startSigning() {

    // Bail out if there is not at least one user id selected
    ArrayList<String> userIds = mUserIdsAdapter.getSelectedUserIds();
    if (userIds.isEmpty()) {
        AppMsg.makeText(CertifyKeyActivity.this, "No User IDs to sign selected!", AppMsg.STYLE_ALERT).show();
        return;
    }

    // Send all information needed to service to sign key in other thread
    Intent intent = new Intent(this, KeychainIntentService.class);

    intent.setAction(KeychainIntentService.ACTION_CERTIFY_KEYRING);

    // fill values for this action
    Bundle data = new Bundle();

    data.putLong(KeychainIntentService.CERTIFY_KEY_MASTER_KEY_ID, mMasterKeyId);
    data.putLong(KeychainIntentService.CERTIFY_KEY_PUB_KEY_ID, mPubKeyId);
    data.putStringArrayList(KeychainIntentService.CERTIFY_KEY_UIDS, userIds);

    intent.putExtra(KeychainIntentService.EXTRA_DATA, data);

    // Message is received after signing is done in KeychainIntentService
    KeychainIntentServiceHandler saveHandler = new KeychainIntentServiceHandler(this,
            getString(R.string.progress_signing), ProgressDialog.STYLE_SPINNER) {
        public void handleMessage(Message message) {
            // handle messages by standard KeychainIntentServiceHandler first
            super.handleMessage(message);

            if (message.arg1 == KeychainIntentServiceHandler.MESSAGE_OKAY) {

                AppMsg.makeText(CertifyKeyActivity.this, R.string.key_certify_success, AppMsg.STYLE_INFO)
                        .show();

                // check if we need to send the key to the server or not
                if (mUploadKeyCheckbox.isChecked()) {
                    // upload the newly signed key to the keyserver
                    uploadKey();
                } else {
                    setResult(RESULT_OK);
                    finish();
                }
            }
        }
    };

    // Create a new Messenger for the communication back
    Messenger messenger = new Messenger(saveHandler);
    intent.putExtra(KeychainIntentService.EXTRA_MESSENGER, messenger);

    // show progress dialog
    saveHandler.showProgressDialog(this);

    // start service with intent
    startService(intent);
}

From source file:org.sufficientlysecure.keychain.ui.CertifyKeyActivity.java

/**
 * kicks off the actual signing process on a background thread
 */// ww  w  .  j av a  2  s.  c o  m
private void startRevokation() {

    // Bail out if there is not at least one user id selected
    ArrayList<String> userIds = mUserIdsAdapter.getSelectedUserIds();
    if (userIds.isEmpty()) {
        AppMsg.makeText(CertifyKeyActivity.this, "No User IDs to sign selected!", AppMsg.STYLE_ALERT).show();
        return;
    }

    // Send all information needed to service to sign key in other thread
    Intent intent = new Intent(this, KeychainIntentService.class);

    intent.setAction(KeychainIntentService.ACTION_REVOKE_KEYRING);

    // fill values for this action
    Bundle data = new Bundle();

    data.putLong(KeychainIntentService.CERTIFY_KEY_MASTER_KEY_ID, mMasterKeyId);
    data.putLong(KeychainIntentService.CERTIFY_KEY_PUB_KEY_ID, mPubKeyId);
    data.putStringArrayList(KeychainIntentService.CERTIFY_KEY_UIDS, userIds);

    intent.putExtra(KeychainIntentService.EXTRA_DATA, data);

    // Message is received after signing is done in KeychainIntentService
    KeychainIntentServiceHandler saveHandler = new KeychainIntentServiceHandler(this,
            getString(R.string.progress_signing), ProgressDialog.STYLE_SPINNER) {
        public void handleMessage(Message message) {
            // handle messages by standard KeychainIntentServiceHandler first
            super.handleMessage(message);

            if (message.arg1 == KeychainIntentServiceHandler.MESSAGE_OKAY) {

                AppMsg.makeText(CertifyKeyActivity.this, R.string.key_revokation_success, AppMsg.STYLE_INFO)
                        .show();

                // check if we need to send the key to the server or not
                if (mUploadKeyCheckbox.isChecked()) {
                    // upload the newly signed key to the keyserver
                    uploadKey();
                } else {
                    setResult(RESULT_OK);
                    finish();
                }
            }
        }
    };

    // Create a new Messenger for the communication back
    Messenger messenger = new Messenger(saveHandler);
    intent.putExtra(KeychainIntentService.EXTRA_MESSENGER, messenger);

    // show progress dialog
    saveHandler.showProgressDialog(this);

    // start service with intent
    startService(intent);
}

From source file:org.sufficientlysecure.keychain.ui.CertifyKeyActivity.java

/**
 * kicks off the actual signing process on a background thread
 *//*from   w  w w  .  j ava 2  s .c o m*/
private void startRevokation() {

    // Bail out if there is not at least one user id selected
    ArrayList<String> userIds = mUserIdsAdapter.getSelectedUserIds();
    if (userIds.isEmpty()) {
        AppMsg.makeText(CertifyKeyActivity.this, "No User IDs to sign selected!", AppMsg.STYLE_ALERT).show();
        return;
    }

    // Send all information needed to service to sign key in other thread
    Intent intent = new Intent(this, KeychainIntentService.class);

    intent.setAction(KeychainIntentService.ACTION_REVOKE_KEYRING);

    // fill values for this action
    Bundle data = new Bundle();

    data.putLong(KeychainIntentService.CERTIFY_KEY_MASTER_KEY_ID, mMasterKeyId);
    data.putLong(KeychainIntentService.CERTIFY_KEY_PUB_KEY_ID, mPubKeyId);
    data.putStringArrayList(KeychainIntentService.CERTIFY_KEY_UIDS, userIds);

    intent.putExtra(KeychainIntentService.EXTRA_DATA, data);

    // Message is received after signing is done in KeychainIntentService
    KeychainIntentServiceHandler saveHandler = new KeychainIntentServiceHandler(this,
            getString(R.string.progress_signing), ProgressDialog.STYLE_SPINNER) {
        public void handleMessage(Message message) {
            // handle messages by standard KeychainIntentServiceHandler first
            super.handleMessage(message);

            if (message.arg1 == KeychainIntentServiceHandler.MESSAGE_OKAY) {

                AppMsg.makeText(CertifyKeyActivity.this, R.string.key_certify_success, AppMsg.STYLE_INFO)
                        .show();

                // check if we need to send the key to the server or not
                if (mUploadKeyCheckbox.isChecked()) {
                    // upload the newly signed key to the keyserver
                    uploadKey();
                } else {
                    setResult(RESULT_OK);
                    finish();
                }
            }
        }
    };

    // Create a new Messenger for the communication back
    Messenger messenger = new Messenger(saveHandler);
    intent.putExtra(KeychainIntentService.EXTRA_MESSENGER, messenger);

    // show progress dialog
    saveHandler.showProgressDialog(this);

    // start service with intent
    startService(intent);
}

From source file:eu.dirtyharry.androidopsiadmin.Main.java

public void getOpsiClientsTask() {
    final ProgressDialog dialog = ProgressDialog.show(Main.this, getString(R.string.gen_title_pleasewait),
            getString(R.string.pd_getclients), true);
    final Handler handler = new Handler() {
        public void handleMessage(Message msg) {
            dialog.dismiss();//w  w  w  .j  a v  a2s .co m
            if (GlobalVar.getInstance().getError().equals("null")) {
                if (doit.equals("true")) {

                    Intent i = new Intent(Main.this, ShowOpsiClientsListView.class);
                    Bundle b = new Bundle();
                    b.putStringArrayList("allclients", allclients);
                    b.putStringArrayList("clientdescriptions", clientdescription);
                    b.putStringArrayList("clientmacs", clientmac);
                    b.putStringArrayList("clientnotes", clientnotes);
                    b.putStringArrayList("clientips", clientip);
                    b.putStringArrayList("clientinventorys", clientinventory);
                    b.putStringArrayList("clientlastseens", clientlastseen);
                    i.putExtras(b);
                    startActivityForResult(i, GET_OPSI_CLIENT_REQUEST);

                } else if (doit.equals("serverdown")) {
                    Toast.makeText(Main.this, String.format(getString(R.string.to_servernotrechable), serverip),
                            Toast.LENGTH_LONG).show();
                }
            } else {
                new Functions().msgBox(Main.this, getString(R.string.gen_title_error),
                        GlobalVar.getInstance().getError(), false);
                // GlobalVar.getInstance().setError("null");
            }

        }
    };

    checkUpdate = new Thread() {
        public void run() {
            Looper.prepare();
            if (Networking.isServerUp(serverip, serverport, serverusername, serverpasswd)) {
                getOpsiClients("rpc", serverip, serverport, "host_getHashes", serverusername, serverpasswd);
                doit = "true";
            } else {
                doit = "serverdown";
                //
            }

            handler.sendEmptyMessage(0);

        }
    };
    checkUpdate.start();
    // RTM ????
    // checkUpdate.interrupt();
}

From source file:org.kontalk.billing.GoogleBillingService.java

int querySkuDetails(String itemType, Inventory inv, List<String> moreSkus)
        throws RemoteException, JSONException {
    logDebug("Querying SKU details.");
    ArrayList<String> skuList = new ArrayList<String>();
    skuList.addAll(inv.getAllOwnedSkus(itemType));
    if (moreSkus != null) {
        for (String sku : moreSkus) {
            if (!skuList.contains(sku)) {
                skuList.add(sku);/*ww w .j  a  v a 2  s .com*/
            }
        }
    }

    if (skuList.size() == 0) {
        logDebug("queryPrices: nothing to do because there are no SKUs.");
        return BILLING_RESPONSE_RESULT_OK;
    }

    Bundle querySkus = new Bundle();
    querySkus.putStringArrayList(GET_SKU_DETAILS_ITEM_LIST, skuList);
    Bundle skuDetails = mService.getSkuDetails(3, mContext.getPackageName(), itemType, querySkus);

    if (!skuDetails.containsKey(RESPONSE_GET_SKU_DETAILS_LIST)) {
        int response = getResponseCodeFromBundle(skuDetails);
        if (response != BILLING_RESPONSE_RESULT_OK) {
            logDebug("getSkuDetails() failed: " + getResponseDesc(response));
            return response;
        } else {
            logError("getSkuDetails() returned a bundle with neither an error nor a detail list.");
            return IABHELPER_BAD_RESPONSE;
        }
    }

    ArrayList<String> responseList = skuDetails.getStringArrayList(RESPONSE_GET_SKU_DETAILS_LIST);

    for (String thisResponse : responseList) {
        ProductDetails d = new ProductDetails(itemType, thisResponse);
        logDebug("Got sku details: " + d);
        inv.addSkuDetails(d);
    }
    return BILLING_RESPONSE_RESULT_OK;
}

From source file:pl.mrwojtek.sensrec.app.Records.java

@Override
public void onSaveInstanceState(Bundle outState) {
    ArrayList<String> activated = new ArrayList<>();
    for (RecordEntry recordEntry : records) {
        if (recordEntry.isActivated()) {
            activated.add(recordEntry.getFile().getPath());
        }/*from   w  w  w  .j a  v a  2 s  .c o  m*/
    }
    outState.putStringArrayList(PARAM_ACTIVATED, activated);
}