List of usage examples for android.os Bundle putString
public void putString(@Nullable String key, @Nullable String value)
From source file:com.cssweb.android.common.FairyUI.java
/** * ??\//from w w w . j a v a2 s .com * * @param paramInt * @param paramContext * @return */ public static Intent genIsLoginIntent(int paramInt, int paramInt2, Context paramContext) { Intent localIntent = new Intent(); if (genIsActiveIntent(paramInt, paramInt2, paramContext)) { if (!TradeUtil.checkUserLogin()) {// ? localIntent.putExtra("menu_id", paramInt); localIntent.setClass(paramContext, LoginActivity.class); } else { localIntent.addFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT); String orgid = TradeUser.getInstance().getOrgid(); switch (paramInt2) { case Global.NJZQ_JLP_JYYH: localIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); localIntent.putExtra("menu_id", paramInt2); if (1 == TradeUser.getInstance().getLoginType()) { localIntent = null; } else { localIntent.setClass(paramContext, LoginActivity.class); } break; case Global.NJZQ_WTJY: localIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); localIntent.putExtra("menu_id", paramInt2); if (orgid == null || "".equals(orgid)) { localIntent.setClass(paramContext, LoginActivity.class); } else { localIntent.setClass(paramContext, JlpActivity.class); } break; case Global.NJZQ_WTJY_TWO: localIntent.putExtra("menu_id", Global.NJZQ_WTJY_GP_THREE); localIntent.setClass(paramContext, FundActivity.class); break; case Global.QUOTE_USERSTK: localIntent.putExtra("requestType", 1); localIntent.setClass(paramContext, PersonalStock.class); break; case Global.QUOTE_WARNING: case Global.NJZQ_HQBJ_HQYJ: if (TradeUser.getInstance().getLoginType() == 3) { localIntent.putExtra("menu_id", paramInt); localIntent.setClass(paramContext, LoginActivity.class); } else localIntent.setClass(paramContext, QuoteWarning.class); break; case Global.NJZQ_ZXHD_EGHT: localIntent.putExtra("menu_id", Global.NJZQ_ZXHD_EGHT); localIntent.setClass(paramContext, VistualTrade.class); break; case Global.QUOTE_PAIMING: localIntent.putExtra("requestType", 0); localIntent.setClass(paramContext, PaiMing.class); break; case Global.QUOTE_DAPAN: localIntent.putExtra("requestType", 2); localIntent.setClass(paramContext, DaPan.class); break; case Global.NJZQ_HQBJ_QQSC_WHSC: localIntent.putExtra("menu_id", Global.NJZQ_HQBJ_QQSC_WHSC); localIntent.setClass(paramContext, GlobalMarket.class); break; case Global.QUOTE_FENLEI: localIntent.putExtra("requestType", 2); localIntent.setClass(paramContext, FenLei.class); break; case Global.QUOTE_STOCK: localIntent.putExtra("type", 0); localIntent.setClass(paramContext, StockTypeFund.class); break; case Global.QUOTE_BOND: localIntent.putExtra("type", 1); localIntent.setClass(paramContext, StockTypeFund.class); break; case Global.QUOTE_MONETARY: localIntent.putExtra("type", 2); localIntent.setClass(paramContext, StockTypeFund.class); break; case Global.QUOTE_MIX: localIntent.putExtra("type", 3); localIntent.setClass(paramContext, StockTypeFund.class); break; case Global.SUN_PRIVATE: localIntent.putExtra("type", 4); localIntent.setClass(paramContext, SunPrivate.class); break; case Global.HK_MAINBOARD: // ? Bundle bundle = new Bundle(); bundle.putInt("stocktype", 101); bundle.putInt("flag", 1); localIntent.putExtras(bundle); localIntent.setClass(paramContext, HKMainboard.class); break; case Global.HK_CYB: // ? Bundle bundle2 = new Bundle(); bundle2.putInt("stocktype", 102); bundle2.putInt("flag", 2); localIntent.putExtras(bundle2); localIntent.setClass(paramContext, HKMainboard.class); break; case Global.ZJS:// localIntent.addFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT); localIntent.setClass(paramContext, ZJS.class); Bundle extras = new Bundle(); extras.putString("market", "cffex"); extras.putString("exchange", "cf"); extras.putString("title", ""); localIntent.putExtras(extras); break; case Global.SDZ:// ,, localIntent.addFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT); localIntent.setClass(paramContext, QHSCBaseActivity.class); break; case Global.QUOTE_HSZS: localIntent.addFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT); localIntent.setClass(paramContext, HSZS.class); break; case Global.QUOTE_KLINE: localIntent.setClass(paramContext, KLineActivity.class); break; case Global.QUOTE_FENSHI: localIntent.putExtra("exchange", CssSystem.exchange); localIntent.putExtra("stockcode", CssSystem.stockcode); localIntent.putExtra("stockname", CssSystem.stockname); localIntent.setClass(paramContext, TrendActivity.class); break; case Global.NJZQ_ZXHD_KHJL: localIntent.putExtra("pos", Global.NJZQ_ZXHD_KHJL); localIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); localIntent.setClass(paramContext, WebViewDisplay.class); break; case Global.NJZQ_ZXHD_TZGW: if (TradeUser.getInstance().getLoginType() == 3) { localIntent.putExtra("menu_id", paramInt); localIntent.setClass(paramContext, LoginActivity.class); } else { localIntent.putExtra("pos", Global.NJZQ_ZXHD_TZGW); localIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); localIntent.setClass(paramContext, WebViewDisplay.class); } break; } } } else { localIntent.putExtra("menu_id", paramInt); if (paramInt == Global.NJZQ_WTJY) { localIntent.putExtra("isChangeBtn", true); } localIntent.setClass(paramContext, SMSJHActivity.class); } return localIntent; }
From source file:com.haoqee.chatsdk.net.Utility.java
@SuppressWarnings("deprecation") public static Bundle decodeUrl(String s) { Bundle params = new Bundle(); if (s != null) { String array[] = s.split("&"); for (String parameter : array) { String v[] = parameter.split("="); params.putString(URLDecoder.decode(v[0]), URLDecoder.decode(v[1])); }// w w w .j a v a 2 s. c o m } return params; }
From source file:org.linkdroid.PostJob.java
/** * Posts the data to our webhook./* w w w . j a v a2s . com*/ * * The HMAC field calculation notes: * <ol> * <li>The Extras.HMAC field is calculated from all the non Extras.STREAM * fields; this includes all the original bundle extra fields, plus the * linkdroid fields (e.g Extras.STREAM_MIME_TYPE, and including * Extras.STREAM_HMAC); the NONCE is NOT prepended to the input since it will * be somewhere in the data bundle.</li> * <li>The Extras.STREAM_HMAC field is calculated by digesting the concat of * the NONCE (first) and the actual binary data obtained from the * EXTRAS_STREAM uri; this STREAM_HMAC field (along with the other * Extras.STREAM_* fields) are added to the data bundle, which will also be * hmac'd.</li> * <li>If no hmac secret is set, then the NONCEs will not be set in the upload * </li> * </ol> * * @param contentResolver * @param webhook * @param data * @throws UnsupportedEncodingException * @throws IOException * @throws InvalidKeyException * @throws NoSuchAlgorithmException */ public static void execute(ContentResolver contentResolver, Bundle webhook, Bundle data) throws UnsupportedEncodingException, IOException, InvalidKeyException, NoSuchAlgorithmException { // Set constants that may be used in this method. final String secret = webhook.getString(WebhookColumns.SECRET); // This is the multipart form object that will contain all the data bundle // extras; it also will include the data of the extra stream and any other // extra linkdroid specific field required. MultipartEntity entity = new MultipartEntity(); // Do the calculations to create our nonce string, if necessary. String nonce = obtainNonce(webhook); // Add the nonce to the data bundle if we have it. if (nonce != null) { data.putString(Extras.NONCE, nonce); } // We have a stream of data, so we need to add that to the multipart form // upload with a possible HMAC. if (data.containsKey(Intent.EXTRA_STREAM)) { Uri mediaUri = (Uri) data.get(Intent.EXTRA_STREAM); // Open our mediaUri, base 64 encode it and add it to our multipart upload // entity. ByteArrayOutputStream baos = new ByteArrayOutputStream(); Base64OutputStream b64os = new Base64OutputStream(baos); InputStream is = contentResolver.openInputStream(mediaUri); byte[] bytes = new byte[1024]; int count; while ((count = is.read(bytes)) != -1) { b64os.write(bytes, 0, count); } is.close(); baos.close(); b64os.close(); final String base64EncodedString = new String(baos.toByteArray(), UTF8); entity.addPart(Extras.STREAM, new StringBody(base64EncodedString, UTF8_CHARSET)); // Add the mimetype of the stream to the data bundle. final String mimeType = contentResolver.getType(mediaUri); if (mimeType != null) { data.putString(Extras.STREAM_MIME_TYPE, mimeType); } // Do the hmac calculation of the stream and add it to the data bundle. // NOTE: This hmac string will be included as part of the input to the // other Extras hmac. if (shouldDoHmac(webhook)) { InputStream inputStream = contentResolver.openInputStream(mediaUri); final String streamHmac = hmacSha1(inputStream, secret, nonce); inputStream.close(); data.putString(Extras.STREAM_HMAC, streamHmac); Log.d(TAG, "STREAM_HMAC: " + streamHmac); } } // Calculate the Hmac for all the items by iterating over the data bundle // keys in order. if (shouldDoHmac(webhook)) { final String dataHmac = calculateBundleExtrasHmac(data, secret); data.putString(Extras.HMAC, dataHmac); Log.d(TAG, "HMAC: " + dataHmac); } // Dump all the data bundle keys into the form. for (String k : data.keySet()) { Object value = data.get(k); // If the value is null, the key will still be in the form, but with // an empty string as its value. if (value != null) { entity.addPart(k, new StringBody(value.toString(), UTF8_CHARSET)); } else { entity.addPart(k, new StringBody("", UTF8_CHARSET)); } } // Create the client and request, then populate it with our multipart form // upload entity as part of the POST request; finally post the form. final String webhookUri = webhook.getString(WebhookColumns.URI); final HttpClient client = new DefaultHttpClient(); client.getParams().setParameter(USER_AGENT_KEY, USER_AGENT); final HttpPost request = new HttpPost(webhookUri); request.setEntity(entity); HttpResponse response = client.execute(request); switch (response.getStatusLine().getStatusCode()) { case HttpStatus.SC_OK: case HttpStatus.SC_CREATED: case HttpStatus.SC_ACCEPTED: break; default: throw new RuntimeException(response.getStatusLine().toString()); } }
From source file:com.facebook.share.internal.ShareInternalUtility.java
/** * Creates a new Request configured to upload a photo to the specified graph path. * * @param graphPath the graph path to use * @param accessToken the access token to use, or null * @param image the image to upload * @param caption the user generated caption for the photo. * @param params the parameters/* w w w . j a v a 2 s .c om*/ * @param callback a callback that will be called when the request is completed to handle * success or error conditions * @return a Request that is ready to execute */ public static GraphRequest newUploadPhotoRequest(String graphPath, AccessToken accessToken, Bitmap image, String caption, Bundle params, Callback callback) { Bundle parameters = new Bundle(); if (params != null) { parameters.putAll(params); } parameters.putParcelable(PICTURE_PARAM, image); if (caption != null && !caption.isEmpty()) { parameters.putString(CAPTION_PARAM, caption); } return new GraphRequest(accessToken, graphPath, parameters, HttpMethod.POST, callback); }
From source file:com.clover.sdk.v3.entitlements.Entitlements.java
public boolean isAllowed(String entitlement) { Bundle extras = new Bundle(); extras.putString(EXTRA_ENTITLEMENT, entitlement); Bundle result = context.getContentResolver().call(getAuthorityUri(), METHOD_IS_ALLOWED, null, extras); if (result == null) { return false; }//from w w w. ja v a 2 s.com return result.getBoolean(EXTRA_ALLOWED, false); }
From source file:com.facebook.share.internal.ShareInternalUtility.java
/** * Creates a new Request configured to upload a photo to the specified graph path. The * photo will be read from the specified file. * * @param graphPath the graph path to use * @param accessToken the access token to use, or null * @param file the file containing the photo to upload * @param caption the user generated caption for the photo. * @param params the parameters/*from ww w .ja v a 2 s . co m*/ * @param callback a callback that will be called when the request is completed to handle * success or error conditions * @return a Request that is ready to execute * @throws java.io.FileNotFoundException */ public static GraphRequest newUploadPhotoRequest(String graphPath, AccessToken accessToken, File file, String caption, Bundle params, Callback callback) throws FileNotFoundException { ParcelFileDescriptor descriptor = ParcelFileDescriptor.open(file, ParcelFileDescriptor.MODE_READ_ONLY); Bundle parameters = new Bundle(); if (params != null) { parameters.putAll(params); } parameters.putParcelable(PICTURE_PARAM, descriptor); if (caption != null && !caption.isEmpty()) { parameters.putString(CAPTION_PARAM, caption); } return new GraphRequest(accessToken, graphPath, parameters, HttpMethod.POST, callback); }
From source file:com.browsertophone.ShareLink.java
private void sendToast(String toastMessage) { Message msg = new Message(); Bundle data = new Bundle(); data.putString(TOAST, toastMessage); msg.setData(data);/*from w w w .j av a2 s . c o m*/ mHandler.sendMessage(msg); }
From source file:mx.itdurango.rober.siitdocentes.asynctasks.ParcialesTask.java
@Override protected void onPostExecute(String resultado) { super.onPostExecute(resultado); Intent intent = new Intent(context, ActivityAlumnos.class); Bundle bundle = new Bundle(); bundle.putString("resultado", resultado); intent.putExtras(bundle);/*from ww w . j ava 2 s. c o m*/ context.startActivity(intent); Estaticos.ringProgressDialog.dismiss(); }
From source file:com.brennasoft.facebookdashclockextension.fbclient.InboxRequest.java
public InboxResponse execute(Session session) { InboxResponse inboxResponse = new InboxResponse(); if (session.isOpened() && session.getPermissions().contains("read_mailbox")) { Bundle parameters = new Bundle(); parameters.putString("q", q); Request request = new Request(session, "/fql", parameters, HttpMethod.GET); Response response = request.executeAndWait(); FacebookRequestError error = response.getError(); if (error == null) { inboxResponse = parseResponse(response); }/*from w w w.j av a2s . c o m*/ } return inboxResponse; }
From source file:com.seafile.seadroid2.provider.SeafileProvider.java
/** * Create a MatrixCursor with the option to enable the extraLoading flag. * * @param netProjection column list/* w ww . j a v a 2 s.c o m*/ * @param extraLoading if true, the client will expect that more entries will arrive shortly. * @return the Cursor object */ private static MatrixCursor createCursor(String[] netProjection, final boolean extraLoading, final boolean isReachable) { return new MatrixCursor(netProjection) { @Override public Bundle getExtras() { Bundle b = new Bundle(); b.putBoolean(DocumentsContract.EXTRA_LOADING, extraLoading); if (!extraLoading && !isReachable) { b.putString(DocumentsContract.EXTRA_ERROR, "Could not connect with server"); } return b; } }; }