Java Code Examples for android.os.Bundle#getDouble()
The following examples show how to use
android.os.Bundle#getDouble() .
These examples are extracted from open source projects.
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 Project: react-native-push-notification File: RNPushNotificationHelper.java License: MIT License | 6 votes |
public void sendNotificationScheduledCore(Bundle bundle) { long fireDate = (long) bundle.getDouble("fireDate"); boolean allowWhileIdle = bundle.getBoolean("allowWhileIdle"); // If the fireDate is in past, this will fire immediately and show the // notification to the user PendingIntent pendingIntent = toScheduleNotificationIntent(bundle); if(pendingIntent == null) { return; } Log.d(LOG_TAG, String.format("Setting a notification with id %s at time %s", bundle.getString("id"), Long.toString(fireDate))); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) { if(allowWhileIdle && Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) { getAlarmManager().setExactAndAllowWhileIdle(AlarmManager.RTC_WAKEUP, fireDate, pendingIntent); } else { getAlarmManager().setExact(AlarmManager.RTC_WAKEUP, fireDate, pendingIntent); } } else { getAlarmManager().set(AlarmManager.RTC_WAKEUP, fireDate, pendingIntent); } }
Example 2
Source Project: react-native-push-notification File: RNPushNotificationAttributes.java License: MIT License | 6 votes |
public RNPushNotificationAttributes(Bundle bundle) { id = bundle.getString(ID); message = bundle.getString(MESSAGE); fireDate = bundle.getDouble(FIRE_DATE); title = bundle.getString(TITLE); ticker = bundle.getString(TICKER); autoCancel = bundle.getBoolean(AUTO_CANCEL); largeIcon = bundle.getString(LARGE_ICON); smallIcon = bundle.getString(SMALL_ICON); bigText = bundle.getString(BIG_TEXT); subText = bundle.getString(SUB_TEXT); number = bundle.getString(NUMBER); sound = bundle.getString(SOUND); color = bundle.getString(COLOR); group = bundle.getString(GROUP); userInteraction = bundle.getBoolean(USER_INTERACTION); playSound = bundle.getBoolean(PLAY_SOUND); vibrate = bundle.getBoolean(VIBRATE); vibration = bundle.getDouble(VIBRATION); actions = bundle.getString(ACTIONS); tag = bundle.getString(TAG); repeatType = bundle.getString(REPEAT_TYPE); repeatTime = bundle.getDouble(REPEAT_TIME); ongoing = bundle.getBoolean(ONGOING); }
Example 3
Source Project: CalculatorInputView File: CalculatorActivity.java License: Apache License 2.0 | 6 votes |
@Override protected void onRestoreInstanceState(Bundle savedInstanceState) { super.onRestoreInstanceState(savedInstanceState); if (savedInstanceState != null) { clickArithmeticOperator = savedInstanceState.getBoolean(CLICK_ARITHMETIC_OPERATOR); clearInput = savedInstanceState.getBoolean(CLEAR_INPUT); if (savedInstanceState.containsKey(FIRST_VALUE)) firstValue = savedInstanceState.getDouble(FIRST_VALUE); if (savedInstanceState.containsKey(SECONDS_VALUE)) secondsValue = savedInstanceState.getDouble(SECONDS_VALUE); operatorExecute = savedInstanceState.getString(OPERATOR_EXECUTE); prevOperatorExecute = savedInstanceState.getString(PREV_OPERATOR_EXECUTE); } }
Example 4
Source Project: open-location-code File: MainActivity.java License: Apache License 2.0 | 5 votes |
@Override public void onRestoreInstanceState(Bundle savedInstanceState) { super.onRestoreInstanceState(savedInstanceState); Log.i(TAG, "Restoring state"); if (savedInstanceState != null) { double mapCameraPositionLatitude = savedInstanceState.getDouble(MAP_CAMERA_POSITION_LATITUDE); double mapCameraPositionLongitude = savedInstanceState.getDouble(MAP_CAMERA_POSITION_LONGITUDE); float mapCameraPositionZoom = savedInstanceState.getFloat(MAP_CAMERA_POSITION_ZOOM); mMainPresenter.setMapCameraPosition( mapCameraPositionLatitude, mapCameraPositionLongitude, mapCameraPositionZoom); } }
Example 5
Source Project: Androzic File: WaypointDetails.java License: GNU General Public License v3.0 | 5 votes |
@Override public void onStart() { super.onStart(); if (waypoint != null) { Bundle args = getArguments(); double lat = args != null ? args.getDouble("lat") : waypoint.latitude; double lon = args != null ? args.getDouble("lon") : waypoint.longitude; updateWaypointDetails(lat, lon); } }
Example 6
Source Project: prayer-times-android File: CustomTimeAdjustDialogFragment.java License: Apache License 2.0 | 5 votes |
@NonNull @Override public Dialog onCreateDialog(Bundle savedInstanceState) { final Bundle bdl = getArguments(); if (bdl != null && bdl.containsKey("cityId")) { mCalcTime = (CalcTimes) CalcTimes.getTimes(bdl.getLong("cityId")); mPrayTimes = mCalcTime.getPrayTimes(); mTime = Vakit.values()[bdl.getInt("time", 0)]; mAngle = bdl.getDouble("angle"); mMins = bdl.getInt("mins"); } return new AlertDialog.Builder(getActivity()) .setTitle(mTime.getString()) .setPositiveButton(R.string.ok, (dialog, whichButton) -> { bdl.putDouble("angle", mAngle); bdl.putInt("mins", mMins); bdl.putSerializable("asrType", mCalcTime.getAsrType().name()); dismiss(); } ) .setNegativeButton(R.string.cancel, (dialog, whichButton) -> dismiss() ) .create(); }
Example 7
Source Project: prayer-times-android File: CustomTimeAdjustDialogFragment.java License: Apache License 2.0 | 5 votes |
@NonNull @Override public Dialog onCreateDialog(Bundle savedInstanceState) { final Bundle bdl = getArguments(); if (bdl != null && bdl.containsKey("cityId")) { mCalcTime = (CalcTimes) CalcTimes.getTimes(bdl.getLong("cityId")); mPrayTimes = mCalcTime.getPrayTimes(); mTime = Vakit.values()[bdl.getInt("time", 0)]; mAngle = bdl.getDouble("angle"); mMins = bdl.getInt("mins"); } return new AlertDialog.Builder(getActivity()) .setTitle(mTime.getString()) .setPositiveButton(R.string.ok, (dialog, whichButton) -> { bdl.putDouble("angle", mAngle); bdl.putInt("mins", mMins); bdl.putSerializable("asrType", mCalcTime.getAsrType().name()); dismiss(); } ) .setNegativeButton(R.string.cancel, (dialog, whichButton) -> dismiss() ) .create(); }
Example 8
Source Project: SimpleVideoEdit File: RangeSeekBar.java License: Apache License 2.0 | 5 votes |
@Override protected void onRestoreInstanceState(Parcelable parcel) { final Bundle bundle = (Bundle) parcel; super.onRestoreInstanceState(bundle.getParcelable("SUPER")); normalizedMinValue = bundle.getDouble("MIN"); normalizedMaxValue = bundle.getDouble("MAX"); normalizedMinValueTime = bundle.getDouble("MIN_TIME"); normalizedMaxValueTime = bundle.getDouble("MAX_TIME"); }
Example 9
Source Project: trekarta File: MarkerInformation.java License: GNU General Public License v3.0 | 5 votes |
@Override public void onActivityCreated(Bundle savedInstanceState) { super.onActivityCreated(savedInstanceState); mLatitude = getArguments().getDouble(ARG_LATITUDE); mLongitude = getArguments().getDouble(ARG_LONGITUDE); mName = getArguments().getString(ARG_NAME); if (savedInstanceState != null) { mLatitude = savedInstanceState.getDouble(ARG_LATITUDE); mLongitude = savedInstanceState.getDouble(ARG_LONGITUDE); mName = savedInstanceState.getString(ARG_NAME); } String name; if (mName != null && !"".equals(mName)) name = mName; else name = StringFormatter.coordinates(" ", mLatitude, mLongitude); //noinspection ConstantConditions ((TextView) getView().findViewById(R.id.name)).setText(name); final GeoPoint point = new GeoPoint(mLatitude, mLongitude); mMapHolder.showMarker(point, name, false); FloatingActionButton floatingButton = mFragmentHolder.enableActionButton(); floatingButton.setImageDrawable(getContext().getDrawable(R.drawable.ic_pin_drop)); floatingButton.setOnClickListener(v -> { String name1; if (mName != null && !"".equals(mName)) name1 = mName; else name1 = getString(R.string.place_name, Configuration.getPointsCounter()); mListener.onWaypointCreate(point, name1, true, true); mFragmentHolder.disableActionButton(); mFragmentHolder.popCurrent(); }); }
Example 10
Source Project: SightRemote File: EditBRProfileActivity.java License: GNU General Public License v3.0 | 5 votes |
@Override protected void onCreate(@Nullable Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContent(R.layout.activity_edit_br_profile); getSupportActionBar().setDisplayHomeAsUpEnabled(true); if (savedInstanceState == null) { nameBlock = (NameBlock) SerializationUtils.deserialize(getIntent().getByteArrayExtra("nameBlock")); profileBlock = (BRProfileBlock) SerializationUtils.deserialize(getIntent().getByteArrayExtra("profileBlock")); } else { nameBlock = (NameBlock) SerializationUtils.deserialize(savedInstanceState.getByteArray("nameBlock")); profileBlock = (BRProfileBlock) SerializationUtils.deserialize(savedInstanceState.getByteArray("profileBlock")); minBRAmount = savedInstanceState.getDouble("minBRAmount"); maxBRAmount = savedInstanceState.getDouble("maxBRAmount"); } adjustTitle(); profileBlocks = FixedSizeProfileBlock.convertToFixed(profileBlock.getProfileBlocks()); blockList = findViewById(R.id.block_list); blockList.setLayoutManager(new LinearLayoutManager(this)); blockList.setAdapter(adapter = new BRProfileBlockAdapter()); adapter.setProfileBlocks(profileBlocks); adapter.setOnClickListener(this); adapter.notifyDataSetChanged(); if (maxBRAmount == -1) showManualOverlay(); }
Example 11
Source Project: android File: MapUtils.java License: MIT License | 5 votes |
public static LatLngZoom getBundleGeoPoint(@NonNull Bundle extras) { final double lat = extras.getDouble(Const.BundleKeys.LATITUDE, Const.UNKNOWN_VALUE); final double lng = extras.getDouble(Const.BundleKeys.LONGITUDE, Const.UNKNOWN_VALUE); if ((Double.compare(lat, Const.UNKNOWN_VALUE) != 0) && (Double.compare(lng, Const.UNKNOWN_VALUE) != 0)) { // Mapbox's empty value for zoom is 0.0 double zoom = extras.getDouble(Const.BundleKeys.ZOOM, 0.0); return new LatLngZoom(lat, lng, zoom); } return null; }
Example 12
Source Project: Conquer File: LocationActivity.java License: Apache License 2.0 | 5 votes |
private void initBaiduMap() { // 地图初始化 mMapView = (MapView) findViewById(R.id.bmapView); mBaiduMap = mMapView.getMap(); // 设置缩放级别 mBaiduMap.setMaxAndMinZoomLevel(18, 13); // 注册 SDK 广播监听者 IntentFilter iFilter = new IntentFilter(); iFilter.addAction(SDKInitializer.SDK_BROADTCAST_ACTION_STRING_PERMISSION_CHECK_ERROR); iFilter.addAction(SDKInitializer.SDK_BROADCAST_ACTION_STRING_NETWORK_ERROR); mReceiver = new BaiduReceiver(); registerReceiver(mReceiver, iFilter); Intent intent = getIntent(); String type = intent.getStringExtra("type"); if (type.equals("select")) {// 选择发送位置 // initTopBarForBoth("位置", R.drawable.btn_login_selector, "发送", new // onRightImageButtonClickListener() { // @Override // public void onClick() { // // TODO Auto-generated method stub // gotoChatPage(); // } // }); // mHeaderLayout.getRightImageButton().setEnabled(false); initLocClient(); } else {// 查看当前位置 // initTopBarForLeft("位置"); Bundle b = intent.getExtras(); LatLng latlng = new LatLng(b.getDouble("latitude"), b.getDouble("longtitude"));// 维度在前,经度在后 mBaiduMap.setMapStatus(MapStatusUpdateFactory.newLatLng(latlng)); // 显示当前位置图标 OverlayOptions ooA = new MarkerOptions().position(latlng).icon(bdgeo).zIndex(9); mBaiduMap.addOverlay(ooA); } mSearch = GeoCoder.newInstance(); mSearch.setOnGetGeoCodeResultListener(this); }
Example 13
Source Project: Androzic File: WaypointInfo.java License: GNU General Public License v3.0 | 5 votes |
@Override public void onStart() { super.onStart(); Bundle args = getArguments(); if (args != null) { double lat = args.getDouble("lat"); double lon = args.getDouble("lon"); updateWaypointInfo(lat, lon); } }
Example 14
Source Project: AnimCubeAndroid File: AnimCubeDebug.java License: Apache License 2.0 | 5 votes |
/** * <p> * Restores a previously saved state. * </p> * <p> * If the cube was animating when its state was saved, then this method will also resume the animation and repeat the step * that was interrupted by the configuration change. * </p> * * @param state a {@link Bundle} containing a previously saved state of the cube. * @see #saveState() */ public void restoreState(Bundle state) { synchronized (animThreadLock) { for (int i = 0; i < cube.length; i++) { cube[i] = state.getIntArray(CubeState.KEY_CUBE + i); } for (int i = 0; i < initialCube.length; i++) { initialCube[i] = state.getIntArray(CubeState.KEY_INITIAL_CUBE + i); } move = state.getIntArray(CubeState.KEY_MOVE); movePos = state.getInt(CubeState.KEY_MOVE_POS); originalAngle = state.getDouble(CubeState.KEY_ORIGINAL_ANGLE); double[] buffer = state.getDoubleArray(CubeState.KEY_EYE); System.arraycopy(buffer, 0, eye, 0, eye.length); buffer = state.getDoubleArray(CubeState.KEY_EYE_X); System.arraycopy(buffer, 0, eyeX, 0, eyeX.length); buffer = state.getDoubleArray(CubeState.KEY_EYE_Y); System.arraycopy(buffer, 0, eyeY, 0, eyeY.length); editable = state.getBoolean(CubeState.KEY_EDITABLE); backFacesDistance = state.getInt(CubeState.KEY_BACKFACES_DISTANCE); setBackFacesDistanceInternal(backFacesDistance); speed = state.getInt(CubeState.KEY_SINGLE_ROTATION_SPEED); doubleSpeed = state.getInt(CubeState.KEY_DOUBLE_ROTATION_SPEED); isDebuggable = state.getBoolean(CubeState.KEY_IS_DEBUGGABLE); repaint(); boolean animating = state.getBoolean(CubeState.KEY_IS_ANIMATING); if (animating) { int animationMode = state.getInt(CubeState.KEY_ANIMATION_MODE); if (animationMode != AnimationMode.STOPPED) { startAnimation(animationMode); } } } }
Example 15
Source Project: openshop.io-android File: RangeSeekBar.java License: MIT License | 5 votes |
/** * Overridden to restore 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. */ @Override protected void onRestoreInstanceState(Parcelable parcel) { final Bundle bundle = (Bundle) parcel; super.onRestoreInstanceState(bundle.getParcelable("SUPER")); normalizedMinValue = bundle.getDouble("MIN"); normalizedMaxValue = bundle.getDouble("MAX"); }
Example 16
Source Project: react-native-push-notification File: RNPushNotificationHelper.java License: MIT License | 4 votes |
private void scheduleNextNotificationIfRepeating(Bundle bundle) { String repeatType = bundle.getString("repeatType"); long repeatTime = (long) bundle.getDouble("repeatTime"); if (repeatType != null) { long fireDate = (long) bundle.getDouble("fireDate"); boolean validRepeatType = Arrays.asList("time", "month", "week", "day", "hour", "minute").contains(repeatType); // Sanity checks if (!validRepeatType) { Log.w(LOG_TAG, String.format("Invalid repeatType specified as %s", repeatType)); return; } if ("time".equals(repeatType) && repeatTime <= 0) { Log.w(LOG_TAG, "repeatType specified as time but no repeatTime " + "has been mentioned"); return; } long newFireDate = 0; switch (repeatType) { case "time": newFireDate = fireDate + repeatTime; break; case "month": final Calendar fireDateCalendar = new GregorianCalendar(); fireDateCalendar.setTime(new Date(fireDate)); final int fireDay = fireDateCalendar.get(Calendar.DAY_OF_MONTH); final int fireMinute = fireDateCalendar.get(Calendar.MINUTE); final int fireHour = fireDateCalendar.get(Calendar.HOUR_OF_DAY); final Calendar nextEvent = new GregorianCalendar(); nextEvent.setTime(new Date()); final int currentMonth = nextEvent.get(Calendar.MONTH); int nextMonth = currentMonth < 11 ? (currentMonth + 1) : 0; nextEvent.set(Calendar.YEAR, nextEvent.get(Calendar.YEAR) + (nextMonth == 0 ? 1 : 0)); nextEvent.set(Calendar.MONTH, nextMonth); final int maxDay = nextEvent.getActualMaximum(Calendar.DAY_OF_MONTH); nextEvent.set(Calendar.DAY_OF_MONTH, fireDay <= maxDay ? fireDay : maxDay); nextEvent.set(Calendar.HOUR_OF_DAY, fireHour); nextEvent.set(Calendar.MINUTE, fireMinute); nextEvent.set(Calendar.SECOND, 0); newFireDate = nextEvent.getTimeInMillis(); break; case "week": newFireDate = fireDate + 7 * ONE_DAY; break; case "day": newFireDate = fireDate + ONE_DAY; break; case "hour": newFireDate = fireDate + ONE_HOUR; break; case "minute": newFireDate = fireDate + ONE_MINUTE; break; } // Sanity check, should never happen if (newFireDate != 0) { Log.d(LOG_TAG, String.format("Repeating notification with id %s at time %s", bundle.getString("id"), Long.toString(newFireDate))); bundle.putDouble("fireDate", newFireDate); this.sendNotificationScheduled(bundle); } } }
Example 17
Source Project: aptoide-client File: MakeReviewActivity.java License: GNU General Public License v2.0 | 4 votes |
@Override protected void onCreate(Bundle savedInstanceState) { Aptoide.getThemePicker().setAptoideTheme(this); super.onCreate(savedInstanceState); setContentView(getContentView()); bindViews(); mToolbar.setCollapsible(false); setSupportActionBar(mToolbar); scoreTV = (TextView) findViewById(R.id.finalScore); scoreString = getString(R.string.review_final_score); screenshots = (RecyclerView) findViewById(R.id.layout_screenshots); getSupportActionBar().setHomeButtonEnabled(true); getSupportActionBar().setDisplayHomeAsUpEnabled(true); getSupportActionBar().setDisplayShowTitleEnabled(true); getSupportActionBar().setTitle(R.string.make_review_title); int pixels = AptoideUtils.getPixels(this, 5); screenshots.addItemDecoration(new DividerItemDecoration(pixels)); screenshots.setLayoutManager(new LinearLayoutManager(this, LinearLayoutManager.HORIZONTAL, false)); screenshots.setAdapter(new ScreenshotsAdapter(getIntent().getStringArrayListExtra(EXTRA_SCREENSHOTS_URL))); Glide.with(this).load(getIntent().getStringExtra(EXTRA_ICON)).into((ImageView) findViewById(R.id.icon)); ((TextView) findViewById(R.id.name)).setText(getIntent().getStringExtra(EXTRA_APP_NAME)); String text = getString(R.string.size) + ": " + getIntent().getLongExtra(EXTRA_SIZE,0); ((TextView) findViewById(R.id.text1)).setText(text); text = getString(R.string.downloads) + ": " + getIntent().getIntExtra(EXTRA_DOWNLOADS,0); ((TextView) findViewById(R.id.text2)).setText(text); ((RatingBar) findViewById(R.id.app_rating)).setRating(getIntent().getFloatExtra(EXTRA_STARS,0.0f)); if(savedInstanceState != null ) { ratingValues=savedInstanceState.getIntArray(RATINGS_VALUES); avg=savedInstanceState.getDouble(RATINGS_AVG); updateScoreUI(); }else{ for (int i = 0; i < RATINGS_COUNT; i++) { ratingValues[i]=0; } } setupSeekBar(RATINGS_SPEED,R.string.review_speed,R.id.Seek_Bar_Speed); setupSeekBar(RATINGS_USABILITY,R.string.review_usability,R.id.Seek_Bar_Usability); setupSeekBar(RATINGS_ADDICTIVE,R.string.review_addictive,R.id.Seek_Bar_Funny); setupSeekBar(RATINGS_STABILITY,R.string.review_stability,R.id.Seek_Bar_Stability); }
Example 18
Source Project: pixelvisualcorecamera File: ZoomScaleGestureListener.java License: Apache License 2.0 | 4 votes |
public void restoreInstanceState(Bundle savedInstanceState) { zoomLevel = (savedInstanceState != null) ? savedInstanceState.getDouble(stateKey, DEFAULT_ZOOM) : DEFAULT_ZOOM; }
Example 19
Source Project: react-native-turbolinks File: TurbolinksAction.java License: MIT License | 4 votes |
public TurbolinksAction(Bundle bundle) { this.id = (int) bundle.getDouble("id"); this.title = bundle.getString("title"); this.icon = bundle.getBundle("icon"); this.button = bundle.getBoolean("button"); }
Example 20
Source Project: Androzic File: MapView.java License: GNU General Public License v3.0 | 4 votes |
@Override protected void onRestoreInstanceState(Parcelable state) { if (state instanceof Bundle) { Bundle bundle = (Bundle) state; super.onRestoreInstanceState(bundle.getParcelable("instanceState")); vectorType = bundle.getInt("vectorType"); vectorMultiplier = bundle.getInt("vectorMultiplier"); isFollowing = bundle.getBoolean("autoFollow"); strictUnfollow = bundle.getBoolean("strictUnfollow"); loadBestMap = bundle.getBoolean("loadBestMap"); bestMapInterval = bundle.getInt("bestMapInterval"); isFixed = bundle.getBoolean("isFixed"); isMoving = bundle.getBoolean("isMoving"); lastBestMap = bundle.getLong("lastBestMap"); penX = bundle.getInt("penX"); penY = bundle.getInt("penY"); penOX = bundle.getInt("penOX"); penOY = bundle.getInt("penOY"); currentViewport.lookAheadXY = bundle.getIntArray("lookAheadXY"); lookAhead = bundle.getInt("lookAhead"); lookAheadC = bundle.getFloat("lookAheadC"); lookAheadS = bundle.getFloat("lookAheadS"); lookAheadSS = bundle.getFloat("lookAheadSS"); lookAheadPst = bundle.getInt("lookAheadPst"); lookAheadB = bundle.getFloat("lookAheadB"); smoothB = bundle.getFloat("smoothB"); smoothBS = bundle.getFloat("smoothBS"); currentViewport.mapCenter = bundle.getDoubleArray("mapCenter"); currentViewport.location = bundle.getDoubleArray("currentLocation"); currentViewport.mapCenterXY = bundle.getIntArray("mapCenterXY"); currentViewport.locationXY = bundle.getIntArray("currentLocationXY"); currentViewport.mapHeading = bundle.getFloat("mapHeading"); currentViewport.bearing = bundle.getFloat("bearing"); currentViewport.speed = bundle.getFloat("speed"); mpp = bundle.getDouble("mpp"); vectorLength = bundle.getInt("vectorLength"); proximity = bundle.getInt("proximity"); // TODO Should be somewhere else? if (movingCursor != null) movingCursor.setColorFilter(isFixed ? active : null); } else { super.onRestoreInstanceState(state); } }