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.locosoft.imageselector.MultiImageSelectorActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    mFakeR = new FakeR(this);
    setContentView(mFakeR.getId("layout", "activity_image_selector"));

    Intent intent = getIntent();//  w  w  w . ja  v a 2 s. com
    mDefaultCount = intent.getIntExtra(EXTRA_SELECT_COUNT, 9);
    int mode = intent.getIntExtra(EXTRA_SELECT_MODE, MODE_MULTI);
    boolean isShow = intent.getBooleanExtra(EXTRA_SHOW_CAMERA, true);
    if (mode == MODE_MULTI && intent.hasExtra(EXTRA_DEFAULT_SELECTED_LIST)) {
        resultList = intent.getStringArrayListExtra(EXTRA_DEFAULT_SELECTED_LIST);
    }

    desiredWidth = intent.getIntExtra(EXTRA_WIDTH, 0);
    desiredHeight = intent.getIntExtra(EXTRA_HEIGHT, 0);
    quality = intent.getIntExtra(EXTRA_QUALITY, 0);
    fixRotation = intent.getBooleanExtra(EXTRA_FIXROTATION, false);

    Bundle bundle = new Bundle();
    bundle.putInt(MultiImageSelectorFragment.EXTRA_SELECT_COUNT, mDefaultCount);
    bundle.putInt(MultiImageSelectorFragment.EXTRA_SELECT_MODE, mode);
    bundle.putBoolean(MultiImageSelectorFragment.EXTRA_SHOW_CAMERA, isShow);
    bundle.putStringArrayList(MultiImageSelectorFragment.EXTRA_DEFAULT_SELECTED_LIST, resultList);

    getSupportFragmentManager().beginTransaction().add(mFakeR.getId("id", "imageselector_image_grid"),
            Fragment.instantiate(this, MultiImageSelectorFragment.class.getName(), bundle)).commit();

    // back button
    findViewById(mFakeR.getId("id", "imageselector_btn_back")).setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            setResult(RESULT_CANCELED);
            finish();
        }
    });

    // done button
    mSubmitButton = (Button) findViewById(mFakeR.getId("id", "imageselector_commit"));
    if (resultList == null || resultList.size() <= 0) {
        mSubmitButton.setText(mFakeR.getId("string", "imageselector_done"));
        mSubmitButton.setEnabled(false);
    } else {
        mSubmitButton.setText(getResources().getString(mFakeR.getId("string", "imageselector_done")) + "("
                + resultList.size() + "/" + mDefaultCount + ")");

        mSubmitButton.setEnabled(true);
    }
    mSubmitButton.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            if (resultList != null && resultList.size() > 0) {
                // return the selection array list
                if (desiredHeight == 0 && desiredWidth == 0 && quality == 100 && !fixRotation) {
                    Intent data = new Intent();
                    data.putStringArrayListExtra(EXTRA_RESULT, resultList);
                    setResult(RESULT_OK, data);
                    finish();
                } else {
                    postProcessImages();
                }
            }
        }
    });

    progress = new ProgressDialog(this);
    progress.setTitle(getResources().getString(mFakeR.getId("string", "imageselector_progress_title")));
    progress.setMessage(getResources().getString(mFakeR.getId("string", "imageselector_progress_content")));
}

From source file:com.ijiaban.yinxiang.MainActivity.java

@Override
public void sendGroup(List<String> list) {
    Fragment fr = new LocalImageFragment();
    FragmentManager fm = getSupportFragmentManager();
    FragmentTransaction ft = fm.beginTransaction();
    Bundle bundle = new Bundle();
    bundle.putStringArrayList("data", (ArrayList<String>) list);
    fr.setArguments(bundle);//from w w  w.  ja  va 2s. c  o m
    ft.addToBackStack("groupframetag");
    ft.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_FADE);
    ft.replace(R.id.groupframe, fr);
    ft.commit();
    isTop = true;
}

From source file:link.kjr.file_manager.MainActivity.java

@Override
protected void onSaveInstanceState(Bundle savedInstanceState) {
    Log.i(BuildConfig.APPLICATION_ID, "onSaveInstance called");
    savedInstanceState.putStringArrayList("tabs", p);
    savedInstanceState.putString("currentPath", currentPath);
    savedInstanceState.putStringArrayList("selectedFiles", selectedFiles);
}

