List of usage examples for android.os Bundle keySet
public Set<String> keySet()
From source file:am.project.x.widget.FragmentRemovePagerAdapter.java
@Override public void restoreState(Parcelable state, ClassLoader loader) { if (state != null) { Bundle bundle = (Bundle) state; bundle.setClassLoader(loader);//from w w w.j a v a 2s.c om Parcelable[] fss = bundle.getParcelableArray("states"); mSavedState.clear(); if (fss != null) { for (Parcelable fs : fss) { mSavedState.add((Fragment.SavedState) fs); } } Iterable<String> keys = bundle.keySet(); for (String key : keys) { if (key.startsWith("f")) { Fragment f = mFragmentManager.getFragment(bundle, key); if (f != null) { f.setMenuVisibility(false); } else { Log.w(TAG, "Bad fragment at key " + key); } } } } }
From source file:com.afollestad.impression.utils.FragmentStatePagerAdapter.java
@Override public void restoreState(Parcelable state, ClassLoader loader) { if (state != null) { Bundle bundle = (Bundle) state; bundle.setClassLoader(loader);//from w w w . ja va 2 s . com Parcelable[] fss = bundle.getParcelableArray("states"); mSavedState.clear(); mFragments.clear(); if (fss != null) { for (Parcelable fs : fss) { mSavedState.add((Fragment.SavedState) fs); } } Iterable<String> keys = bundle.keySet(); for (String key : keys) { if (key.startsWith("f")) { int index = Integer.parseInt(key.substring(1)); Fragment f = mFragmentManager.getFragment(bundle, key); if (f != null) { while (mFragments.size() <= index) { mFragments.add(null); } FragmentCompat.setMenuVisibility(f, false); mFragments.set(index, f); } else { Log.w(TAG, "Bad fragment at key " + key); } } } } }
From source file:com.collegiate.core.FragmentStatePagerAdapter.java
@Override public void restoreState(Parcelable state, ClassLoader loader) { if (state != null) { Bundle bundle = (Bundle) state; bundle.setClassLoader(loader);// w w w .j a va2s . co m Parcelable[] fss = bundle.getParcelableArray("states"); mSavedState.clear(); mFragments.clear(); if (fss != null) { for (int i = 0; i < fss.length; i++) { mSavedState.add((Fragment.SavedState) fss[i]); } } Iterable<String> keys = bundle.keySet(); for (String key : keys) { if (key.startsWith("f")) { int index = Integer.parseInt(key.substring(1)); Fragment f = mFragmentManager.getFragment(bundle, key); if (f != null) { while (mFragments.size() <= index) { mFragments.add(null); } f.setMenuVisibility(false); mFragments.set(index, f); } } } } }
From source file:cn.youngkaaa.yviewpager.YFragmentStatePagerAdapter.java
@Override public void restoreState(Parcelable state, ClassLoader loader) { if (state != null) { Bundle bundle = (Bundle) state; bundle.setClassLoader(loader);//from w ww . j a v a2s .com Parcelable[] fss = bundle.getParcelableArray("states"); mSavedState.clear(); mFragments.clear(); if (fss != null) { for (int i = 0; i < fss.length; i++) { mSavedState.add((Fragment.SavedState) fss[i]); } } Iterable<String> keys = bundle.keySet(); for (String key : keys) { if (key.startsWith("f")) { int index = Integer.parseInt(key.substring(1)); Fragment f = mFragmentManager.getFragment(bundle, key); if (f != null) { while (mFragments.size() <= index) { mFragments.add(null); } f.setMenuVisibility(false); mFragments.set(index, f); } else { Log.w(TAG, "Bad fragment at key " + key); } } } } }
From source file:am.util.viewpager.adapter.FragmentRemovePagerAdapter.java
@Override public void restoreState(Parcelable state, ClassLoader loader) { if (state != null) { Bundle bundle = (Bundle) state; bundle.setClassLoader(loader);/*from ww w. j a v a2 s .co m*/ Parcelable[] fss = bundle.getParcelableArray("states"); mSavedState.clear(); if (fss != null) { for (int i = 0; i < fss.length; i++) { mSavedState.add((Fragment.SavedState) fss[i]); } } Iterable<String> keys = bundle.keySet(); for (String key : keys) { if (key.startsWith("f")) { Fragment f = mFragmentManager.getFragment(bundle, key); if (f != null) { f.setMenuVisibility(false); } else { Log.w(TAG, "Bad fragment at key " + key); } } } } }
From source file:android.support.v13.app.FragmentStatePagerAdapter.java
@Override public void restoreState(Parcelable state, ClassLoader loader) { if (state != null) { Bundle bundle = (Bundle) state; bundle.setClassLoader(loader);/*from ww w .j a v a 2s . com*/ Parcelable[] fss = bundle.getParcelableArray("states"); mSavedState.clear(); mFragments.clear(); if (fss != null) { for (int i = 0; i < fss.length; i++) { mSavedState.add((Fragment.SavedState) fss[i]); } } Iterable<String> keys = bundle.keySet(); for (String key : keys) { if (key.startsWith("f")) { int index = Integer.parseInt(key.substring(1)); Fragment f = mFragmentManager.getFragment(bundle, key); if (f != null) { while (mFragments.size() <= index) { mFragments.add(null); } FragmentCompat.setMenuVisibility(f, false); mFragments.set(index, f); } else { Log.w(TAG, "Bad fragment at key " + key); } } } } }
From source file:chat.crypt.messenger.app.view.FragmentNoMenuStatePagerAdapter.java
@Override public void restoreState(Parcelable state, ClassLoader loader) { if (state != null) { Bundle bundle = (Bundle) state; bundle.setClassLoader(loader);/*from w ww . java2 s . co m*/ Parcelable[] fss = bundle.getParcelableArray("states"); mSavedState.clear(); mFragments.clear(); if (fss != null) { for (int i = 0; i < fss.length; i++) { mSavedState.add((Fragment.SavedState) fss[i]); } } Iterable<String> keys = bundle.keySet(); for (String key : keys) { if (key.startsWith("f")) { int index = Integer.parseInt(key.substring(1)); Fragment f = mFragmentManager.getFragment(bundle, key); if (f != null) { while (mFragments.size() <= index) { mFragments.add(null); } // f.setMenuVisibility(false); mFragments.set(index, f); } else { Log.w(TAG, "Bad fragment at key " + key); } } } } }
From source file:com.hanuor.sapphire.utils.intentation.IntentationPrime.java
public String intentToJSON(Context con, Intent intent) throws JsonProcessingException { ObjectMapper mapper = new ObjectMapper(); String getContextName = null; String getClassName = null;/*from w w w . ja va2 s. c om*/ try { getClassName = intent.getComponent().getClassName(); getContextName = con.getPackageName(); } catch (Exception e) { e.printStackTrace(); } HashMap<String, String> makeInsideJsonArray = new HashMap<String, String>(); HashMap<String, String> hashMap = new HashMap<String, String>(); hashMap.put("className", getClassName); hashMap.put("context", getContextName); Bundle bundle = intent.getExtras(); if (bundle != null) { Set<String> keys = bundle.keySet(); Iterator<String> it = keys.iterator(); Log.d("SappsnoopDog", "" + keys.size()); while (it.hasNext()) { String key = it.next(); Log.d("Sapptagdog", "TYPE " + bundle.get(key).toString()); Log.d("NERVE", "" + bundle.get(key).getClass().getAnnotations()); String type = bundle.get(key).getClass().getSimpleName(); Log.d("SappDogTAG", key + " OF TYPE " + type); switch (type) { case "String": makeInsideJsonArray.put(key, type + LibraryDatabase.JSONSEPERATOR + bundle.get(key).toString()); Log.d("SappDogTAG", "bool array"); break; case "String[]": makeInsideJsonArray.put(key, type + LibraryDatabase.JSONSEPERATOR + bundle.get(key).toString().replace(" ", "")); Log.d("SappDogTAG", "bool array"); break; case "Integer": makeInsideJsonArray.put(key, type + LibraryDatabase.JSONSEPERATOR + bundle.get(key).toString()); Log.d("SappDogTAG", "bool array"); break; case "Double": makeInsideJsonArray.put(key, type + LibraryDatabase.JSONSEPERATOR + bundle.get(key).toString()); Log.d("SappDogTAG", "bool array"); break; case "double[]": double[] newDouble = (double[]) bundle.get(key); String fromDouble = Arrays.toString(newDouble); makeInsideJsonArray.put(key, type + LibraryDatabase.JSONSEPERATOR + fromDouble.replace(" ", "")); Log.d("SappDogTAG", "bool array"); break; case "int[]": int[] newArray = (int[]) bundle.get(key); String fromArray = Arrays.toString(newArray); makeInsideJsonArray.put(key, type + LibraryDatabase.JSONSEPERATOR + fromArray.replace(" ", "")); Log.d("SappDogTAG", "bool array"); break; case "Boolean": makeInsideJsonArray.put(key, type + LibraryDatabase.JSONSEPERATOR + bundle.get(key).toString()); Log.d("SappDogTAG", "bool array"); break; case "boolean[]": boolean[] newBool = (boolean[]) bundle.get(key); String fromBool = Arrays.toString(newBool); makeInsideJsonArray.put(key, type + LibraryDatabase.JSONSEPERATOR + fromBool.replace(" ", "")); Log.d("SappDogTAG", "bool array"); break; case "Char": makeInsideJsonArray.put(key, type + LibraryDatabase.JSONSEPERATOR + bundle.get(key).toString()); Log.d("SappDogTAG", "bool array"); break; case "char[]": char[] newChar = (char[]) bundle.get(key); String fromChar = Arrays.toString(newChar); makeInsideJsonArray.put(key, type + LibraryDatabase.JSONSEPERATOR + fromChar.replace(" ", "")); Log.d("SappDogTAG", "bool array"); break; case "CharSequence": makeInsideJsonArray.put(key, type + LibraryDatabase.JSONSEPERATOR + bundle.get(key).toString()); Log.d("SappDogTAG", "bool array"); break; case "charsequence[]": makeInsideJsonArray.put(key, type + LibraryDatabase.JSONSEPERATOR + bundle.get(key).toString().replace(" ", "")); Log.d("SappDogTAG", "bool array"); break; case "Byte": makeInsideJsonArray.put(key, type + LibraryDatabase.JSONSEPERATOR + bundle.get(key).toString()); Log.d("SappDogTAG", "bool array"); break; case "byte[]": byte[] newByte = (byte[]) bundle.get(key); String fromByte = Arrays.toString(newByte); makeInsideJsonArray.put(key, type + LibraryDatabase.JSONSEPERATOR + fromByte.replace(" ", "")); Log.d("SappDogTAG", "bool array"); break; case "Float": makeInsideJsonArray.put(key, type + LibraryDatabase.JSONSEPERATOR + bundle.get(key).toString()); Log.d("SappDogTAG", "bool array"); break; case "float[]": float[] newFloat = (float[]) bundle.get(key); String fromFloat = Arrays.toString(newFloat); makeInsideJsonArray.put(key, type + LibraryDatabase.JSONSEPERATOR + fromFloat.replace(" ", "")); Log.d("SappDogTAG", "bool array"); break; case "Short": makeInsideJsonArray.put(key, type + LibraryDatabase.JSONSEPERATOR + bundle.get(key).toString()); Log.d("SappDogTAG", "bool array"); break; case "short[]": short[] newShort = (short[]) bundle.get(key); String fromShort = Arrays.toString(newShort); fromShort = fromShort.replace(" ", ""); makeInsideJsonArray.put(key, type + LibraryDatabase.JSONSEPERATOR + fromShort.replace(" ", "")); Log.d("SappDogTAG", "bool array"); break; case "Long": makeInsideJsonArray.put(key, type + LibraryDatabase.JSONSEPERATOR + bundle.get(key).toString()); Log.d("SappDogTAG", "bool array"); break; case "long[]": long[] newLong = (long[]) bundle.get(key); String fromLong = Arrays.toString(newLong); makeInsideJsonArray.put(key, type + LibraryDatabase.JSONSEPERATOR + bundle.get(key).toString().replace(" ", "")); Log.d("SappDogTAG", "bool array"); break; case "ArrayList": ArrayList<Object> obj = (ArrayList<Object>) bundle.get(key); Object[] objArr = obj.toArray(); if (objArr[0] instanceof Integer) { ArrayList<Integer> newIntegerArray = bundle.getIntegerArrayList(key); makeInsideJsonArray.put(key, type + "Integer" + LibraryDatabase.JSONSEPERATOR + newIntegerArray.toString().replace(" ", "")); } else if (objArr[0] instanceof String) { ArrayList<String> newStringArray = bundle.getStringArrayList(key); makeInsideJsonArray.put(key, type + "String" + LibraryDatabase.JSONSEPERATOR + newStringArray.toString().replace(" ", "")); } break; default: // whatever } hashMap.put(key, bundle.get(key).toString()); } } String passArray = mapper.writeValueAsString(makeInsideJsonArray); hashMap.put("intentExtras", passArray); Log.d("GOGTAD", "" + passArray); String intentString = mapper.writeValueAsString(intent); Log.d("IntentString", "" + mapper.writeValueAsString(hashMap)); StringBuilder a1S = new StringBuilder(mapper.writeValueAsString(hashMap)); a1S.deleteCharAt(mapper.writeValueAsString(hashMap).length() - 1); a1S.append(","); String s1t = a1S.toString(); StringBuilder sb = new StringBuilder(intentString); sb.deleteCharAt(0); String retrString = sb.toString(); StringBuilder newS = new StringBuilder(); newS.append(s1t); newS.append(retrString); Log.d("Insnsns", newS.toString()); return newS.toString(); }
From source file:com.facebook.LegacyTokenHelper.java
public void save(Bundle bundle) { Validate.notNull(bundle, "bundle"); SharedPreferences.Editor editor = cache.edit(); for (String key : bundle.keySet()) { try {/* w w w. j a v a2 s.c o m*/ serializeKey(key, bundle, editor); } catch (JSONException e) { // Error in the bundle. Don't store a partial cache. Logger.log(LoggingBehavior.CACHE, Log.WARN, TAG, "Error processing value for key: '" + key + "' -- " + e); // Bypass the commit and just return. This cancels the entire edit transaction return; } } editor.apply(); }
From source file:com.view.FragmentStatePagerAdapter.java
@Override public void restoreState(Parcelable state, ClassLoader loader) { if (state != null) { Bundle bundle = (Bundle) state; bundle.setClassLoader(loader);//from w w w . ja v a 2 s. co m Parcelable[] fss = bundle.getParcelableArray("states"); mSavedState.clear(); mFragments.clear(); if (fss != null) { for (int i = 0; i < fss.length; i++) { mSavedState.add((Fragment.SavedState) fss[i]); } } Iterable<String> keys = bundle.keySet(); for (String key : keys) { if (key.startsWith("f")) { int index = Integer.parseInt(key.substring(1)); Fragment f = mFragmentManager.getFragment(bundle, key); if (f != null) { while (mFragments.size() <= index) { mFragments.add(null); } f.setMenuVisibility(false); mFragments.set(index, f); } else { Log.w(TAG, "Bad fragment at key " + key); } } } } }