android.os.Bundle#putDouble ( )源码实例Demo

下面列出了android.os.Bundle#putDouble ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

@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);

}
 
源代码2 项目: Android   文件: TransferAddressActivity.java
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);
}
 
源代码3 项目: q-municate-android   文件: MapsActivity.java
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();
}
 
源代码4 项目: Android   文件: TransferToActivity.java
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);
}
 
源代码5 项目: android   文件: CitiesDialog.java
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;
}
 
源代码6 项目: Android-Video-Trimmer   文件: RangeSeekBarView.java
@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;
}
 
源代码7 项目: android-test   文件: BundleMatchersTest.java
@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));
}
 
源代码8 项目: barterli_android   文件: InsightsLogger.java
/**
 * 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();
}
 
源代码9 项目: monolog-android   文件: MainActivity.java
@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);
}
 
源代码10 项目: platform-friends-android   文件: InsightsLogger.java
/**
 * 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();
}
 
源代码11 项目: openshop.io-android   文件: RangeSeekBar.java
/**
 * 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;
}
 
源代码12 项目: trekarta   文件: MainActivity.java
@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();
}
 
源代码13 项目: xDrip-Experimental   文件: BgEstimateBroadcaster.java
/**
 * 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);
}
 
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;
}
 
源代码15 项目: xDrip   文件: BgSendQueue.java
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();
}
 
源代码16 项目: lbry-android   文件: ChannelCommentsFragment.java
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);
}
 
/**
 * 回転加速度センサー情報にx軸回転の角度を設定する.
 * 
 * @param rotationRate 回転加速度センサー情報
 * @param beta x軸回転の角度
 */
public static void setBeta(final Bundle rotationRate, final double beta) {
    rotationRate.putDouble(PARAM_BETA, beta);
}
 
源代码18 项目: DeviceConnect-Android   文件: ProximityProfile.java
/**
 * メッセージに近接距離の最小値を設定する.
 * 
 * @param proximity メッセージパラメータ
 * @param min 最小値
 */
public static void setMin(final Bundle proximity, final double min) {
    proximity.putDouble(PARAM_MIN, min);
}
 
/**
 * 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);
}
 
源代码20 项目: lyra   文件: DoubleCoder.java
/**
 * 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);
}