From source file:com.soomla.store.billing.nokia.NokiaIabHelper.java

/**
 * Queries a chunk of SKU details to prevent Google's 20 items bug.
 *
 * @throws RemoteException/*  w  ww . j  av  a2 s .co  m*/
 * @throws JSONException
 */
private int querySkuDetailsChunk(String itemType, IabInventory inv, ArrayList<String> chunkSkuList)
        throws RemoteException, JSONException {
    Bundle querySkus = new Bundle();
    querySkus.putStringArrayList(GET_SKU_DETAILS_ITEM_LIST, chunkSkuList);
    Bundle skuDetails = mService.getProductDetails(3, SoomlaApp.getAppContext().getPackageName(), itemType,
            querySkus);

    if (!skuDetails.containsKey(RESPONSE_GET_SKU_DETAILS_LIST)) {
        int response = getResponseCodeFromBundle(skuDetails);
        if (response != IabResult.BILLING_RESPONSE_RESULT_OK) {
            SoomlaUtils.LogDebug(TAG, "querySkuDetailsChunk() failed: " + IabResult.getResponseDesc(response));
            return response;
        } else {
            SoomlaUtils.LogError(TAG,
                    "querySkuDetailsChunk() returned a bundle with neither an error nor a detail list.");
            return IabResult.IABHELPER_BAD_RESPONSE;
        }
    }

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

    for (String thisResponse : responseList) {
        IabSkuDetails d = new IabSkuDetails(itemType, thisResponse);
        SoomlaUtils.LogDebug(TAG, "Got sku details: " + d);
        inv.addSkuDetails(d);
    }

    return IabResult.BILLING_RESPONSE_RESULT_OK;
}

From source file:com.nextgis.libngui.dialog.LocalResourceSelectDialog.java

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

    mSavedPathList = new ArrayList<>(mAdapter.getSelectedItemCount());
    List<LocalResourceListItem> items = mAdapter.getSelectedItems();
    for (LocalResourceListItem item : items) {
        mSavedPathList.add(item.getFile().getAbsolutePath());
    }//www .  j  a v a 2  s .c o m

    outState.putSerializable(KEY_PATH, mPath);
    outState.putInt(KEY_MASK, mTypeMask);
    outState.putBoolean(KEY_CAN_SEL_MULTI, mCanSelectMulti);
    outState.putBoolean(KEY_WRITABLE, mCanWrite);
    outState.putStringArrayList(KEY_SELECTED_ITEMS, mSavedPathList);
}

From source file:com.soomla.store.billing.google.GoogleIabHelper.java

/**
 * Queries a chunk of SKU details to prevent Google's 20 items bug.
 *
 * @throws RemoteException//  w  w w.ja v  a2 s .  c o  m
 * @throws JSONException
 */
private int querySkuDetailsChunk(String itemType, IabInventory inv, ArrayList<String> chunkSkuList)
        throws RemoteException, JSONException {
    Bundle querySkus = new Bundle();
    querySkus.putStringArrayList(GET_SKU_DETAILS_ITEM_LIST, chunkSkuList);
    Bundle skuDetails = mService.getSkuDetails(3, SoomlaApp.getAppContext().getPackageName(), itemType,
            querySkus);

    if (!skuDetails.containsKey(RESPONSE_GET_SKU_DETAILS_LIST)) {
        int response = getResponseCodeFromBundle(skuDetails);
        if (response != IabResult.BILLING_RESPONSE_RESULT_OK) {
            SoomlaUtils.LogDebug(TAG, "querySkuDetailsChunk() failed: " + IabResult.getResponseDesc(response));
            return response;
        } else {
            SoomlaUtils.LogError(TAG,
                    "querySkuDetailsChunk() returned a bundle with neither an error nor a detail list.");
            return IabResult.IABHELPER_BAD_RESPONSE;
        }
    }

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

    for (String thisResponse : responseList) {
        IabSkuDetails d = new IabSkuDetails(itemType, thisResponse);
        SoomlaUtils.LogDebug(TAG, "Got sku details: " + d);
        inv.addSkuDetails(d);
    }

    return IabResult.BILLING_RESPONSE_RESULT_OK;
}

