List of usage examples for android.os Bundle putStringArrayList
@Override public void putStringArrayList(@Nullable String key, @Nullable ArrayList<String> value)
From source file:com.money.manager.ex.fragment.SearchFragment.java
/** * Compose arguments and execute search/*from w w w . j av a2 s. c o m*/ */ public void executeSearch() { ArrayList<String> whereClause = new ArrayList<String>(); //account if (spinAccount.getSelectedItemPosition() != AdapterView.INVALID_POSITION && mAccountIdList.get(spinAccount.getSelectedItemPosition()) != -1) { whereClause.add( ViewMobileData.ACCOUNTID + "=" + mAccountIdList.get(spinAccount.getSelectedItemPosition())); } //checkbox if (cbxDeposit.isChecked() || cbxTransfer.isChecked() || cbxWithdrawal.isChecked()) { whereClause.add(ViewMobileData.TransactionType + " IN (" + (cbxDeposit.isChecked() ? "'Deposit'" : "''") + "," + (cbxTransfer.isChecked() ? "'Transfer'" : "''") + "," + (cbxWithdrawal.isChecked() ? "'Withdrawal'" : "''") + ")"); } //status if (spinStatus.getSelectedItemPosition() > 0) { whereClause.add( ViewMobileData.Status + "='" + mStatusValues.get(spinStatus.getSelectedItemPosition()) + "'"); } //from date if (!TextUtils.isEmpty(txtFromDate.getText())) { whereClause.add(ViewMobileData.Date + ">='" + mApplication.getSQLiteStringDate( mApplication.getDateFromString(String.valueOf(txtFromDate.getText()))) + "'"); } //to date if (!TextUtils.isEmpty(txtToDate.getText())) { whereClause.add(ViewMobileData.Date + "<='" + mApplication.getSQLiteStringDate( mApplication.getDateFromString(String.valueOf(txtToDate.getText()))) + "'"); } //payee if (txtSelectPayee.getTag() != null) { whereClause.add(ViewMobileData.PayeeID + "=" + String.valueOf(txtSelectPayee.getTag())); } //categories if (txtSelectCategory.getTag() != null) { CategorySub categorySub = (CategorySub) txtSelectCategory.getTag(); whereClause.add(ViewMobileData.CategID + "=" + categorySub.categId); if (categorySub.subCategId != -1) whereClause.add(ViewMobileData.SubcategID + "=" + categorySub.subCategId); } //from amount if (txtFromAmount.getTag() != null) { whereClause.add(ViewMobileData.Amount + ">=" + String.valueOf(txtFromAmount.getTag())); } //to amount if (txtToAmount.getTag() != null) { whereClause.add(ViewMobileData.Amount + "<=" + String.valueOf(txtToAmount.getTag())); } //transaction number if (!TextUtils.isEmpty(edtTransNumber.getText())) { whereClause.add(ViewMobileData.TransactionNumber + " LIKE '" + edtTransNumber.getText() + "'"); } //note if (!TextUtils.isEmpty(edtNotes.getText())) { whereClause.add(ViewMobileData.Notes + " LIKE '" + edtNotes.getText() + "'"); } //create a fragment search AllDataFragment fragment; fragment = (AllDataFragment) getSherlockActivity().getSupportFragmentManager() .findFragmentByTag(AllDataFragment.class.getSimpleName()); if (fragment != null) { getSherlockActivity().getSupportFragmentManager().beginTransaction().remove(fragment).commit(); } fragment = AllDataFragment.newInstance(-1); //create bundle Bundle args = new Bundle(); args.putStringArrayList(AllDataFragment.KEY_ARGUMENTS_WHERE, whereClause); args.putString(AllDataFragment.KEY_ARGUMENTS_SORT, QueryAllData.ACCOUNTID + ", " + QueryAllData.ID); //set arguments fragment.setArguments(args); fragment.setSearResultFragmentLoaderCallbacks((SearchActivity) getSherlockActivity()); fragment.setShownHeader(true); //add fragment FragmentTransaction transaction = getSherlockActivity().getSupportFragmentManager().beginTransaction(); //animation transaction.setCustomAnimations(R.anim.slide_in_right, R.anim.slide_out_left, R.anim.slide_in_right, R.anim.slide_out_left); // Replace whatever is in the fragment_container view with this fragment, // and add the transaction to the back stack if (isDualPanel()) { transaction.add(R.id.fragmentDetail, fragment, AllDataFragment.class.getSimpleName()); } else { transaction.replace(R.id.fragmentContent, fragment, AllDataFragment.class.getSimpleName()); transaction.addToBackStack(null); } // Commit the transaction transaction.commit(); }
From source file:com.nokia.example.pepperfarm.iap.Payment.java
/** * Check the products that we have already purchased *//*w w w. java2s . c om*/ public void getPurchases(boolean ignoreLifeCycleCheck) { if (!isBillingAvailable()) return; if (ignoreLifeCycleCheck == false) { if (purchases_asked) { Log.i("getPurchases", "Restorables already asked."); return; } } MainScreenPepperListFragment.getpeppers.setVisibility(View.INVISIBLE); MainScreenPepperListFragment.fetch_peppers_progressbar.setVisibility(View.VISIBLE); MainScreenPepperListFragment.fetching_peppers.setVisibility(View.VISIBLE); AsyncTask<Void, String, Void> restoreTask = new AsyncTask<Void, String, Void>() { @Override protected Void doInBackground(Void... params) { ArrayList<String> productIdArray = new ArrayList<String>(Content.ITEM_MAP.keySet()); Bundle productBundle = new Bundle(); productBundle.putStringArrayList("ITEM_ID_LIST", productIdArray); try { Bundle purchases = npay.getPurchases(API_VERSION, activity.getPackageName(), ITEM_TYPE_INAPP, productBundle, null); Log.i("getPurchases", "GET PURCHASES RESPONSE CODE: " + purchases.getInt("RESPONSE_CODE", RESULT_ERR)); if (purchases.getInt("RESPONSE_CODE", RESULT_ERR) == RESULT_OK) { ArrayList<String> purchaseDataList = purchases .getStringArrayList("INAPP_PURCHASE_DATA_LIST"); for (String purchaseData : purchaseDataList) { parsePurchaseData(purchaseData); } purchases_asked = true; } else { Log.e("getPurchases", "GET PURCHASES - response was not ok: Result was: " + purchases.getInt("RESPONSE_CODE", RESULT_ERR)); } } catch (JSONException e) { Log.e("getPurchases", "PURCHASE DATA PARSING EXCEPTION: " + e.getMessage(), e); } catch (RemoteException e) { Log.e("getPurchases", "EXCEPTION: " + e.getMessage(), e); } return null; } private void parsePurchaseData(String purchaseData) throws JSONException { Purchase purchase = new Purchase(purchaseData); Product p = Content.ITEM_MAP.get(purchase.getProductId()); if (p != null) { p.setPurchased(purchase); Log.i("getPurchases", "Restoring product " + purchase.getProductId() + " Purchase token: " + purchase.getToken()); } else { Log.i("getPurchases", "Unable to restore product " + purchase.getProductId() + ". Product not found."); } } @Override protected void onPostExecute(Void result) { super.onPostExecute(result); MainScreenPepperListFragment.getpeppers.setVisibility(View.VISIBLE); MainScreenPepperListFragment.fetch_peppers_progressbar.setVisibility(View.GONE); MainScreenPepperListFragment.fetching_peppers.setVisibility(View.GONE); if (ProductListFragment.purchaseListAdapter != null) { ProductListFragment.purchaseListAdapter.notifyDataSetChanged(); } if (MainScreenPepperListFragment.reference.adapter != null) { MainScreenPepperListFragment.reference.adapter.notifyDataSetChanged(); } } }; restoreTask.execute(); }
From source file:com.todoroo.astrid.tags.TagsControlSet.java
@Override public void onSaveInstanceState(Bundle outState) { super.onSaveInstanceState(outState); outState.putParcelableArrayList(EXTRA_SELECTED_TAGS, selectedTags); outState.putStringArrayList(EXTRA_NEW_TAGS, getNewTags()); }
From source file:co.zzyzx.showtimes.android.MainActivity.java
@Override protected void onSaveInstanceState(Bundle outState) { super.onSaveInstanceState(outState); if (savedFavList != null && savedFavList.size() > 0) { outState.putStringArrayList("favList", savedFavList); }//from w w w .j a va 2 s .co m }
From source file:ir.aarani.bazaar.billing.BillingProcessor.java
private List<SkuDetails> getSkuDetails(ArrayList<String> productIdList, String purchaseType) { if (billingService != null && productIdList != null && productIdList.size() > 0) { try {//from w ww . java 2 s .c om Bundle products = new Bundle(); products.putStringArrayList(Constants.PRODUCTS_LIST, productIdList); Bundle skuDetails = billingService.getSkuDetails(Constants.GOOGLE_API_VERSION, contextPackageName, purchaseType, products); int response = skuDetails.getInt(Constants.RESPONSE_CODE); if (response == Constants.BILLING_RESPONSE_RESULT_OK) { ArrayList<SkuDetails> productDetails = new ArrayList<SkuDetails>(); List<String> detailsList = skuDetails.getStringArrayList(Constants.DETAILS_LIST); if (detailsList != null) for (String responseLine : detailsList) { JSONObject object = new JSONObject(responseLine); SkuDetails product = new SkuDetails(object); productDetails.add(product); } return productDetails; } else { if (eventHandler != null) eventHandler.onBillingError(response, null); Log.e(LOG_TAG, String.format("Failed to retrieve info for %d products, %d", productIdList.size(), response)); } } catch (Exception e) { Log.e(LOG_TAG, "Failed to call getSkuDetails", e); if (eventHandler != null) eventHandler.onBillingError(Constants.BILLING_ERROR_SKUDETAILS_FAILED, e); } } return null; }
From source file:com.turbulenz.turbulenz.googlepayment.java
void threadQueryProduct(final String sku, final long context) { ArrayList skuList = new ArrayList(); skuList.add(sku);/*from w w w . j a va 2 s .c o m*/ Bundle productQueryBundle = new Bundle(); productQueryBundle.putStringArrayList("ITEM_ID_LIST", skuList); Bundle skuDetails; try { skuDetails = mService.getSkuDetails(3, mActivity.getPackageName(), ITEM_TYPE_INAPP, productQueryBundle); } catch (RemoteException e) { _error("threadQueryProduct: remote exception: " + e); e.printStackTrace(); sendProductInfoError(context, sku); return; } int response = getResponseCodeFromBundle(skuDetails); if (BILLING_RESPONSE_RESULT_OK != response) { _log("threadQueryProduct: bad response from getSkuDetails: " + response); sendProductInfoError(context, sku); return; } if (!skuDetails.containsKey(RESPONSE_GET_SKU_DETAILS_LIST)) { _log("threadQueryProduct: bundle doens't contain list"); sendProductInfoError(context, sku); return; } ArrayList<String> responseList = skuDetails.getStringArrayList(RESPONSE_GET_SKU_DETAILS_LIST); if (1 != responseList.size()) { _log("threadQueryProduct: repsonse list has unexpected length: " + responseList.size()); sendProductInfoError(context, sku); return; } String responseString = responseList.get(0); try { JSONObject o = new JSONObject(responseString); final String _sku = o.getString("productId"); final String title = o.getString("title"); final String description = o.getString("description"); // TODO: something with price final String price = o.getString("price"); // TOOD: check _sku == sku sendProductInfo(context, sku, title, description, price); } catch (JSONException e) { _error("threadQueryProduct: failed parsing JSON"); sendProductInfoError(context, sku); } }
From source file:com.artemchep.horario.ui.fragments.master.LessonsFragment.java
@Override public void onSaveInstanceState(Bundle outState) { outState.putStringArrayList(SIS_SELECTIONS, mWeekView.getMultiSelector().getSelections()); super.onSaveInstanceState(outState); }
From source file:com.gigathinking.simpleapplock.AppListFragment.java
private void deleteApp(final int position) { String message = ""; UndoBarController.clear(getActivity()); Bundle bundle = new Bundle(); bundle.putStringArrayList(AppLockApplication.APPLIST, new ArrayList<String>(mList)); try {//w w w . j a va 2 s .c o m message = getActivity().getPackageManager().getApplicationLabel( getActivity().getPackageManager().getApplicationInfo(mList.get(position), 0)) + getActivity().getString(R.string.deleted); } catch (PackageManager.NameNotFoundException e) { e.printStackTrace(); } ListViewAnimationHelper helper = new ListViewAnimationHelper(mAdapter, ((AbsListView) getActivity().findViewById(R.id.lv_app_list))); helper.animateRemoval(((AbsListView) getActivity().findViewById(R.id.lv_app_list)), ((AbsListView) getActivity().findViewById(R.id.lv_app_list)).getChildAt(position)); MainActivity.getAppListData().deleteApp(mList.get(position)); mList.remove(position); LocalBroadcastManager.getInstance(getActivity()).sendBroadcast(new Intent(AppLockApplication.UPDATE_LIST)); if (mList.size() == 0) { showInitialStart(true); } UndoBarController.show(getActivity(), message, this, bundle); }
From source file:com.gigathinking.simpleapplock.AppListFragment.java
private void deleteApp(ArrayList<String> items) { UndoBarController.clear(getActivity()); Bundle bundle = new Bundle(); bundle.putStringArrayList(AppLockApplication.APPLIST, new ArrayList<String>(mList)); for (String item : items) { ListViewAnimationHelper helper = new ListViewAnimationHelper(mAdapter, ((AbsListView) getActivity().findViewById(R.id.lv_app_list))); helper.animateRemoval(((AbsListView) getActivity().findViewById(R.id.lv_app_list)), ((AbsListView) getActivity().findViewById(R.id.lv_app_list)).getChildAt(mList.indexOf(item))); MainActivity.getAppListData().deleteApp(item); mList.remove(item);// w w w . j a v a 2s .com } mAdapter.notifyDataSetChanged(); LocalBroadcastManager.getInstance(getActivity()).sendBroadcast(new Intent(AppLockApplication.UPDATE_LIST)); if (mList.size() == 0) { showInitialStart(true); } String message = null; try { message = items.size() > 1 ? "" + items.size() + getActivity().getString(R.string.apps_deleted) : getActivity().getPackageManager().getApplicationLabel( getActivity().getPackageManager().getApplicationInfo(items.get(0), 0)) + getActivity().getString(R.string.deleted); } catch (PackageManager.NameNotFoundException e) { e.printStackTrace(); } UndoBarController.show(getActivity(), message, this, bundle); }