Java Code Examples for android.os.Bundle#remove()
The following examples show how to use
android.os.Bundle#remove() .
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: FragmentContainerActivity.java From Rabbits with Apache License 2.0 | 6 votes |
@Override protected void onNewIntent(Intent intent) { super.onNewIntent(intent); String pattern = intent.getStringExtra(Rabbit.KEY_PATTERN); Bundle extras = intent.getExtras(); if (extras != null) { extras.remove(KEY_FRAG_URL); } BaseFragment fragment = (BaseFragment) Rabbit.from(this) .to(intent.getStringExtra(KEY_FRAG_URL)) .putExtras(extras) .obtain().getTarget(); if (fragment == null) { return; } SupportFragment topFragment = getTopFragment(); if (topFragment != null && topFragment.getArguments().getString(Rabbit.KEY_PATTERN, "").equals(pattern)) { topFragment.replaceFragment(fragment, false); } else if (topFragment == null) { loadRootFragment(R.id.common_fragment_container, fragment); } else { start(fragment); } }
Example 2
Source File: RuleListPresenter.java From XposedSmsCode with GNU General Public License v3.0 | 6 votes |
@Override public void handleArguments(Bundle args) { if (args == null) { return; } final Uri importUri = args.getParcelable(EXTRA_IMPORT_URI); if (importUri != null) { args.remove(EXTRA_IMPORT_URI); if (ContentResolver.SCHEME_FILE.equals(importUri.getScheme())) { // file:// URI need storage permission mView.attemptImportRuleListDirectly(importUri); } else { // content:// URI don't need storage permission mView.showImportDialogConfirm(importUri); } } }
Example 3
Source File: MutableStatusBarNotification.java From sdk with Apache License 2.0 | 6 votes |
@Override public void writeToParcel(final Parcel out, final int flags) { if (mAllowIncWriteBack && (flags & PARCELABLE_WRITE_RETURN_VALUE) != 0) { writeMutableFieldsToParcel(out); // Use remote implementation to ensure the consistency of parceling across SDK versions. final MutableNotification mutable = getNotification(); RemoteImplementation.writeBackToParcel(out, flags, mutable, ((MutableNotificationBaseImpl) mutable).getOriginalMutableKeeper()); } else { // Store original values in extras if mutated, and write to parcel as StatusBarNotification with mutated values. final Bundle extras = super.getNotification().extras; final boolean tag_mutated, id_mutated; if (tag_mutated = (mTag == null ? super.getTag() != null : ! mTag.equals(super.getTag()))) extras.putString(EXTRA_ORIGINAL_TAG, super.getTag()); if (id_mutated = (mId != super.getId())) extras.putInt(EXTRA_ORIGINAL_ID, super.getId()); writeToParcelAsSuper(out, flags); if (tag_mutated) extras.remove(EXTRA_ORIGINAL_TAG); if (id_mutated) extras.remove(EXTRA_ORIGINAL_ID); } }
Example 4
Source File: TestRunnable.java From android-test with Apache License 2.0 | 6 votes |
private Bundle getTargetInstrumentationArguments() { Bundle targetArgs = new Bundle(arguments); // Filter out the only argument intended specifically for Listener targetArgs.remove(TARGET_INSTRUMENTATION_ARGUMENT); targetArgs.remove(ISOLATED_ARGUMENT); if (collectTests) { targetArgs.putString(AJUR_LIST_TESTS_ARGUMENT, "true"); } else { // If we aren't engaging in test collection, then we should have a specific test target, and // the orchestrator will pass a specific class parameter. Passing class and package parameters // at the same time breaks AndroidJUnitRunner and is redundant. Thus, we can remove these // parameters. targetArgs.remove("package"); targetArgs.remove("testFile"); } // Override the class parameter with the current test target. if (test != null) { targetArgs.putString(AJUR_CLASS_ARGUMENT, test); } return targetArgs; }
Example 5
Source File: Utility.java From kognitivo with Apache License 2.0 | 5 votes |
public static boolean putJSONValueInBundle(Bundle bundle, String key, Object value) { if (value == null) { bundle.remove(key); } else if (value instanceof Boolean) { bundle.putBoolean(key, (boolean) value); } else if (value instanceof boolean[]) { bundle.putBooleanArray(key, (boolean[]) value); } else if (value instanceof Double) { bundle.putDouble(key, (double) value); } else if (value instanceof double[]) { bundle.putDoubleArray(key, (double[]) value); } else if (value instanceof Integer) { bundle.putInt(key, (int) value); } else if (value instanceof int[]) { bundle.putIntArray(key, (int[]) value); } else if (value instanceof Long) { bundle.putLong(key, (long) value); } else if (value instanceof long[]) { bundle.putLongArray(key, (long[]) value); } else if (value instanceof String) { bundle.putString(key, (String) value); } else if (value instanceof JSONArray) { bundle.putString(key, ((JSONArray) value).toString()); } else if (value instanceof JSONObject) { bundle.putString(key, ((JSONObject) value).toString()); } else { return false; } return true; }
Example 6
Source File: TextToSpeech.java From android_9.0.0_r45 with Apache License 2.0 | 5 votes |
private static boolean verifyFloatBundleParam(Bundle bundle, String key) { if (bundle.containsKey(key)) { if (!(bundle.get(key) instanceof Float || bundle.get(key) instanceof Double)) { bundle.remove(key); Log.w(TAG, "Synthesis request paramter " + key + " containst value " + " with invalid type. Should be a Float or a Double"); return false; } } return true; }
Example 7
Source File: CustomButtonParams.java From AndroidChromium with Apache License 2.0 | 5 votes |
/** * Remove the bitmap contained in the given {@link Bundle}. Used when the bitmap is invalid. */ private static void removeBitmapFromBundle(Bundle bundle) { if (bundle == null) return; try { bundle.remove(CustomTabsIntent.KEY_ICON); } catch (Throwable t) { Log.e(TAG, "Failed to remove icon extra from the intent"); } }
Example 8
Source File: GcmListenerSvc.java From xDrip-plus with GNU General Public License v3.0 | 5 votes |
@Override protected Intent zzD(Intent inteceptedIntent) { // intercept and fix google play services wakelocking bug try { if (!Pref.getBooleanDefaultFalse("excessive_wakelocks")) { completeWakefulIntent(inteceptedIntent); final Bundle extras = inteceptedIntent.getExtras(); if (extras != null) extras.remove(EXTRA_WAKE_LOCK_ID); } } catch (Exception e) { UserError.Log.wtf(TAG, "Error patching play services: " + e); } return super.zzD(inteceptedIntent); }
Example 9
Source File: EipFragment.java From bitmask_android with GNU General Public License v3.0 | 5 votes |
@Override public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { eipStatus.addObserver(this); View view = inflater.inflate(R.layout.f_eip, container, false); ButterKnife.inject(this, view); Bundle arguments = getArguments(); if (arguments != null && arguments.containsKey(ASK_TO_CANCEL_VPN) && arguments.getBoolean(ASK_TO_CANCEL_VPN)) { arguments.remove(ASK_TO_CANCEL_VPN); setArguments(arguments); askToStopEIP(); } restoreFromSavedInstance(savedInstanceState); return view; }
Example 10
Source File: HashCalculatorFragment.java From hash-checker with Apache License 2.0 | 5 votes |
private void checkShortcutActionPresence( @NonNull Bundle shortcutsArguments ) { startWithTextSelection = shortcutsArguments.getBoolean( App.ACTION_START_WITH_TEXT, false ); startWithFileSelection = shortcutsArguments.getBoolean( App.ACTION_START_WITH_FILE, false ); shortcutsArguments.remove(App.ACTION_START_WITH_TEXT); shortcutsArguments.remove(App.ACTION_START_WITH_FILE); }
Example 11
Source File: PhotoGallery.java From android_maplibui with GNU Lesser General Public License v3.0 | 5 votes |
@Override public void saveState(Bundle outState) { Bundle bundle = (Bundle) super.onSaveInstanceState(); if (bundle != null) { bundle.putIntegerArrayList(BUNDLE_DELETED_IMAGES, new ArrayList<>(getDeletedAttaches())); bundle.remove("instanceState"); outState.putAll(bundle); } }
Example 12
Source File: CustomTabsService.java From custom-tabs-client with Apache License 2.0 | 5 votes |
private @Nullable PendingIntent getSessionIdFromBundle(@Nullable Bundle bundle) { if (bundle == null) return null; PendingIntent sessionId = bundle.getParcelable(CustomTabsIntent.EXTRA_SESSION_ID); bundle.remove(CustomTabsIntent.EXTRA_SESSION_ID); return sessionId; }
Example 13
Source File: PluginLibraryInternalProxy.java From springreplugin with Apache License 2.0 | 5 votes |
/** * @hide 内部方法,插件框架使用 * 插件的Activity的onCreate调用前调用此方法 * @param activity * @param savedInstanceState */ public void handleActivityCreateBefore(Activity activity, Bundle savedInstanceState) { if (LOG) { LogDebug.d(PLUGIN_TAG, "activity create before: " + activity.getClass().getName() + " this=" + activity.hashCode() + " taskid=" + activity.getTaskId()); } // 对FragmentActivity做特殊处理 if (savedInstanceState != null) { // savedInstanceState.setClassLoader(activity.getClassLoader()); // try { savedInstanceState.remove("android:support:fragments"); } catch (Throwable e) { if (LOGR) { LogRelease.e(PLUGIN_TAG, "a.c.b1: " + e.getMessage(), e); } } } // 对FragmentActivity做特殊处理 Intent intent = activity.getIntent(); if (intent != null) { intent.setExtrasClassLoader(activity.getClassLoader()); activity.setTheme(getThemeId(activity, intent)); } }
Example 14
Source File: BlockedMessagesFragment.java From NekoSMS with GNU General Public License v3.0 | 5 votes |
@Override public void onNewArguments(Bundle args) { if (args == null) { return; } Uri messageUri = args.getParcelable(ARG_MESSAGE_URI); if (messageUri != null) { args.remove(ARG_MESSAGE_URI); showMessageDetailsDialog(messageUri); BlockedSmsLoader.get().markAllSeen(getContext()); } }
Example 15
Source File: ContentService.java From AndroidComponentPlugin with Apache License 2.0 | 5 votes |
@SyncExemption private int getSyncExemptionAndCleanUpExtrasForCaller(int callingUid, Bundle extras) { if (extras != null) { final int exemption = extras.getInt(ContentResolver.SYNC_VIRTUAL_EXTRAS_EXEMPTION_FLAG, -1); // Need to remove the virtual extra. extras.remove(ContentResolver.SYNC_VIRTUAL_EXTRAS_EXEMPTION_FLAG); if (exemption != -1) { return exemption; } } final ActivityManagerInternal ami = LocalServices.getService(ActivityManagerInternal.class); if (ami == null) { return ContentResolver.SYNC_EXEMPTION_NONE; } final int procState = ami.getUidProcessState(callingUid); final boolean isUidActive = ami.isUidActive(callingUid); // Providers bound by a TOP app will get PROCESS_STATE_BOUND_TOP, so include those as well if (procState <= ActivityManager.PROCESS_STATE_TOP || procState == ActivityManager.PROCESS_STATE_BOUND_TOP) { return ContentResolver.SYNC_EXEMPTION_PROMOTE_BUCKET_WITH_TEMP; } if (procState <= ActivityManager.PROCESS_STATE_IMPORTANT_FOREGROUND || isUidActive) { return ContentResolver.SYNC_EXEMPTION_PROMOTE_BUCKET; } return ContentResolver.SYNC_EXEMPTION_NONE; }
Example 16
Source File: TaskerPlugin.java From xDrip with GNU General Public License v3.0 | 4 votes |
public static void cleanRelevantVariables( Bundle b ) { b.remove( BUNDLE_KEY_RELEVANT_VARIABLES ); }
Example 17
Source File: TaskerPlugin.java From sony-headphones-control with GNU General Public License v3.0 | 4 votes |
public static void cleanRequestedTimeout( Bundle extras ) { extras.remove( Setting.EXTRA_REQUESTED_TIMEOUT ); }
Example 18
Source File: TaskerPlugin.java From xDrip-plus with GNU General Public License v3.0 | 4 votes |
public static void cleanRequestedTimeout( Bundle extras ) { extras.remove( Setting.EXTRA_REQUESTED_TIMEOUT ); }
Example 19
Source File: RNDataWedgeIntentsModule.java From react-native-datawedge-intents with MIT License | 4 votes |
@Override public void update(Observable observable, Object data) { Intent intent = (Intent)data; if (intent.hasExtra("v2API")) { Bundle intentBundle = intent.getExtras(); intentBundle.remove("com.symbol.datawedge.decode_data"); // fb converter cannot cope with byte arrays intentBundle.remove("com.motorolasolutions.emdk.datawedge.decode_data"); // fb converter cannot cope with byte arrays WritableMap map = Arguments.fromBundle(intentBundle); sendEvent(this.reactContext, "datawedge_broadcast_intent", map); } String action = intent.getAction(); if (action.equals(ACTION_ENUMERATEDLISET)) { Bundle b = intent.getExtras(); String[] scanner_list = b.getStringArray(KEY_ENUMERATEDSCANNERLIST); WritableArray userFriendlyScanners = new WritableNativeArray(); for (int i = 0; i < scanner_list.length; i++) { userFriendlyScanners.pushString(scanner_list[i]); } try { WritableMap enumeratedScannersObj = new WritableNativeMap(); enumeratedScannersObj.putArray("Scanners", userFriendlyScanners); sendEvent(this.reactContext, "enumerated_scanners", enumeratedScannersObj); } catch (Exception e) { Toast.makeText(this.reactContext, "Error returning scanners", Toast.LENGTH_LONG).show(); e.printStackTrace(); } } else { // Intent from the scanner (barcode has been scanned) String decodedSource = intent.getStringExtra(RECEIVED_SCAN_SOURCE); String decodedData = intent.getStringExtra(RECEIVED_SCAN_DATA); String decodedLabelType = intent.getStringExtra(RECEIVED_SCAN_TYPE); WritableMap scanData = new WritableNativeMap(); scanData.putString("source", decodedSource); scanData.putString("data", decodedData); scanData.putString("labelType", decodedLabelType); sendEvent(this.reactContext, "barcode_scan", scanData); } }
Example 20
Source File: DbxOfficialAppConnector.java From dropbox-sdk-java with MIT License | 4 votes |
/** * Decodes a Google Play Campaign attribution utm_content field that was generated by Dropbox * OpenWith flow. This should only be called if utm_source=”dropbox_android_openwith”. See * https://developers.google.com/analytics/devguides/collection/android/v4/campaign for more * information about how to use Play Store attribution. * * <p>You won't need to use this unless you are our official partner in openwith.</p> * * @param UtmContent GooglePlay utm content that has been urldecoded * @return Intent OpenWith intent that, when launched, will open the file the user requested to * edit. Caller MUST convert intent into an explicit intent it can handle. * @throws DropboxParseException if cannot produce Intent from UtmContent */ public static Intent generateOpenWithIntentFromUtmContent(String UtmContent) throws DropboxParseException { // Utm content is encoded a base64-encoded marshalled bundle // _action is extracted and becomes intent's action // _uri is extracted and becomes intent's data uri // All other items in bundle transferred to returned intent's extras byte[] b; try { b = Base64.decode(UtmContent, 0); } catch (IllegalArgumentException ex) { throw new DropboxParseException("UtmContent was not base64 encoded: " + ex.getMessage()); } final Parcel parcel = Parcel.obtain(); parcel.unmarshall(b, 0, b.length); parcel.setDataPosition(0); Bundle bundle = parcel.readBundle(); parcel.recycle(); if (bundle == null) { throw new DropboxParseException("Could not extract bundle from UtmContent"); } String action = bundle.getString("_action"); if (action == null) { throw new DropboxParseException("_action was not present in bundle"); } bundle.remove("_action"); Uri uri = bundle.getParcelable("_uri"); if (uri == null) { throw new DropboxParseException("_uri was not present in bundle"); } bundle.remove("_uri"); String type = bundle.getString("_type"); if (type == null) { throw new DropboxParseException("_type was not present in bundle"); } bundle.remove("_type"); Intent openWithIntent = new Intent(action); openWithIntent.setDataAndType(uri, type); openWithIntent.putExtras(bundle); return openWithIntent; }