Java Code Examples for android.os.Bundle#putDouble()
The following examples show how to use
android.os.Bundle#putDouble() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: TorrentDetailsFragment.java From qBittorrent-Controller with MIT License | 6 votes |
@Override public void onSaveInstanceState(Bundle outState) { super.onSaveInstanceState(outState); outState.putString("torrentDetailName", name); outState.putString("torrentDetailSize", size); outState.putString("torrentDetailHash", hash); outState.putString("torrentDetailRatio", ratio); outState.putString("torrentDetailState", state); outState.putString("torrentDetailLeechs", leechs); outState.putString("torrentDetailSeeds", seeds); outState.putDouble("torrentDetailProgress", progress); outState.putString("torrentDetailPriority", priority); outState.putString("torrentDetailEta", eta); outState.putString("torrentDetailUploadSpeed", uploadSpeed); outState.putString("torrentDetailDownloadSpeed", downloadSpeed); outState.putString("torrentDetailDownloaded", downloaded); outState.putLong("torrentDetailsAddedOn", addedOn); outState.putLong("torrentDetailsCompletionOn", completionOn); }
Example 2
Source File: MapsActivity.java From q-municate-android with Apache License 2.0 | 5 votes |
private void sendLocation(LatLng position) { if (position == null) { showMissingGeoDataError(true); return; } Bundle extras = new Bundle(); extras.putDouble(ConstsCore.EXTRA_LOCATION_LATITUDE, position.latitude); extras.putDouble(ConstsCore.EXTRA_LOCATION_LONGITUDE, position.longitude); Intent result = new Intent(); result.putExtras(extras); setResult(RESULT_OK, result); finish(); }
Example 3
Source File: RangeSeekBar.java From openshop.io-android with MIT License | 5 votes |
/** * Overridden to save instance state when device orientation changes. This method is called automatically if you assign an id to the RangeSeekBar widget using the {@link #setId(int)} method. Other members of this class than the normalized min and max values don't need to be saved. */ @Override protected Parcelable onSaveInstanceState() { final Bundle bundle = new Bundle(); bundle.putParcelable("SUPER", super.onSaveInstanceState()); bundle.putDouble("MIN", normalizedMinValue); bundle.putDouble("MAX", normalizedMaxValue); return bundle; }
Example 4
Source File: InsightsLogger.java From platform-friends-android with BSD 2-Clause "Simplified" License | 5 votes |
/** * Deprecated. Please use {@link AppEventsLogger} instead. */ public void logConversionPixel(String pixelId, double valueOfPixel) { if (pixelId == null) { Logger.log(LoggingBehavior.DEVELOPER_ERRORS, "Insights", "pixelID cannot be null"); return; } Bundle parameters = new Bundle(); parameters.putString(EVENT_PARAMETER_PIXEL_ID, pixelId); parameters.putDouble(EVENT_PARAMETER_PIXEL_VALUE, valueOfPixel); appEventsLogger.logEvent(EVENT_NAME_LOG_CONVERSION_PIXEL, valueOfPixel, parameters); AppEventsLogger.eagerFlush(); }
Example 5
Source File: MainActivity.java From monolog-android with MIT License | 5 votes |
@Override public void onComplete(int code, double lng, double lat, String addr) { isRefresh = false; if (isHidden) return; Message msg=new Message(); Bundle b=new Bundle(); b.putDouble("lng", lng); b.putDouble("lat", lat); msg.setData(b); msg.what=HANDLER_LOAD_STATUE; mHandler.sendMessage(msg); }
Example 6
Source File: InsightsLogger.java From barterli_android with Apache License 2.0 | 5 votes |
/** * Deprecated. Please use {@link AppEventsLogger} instead. */ public void logConversionPixel(String pixelId, double valueOfPixel) { if (pixelId == null) { Logger.log(LoggingBehavior.DEVELOPER_ERRORS, "Insights", "pixelID cannot be null"); return; } Bundle parameters = new Bundle(); parameters.putString(EVENT_PARAMETER_PIXEL_ID, pixelId); parameters.putDouble(EVENT_PARAMETER_PIXEL_VALUE, valueOfPixel); appEventsLogger.logEvent(EVENT_NAME_LOG_CONVERSION_PIXEL, valueOfPixel, parameters); AppEventsLogger.eagerFlush(); }
Example 7
Source File: BundleMatchersTest.java From android-test with Apache License 2.0 | 5 votes |
@Test public void hasValueWithMultipleEntries() { Bundle bundle = new Bundle(); bundle.putDouble("key", 10000000); bundle.putDouble("key1", 10000001); bundle.putBundle("key2", new Bundle()); double dbl = 10000000; assertTrue(hasValue(dbl).matches(bundle)); assertTrue(hasValue(instanceOf(Double.class)).matches(bundle)); }
Example 8
Source File: RangeSeekBarView.java From Android-Video-Trimmer with Apache License 2.0 | 5 votes |
@Override protected Parcelable onSaveInstanceState() { final Bundle bundle = new Bundle(); bundle.putParcelable("SUPER", super.onSaveInstanceState()); bundle.putDouble("MIN", normalizedMinValue); bundle.putDouble("MAX", normalizedMaxValue); bundle.putDouble("MIN_TIME", normalizedMinValueTime); bundle.putDouble("MAX_TIME", normalizedMaxValueTime); return bundle; }
Example 9
Source File: CitiesDialog.java From android with MIT License | 5 votes |
public static CitiesDialog newInstance(LatLng latLng) { final CitiesDialog dialog = new CitiesDialog(); dialog.setCancelable(false); final Bundle bundle = new Bundle(); bundle.putDouble(Const.BundleKeys.LATITUDE, latLng.getLatitude()); bundle.putDouble(Const.BundleKeys.LONGITUDE, latLng.getLongitude()); dialog.setArguments(bundle); return dialog; }
Example 10
Source File: TransferToActivity.java From Android with MIT License | 5 votes |
public static void startActivity(Activity activity, TransferType type, String address, Double amount) { Bundle bundle = new Bundle(); bundle.putSerializable(TRANSFER_TYPE, type); bundle.putString(TRANSFER_PUBKEY, address); if (amount != null) bundle.putDouble(TRANSFER_AMOUNT, amount); ActivityUtil.next(activity, TransferToActivity.class, bundle); }
Example 11
Source File: TransferAddressActivity.java From Android with MIT License | 5 votes |
public static void startActivity(Activity activity, String address,Double amount) { Bundle bundle = new Bundle(); bundle.putString("address", address); if(amount != null) bundle.putDouble("amount", amount); ActivityUtil.next(activity, TransferAddressActivity.class, bundle); }
Example 12
Source File: RNDataWedgeIntentsModule.java From react-native-datawedge-intents with MIT License | 4 votes |
private Bundle toBundle(final JSONObject obj) { Bundle returnBundle = new Bundle(); if (obj == null) { return null; } try { Iterator<?> keys = obj.keys(); while(keys.hasNext()) { String key = (String)keys.next(); Object compare = obj.get(key); if (obj.get(key) instanceof String) returnBundle.putString(key, obj.getString(key)); else if (obj.get(key) instanceof Boolean) returnBundle.putBoolean(key, obj.getBoolean(key)); else if (obj.get(key) instanceof Integer) returnBundle.putInt(key, obj.getInt(key)); else if (obj.get(key) instanceof Long) returnBundle.putLong(key, obj.getLong(key)); else if (obj.get(key) instanceof Double) returnBundle.putDouble(key, obj.getDouble(key)); else if (obj.get(key).getClass().isArray() || obj.get(key) instanceof JSONArray) { JSONArray jsonArray = obj.getJSONArray(key); int length = jsonArray.length(); if (jsonArray.get(0) instanceof String) { String[] stringArray = new String[length]; for (int j = 0; j < length; j++) stringArray[j] = jsonArray.getString(j); returnBundle.putStringArray(key, stringArray); //returnBundle.putParcelableArray(key, obj.get); } else { Bundle[] bundleArray = new Bundle[length]; for (int k = 0; k < length ; k++) bundleArray[k] = toBundle(jsonArray.getJSONObject(k)); returnBundle.putParcelableArray(key, bundleArray); } } else if (obj.get(key) instanceof JSONObject) returnBundle.putBundle(key, toBundle((JSONObject)obj.get(key))); } } catch (JSONException e) { e.printStackTrace(); } return returnBundle; }
Example 13
Source File: BgEstimateBroadcaster.java From xDrip-Experimental with GNU General Public License v3.0 | 4 votes |
/** * Will send a broadcast local to the phone for other apps (NightWatch, HAPP, ...) to receive the current bg data * * @param bgEstimate The value the CGM would show * * @param rawEstimate If there exists a notion of "calculated raw value" like Nightscout has, it can be passed. If it does not exist, please pass <code>0d</code>. It should just be used for visualization by the receiving app. * * @param timestamp The timestamp of this bgEstimate. * * @param slope The current slope as change in bg per millisecond. * It can be calculated like this: * <code>(last.bgEstimate - current.bgEstimate) / (last.timestamp - current.timestamp)</code> * * @param slopeName A symbolic representation of the slope. * Names accepted by receiving apps are: "DoubleDown", "SingleDown", "FortyFiveDown", "Flat", "FortyFiveUp", "SingleUp", "DoubleUp", "NONE" and "NOT COMPUTABLE". * This class defines String constants for those names. * On <code>null</code> it will default to "NONE". * * @param batteryLevel The battery level on a scale from 0 to 100. (Percentages) * * @param context The current context. * **/ public static void broadcastBgEstimate(double bgEstimate, double rawEstimate, long timestamp, double slope, String slopeName, int batteryLevel, Context context) { //add data to bundle final Bundle bundle = new Bundle(); bundle.putDouble(EXTRA_BG_ESTIMATE, bgEstimate); bundle.putDouble(EXTRA_BG_SLOPE, slope); bundle.putString(EXTRA_BG_SLOPE_NAME, slopeName == null ? SLOPE_NONE : slopeName); bundle.putInt(EXTRA_SENSOR_BATTERY, batteryLevel); bundle.putLong(EXTRA_TIMESTAMP, timestamp); bundle.putDouble(EXTRA_RAW, rawEstimate); //generate intent with data Intent intent = (new Intent(ACTION_NEW_BG_ESTIMATE)) .putExtras(bundle) .addFlags(Intent.FLAG_INCLUDE_STOPPED_PACKAGES); // send broadcast context.sendBroadcast(intent, null); }
Example 14
Source File: BgSendQueue.java From xDrip with GNU General Public License v3.0 | 4 votes |
public static void addToQueue(BgReading bgReading, String operation_type, Context context) { PowerManager powerManager = (PowerManager) context.getSystemService(context.POWER_SERVICE); PowerManager.WakeLock wakeLock = powerManager.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK, "sendQueue"); wakeLock.acquire(); BgSendQueue bgSendQueue = new BgSendQueue(); bgSendQueue.operation_type = operation_type; bgSendQueue.bgReading = bgReading; bgSendQueue.success = false; bgSendQueue.mongo_success = false; bgSendQueue.save(); Log.d("BGQueue", "New value added to queue!"); SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context); Intent updateIntent = new Intent(Intents.ACTION_NEW_BG_ESTIMATE_NO_DATA); context.sendBroadcast(updateIntent); context.startService(new Intent(context, widgetUpdateService.class)); if (prefs.getBoolean("cloud_storage_mongodb_enable", false) || prefs.getBoolean("cloud_storage_api_enable", false)) { Log.w("SENSOR QUEUE:", String.valueOf(bgSendQueue.mongo_success)); if (operation_type.compareTo("create") == 0) { MongoSendTask task = new MongoSendTask(context, bgSendQueue); task.execute(); } } if(prefs.getBoolean("broadcast_data_through_intents", false)) { Log.i("SENSOR QUEUE:", "Broadcast data"); final Bundle bundle = new Bundle(); bundle.putDouble(Intents.EXTRA_BG_ESTIMATE, bgReading.calculated_value); bundle.putDouble(Intents.EXTRA_BG_SLOPE, bgReading.calculated_value_slope); if(bgReading.hide_slope) { bundle.putString(Intents.EXTRA_BG_SLOPE_NAME, "9"); } else { bundle.putString(Intents.EXTRA_BG_SLOPE_NAME, bgReading.slopeName()); } bundle.putInt(Intents.EXTRA_SENSOR_BATTERY, getBatteryLevel(context)); bundle.putLong(Intents.EXTRA_TIMESTAMP, bgReading.timestamp); Intent intent = new Intent(Intents.ACTION_NEW_BG_ESTIMATE); intent.putExtras(bundle); context.sendBroadcast(intent, Intents.RECEIVER_PERMISSION); } if(prefs.getBoolean("broadcast_to_pebble", false)) { PebbleSync pebbleSync = new PebbleSync(); pebbleSync.sendData(context, bgReading); } if(prefs.getBoolean("share_upload", false)) { ShareRest shareRest = new ShareRest(context); Log.w("ShareRest", "About to call ShareRest!!"); shareRest.sendBgData(bgReading); } wakeLock.release(); }
Example 15
Source File: MainActivity.java From trekarta with GNU General Public License v3.0 | 4 votes |
@Override public void onFeatureDetails(long id, boolean fromList) { Bundle args = new Bundle(3); //args.putBoolean(AmenityInformation.ARG_DETAILS, fromList); if (fromList || mLocationState != LocationState.DISABLED) { if (mLocationState != LocationState.DISABLED && mLocationService != null) { Location location = mLocationService.getLocation(); args.putDouble(AmenityInformation.ARG_LATITUDE, location.getLatitude()); args.putDouble(AmenityInformation.ARG_LONGITUDE, location.getLongitude()); } else { MapPosition position = mMap.getMapPosition(); args.putDouble(AmenityInformation.ARG_LATITUDE, position.getLatitude()); args.putDouble(AmenityInformation.ARG_LONGITUDE, position.getLongitude()); } } Fragment fragment = mFragmentManager.findFragmentByTag("waypointInformation"); if (fragment != null) { mFragmentManager.popBackStack("waypointInformation", FragmentManager.POP_BACK_STACK_INCLUSIVE); } fragment = mFragmentManager.findFragmentByTag("amenityInformation"); if (fragment == null) { fragment = Fragment.instantiate(this, AmenityInformation.class.getName(), args); Slide slide = new Slide(Gravity.BOTTOM); // Required to sync with FloatingActionButton slide.setDuration(getResources().getInteger(android.R.integer.config_shortAnimTime)); fragment.setEnterTransition(slide); FragmentTransaction ft = mFragmentManager.beginTransaction(); ft.replace(R.id.bottomSheetPanel, fragment, "amenityInformation"); ft.addToBackStack("amenityInformation"); ft.commit(); updateMapViewArea(); } ((AmenityInformation) fragment).setPreferredLanguage(Configuration.getLanguage()); ((AmenityInformation) fragment).setAmenity(id); mViews.extendPanel.setForeground(getDrawable(R.drawable.dim)); mViews.extendPanel.getForeground().setAlpha(0); ObjectAnimator anim = ObjectAnimator.ofInt(mViews.extendPanel.getForeground(), "alpha", 0, 255); anim.setDuration(500); anim.start(); }
Example 16
Source File: ChannelCommentsFragment.java From lbry-android with MIT License | 4 votes |
private void postComment(double tipAmount) { if (postingComment) { return; } Comment comment = buildPostComment(); // only use 2 decimal places BigDecimal amount = new BigDecimal(String.valueOf(tipAmount)); beforePostComment(); CommentCreateWithTipTask task = new CommentCreateWithTipTask(comment, amount, progressPostComment, new CommentCreateWithTipTask.CommentCreateWithTipHandler() { @Override public void onSuccess(Comment createdComment) { inputComment.setText(null); clearReplyToComment(); if (commentListAdapter != null) { createdComment.setPoster(comment.getPoster()); if (!Helper.isNullOrEmpty(createdComment.getParentId())) { commentListAdapter.addReply(createdComment); } else { commentListAdapter.insert(0, createdComment); } } afterPostComment(); checkNoComments(); Bundle bundle = new Bundle(); bundle.putDouble("amount", amount.doubleValue()); bundle.putString("claim_id", claim != null ? claim.getClaimId() : null); bundle.putString("claim_name", claim != null ? claim.getName() : null); LbryAnalytics.logEvent(LbryAnalytics.EVENT_COMMENT_CREATE, bundle); Context context = getContext(); if (context instanceof MainActivity) { ((MainActivity) context).showMessage(R.string.comment_posted); } } @Override public void onError(Exception error) { try { showError(error != null ? error.getMessage() : getString(R.string.comment_error)); } catch (IllegalStateException ex) { // pass } afterPostComment(); } }); task.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR); }
Example 17
Source File: DeviceOrientationProfile.java From DeviceConnect-Android with MIT License | 2 votes |
/** * 回転加速度センサー情報にx軸回転の角度を設定する. * * @param rotationRate 回転加速度センサー情報 * @param beta x軸回転の角度 */ public static void setBeta(final Bundle rotationRate, final double beta) { rotationRate.putDouble(PARAM_BETA, beta); }
Example 18
Source File: ProximityProfile.java From DeviceConnect-Android with MIT License | 2 votes |
/** * メッセージに近接距離の最小値を設定する. * * @param proximity メッセージパラメータ * @param min 最小値 */ public static void setMin(final Bundle proximity, final double min) { proximity.putDouble(PARAM_MIN, min); }
Example 19
Source File: HumanDetectionProfile.java From DeviceConnect-Android with MIT License | 2 votes |
/** * set gazeLR value to bundle. * @param bundle bundle * @param gazeLR gazeLR value. */ public static void setParamGazeLR(final Bundle bundle, final double gazeLR) { bundle.putDouble(PARAM_GAZE_LR, gazeLR); }
Example 20
Source File: DoubleCoder.java From lyra with Apache License 2.0 | 2 votes |
/** * Write a field's value into the saved state {@link Bundle}. * * @param state {@link Bundle} used to save the state * @param key key retrieved from {@code fieldDeclaringClass#fieldName} * @param fieldValue value of field */ @Override public void serialize(@NonNull Bundle state, @NonNull String key, @NonNull Double fieldValue) { state.putDouble(key, fieldValue); }