From source file:com.rjfun.cordova.qq.QQPlugin.java

public boolean share(JSONObject args) {
    Log.d(LOGTAG, "share");

    if (!this.inited) {
        this.mTencent = Tencent.createInstance(this.appId, this.getActivity().getApplicationContext());
        this.inited = true;
    }//from   w w  w  .j  av  a 2s .  c  om

    String message = args.optString(OPT_MESSAGE);
    String subject = args.optString(OPT_SUBJECT);
    String image = args.optString(OPT_IMAGE);
    String url = args.optString(OPT_URL);

    final boolean qqZone = args.optBoolean(OPT_QQZONE);
    final Bundle params = new Bundle();
    if (qqZone) {
        params.putInt(QzoneShare.SHARE_TO_QZONE_KEY_TYPE, QzoneShare.SHARE_TO_QZONE_TYPE_IMAGE_TEXT);
        params.putString(QzoneShare.SHARE_TO_QQ_TITLE, subject);
        params.putString(QzoneShare.SHARE_TO_QQ_SUMMARY, message);
        params.putString(QzoneShare.SHARE_TO_QQ_TARGET_URL, url);
        ArrayList<String> images = new ArrayList<String>();
        images.add(image);
        params.putStringArrayList(QQShare.SHARE_TO_QQ_IMAGE_URL, images);
        params.putString(QzoneShare.SHARE_TO_QQ_APP_NAME, this.appName + "" + this.appId);

    } else {
        params.putInt(QQShare.SHARE_TO_QQ_KEY_TYPE, QQShare.SHARE_TO_QQ_TYPE_DEFAULT);
        params.putString(QQShare.SHARE_TO_QQ_TITLE, subject);
        params.putString(QQShare.SHARE_TO_QQ_SUMMARY, message);
        params.putString(QQShare.SHARE_TO_QQ_TARGET_URL, url);
        params.putString(QzoneShare.SHARE_TO_QQ_IMAGE_URL, image);
        params.putString(QQShare.SHARE_TO_QQ_APP_NAME, this.appName + "" + this.appId);
        //params.putInt(QQShare.SHARE_TO_QQ_EXT_INT,  0);
    }

    final Activity activity = this.getActivity();
    final IUiListener qqDelegate = this;
    activity.runOnUiThread(new Runnable() {
        @Override
        public void run() {
            if (qqZone) {
                mTencent.shareToQzone(activity, params, qqDelegate);
            } else {
                mTencent.shareToQQ(activity, params, qqDelegate);
            }
        }
    });

    return true;
}

From source file:com.paranoid.gerrit.ChangeListFragment.java

public boolean processTokens(Set<SearchKeyword> tokens) {
    Bundle bundle = new Bundle();

    if (tokens != null && !tokens.isEmpty()) {
        String where = SearchKeyword.constructDbSearchQuery(tokens);
        if (where != null && !where.isEmpty()) {
            ArrayList<String> bindArgs = new ArrayList<>();
            for (SearchKeyword token : tokens) {
                bindArgs.addAll(Arrays.asList(token.getEscapeArgument()));
            }//w  w  w. j a  v a2s  .co m

            bundle.putString("WHERE", where);
            bundle.putStringArrayList("BIND_ARGS", bindArgs);
        } else {
            return false;
        }
    }
    Intent intent = new Intent(CardsFragment.SEARCH_QUERY);
    intent.putExtras(bundle);
    LocalBroadcastManager.getInstance(mParent).sendBroadcast(intent);
    return true;
}

From source file:com.soomla.store.billing.nokia.NokiaIabHelper.java

/**
 * Restores purchases from Nokia Store/*from   w ww  .  jav  a2s .com*/
 *
 * @throws JSONException
 * @throws RemoteException
 */
