List of usage examples for android.os Bundle containsKey
public boolean containsKey(String key)
From source file:com.abplus.surroundcalc.billing.BillingHelper.java
int querySkuDetails(Inventory inv, List<String> moreSkus) throws RemoteException, JSONException { ArrayList<String> skuList = new ArrayList<String>(); skuList.addAll(inv.getAllOwnedSkus(ITEM_TYPE_INAPP)); if (moreSkus != null) skuList.addAll(moreSkus);/*from w w w . j a va 2 s . c o m*/ if (skuList.size() == 0) { return BILLING_RESPONSE_RESULT_OK; } Bundle querySkus = new Bundle(); querySkus.putStringArrayList(GET_SKU_DETAILS_ITEM_LIST, skuList); Bundle skuDetails = connection.getSkuDetails(querySkus); if (!skuDetails.containsKey(RESPONSE_GET_SKU_DETAILS_LIST)) { int response = getResponseCodeFromBundle(skuDetails); if (response != BILLING_RESPONSE_RESULT_OK) { return response; } else { return HELPER_BAD_RESPONSE; } } ArrayList<String> responseList = skuDetails.getStringArrayList(RESPONSE_GET_SKU_DETAILS_LIST); for (String thisResponse : responseList) { SkuDetails d = new SkuDetails(thisResponse); inv.addSkuDetails(d); } return BILLING_RESPONSE_RESULT_OK; }
From source file:de.geeksfactory.opacclient.frontend.OpacActivity.java
@Override public void onCreate(Bundle savedInstanceState) { supportRequestWindowFeature(android.view.Window.FEATURE_INDETERMINATE_PROGRESS); super.onCreate(savedInstanceState); setContentView(getContentView());// w w w . j av a2 s. c o m app = (OpacClient) getApplication(); aData = new AccountDataSource(this); setupDrawer(); if (savedInstanceState != null) { setTwoPane(savedInstanceState.getBoolean("twoPane")); if (savedInstanceState.containsKey("title")) { setTitle(savedInstanceState.getCharSequence("title")); } if (savedInstanceState.containsKey("fragment")) { fragment = (Fragment) getSupportFragmentManager().getFragment(savedInstanceState, "fragment"); getSupportFragmentManager().beginTransaction().replace(R.id.content_frame, fragment).commit(); } } }
From source file:com.amazonaws.mobileconnectors.pinpoint.targeting.notification.NotificationClient.java
private CampaignPushResult handleCampaignPush(final String from, final Bundle data, final Class<?> targetClass, String intentAction) {/*ww w .j a v a 2 s.c o m*/ // Check if push data contains a Campaign Id if (!data.containsKey(CAMPAIGN_ID_PUSH_KEY)) { return CampaignPushResult.NOT_HANDLED; } final boolean isAppInForeground = appUtil.isAppInForeground(); final String imageUrl = data.getString(CAMPAIGN_IMAGE_PUSH_KEY); final String imageIconUrl = data.getString(CAMPAIGN_IMAGE_ICON_PUSH_KEY); final String imageSmallIconUrl = data.getString(CAMPAIGN_IMAGE_SMALL_ICON_PUSH_KEY); final Map<String, String> campaignAttributes = new HashMap<String, String>(); campaignAttributes.put(CAMPAIGN_ID_ATTRIBUTE_KEY, data.getString(CAMPAIGN_ID_PUSH_KEY)); campaignAttributes.put(CAMPAIGN_TREATMENT_ID_ATTRIBUTE_KEY, data.getString(CAMPAIGN_TREATMENT_ID_PUSH_KEY)); campaignAttributes.put(CAMPAIGN_ACTIVITY_ID_ATTRIBUTE_KEY, data.getString(CAMPAIGN_ACTIVITY_ID_PUSH_KEY)); this.pinpointContext.getAnalyticsClient().setCampaignAttributes(campaignAttributes); log.info("Campaign Attributes are:" + campaignAttributes); if (AWS_EVENT_TYPE_OPENED.equals(from)) { return this.handleNotificationOpen(campaignAttributes, data); } if (campaignAttributes != null) { // Create the push event. String eventType = null; if (isAppInForeground) { eventType = AWS_EVENT_TYPE_RECEIVED_FOREGROUND; } else { eventType = AWS_EVENT_TYPE_RECEIVED_BACKGROUND; } final AnalyticsEvent pushEvent = this.pinpointContext.getAnalyticsClient().createEvent(eventType); // Add the campaign attributes. addCampaignAttributesToEvent(pushEvent, campaignAttributes); pushEvent.addAttribute("isAppInForeground", Boolean.toString(isAppInForeground)); try { // Ignore whether the app is in the foreground if the configuration indicates it should post // notifications in the foreground. if (!pinpointContext.getPinpointConfiguration().getShouldPostNotificationsInForeground() && isAppInForeground) { // Notify the caller that the app was in the foreground. return CampaignPushResult.APP_IN_FOREGROUND; } else { // Display a notification with an icon, title, message, // image, and default sound. if ("1".equalsIgnoreCase(data.getString(NOTIFICATION_SILENT_PUSH_KEY))) { return CampaignPushResult.SILENT; } // App is in the background; attempt to display a // notification in the notification center. if (!areAppNotificationsEnabled() || !displayNotification(data, targetClass, imageUrl, imageIconUrl, imageSmallIconUrl, campaignAttributes, intentAction)) { // Local app notifications have been disabled by the // user from Settings -> App Info // or we couldn't display the notification for some // reason. pushEvent.addAttribute("isOptedOut", "true"); // We can't post a notification, so delegate to the // passed in handler. return CampaignPushResult.OPTED_OUT; } } } finally { this.pinpointContext.getAnalyticsClient().recordEvent(pushEvent); this.pinpointContext.getAnalyticsClient().submitEvents(); } } return CampaignPushResult.POSTED_NOTIFICATION; }
From source file:com.cdvdev.subscriptiondemo.helpers.IabHelper.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);//from ww w . j av a 2 s . co m } } } if (skuList.size() == 0) { logDebug("queryPrices: nothing to do because there are no SKUs."); return BILLING_RESPONSE_RESULT_OK; } // Split the sku list in blocks of no more than 20 elements. ArrayList<ArrayList<String>> packs = new ArrayList<ArrayList<String>>(); ArrayList<String> tempList; int n = skuList.size() / 20; int mod = skuList.size() % 20; for (int i = 0; i < n; i++) { tempList = new ArrayList<String>(); for (String s : skuList.subList(i * 20, i * 20 + 20)) { tempList.add(s); } packs.add(tempList); } if (mod != 0) { tempList = new ArrayList<String>(); for (String s : skuList.subList(n * 20, n * 20 + mod)) { tempList.add(s); } packs.add(tempList); } for (ArrayList<String> skuPartList : packs) { Bundle querySkus = new Bundle(); querySkus.putStringArrayList(GET_SKU_DETAILS_ITEM_LIST, skuPartList); Bundle skuDetails = mIInAppBillingService.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) { SkuDetails d = new SkuDetails(itemType, thisResponse); logDebug("Got sku details: " + d); inv.addSkuDetails(d); } } return BILLING_RESPONSE_RESULT_OK; }
From source file:com.nearnotes.NoteEdit.java
@Override public void onStart() { super.onStart(); mTitleText = (EditText) getActivity().findViewById(R.id.title_edit); mCallback.setActionItems(NOTE_EDIT); if (mRowId == null) { Bundle extras = getArguments(); mRowId = extras.containsKey(NotesDbAdapter.KEY_ROWID) ? extras.getLong(NotesDbAdapter.KEY_ROWID) : null; }// w ww .j av a 2s.c om getActivity().setTitle(R.string.edit_note); Bundle bundle = getArguments(); mLongitude = bundle.getDouble("longitude"); mLatitude = bundle.getDouble("latitude"); mTitleText = (EditText) getActivity().findViewById(R.id.title_edit); mBodyText = (EditText) getView().findViewById(R.id.body); mTblAddLayout = (TableLayout) getActivity().findViewById(R.id.checkbody); mTblAddLayout.setPadding(0, 0, 0, 0); acAdapter = new PlacesAutoCompleteAdapter(getActivity(), R.layout.list_item); mCheckBox = (CheckBox) getActivity().findViewById(R.id.checkbox_on_top); mCheckBox.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { if (((CheckBox) v).isChecked() && mRowId != null) { mDbHelper.updateSetting(mRowId); } else if (mRowId != null) { mDbHelper.removeSetting(); } } }); autoCompView = (DelayAutoCompleteTextView) getView().findViewById(R.id.autoCompleteTextView1); autoCompView.setAdapter(acAdapter); //int height = autoCompView.getDropDownHeight(); //autoCompView.setDropDownHeight(height + 20); autoCompView.setOnItemClickListener(this); autoCompView.setLoadingIndicator((ProgressBar) getView().findViewById(R.id.progressAPI), (ImageView) getView().findViewById(R.id.location_icon)); autoCompView.setCompletionHint(""); if (mRowId != null) { autoCompView.setTextColor(getResources().getColor(R.color.deepgreen)); } else { SharedPreferences sharedPref = PreferenceManager.getDefaultSharedPreferences(getActivity()); boolean checklistPref = sharedPref.getBoolean("pref_key_note_checklist", false); if (checklistPref) { mChecklist = true; } } mBodyText.getViewTreeObserver().addOnGlobalLayoutListener(new OnGlobalLayoutListener() { @SuppressWarnings("deprecation") @Override public void onGlobalLayout() { //This listener is added to make sure the globalLayout has been displayed // before accessing getLayout().getLineEnd() ViewTreeObserver obs = mBodyText.getViewTreeObserver(); obs.removeGlobalOnLayoutListener(this); if (!mChecklist) { return; } mBodyText.addTextChangedListener(bodyTextWatcher); // Run the code below just once on startup to populate the global listArray mRealRow String tempBoxes = mBodyText.getText().toString(); if (mBodyText.getLayout() != null) { mRealRow = populateBoxes(tempBoxes); int row = 0; for (NoteRow line : mRealRow) { switch (line.getType()) { case 0: TableRow inflate = (TableRow) View.inflate(getActivity(), R.layout.table_row_invisible, null); mTblAddLayout.addView(inflate); break; case 1: TableRow checkRow = (TableRow) View.inflate(getActivity(), R.layout.table_row, null); CheckBox temp = (CheckBox) checkRow.getChildAt(0); temp.setTag(Integer.valueOf(row)); mTblAddLayout.addView(checkRow); temp.setOnClickListener(checkBoxListener); break; case 2: TableRow checkRow1 = (TableRow) View.inflate(getActivity(), R.layout.table_row, null); CheckBox temp1 = (CheckBox) checkRow1.getChildAt(0); temp1.setTag(Integer.valueOf(row)); temp1.setChecked(true); mTblAddLayout.addView(checkRow1); temp1.setOnClickListener(checkBoxListener); break; } for (int k = 1; line.getSize() > k; k++) { TableRow inflate = (TableRow) View.inflate(getActivity(), R.layout.table_row_invisible, null); mTblAddLayout.addView(inflate); } row++; } } } }); }
From source file:org.lol.reddit.fragments.PostListingFragment.java
@Override public void onCreate(final Bundle savedInstanceState) { // TODO load position/etc? super.onCreate(savedInstanceState); final Bundle arguments = getArguments(); final Uri url = Uri.parse(arguments.getString("url")); try {// w w w.ja v a2 s.c o m postListingURL = (PostListingURL) RedditURLParser.parseProbablePostListing(url); } catch (ClassCastException e) { Toast.makeText(getSupportActivity(), "Invalid post listing URL.", Toast.LENGTH_LONG); return; } if (arguments.containsKey("session")) { session = UUID.fromString(arguments.getString("session")); } downloadType = CacheRequest.DownloadType.valueOf(arguments.getString("downloadType")); }
From source file:mc.inappbilling.v3.InAppBillingHelper.java
int querySkuDetails(Inventory inv, List<String> moreSkus) throws RemoteException, JSONException { logDebug("Querying SKU details."); ArrayList<String> skuList = new ArrayList<String>(); skuList.addAll(inv.getAllOwnedSkus()); if (moreSkus != null) skuList.addAll(moreSkus);//from w ww.ja va 2 s . co m 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(), ITEM_TYPE_INAPP, 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) { Product p = new Product(thisResponse); logDebug("Got sku details: " + p); inv.addProducts(p); } return BILLING_RESPONSE_RESULT_OK; }
From source file:com.facebook.widget.FacebookDialog.java
/** * Determines whether the native dialog completed normally (without error or exception). * * @param result the bundle passed back to onActivityResult * @return true if the native dialog completed normally *///from w w w.j a v a 2 s. com public static boolean getNativeDialogDidComplete(Bundle result) { if (result.containsKey(RESULT_ARGS_DIALOG_COMPLETE_KEY)) { return result.getBoolean(RESULT_ARGS_DIALOG_COMPLETE_KEY); } return result.getBoolean(EXTRA_DIALOG_COMPLETE_KEY, false); }
From source file:com.facebook.widget.FacebookDialog.java
/** * Returns the gesture with which the user completed the native dialog. This is only returned if the * user has previously authorized the calling app with basic permissions. * * @param result the bundle passed back to onActivityResult * @return "post" or "cancel" as the completion gesture *//*from w w w . jav a2s . c o m*/ public static String getNativeDialogCompletionGesture(Bundle result) { if (result.containsKey(RESULT_ARGS_DIALOG_COMPLETION_GESTURE_KEY)) { return result.getString(RESULT_ARGS_DIALOG_COMPLETION_GESTURE_KEY); } return result.getString(EXTRA_DIALOG_COMPLETION_GESTURE_KEY); }
From source file:com.facebook.widget.FacebookDialog.java
/** * Returns the id of the published post. This is only returned if the user has previously given the * app publish permissions./*ww w .jav a2 s. co m*/ * * @param result the bundle passed back to onActivityResult * @return the id of the published post */ public static String getNativeDialogPostId(Bundle result) { if (result.containsKey(RESULT_ARGS_DIALOG_COMPLETION_ID_KEY)) { return result.getString(RESULT_ARGS_DIALOG_COMPLETION_ID_KEY); } return result.getString(EXTRA_DIALOG_COMPLETION_ID_KEY); }