List of usage examples for android.os Bundle putFloat
@Override public void putFloat(@Nullable String key, float value)
From source file:pl.edu.agh.mindmapex.gui.MainActivity.java
@Override protected void onSaveInstanceState(Bundle outState) { super.onSaveInstanceState(outState); outState.putFloat(TRANSX_KEY, lay.transx); outState.putFloat(TRANSY_KEY, lay.transy); outState.putFloat(ZOOMX_KEY, lay.zoomx); outState.putFloat(ZOOMY_KEY, lay.zoomy); outState.putFloat(PIVOTX_KEY, lay.pivotx); outState.putFloat(PIVOTY_KEY, lay.pivoty); }
From source file:androidx.media.MediaController2.java
/** * Set the playback speed./*from w w w . j a va 2 s . c o m*/ */ public void setPlaybackSpeed(float speed) { synchronized (mLock) { if (!mConnected) { Log.w(TAG, "Session isn't active", new IllegalStateException()); return; } Bundle args = new Bundle(); args.putFloat(ARGUMENT_PLAYBACK_SPEED, speed); sendCommand(COMMAND_CODE_PLAYBACK_SET_SPEED, args); } }
From source file:com.android.mail.ui.ConversationViewFragment.java
@Override public void onSaveInstanceState(Bundle outState) { super.onSaveInstanceState(outState); outState.putFloat(BUNDLE_KEY_WEBVIEW_Y_PERCENT, calculateScrollYPercent()); }
From source file:com.mantz_it.rfanalyzer.ui.activity.MainActivity.java
@Override protected void onSaveInstanceState(Bundle outState) { outState.putBoolean(getString(R.string.save_state_running), running); outState.putInt(getString(R.string.save_state_demodulatorMode), demodulationMode); // todo: also save source settings? definitely in need of interface handling settings if (analyzerSurface != null) { outState.putLong(getString(R.string.save_state_channelFrequency), analyzerSurface.getChannelFrequency()); outState.putInt(getString(R.string.save_state_channelWidth), analyzerSurface.getChannelWidth()); outState.putFloat(getString(R.string.save_state_squelch), analyzerSurface.getSquelch()); outState.putLong(getString(R.string.save_state_virtualFrequency), analyzerSurface.getVirtualFrequency()); outState.putInt(getString(R.string.save_state_virtualSampleRate), analyzerSurface.getVirtualSampleRate()); outState.putFloat(getString(R.string.save_state_minDB), analyzerSurface.getMinDB()); outState.putFloat(getString(R.string.save_state_maxDB), analyzerSurface.getMaxDB()); }// w w w. jav a2 s . co m }
From source file:com.mantz_it.rfanalyzer.MainActivity.java
@Override protected void onSaveInstanceState(Bundle outState) { outState.putBoolean(getString(R.string.save_state_running), running); outState.putInt(getString(R.string.save_state_demodulatorMode), demodulationMode); if (analyzerSurface != null) { outState.putLong(getString(R.string.save_state_channelFrequency), analyzerSurface.getChannelFrequency()); outState.putInt(getString(R.string.save_state_channelWidth), analyzerSurface.getChannelWidth()); outState.putFloat(getString(R.string.save_state_squelch), analyzerSurface.getSquelch()); outState.putLong(getString(R.string.save_state_virtualFrequency), analyzerSurface.getVirtualFrequency()); outState.putInt(getString(R.string.save_state_virtualSampleRate), analyzerSurface.getVirtualSampleRate()); outState.putFloat(getString(R.string.save_state_minDB), analyzerSurface.getMinDB()); outState.putFloat(getString(R.string.save_state_maxDB), analyzerSurface.getMaxDB()); }//from w w w. j a v a 2s .co m }
From source file:io.jawg.osmcontributor.ui.fragments.MapFragment.java
@Override public void onSaveInstanceState(Bundle outState) { super.onSaveInstanceState(outState); mapView.onSaveInstanceState(outState); outState.putParcelable(LOCATION, mapboxMap.getCameraPosition().target); outState.putFloat(ZOOM_LEVEL, getZoomLevel()); outState.putInt(CREATION_MODE, mapMode.ordinal()); outState.putLong(POI_TYPE_ID, poiTypeSelected == null ? -1 : poiTypeSelected.getId()); outState.putDouble(LEVEL, currentLevel); outState.putBoolean(DISPLAY_OPEN_NOTES, displayOpenNotes); outState.putBoolean(DISPLAY_CLOSED_NOTES, displayClosedNotes); int markerType = markerSelected == null ? LocationMarkerView.MarkerType.NONE.ordinal() : markerSelected.getType().ordinal(); outState.putInt(MARKER_TYPE, markerType); if (markerSelected != null) { switch (markerSelected.getType()) { case POI: markerSelectedId = ((Poi) markerSelected.getRelatedObject()).getId(); break; case NODE_REF: markerSelectedId = ((PoiNodeRef) markerSelected.getRelatedObject()).getId(); break; case NOTE: markerSelectedId = ((Note) markerSelected.getRelatedObject()).getId(); break; }// w ww .j a v a2 s.c om } else { markerSelectedId = -1L; } outState.putLong(SELECTED_MARKER_ID, markerSelectedId); long[] hidden = new long[poiTypeHidden.size()]; int index = 0; for (Long value : poiTypeHidden) { hidden[index] = value; index++; } outState.putLongArray(HIDDEN_POI_TYPE, hidden); }
From source file:cn.edu.zafu.corepage.base.BaseActivity.java
/** * ??// w w w. j a va 2 s.c om * * @param outState Bundle */ @Override protected void onSaveInstanceState(Bundle outState) { Field[] fields = this.getClass().getDeclaredFields(); Field.setAccessible(fields, true); Annotation[] ans; for (Field f : fields) { ans = f.getDeclaredAnnotations(); for (Annotation an : ans) { if (an instanceof SaveWithActivity) { try { Object o = f.get(this); if (o == null) { continue; } String fieldName = f.getName(); if (o instanceof Integer) { outState.putInt(fieldName, f.getInt(this)); } else if (o instanceof String) { outState.putString(fieldName, (String) f.get(this)); } else if (o instanceof Long) { outState.putLong(fieldName, f.getLong(this)); } else if (o instanceof Short) { outState.putShort(fieldName, f.getShort(this)); } else if (o instanceof Boolean) { outState.putBoolean(fieldName, f.getBoolean(this)); } else if (o instanceof Byte) { outState.putByte(fieldName, f.getByte(this)); } else if (o instanceof Character) { outState.putChar(fieldName, f.getChar(this)); } else if (o instanceof CharSequence) { outState.putCharSequence(fieldName, (CharSequence) f.get(this)); } else if (o instanceof Float) { outState.putFloat(fieldName, f.getFloat(this)); } else if (o instanceof Double) { outState.putDouble(fieldName, f.getDouble(this)); } else if (o instanceof String[]) { outState.putStringArray(fieldName, (String[]) f.get(this)); } else if (o instanceof Parcelable) { outState.putParcelable(fieldName, (Parcelable) f.get(this)); } else if (o instanceof Serializable) { outState.putSerializable(fieldName, (Serializable) f.get(this)); } else if (o instanceof Bundle) { outState.putBundle(fieldName, (Bundle) f.get(this)); } } catch (IllegalArgumentException e) { e.printStackTrace(); } catch (IllegalAccessException e) { e.printStackTrace(); } } } } super.onSaveInstanceState(outState); }
From source file:com.tct.mail.ui.ConversationViewFragment.java
@Override public void onSaveInstanceState(Bundle outState) { super.onSaveInstanceState(outState); //TS: wenggangjin 2015-01-03 EMAIL BUGFIX_882241 MOD_S outState.putBoolean("starred", mConversation.starred); //TS: wenggangjin 2015-01-03 EMAIL BUGFIX_882241 MOD_E outState.putFloat(BUNDLE_KEY_WEBVIEW_Y_PERCENT, calculateScrollYPercent()); outState.putBoolean(IS_DOWNLOADING_REMAINING, mIsDownloadingRemaining); // TS: gangjin.weng 2015-04-20 EMAIL BUGFIX_940964 ADD outState.putBoolean(IS_POP_DOWNLOAD_REMAIN, mIsPopDownloadRemain); }
From source file:com.facebook.SharedPreferencesTokenCache.java
private void deserializeKey(String key, Bundle bundle) throws JSONException { String jsonString = cache.getString(key, "{}"); JSONObject json = new JSONObject(jsonString); String valueType = json.getString(JSON_VALUE_TYPE); if (valueType.equals(TYPE_BOOLEAN)) { bundle.putBoolean(key, json.getBoolean(JSON_VALUE)); } else if (valueType.equals(TYPE_BOOLEAN_ARRAY)) { JSONArray jsonArray = json.getJSONArray(JSON_VALUE); boolean[] array = new boolean[jsonArray.length()]; for (int i = 0; i < array.length; i++) { array[i] = jsonArray.getBoolean(i); }/*from w w w.ja va 2s. c om*/ bundle.putBooleanArray(key, array); } else if (valueType.equals(TYPE_BYTE)) { bundle.putByte(key, (byte) json.getInt(JSON_VALUE)); } else if (valueType.equals(TYPE_BYTE_ARRAY)) { JSONArray jsonArray = json.getJSONArray(JSON_VALUE); byte[] array = new byte[jsonArray.length()]; for (int i = 0; i < array.length; i++) { array[i] = (byte) jsonArray.getInt(i); } bundle.putByteArray(key, array); } else if (valueType.equals(TYPE_SHORT)) { bundle.putShort(key, (short) json.getInt(JSON_VALUE)); } else if (valueType.equals(TYPE_SHORT_ARRAY)) { JSONArray jsonArray = json.getJSONArray(JSON_VALUE); short[] array = new short[jsonArray.length()]; for (int i = 0; i < array.length; i++) { array[i] = (short) jsonArray.getInt(i); } bundle.putShortArray(key, array); } else if (valueType.equals(TYPE_INTEGER)) { bundle.putInt(key, json.getInt(JSON_VALUE)); } else if (valueType.equals(TYPE_INTEGER_ARRAY)) { JSONArray jsonArray = json.getJSONArray(JSON_VALUE); int[] array = new int[jsonArray.length()]; for (int i = 0; i < array.length; i++) { array[i] = jsonArray.getInt(i); } bundle.putIntArray(key, array); } else if (valueType.equals(TYPE_LONG)) { bundle.putLong(key, json.getLong(JSON_VALUE)); } else if (valueType.equals(TYPE_LONG_ARRAY)) { JSONArray jsonArray = json.getJSONArray(JSON_VALUE); long[] array = new long[jsonArray.length()]; for (int i = 0; i < array.length; i++) { array[i] = jsonArray.getLong(i); } bundle.putLongArray(key, array); } else if (valueType.equals(TYPE_FLOAT)) { bundle.putFloat(key, (float) json.getDouble(JSON_VALUE)); } else if (valueType.equals(TYPE_FLOAT_ARRAY)) { JSONArray jsonArray = json.getJSONArray(JSON_VALUE); float[] array = new float[jsonArray.length()]; for (int i = 0; i < array.length; i++) { array[i] = (float) jsonArray.getDouble(i); } bundle.putFloatArray(key, array); } else if (valueType.equals(TYPE_DOUBLE)) { bundle.putDouble(key, json.getDouble(JSON_VALUE)); } else if (valueType.equals(TYPE_DOUBLE_ARRAY)) { JSONArray jsonArray = json.getJSONArray(JSON_VALUE); double[] array = new double[jsonArray.length()]; for (int i = 0; i < array.length; i++) { array[i] = jsonArray.getDouble(i); } bundle.putDoubleArray(key, array); } else if (valueType.equals(TYPE_CHAR)) { String charString = json.getString(JSON_VALUE); if (charString != null && charString.length() == 1) { bundle.putChar(key, charString.charAt(0)); } } else if (valueType.equals(TYPE_CHAR_ARRAY)) { JSONArray jsonArray = json.getJSONArray(JSON_VALUE); char[] array = new char[jsonArray.length()]; for (int i = 0; i < array.length; i++) { String charString = jsonArray.getString(i); if (charString != null && charString.length() == 1) { array[i] = charString.charAt(0); } } bundle.putCharArray(key, array); } else if (valueType.equals(TYPE_STRING)) { bundle.putString(key, json.getString(JSON_VALUE)); } else if (valueType.equals(TYPE_STRING_LIST)) { JSONArray jsonArray = json.getJSONArray(JSON_VALUE); int numStrings = jsonArray.length(); ArrayList<String> stringList = new ArrayList<String>(numStrings); for (int i = 0; i < numStrings; i++) { Object jsonStringValue = jsonArray.get(i); stringList.add(i, jsonStringValue == JSONObject.NULL ? null : (String) jsonStringValue); } bundle.putStringArrayList(key, stringList); } }
From source file:org.de.jmg.learn.MainActivity.java
@Override protected void onSaveInstanceState(Bundle outState) { super.onSaveInstanceState(outState); try {//from w ww .j av a 2 s . c o m boolean aend = vok.aend; String filename = vok.getFileName(); Uri uri = vok.getURI(); outState.putInt("SelFragID", mPager.getCurrentItem()); outState.putString("JMGDataDirectory", JMGDataDirectory); outState.putFloat("ActionBarOriginalTextSize", ActionBarOriginalTextSize); if (vok.getGesamtzahl() > 0) { saveFilePrefs(true); if (uri != null) { lib.CheckPermissions(this, uri, false); //this.takePersistableUri(getIntent(), uri,true); } vok.SaveFile(Path.combine(getApplicationInfo().dataDir, "vok.tmp"), uri, vok.getUniCode(), true); outState.putString("vokpath", filename); outState.putInt("vokindex", vok.getIndex()); outState.putInt("vokLastIndex", vok.getLastIndex()); outState.putIntArray("Lernvokabeln", vok.getLernvokabeln()); outState.putInt("Lernindex", vok.getLernIndex()); outState.putBoolean("Unicode", vok.getUniCode()); outState.putBoolean("Cardmode", vok.getCardMode()); outState.putBoolean("aend", aend); outState.putInt("Right", vok.AnzRichtig); outState.putInt("Wrong", vok.AnzFalsch); if (uri != null) outState.putString("URI", uri.toString()); vok.aend = aend; vok.setFileName(filename); vok.setURI(uri); } handlerbackpressed.removeCallbacks(rSetBackPressedFalse); for (DialogInterface dlg : lib.OpenDialogs) { dlg.dismiss(); } lib.OpenDialogs.clear(); } catch (Exception e) { Log.e("OnSaveInstanceState", e.getMessage(), e); e.printStackTrace(); } // outState.putParcelable("vok", vok); }