private int queryPurchases(IabInventory inv, String itemType) throws JSONException, RemoteException {
    // Query purchases
    SoomlaUtils.LogDebug(TAG, "Querying owned items, item type: " + itemType);
    SoomlaUtils.LogDebug(TAG, "Package name: " + SoomlaApp.getAppContext().getPackageName());
    boolean verificationFailed = false;
    String continueToken = null;

    //TODO: Tofix
    ArrayList<String> products = new ArrayList<String>(StoreInfo.getAllProductIds());
    Bundle queryBundle = new Bundle();
    queryBundle.putStringArrayList("ITEM_ID_LIST", products);

    do {
        SoomlaUtils.LogDebug(TAG, "Calling getPurchases with continuation token: " + continueToken);
        Bundle ownedItems = mService.getPurchases(3, SoomlaApp.getAppContext().getPackageName(),
                ITEM_TYPE_INAPP, queryBundle, continueToken);

        int response = getResponseCodeFromBundle(ownedItems);
        SoomlaUtils.LogDebug(TAG, "Owned items response: " + String.valueOf(response));
        if (response != IabResult.BILLING_RESPONSE_RESULT_OK) {
            SoomlaUtils.LogDebug(TAG, "getPurchases() failed: " + IabResult.getResponseDesc(response));
            return response;
        }
        if (!ownedItems.containsKey(RESPONSE_INAPP_ITEM_LIST)
                || !ownedItems.containsKey(RESPONSE_INAPP_PURCHASE_DATA_LIST)
        //|| !ownedItems.containsKey(RESPONSE_INAPP_SIGNATURE_LIST)
        ) {
            SoomlaUtils.LogError(TAG, "Bundle returned from getPurchases() doesn't contain required fields.");
            return IabResult.IABHELPER_BAD_RESPONSE;
        }

        ArrayList<String> ownedSkus = ownedItems.getStringArrayList(RESPONSE_INAPP_ITEM_LIST);
        ArrayList<String> purchaseDataList = ownedItems.getStringArrayList(RESPONSE_INAPP_PURCHASE_DATA_LIST);

        SharedPreferences prefs = SoomlaApp.getAppContext().getSharedPreferences(SoomlaConfig.PREFS_NAME,
                Context.MODE_PRIVATE);
        String publicKey = prefs.getString(NokiaStoreIabService.PUBLICKEY_KEY, "");
        for (int i = 0; i < purchaseDataList.size(); ++i) {
            String purchaseData = purchaseDataList.get(i);
            String sku = ownedSkus.get(i);
            if (Security.verifyPurchase(publicKey, purchaseData)) {
                SoomlaUtils.LogDebug(TAG, "Sku is owned: " + sku);
                IabPurchase purchase = new IabPurchase(itemType, purchaseData, "");

                if (TextUtils.isEmpty(purchase.getToken())) {
                    SoomlaUtils.LogWarning(TAG, "BUG: empty/null token!");
                    SoomlaUtils.LogDebug(TAG, "IabPurchase data: " + purchaseData);
                }

                // Record ownership and token
                inv.addPurchase(purchase);
            } else {
                SoomlaUtils.LogWarning(TAG, "IabPurchase signature verification **FAILED**. Not adding item.");
                SoomlaUtils.LogDebug(TAG, "   IabPurchase data: " + purchaseData);
                verificationFailed = true;
            }
        }

        continueToken = ownedItems.getString(INAPP_CONTINUATION_TOKEN);
        SoomlaUtils.LogDebug(TAG, "Continuation token: " + continueToken);
    } while (!TextUtils.isEmpty(continueToken));

    return verificationFailed ? IabResult.IABHELPER_VERIFICATION_FAILED : IabResult.BILLING_RESPONSE_RESULT_OK;
}

From source file:org.ale.scanner.zotero.MainActivity.java

@Override
public void onSaveInstanceState(Bundle state) {
    super.onSaveInstanceState(state);
    state.putStringArrayList(RC_PEND, mPendingItems);
    state.putIntegerArrayList(RC_PEND_STAT, mPendingStatus);
    state.putIntArray(RC_CHECKED, mItemAdapter.getChecked());
    state.putParcelable(RC_ACCESS, mAccountAccess);
    state.putInt(RC_UPLOADING, mUploadState);
    state.putSparseParcelableArray(RC_GROUPS, mGroups);
}