List of usage examples for android.os Bundle containsKey
public boolean containsKey(String key)
From source file:com.github.gorbin.asne.instagram.InstagramSocialNetwork.java
private boolean checkTokenError(Bundle result) { if (result != null && result.containsKey(ERROR_CODE) && result.getString(ERROR_CODE).contains("400") && result.getString(ERROR_CODE).contains("OAuth")) { mRestart = true;//from w ww .j a v a 2 s. c om mRequestBundle = result; mRequestBundle.remove(ERROR_CODE); mRequestBundle.remove(SocialNetworkAsyncTask.RESULT_ERROR); initInstagramLogin(); return true; } return false; }
From source file:com.skubit.android.billing.BillingServiceBinder.java
@Override public Bundle getSkuDetails(int apiVersion, String userId, String packageName, String type, Bundle skusBundle) throws RemoteException { Bundle bundle = new Bundle(); if (TextUtils.isEmpty(packageName) || TextUtils.isEmpty(type)) { bundle.putInt("RESPONSE_CODE", BillingResponseCodes.RESULT_DEVELOPER_ERROR); return bundle; }//w w w . j a v a2 s.co m if (apiVersion != 1) { bundle.putInt("RESPONSE_CODE", BillingResponseCodes.RESULT_BILLING_UNAVAILABLE); return bundle; } if (skusBundle == null || !skusBundle.containsKey("ITEM_ID_LIST")) { bundle.putInt("RESPONSE_CODE", BillingResponseCodes.RESULT_DEVELOPER_ERROR); return bundle; } if (!isValidType(type)) { bundle.putInt("RESPONSE_CODE", BillingResponseCodes.RESULT_BILLING_UNAVAILABLE); return bundle; } int packValidate = validatePackageIsOwnedByCaller(packageName); if (packValidate != BillingResponseCodes.RESULT_OK) { bundle.putInt("RESPONSE_CODE", packValidate); return bundle; } String account = userId; if (!hasAccess(userId, packageName)) { Log.d(TAG, "User account not configured"); bundle.putInt("RESPONSE_CODE", BillingResponseCodes.RESULT_USER_ACCESS); return bundle; } Utils.changeAccount(mContext, userId); InventoryRestService service = new InventoryService(account, mContext).getRestService(); ArrayList<String> itemIds = skusBundle.getStringArrayList("ITEM_ID_LIST"); SkuDetailsListDto skuDetailsListDto = null; try { skuDetailsListDto = service.getSkuDetailsByIds(packageName, Joiner.on(",").join(itemIds)); } catch (Exception e1) { e1.printStackTrace(); bundle.putInt("RESPONSE_CODE", BillingResponseCodes.RESULT_ERROR); } ArrayList<String> details = new ArrayList<String>(); for (SkuDetailsDto skuDetailsDto : skuDetailsListDto.getItems()) { JSONObject jo = new JSONObject(); try { jo.put("productId", skuDetailsDto.getProductId()); jo.put("type", skuDetailsDto.getType().name()); jo.put("price", String.valueOf(skuDetailsDto.getSatoshi())); jo.put("title", skuDetailsDto.getTitle()); jo.put("description", skuDetailsDto.getDescription()); } catch (JSONException e) { e.printStackTrace(); } details.add(jo.toString()); } bundle.putStringArrayList("DETAILS_LIST", details); bundle.putInt("RESPONSE_CODE", BillingResponseCodes.RESULT_OK); return bundle; }
From source file:br.com.arlsoft.pushclient.PushClientModule.java
private void checkForExtras() { Activity activity = TiApplication.getAppRootOrCurrentActivity(); if (activity != null) { Intent intent = activity.getIntent(); if (intent != null) { Bundle extras = intent.getExtras(); if (extras != null && !extras.isEmpty() && extras.containsKey(PROPERTY_EXTRAS)) { extras = extras.getBundle(PROPERTY_EXTRAS); HashMap data = PushClientModule.convertBundleToHashMap(extras); data.put("prev_state", "stopped"); PushClientModule.sendMessage(data, PushClientModule.MODE_CLICK); intent.removeExtra(PROPERTY_EXTRAS); }/*from w ww . jav a2 s .c o m*/ } } }
From source file:cn.fulldroid.lib.datetimepicker.time.TimePickerDialog.java
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); if (savedInstanceState != null && savedInstanceState.containsKey(KEY_HOUR_OF_DAY) && savedInstanceState.containsKey(KEY_MINUTE) && savedInstanceState.containsKey(KEY_IS_24_HOUR_VIEW)) { mInitialHourOfDay = savedInstanceState.getInt(KEY_HOUR_OF_DAY); mInitialMinute = savedInstanceState.getInt(KEY_MINUTE); mIs24HourMode = savedInstanceState.getBoolean(KEY_IS_24_HOUR_VIEW); mInKbMode = savedInstanceState.getBoolean(KEY_IN_KB_MODE); mVibrate = savedInstanceState.getBoolean(KEY_VIBRATE); }// w w w . j av a 2 s . c o m }
From source file:br.com.cpb.esperanca.iab.IabHelper.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 .j a v a 2s . c o 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) { SkuDetails d = new SkuDetails(thisResponse); logDebug("Got sku details: " + d); inv.addSkuDetails(d); } return BILLING_RESPONSE_RESULT_OK; }
From source file:co.hmsk.android.webdbpress76.util.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) skuList.addAll(moreSkus);//w w w . j av a 2 s .c o 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(), 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.pseudosudostudios.jdd.activities.GameActivity.java
/** * Creates the view, loads from a rotation and from a relaunch *///from www . ja v a2s . co m @Override protected void onCreate(Bundle savedInstanceState) { // Remove the ActionBar, same logic as the drama app super.onCreate(savedInstanceState); bg = new Grid(this); setContentView(bg); // if there was a savedInstanceGame, then load that one final SharedPreferences prefs = getPreferences(Context.MODE_PRIVATE); boolean hasScreen = prefs.getBoolean(instructionString, false); if (!hasScreen && savedInstanceState == null) { showInstructions(); onCreateStuff(savedInstanceState); } else if (savedInstanceState != null && savedInstanceState.containsKey(onSaveBaseString + 0 + 0)) onCreateStuff(savedInstanceState); else loadGamePrompt(savedInstanceState); scoreNoTime = 0; scorePrev = 0; }
From source file:me.ccrama.redditslide.util.IabHelper.java
private int querySkuDetails(String itemType, Inventory inv, List<String> moreSkus) throws RemoteException, JSONException { logDebug("Querying SKU details."); ArrayList<String> skuList = new ArrayList<>(); skuList.addAll(inv.getAllOwnedSkus(itemType)); if (moreSkus != null) { for (String sku : moreSkus) { if (!skuList.contains(sku)) { skuList.add(sku);/* w ww .ja va 2s.co m*/ } } } if (skuList.isEmpty()) { 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; } } List<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.mirasense.scanditsdk.plugin.ScanditSDK.java
/** * Adjusts the layout parameters of the barcode picker according to the margins set through java script. * * @param bundle The bundle with the java script parameters. * @param animationDuration Over how long the change should be animated. */// w w w . j ava 2 s .co m private void adjustLayout(Bundle bundle, double animationDuration) { if (mBarcodePicker == null) { return; } final RelativeLayout.LayoutParams rLayoutParams = (RelativeLayout.LayoutParams) mBarcodePicker .getLayoutParams(); Display display = ((WindowManager) webView.getContext().getSystemService(Context.WINDOW_SERVICE)) .getDefaultDisplay(); if (bundle.containsKey(ScanditSDKParameterParser.paramPortraitMargins) && display.getHeight() > display.getWidth()) { String portraitMargins = bundle.getString(ScanditSDKParameterParser.paramPortraitMargins); String[] split = portraitMargins.split("[/]"); if (split.length == 4) { try { final Rect oldPortraitMargins = new Rect(mPortraitMargins); mPortraitMargins = new Rect(Integer.valueOf(split[0]), Integer.valueOf(split[1]), Integer.valueOf(split[2]), Integer.valueOf(split[3])); if (animationDuration > 0) { Animation anim = new Animation() { @Override protected void applyTransformation(float interpolatedTime, Transformation t) { rLayoutParams.topMargin = SbSystemUtils.pxFromDp(webView.getContext(), (int) (oldPortraitMargins.top + (mPortraitMargins.top - oldPortraitMargins.top) * interpolatedTime)); rLayoutParams.rightMargin = SbSystemUtils.pxFromDp(webView.getContext(), (int) (oldPortraitMargins.right + (mPortraitMargins.right - oldPortraitMargins.right) * interpolatedTime)); rLayoutParams.bottomMargin = SbSystemUtils.pxFromDp(webView.getContext(), (int) (oldPortraitMargins.bottom + (mPortraitMargins.bottom - oldPortraitMargins.bottom) * interpolatedTime)); rLayoutParams.leftMargin = SbSystemUtils.pxFromDp(webView.getContext(), (int) (oldPortraitMargins.left + (mPortraitMargins.left - oldPortraitMargins.left) * interpolatedTime)); mBarcodePicker.setLayoutParams(rLayoutParams); } }; anim.setDuration((int) (animationDuration * 1000)); mBarcodePicker.startAnimation(anim); } else { rLayoutParams.topMargin = SbSystemUtils.pxFromDp(webView.getContext(), mPortraitMargins.top); rLayoutParams.rightMargin = SbSystemUtils.pxFromDp(webView.getContext(), mPortraitMargins.right); rLayoutParams.bottomMargin = SbSystemUtils.pxFromDp(webView.getContext(), mPortraitMargins.bottom); rLayoutParams.leftMargin = SbSystemUtils.pxFromDp(webView.getContext(), mPortraitMargins.left); mBarcodePicker.setLayoutParams(rLayoutParams); } } catch (NumberFormatException e) { } } } else if (bundle.containsKey(ScanditSDKParameterParser.paramLandscapeMargins) && display.getWidth() > display.getHeight()) { String landscapeMargins = bundle.getString(ScanditSDKParameterParser.paramLandscapeMargins); String[] split = landscapeMargins.split("[/]"); if (split.length == 4) { final Rect oldLandscapeMargins = new Rect(mLandscapeMargins); mLandscapeMargins = new Rect(Integer.valueOf(split[0]), Integer.valueOf(split[1]), Integer.valueOf(split[2]), Integer.valueOf(split[3])); Animation anim = new Animation() { @Override protected void applyTransformation(float interpolatedTime, Transformation t) { rLayoutParams.topMargin = SbSystemUtils.pxFromDp(webView.getContext(), (int) (oldLandscapeMargins.top + (mLandscapeMargins.top - oldLandscapeMargins.top) * interpolatedTime)); rLayoutParams.rightMargin = SbSystemUtils.pxFromDp(webView.getContext(), (int) (oldLandscapeMargins.right + (mLandscapeMargins.right - oldLandscapeMargins.right) * interpolatedTime)); rLayoutParams.bottomMargin = SbSystemUtils.pxFromDp(webView.getContext(), (int) (oldLandscapeMargins.bottom + (mLandscapeMargins.bottom - oldLandscapeMargins.bottom) * interpolatedTime)); rLayoutParams.leftMargin = SbSystemUtils.pxFromDp(webView.getContext(), (int) (oldLandscapeMargins.left + (mLandscapeMargins.left - oldLandscapeMargins.left) * interpolatedTime)); mBarcodePicker.setLayoutParams(rLayoutParams); } }; anim.setDuration((int) (animationDuration * 1000)); mBarcodePicker.startAnimation(anim); } } }
From source file:com.radicaldynamic.groupinform.activities.AccountFolderList.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); requestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS); setContentView(R.layout.generic_list); if (savedInstanceState == null) { Intent intent = getIntent();/*from w w w . j a v a 2 s . c o m*/ if (intent == null) { // Load defaults } else { mCopyToFolder = intent.getBooleanExtra(KEY_COPY_TO_FOLDER, false); } } else { if (savedInstanceState.containsKey(KEY_COPY_TO_FOLDER)) mCopyToFolder = savedInstanceState.getBoolean(KEY_COPY_TO_FOLDER); if (savedInstanceState.containsKey(KEY_FOLDER_ID)) mSelectedFolderId = savedInstanceState.getString(KEY_FOLDER_ID); if (savedInstanceState.containsKey(KEY_FOLDER_NAME)) mSelectedFolderName = savedInstanceState.getString(KEY_FOLDER_NAME); Object data = getLastNonConfigurationInstance(); if (data instanceof RefreshViewTask) mRefreshViewTask = (RefreshViewTask) data; else if (data instanceof SynchronizeFoldersTask) mSynchronizeFoldersTask = (SynchronizeFoldersTask) data; } if (mCopyToFolder) setTitle(getString(R.string.app_name) + " > " + getString(R.string.tf_copy_to_folder)); else setTitle(getString(R.string.app_name) + " > " + getString(R.string.tf_form_folders)); }