List of usage examples for android.os Bundle containsKey
public boolean containsKey(String key)
From source file:com.markupartist.sthlmtraveling.RoutesActivity.java
/** * Restores the local state.//w ww . j a va2 s. c o m * @param savedInstanceState the bundle containing the saved state */ private void restoreLocalState(Bundle savedInstanceState) { restoreJourneyQuery(savedInstanceState); restoreSearchRoutesTask(savedInstanceState); restoreGetEarlierRoutesTask(savedInstanceState); restoreGetLaterRoutesTask(savedInstanceState); if (savedInstanceState.containsKey(STATE_ROUTE_ERROR_CODE)) { mRouteErrorCode = savedInstanceState.getString(STATE_ROUTE_ERROR_CODE); } }
From source file:com.facebook.share.internal.LikeActionController.java
private void refreshStatusViaService() { LikeStatusClient likeStatusClient = new LikeStatusClient(FacebookSdk.getApplicationContext(), FacebookSdk.getApplicationId(), objectId); if (!likeStatusClient.start()) { return;// w w w. j a v a2 s. c om } LikeStatusClient.CompletedListener callback = new LikeStatusClient.CompletedListener() { @Override public void completed(Bundle result) { // Don't lose old state if the service response is incomplete. if (result == null || !result.containsKey(ShareConstants.EXTRA_OBJECT_IS_LIKED)) { return; } boolean objectIsLiked = result.getBoolean(ShareConstants.EXTRA_OBJECT_IS_LIKED); String likeCountWithLike = result.containsKey(ShareConstants.EXTRA_LIKE_COUNT_STRING_WITH_LIKE) ? result.getString(ShareConstants.EXTRA_LIKE_COUNT_STRING_WITH_LIKE) : LikeActionController.this.likeCountStringWithLike; String likeCountWithoutLike = result .containsKey(ShareConstants.EXTRA_LIKE_COUNT_STRING_WITHOUT_LIKE) ? result.getString(ShareConstants.EXTRA_LIKE_COUNT_STRING_WITHOUT_LIKE) : LikeActionController.this.likeCountStringWithoutLike; String socialSentenceWithLike = result.containsKey(ShareConstants.EXTRA_SOCIAL_SENTENCE_WITH_LIKE) ? result.getString(ShareConstants.EXTRA_SOCIAL_SENTENCE_WITH_LIKE) : LikeActionController.this.socialSentenceWithLike; String socialSentenceWithoutLike = result .containsKey(ShareConstants.EXTRA_SOCIAL_SENTENCE_WITHOUT_LIKE) ? result.getString(ShareConstants.EXTRA_SOCIAL_SENTENCE_WITHOUT_LIKE) : LikeActionController.this.socialSentenceWithoutLike; String unlikeToken = result.containsKey(ShareConstants.EXTRA_UNLIKE_TOKEN) ? result.getString(ShareConstants.EXTRA_UNLIKE_TOKEN) : LikeActionController.this.unlikeToken; updateState(objectIsLiked, likeCountWithLike, likeCountWithoutLike, socialSentenceWithLike, socialSentenceWithoutLike, unlikeToken); } }; likeStatusClient.setCompletedListener(callback); }
From source file:org.mifos.androidclient.main.AccountDetailsActivity.java
@Override public void onCreate(Bundle bundle) { super.onCreate(bundle); setContentView(R.layout.account_details); tabs = (TabHost) findViewById(R.id.accountDetails_tabHost); tabs.setup();/*www .j a va2 s . c o m*/ TabHost.TabSpec overviewSpec = tabs.newTabSpec(getString(R.string.accountDetails_tab_overview)); overviewSpec.setIndicator(getString(R.string.accountDetails_tab_overview)); overviewSpec.setContent(R.id.account_overview); TabHost.TabSpec additionalInfoSpec = tabs.newTabSpec(getString(R.string.accountDetails_tab_additionalInfo)); additionalInfoSpec.setIndicator(getString(R.string.accountDetails_tab_additionalInfo)); additionalInfoSpec.setContent(R.id.account_details); TabHost.TabSpec transactionSpec = tabs.newTabSpec(getString(R.string.accountDetails_tab_transaction)); transactionSpec.setIndicator(getString(R.string.accountDetails_tab_transaction)); transactionSpec.setContent(R.id.account_transaction); tabs.addTab(overviewSpec); tabs.addTab(transactionSpec); tabs.addTab(additionalInfoSpec); TabColorUtils.setTabColor(tabs); tabs.setOnTabChangedListener(this); if (bundle != null) { if (bundle.containsKey(AbstractAccountDetails.BUNDLE_KEY)) { mDetails = (AbstractAccountDetails) bundle.getSerializable(AbstractAccountDetails.BUNDLE_KEY); } if (bundle.containsKey(Fee.BUNDLE_KEY)) { mApplicableFees = (Map<String, Map<String, String>>) bundle.getSerializable(Fee.BUNDLE_KEY); } if (bundle.containsKey(SELECTED_TAB_BUNDLE_KEY)) { tabs.setCurrentTab(bundle.getInt(SELECTED_TAB_BUNDLE_KEY)); } } mAccount = (AccountBasicInformation) getIntent().getSerializableExtra(AccountBasicInformation.BUNDLE_KEY); mAccountService = new AccountService(this); mSystemSettingsService = new SystemSettingsService(this); }
From source file:com.google.android.apps.authenticator.dataimport.Importer.java
private void importAccountDbFromBundle(Bundle bundle, AccountDb accountDb) { // Each account is stored in a Bundle whose key is a string representing the ordinal (integer) // position of the account in the database. List<String> sortedAccountBundleKeys = new ArrayList<String>(bundle.keySet()); Collections.sort(sortedAccountBundleKeys, new IntegerStringComparator()); int importedAccountCount = 0; for (String accountBundleKey : sortedAccountBundleKeys) { Bundle accountBundle = bundle.getBundle(accountBundleKey); String name = accountBundle.getString(KEY_NAME); if (name == null) { Log.w(LOG_TAG, "Skipping account #" + accountBundleKey + ": name missing"); continue; }//from w w w . java 2 s.c o m if (accountDb.nameExists(name)) { // Don't log account name here and below because it's considered PII Log.w(LOG_TAG, "Skipping account #" + accountBundleKey + ": already configured"); continue; } String encodedSecret = accountBundle.getString(KEY_ENCODED_SECRET); if (encodedSecret == null) { Log.w(LOG_TAG, "Skipping account #" + accountBundleKey + ": secret missing"); continue; } String typeString = accountBundle.getString(KEY_TYPE); AccountDb.OtpType type; if ("totp".equals(typeString)) { type = AccountDb.OtpType.TOTP; } else if ("hotp".equals(typeString)) { type = AccountDb.OtpType.HOTP; } else { Log.w(LOG_TAG, "Skipping account #" + accountBundleKey + ": unsupported type: \"" + typeString + "\""); continue; } Integer counter = accountBundle.containsKey(KEY_COUNTER) ? accountBundle.getInt(KEY_COUNTER) : null; if (counter == null) { if (type == AccountDb.OtpType.HOTP) { Log.w(LOG_TAG, "Skipping account #" + accountBundleKey + ": counter missing"); continue; } else { // TOTP counter = AccountDb.DEFAULT_HOTP_COUNTER; } } accountDb.update(name, encodedSecret, name, type, counter); importedAccountCount++; } Log.i(LOG_TAG, "Imported " + importedAccountCount + " accounts"); }
From source file:bulat.diet.helper_sport.utils.IabHelper.java
public int queryPurchases(Inventory inv, String itemType) throws JSONException, RemoteException { // Query purchases logDebug("Querying owned items, item type: " + itemType); logDebug("Package name: " + mContext.getPackageName()); boolean verificationFailed = false; String continueToken = null;/*from ww w . jav a 2s. c o m*/ do { logDebug("Calling getPurchases with continuation token: " + continueToken); Bundle ownedItems = mService.getPurchases(3, mContext.getPackageName(), itemType, continueToken); int response = getResponseCodeFromBundle(ownedItems); logDebug("Owned items response: " + String.valueOf(response)); if (response != BILLING_RESPONSE_RESULT_OK) { logDebug("getPurchases() failed: " + getResponseDesc(response)); return response; } if (!ownedItems.containsKey(RESPONSE_INAPP_ITEM_LIST) || !ownedItems.containsKey(RESPONSE_INAPP_PURCHASE_DATA_LIST) || !ownedItems.containsKey(RESPONSE_INAPP_SIGNATURE_LIST)) { logError("Bundle returned from getPurchases() doesn't contain required fields."); return IABHELPER_BAD_RESPONSE; } ArrayList<String> ownedSkus = ownedItems.getStringArrayList(RESPONSE_INAPP_ITEM_LIST); ArrayList<String> purchaseDataList = ownedItems.getStringArrayList(RESPONSE_INAPP_PURCHASE_DATA_LIST); ArrayList<String> signatureList = ownedItems.getStringArrayList(RESPONSE_INAPP_SIGNATURE_LIST); inv.setSkuArray(ownedSkus); for (int i = 0; i < purchaseDataList.size(); ++i) { String purchaseData = purchaseDataList.get(i); String signature = signatureList.get(i); String sku = ownedSkus.get(i); if (Security.verifyPurchase(mSignatureBase64, purchaseData, signature)) { logDebug("Sku is owned: " + sku); Purchase purchase = new Purchase(itemType, purchaseData, signature); if (TextUtils.isEmpty(purchase.getToken())) { logWarn("BUG: empty/null token!"); logDebug("Purchase data: " + purchaseData); } Date currDate = new Date(); if (sku != null && currDate.getTime() > SaveUtils.getEndPDate(mContext)) { // 0 (purchased), 1 (canceled), or 2 (refunded). if (purchase.getPurchaseState() == 0 || purchase.getPurchaseState() == 2) { if (sku.equals(PaymentsListActivity.SKU_YEAR)) { SaveUtils.setEndPDate(currDate.getTime() + 367 * DateUtils.DAY_IN_MILLIS, mContext); } else if (sku.equals(PaymentsListActivity.SKU_MUNTH)) { SaveUtils.setEndPDate(currDate.getTime() + 32 * DateUtils.DAY_IN_MILLIS, mContext); } else if (sku.equals(PaymentsListActivity.SKU_MUNTH_OLD)) { SaveUtils.setEndPDate(currDate.getTime() + 32 * DateUtils.DAY_IN_MILLIS, mContext); } else if (sku.equals(PaymentsListActivity.SKU_YEAR_OLD)) { SaveUtils.setEndPDate(currDate.getTime() + 367 * DateUtils.DAY_IN_MILLIS, mContext); } else if (sku.equals(PaymentsListActivity.SKU_YEAR_NEW)) { SaveUtils.setEndPDate(currDate.getTime() + 367 * DateUtils.DAY_IN_MILLIS, mContext); } else if (sku.equals(PaymentsListActivity.SKU_YEAR_VIP)) { SaveUtils.setEndPDate(currDate.getTime() + 367 * DateUtils.DAY_IN_MILLIS, mContext); } else if (sku.equals(PaymentsListActivity.SKU_HALFYEAR)) { SaveUtils.setEndPDate(currDate.getTime() + 190 * DateUtils.DAY_IN_MILLIS, mContext); } else if (sku.equals(PaymentsListActivity.SKU_MUUNTH_NEW)) { SaveUtils.setEndPDate(currDate.getTime() + 32 * DateUtils.DAY_IN_MILLIS, mContext); } else if (sku.equals(PaymentsListActivity.SKU_YEAR_2017)) { SaveUtils.setEndPDate(currDate.getTime() + 367 * DateUtils.DAY_IN_MILLIS, mContext); } else if (sku.equals(PaymentsListActivity.SKU_HALFYEAR_2017)) { SaveUtils.setEndPDate(currDate.getTime() + 190 * DateUtils.DAY_IN_MILLIS, mContext); } else if (sku.equals(PaymentsListActivity.SKU_MUUNTH_2017)) { SaveUtils.setEndPDate(currDate.getTime() + 32 * DateUtils.DAY_IN_MILLIS, mContext); } } } // Record ownership and token inv.addPurchase(purchase); } else { logWarn("Purchase signature verification **FAILED**. Not adding item."); logDebug(" Purchase data: " + purchaseData); logDebug(" Signature: " + signature); verificationFailed = true; } } continueToken = ownedItems.getString(INAPP_CONTINUATION_TOKEN); logDebug("Continuation token: " + continueToken); } while (!TextUtils.isEmpty(continueToken)); return verificationFailed ? IABHELPER_VERIFICATION_FAILED : BILLING_RESPONSE_RESULT_OK; }
From source file:edu.cens.loci.ui.PlaceListActivity.java
@Override protected void onListItemClick(ListView l, View v, int position, long id) { Intent intent;//from w ww .ja va2 s . co m Bundle extras; switch (mMode) { case MODE_VIEW: //Log.i(TAG, "onListItemClick : position=" + position + ", id=" + id); if ((mFilterState & FILTER_STATE_SUGGESTED) != 0) { if (position == 0) { intent = new Intent(Constants.Intents.UI.ACTION_VIEW_SUGGESTED_GPS_PLACES); Toast.makeText(this, "Not supported yet", Toast.LENGTH_SHORT).show(); return; } else { intent = new Intent(Intent.ACTION_VIEW, getSelectedUri(position - 1)); } } else { intent = new Intent(Intent.ACTION_VIEW, getSelectedUri(position)); } startActivity(intent); break; case MODE_INSERT: extras = getIntent().getExtras(); if (position == 0) { intent = new Intent(Intent.ACTION_INSERT, Places.CONTENT_URI); if (extras.containsKey(UI.LIST_ORDER_EXTRA_WIFI_KEY) && extras.containsKey(UI.LIST_ORDER_EXTRA_WIFI_TIME_KEY)) { String wifiJson = getIntent().getExtras().getString(UI.LIST_ORDER_EXTRA_WIFI_KEY); String timestamp = getIntent().getExtras().getString(UI.LIST_ORDER_EXTRA_WIFI_TIME_KEY); intent.putExtra(Insert.WIFI_FINTERPRINT, wifiJson); intent.putExtra(Insert.TIME, timestamp); } //intent = new Intent(Intent.ACTION_EDIT, getSelectedUri(position)); } else { intent = new Intent(Intent.ACTION_EDIT, getSelectedUri(position - 1)); if (extras.containsKey(UI.LIST_ORDER_EXTRA_WIFI_KEY) && extras.containsKey(UI.LIST_ORDER_EXTRA_WIFI_TIME_KEY)) { String wifiJson = getIntent().getExtras().getString(UI.LIST_ORDER_EXTRA_WIFI_KEY); String timestamp = getIntent().getExtras().getString(UI.LIST_ORDER_EXTRA_WIFI_TIME_KEY); intent.putExtra(Insert.WIFI_FINTERPRINT, wifiJson); intent.putExtra(Insert.TIME, timestamp); } } //extras = getIntent().getExtras(); //if (extras != null) // intent.putExtras(extras); startActivityForResult(intent, SUBACTIVITY_NEW_PLACE); break; case MODE_REGISTER_SUGGESTED: extras = getIntent().getExtras(); if (position == 0) { intent = new Intent(Intents.UI.ACTION_CREATE_FROM_SUGGESTED_PLACE, getIntent().getData()); } else { //intent = new Intent(Intents.UI.ACTION_ADDTO_FROM_SUGESTED_PLACE, getIntent().getData()); //extras.putLong(Intents.UI.SELECTED_PLACE_ID_EXTRA_KEY, getSelectedPlaceId(position-1)); intent = new Intent(Intents.UI.ACTION_ADDTO_FROM_SUGESTED_PLACE, getSelectedUri(position - 1)); extras.putLong(Intents.UI.SELECTED_PLACE_ID_EXTRA_KEY, ContentUris.parseId(getIntent().getData())); } if (extras != null) intent.putExtras(extras); startActivityForResult(intent, SUBACTIVITY_NEW_PLACE); break; case MODE_PICK: final Uri uri = getSelectedUri(position); intent = new Intent(); setResult(RESULT_OK, intent.setData(uri)); finish(); break; } }
From source file:com.yourkey.billing.util.InAppBilling.java
private String testItemSku() { // create empty array of requested item SKU ArrayList<String> itemSkuArray = new ArrayList<String>(); // add our one item to the list itemSkuArray.add(itemSku);//from w w w . j a v a 2 s. c o m // convert the string array to input bundle Bundle itemSkuBundle = new Bundle(); itemSkuBundle.putStringArrayList(GET_SKU_DETAILS_ITEM_LIST, itemSkuArray); // query response bundle Bundle itemDataBundle = null; try { // get info for the one item sku itemDataBundle = inAppBillingService.getSkuDetails(IN_APP_BILLING_API_VERSION, packageName, itemType, itemSkuBundle); } // catch exceptions catch (Exception e) { return (exceptionMessage(PLAY_STORE_INVALID_PRODUCT_ID, e)); } // extract the response code from the response bundle int result = getResponseCodeFromBundle(itemDataBundle); if (result != RESULT_OK) { return (errorMessage(PLAY_STORE_INVALID_PRODUCT_ID, result)); } // response must have the following key value if (!itemDataBundle.containsKey(RESPONSE_GET_SKU_DETAILS_LIST)) return (errorMessage(PLAY_STORE_INVALID_PRODUCT_ID)); // extract response array ArrayList<String> itemDataArray = itemDataBundle.getStringArrayList(RESPONSE_GET_SKU_DETAILS_LIST); // this array must have one item if (itemDataArray.size() != 1) return (errorMessage(PLAY_STORE_INVALID_PRODUCT_ID)); // get the returned product ID and compare it to our itemSku try { // get JSON object JSONObject jsonObject = new JSONObject(itemDataArray.get(0)); // test product id if (!(jsonObject.optString(KEY_PRODUCT_ID)).equals(itemSku)) return (errorMessage(PLAY_STORE_INVALID_PRODUCT_ID)); // NOTE TO PROGRAMMERS // the jsonObject contains the following information // "productId" : "exampleSku" // "type" : "inapp" // "price" : "$5.00" // "title : "Example Title" // "description" : "This is an example description" } // JSON extraction failed catch (Exception e) { return (exceptionMessage(PLAY_STORE_INVALID_PRODUCT_ID, e)); } // Google play has our item return (null); }
From source file:com.aafr.alfonso.sunshine.app.ForecastFragment.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { // The ArrayAdapter will take data from a source and // use it to populate the ListView it's attached to. mForecastAdapter = new ForecastAdapter(getActivity(), null, 0); View rootView = inflater.inflate(R.layout.fragment_main, container, false); // Get a reference to the ListView, and attach this adapter to it. mListView = (ListView) rootView.findViewById(R.id.listview_forecast); mListView.setAdapter(mForecastAdapter); mListView.setOnItemClickListener(new AdapterView.OnItemClickListener() { @Override/*from w w w . j av a 2 s . co m*/ public void onItemClick(AdapterView<?> adapterView, View view, int position, long l) { Cursor cursor = mForecastAdapter.getCursor(); if (cursor != null && cursor.moveToPosition(position)) { ((Callback) getActivity()).onItemSelected(cursor.getString(COL_WEATHER_DATE)); } mPosition = position; } }); // If there's instance state, mine it for useful information. // The end-goal here is that the user never knows that turning their device sideways // does crazy lifecycle related things. It should feel like some stuff stretched out, // or magically appeared to take advantage of room, but data or place in the app was never // actually *lost*. if (savedInstanceState != null && savedInstanceState.containsKey(SELECTED_KEY)) { // The listview probably hasn't even been populated yet. Actually perform the // swapout in onLoadFinished. mPosition = savedInstanceState.getInt(SELECTED_KEY); } mForecastAdapter.setUseTodayLayout(mUseTodayLayout); return rootView; }
From source file:org.lol.reddit.activities.PostSubmitActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { PrefsUtility.applyTheme(this); super.onCreate(savedInstanceState); final LinearLayout layout = (LinearLayout) getLayoutInflater().inflate(R.layout.post_submit); typeSpinner = (Spinner) layout.findViewById(R.id.post_submit_type); usernameSpinner = (Spinner) layout.findViewById(R.id.post_submit_username); subredditEdit = (EditText) layout.findViewById(R.id.post_submit_subreddit); titleEdit = (EditText) layout.findViewById(R.id.post_submit_title); textEdit = (EditText) layout.findViewById(R.id.post_submit_body); final Intent intent = getIntent(); if (intent != null) { if (intent.hasExtra("subreddit")) { final String subreddit = intent.getStringExtra("subreddit"); if (subreddit != null && subreddit.length() > 0 && !subreddit.matches("/?(r/)?all/?") && subreddit.matches("/?(r/)?\\w+/?")) { subredditEdit.setText(subreddit); }/* w w w. ja v a 2s .c om*/ } else if (Intent.ACTION_SEND.equalsIgnoreCase(intent.getAction()) && intent.hasExtra(Intent.EXTRA_TEXT)) { final String url = intent.getStringExtra(Intent.EXTRA_TEXT); textEdit.setText(url); } } else if (savedInstanceState != null && savedInstanceState.containsKey("post_title")) { titleEdit.setText(savedInstanceState.getString("post_title")); textEdit.setText(savedInstanceState.getString("post_body")); subredditEdit.setText(savedInstanceState.getString("subreddit")); typeSpinner.setSelection(savedInstanceState.getInt("post_type")); } final ArrayList<RedditAccount> accounts = RedditAccountManager.getInstance(this).getAccounts(); final ArrayList<String> usernames = new ArrayList<String>(); for (RedditAccount account : accounts) { if (!account.isAnonymous()) { usernames.add(account.username); } } if (usernames.size() == 0) { General.quickToast(this, R.string.error_toast_notloggedin); finish(); } usernameSpinner.setAdapter(new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1, usernames)); typeSpinner.setAdapter(new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1, postTypes)); // TODO remove the duplicate code here setHint(); typeSpinner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() { public void onItemSelected(AdapterView<?> parent, View view, int position, long id) { setHint(); } public void onNothingSelected(AdapterView<?> parent) { } }); final ScrollView sv = new ScrollView(this); sv.addView(layout); setContentView(sv); }
From source file:bulat.diet.helper_sport.utils.IabHelper.java
public int isSubscribed() throws JSONException, RemoteException { // Query purchases if (subscriptionsSupported()) { logDebug("Querying owned items, item type: " + "subs"); logDebug("Package name: " + mContext.getPackageName()); boolean verificationFailed = false; String continueToken = null; do {/* w w w .ja va 2s.co m*/ logDebug("Calling getPurchases with continuation token: " + continueToken); Bundle ownedItems = mService.getPurchases(3, mContext.getPackageName(), "subs", continueToken); int response = getResponseCodeFromBundle(ownedItems); logDebug("Owned items response: " + String.valueOf(response)); if (response != BILLING_RESPONSE_RESULT_OK) { logDebug("getPurchases() failed: " + getResponseDesc(response)); return response; } if (!ownedItems.containsKey(RESPONSE_INAPP_ITEM_LIST) || !ownedItems.containsKey(RESPONSE_INAPP_PURCHASE_DATA_LIST) || !ownedItems.containsKey(RESPONSE_INAPP_SIGNATURE_LIST)) { logError("Bundle returned from getPurchases() doesn't contain required fields."); return IABHELPER_BAD_RESPONSE; } ArrayList<String> ownedSkus = ownedItems.getStringArrayList(RESPONSE_INAPP_ITEM_LIST); ArrayList<String> purchaseDataList = ownedItems .getStringArrayList(RESPONSE_INAPP_PURCHASE_DATA_LIST); ArrayList<String> signatureList = ownedItems.getStringArrayList(RESPONSE_INAPP_SIGNATURE_LIST); for (int i = 0; i < purchaseDataList.size(); ++i) { String purchaseData = purchaseDataList.get(i); String signature = signatureList.get(i); String sku = ownedSkus.get(i); // if (Security.verifyPurchase(mSignatureBase64, // purchaseData, signature)) { logDebug("Sku is owned: " + sku); Purchase purchase = new Purchase("subs", purchaseData, signature); Date currDate = new Date(); if (sku != null && currDate.getTime() > SaveUtils.getEndPDate(mContext)) { if (sku.equals(PaymentsListActivity.SKU_YEAR)) { SaveUtils.setEndPDate(purchase.getPurchaseTime() + 367 * DateUtils.DAY_IN_MILLIS, mContext); } else if (sku.equals(PaymentsListActivity.SKU_MUNTH)) { SaveUtils.setEndPDate(purchase.getPurchaseTime() + 32 * DateUtils.DAY_IN_MILLIS, mContext); } else if (sku.equals(PaymentsListActivity.SKU_MUNTH_OLD)) { SaveUtils.setEndPDate(purchase.getPurchaseTime() + 32 * DateUtils.DAY_IN_MILLIS, mContext); } else if (sku.equals(PaymentsListActivity.SKU_YEAR_OLD)) { SaveUtils.setEndPDate(purchase.getPurchaseTime() + 367 * DateUtils.DAY_IN_MILLIS, mContext); } else if (sku.equals(PaymentsListActivity.SKU_YEAR_NEW)) { SaveUtils.setEndPDate(purchase.getPurchaseTime() + 367 * DateUtils.DAY_IN_MILLIS, mContext); } else if (sku.equals(PaymentsListActivity.SKU_YEAR_VIP)) { SaveUtils.setEndPDate(purchase.getPurchaseTime() + 367 * DateUtils.DAY_IN_MILLIS, mContext); } else if (sku.equals(PaymentsListActivity.SKU_HALFYEAR)) { SaveUtils.setEndPDate(purchase.getPurchaseTime() + 190 * DateUtils.DAY_IN_MILLIS, mContext); } else if (sku.equals(PaymentsListActivity.SKU_MUUNTH_NEW)) { SaveUtils.setEndPDate(purchase.getPurchaseTime() + 32 * DateUtils.DAY_IN_MILLIS, mContext); } else if (sku.equals(PaymentsListActivity.SKU_HALFYEAR_2017)) { SaveUtils.setEndPDate(purchase.getPurchaseTime() + 190 * DateUtils.DAY_IN_MILLIS, mContext); } else if (sku.equals(PaymentsListActivity.SKU_MUUNTH_2017)) { SaveUtils.setEndPDate(purchase.getPurchaseTime() + 32 * DateUtils.DAY_IN_MILLIS, mContext); } else if (sku.equals(PaymentsListActivity.SKU_YEAR_2017)) { SaveUtils.setEndPDate(purchase.getPurchaseTime() + 367 * DateUtils.DAY_IN_MILLIS, mContext); } } if (TextUtils.isEmpty(purchase.getToken())) { logWarn("BUG: empty/null token!"); logDebug("Purchase data: " + purchaseData); } // Record ownership and token // inv.addPurchase(purchase); // } // else { // logWarn("Purchase signature verification **FAILED**. Not adding item."); // logDebug(" Purchase data: " + purchaseData); // / logDebug(" Signature: " + signature); // verificationFailed = true; // } } continueToken = ownedItems.getString(INAPP_CONTINUATION_TOKEN); logDebug("Continuation token: " + continueToken); } while (!TextUtils.isEmpty(continueToken)); return verificationFailed ? IABHELPER_VERIFICATION_FAILED : BILLING_RESPONSE_RESULT_OK; } else { return IABHELPER_UNKNOWN_ERROR; } }