/** Returns whether this is an action for the same media as the {@code other}. */ public boolean isSameMedia(DownloadAction other) { return uri.equals(other.uri); }
@Override public boolean equals(Object obj) { if (!(obj instanceof Video)) { return(false); } return(videoUri.equals(((Video)obj).videoUri)); }
@Override public boolean equals(Object o) { if (this == o) { return true; } if (!(o instanceof ObservedUri)) { return false; } ObservedUri otherUri = (ObservedUri) o; return flags == otherUri.flags && uri.equals(otherUri.uri); }
@Override public boolean equals(Object obj) { if (!(obj instanceof Item)) { return false; } Item other = (Item) obj; return id == other.id && (mimeType != null && mimeType.equals(other.mimeType) || (mimeType == null && other.mimeType == null)) && (uri != null && uri.equals(other.uri) || (uri == null && other.uri == null)) && size == other.size && duration == other.duration; }
@SuppressWarnings("EqualsGetClass") @Override public boolean equals(@Nullable Object o) { if (o == null || getClass() != o.getClass()) { return false; } DownloadAction that = (DownloadAction) o; return type.equals(that.type) && version == that.version && uri.equals(that.uri) && isRemoveAction == that.isRemoveAction && Arrays.equals(data, that.data); }
@Override public boolean equals(Object other) { if (this == other) { return true; } if (!(other instanceof Profile)) { return false; } Profile o = (Profile) other; return id.equals(o.id) && firstName == null ? o.firstName == null : firstName.equals(o.firstName) && middleName == null ? o.middleName == null : middleName.equals(o.middleName) && lastName == null ? o.lastName == null : lastName.equals(o.lastName) && name == null ? o.name == null : name.equals(o.name) && linkUri == null ? o.linkUri == null : linkUri.equals(o.linkUri); }
@Override public Uri insert(MethodBox methodBox, Uri url, ContentValues initialValues) throws InvocationTargetException { if (!(MediaStore.Audio.Media.INTERNAL_CONTENT_URI.equals(url) || MediaStore.Audio.Media.EXTERNAL_CONTENT_URI.equals(url)) || MediaStore.Video.Media.INTERNAL_CONTENT_URI.equals(url) || MediaStore.Video.Media.EXTERNAL_CONTENT_URI.equals(url) || MediaStore.Images.Media.INTERNAL_CONTENT_URI.equals(url) || MediaStore.Images.Media.EXTERNAL_CONTENT_URI.equals(url) ) { return super.insert(methodBox, url, initialValues); } Object v2 = initialValues.get(COLUMN_NAME); if (!(v2 instanceof String)) { return super.insert(methodBox, url, initialValues); } String path = NativeEngine.getEscapePath((String) v2); initialValues.put(COLUMN_NAME, path); return super.insert(methodBox, url, initialValues); }
@Override protected void onNewIntent(Intent intent) { super.onNewIntent(intent); if (!intent.getData().equals(current.getData())) { current=intent; play(); } }
/** * Get Android uri to save the cropped image into.<br> * Use the given in options or create a temp file. */ protected Uri getOutputUri() { Uri outputUri = mOptions.outputUri; if (outputUri == null || outputUri.equals(Uri.EMPTY)) { try { String ext = mOptions.outputCompressFormat == Bitmap.CompressFormat.JPEG ? ".jpg" : mOptions.outputCompressFormat == Bitmap.CompressFormat.PNG ? ".png" : ".webp"; outputUri = Uri.fromFile(File.createTempFile("cropped", ext, getCacheDir())); } catch (IOException e) { throw new RuntimeException("Failed to create temp file for output image", e); } } return outputUri; }
@Subscribe(threadMode=ThreadMode.MAIN) public void onDocumentSaveError(DocumentStorageService.DocumentSaveErrorEvent event) { if (event.document.equals(getDocumentUri())) { editor.setEnabled(true); Toast .makeText(getActivity(), R.string.msg_save_error, Toast.LENGTH_LONG) .show(); } }
@Subscribe(threadMode=ThreadMode.MAIN) public void onDocumentSaved(DocumentStorageService.DocumentSavedEvent event) { if (event.document.equals(getDocumentUri())) { editor.setEnabled(true); } }
@Implementation(minSdk = KITKAT) protected void takePersistableUriPermission(@NonNull Uri uri, int modeFlags) { Objects.requireNonNull(uri, "uri may not be null"); modeFlags &= (Intent.FLAG_GRANT_READ_URI_PERMISSION | Intent.FLAG_GRANT_WRITE_URI_PERMISSION); // If neither read nor write permission is specified there is nothing to do. if (modeFlags == 0) { return; } // Attempt to locate an existing record for the uri. for (Iterator<UriPermission> i = uriPermissions.iterator(); i.hasNext(); ) { UriPermission perm = i.next(); if (uri.equals(perm.getUri())) { if (perm.isReadPermission()) { modeFlags |= Intent.FLAG_GRANT_READ_URI_PERMISSION; } if (perm.isWritePermission()) { modeFlags |= Intent.FLAG_GRANT_WRITE_URI_PERMISSION; } i.remove(); break; } } addUriPermission(uri, modeFlags); }
if (data1 != null && data2 == null) return 1; if (data1 != null && data2 != null) { if (!data1.equals(data2)) { return data1.compareTo(data2);
@Implementation(minSdk = KITKAT) protected void releasePersistableUriPermission(@NonNull Uri uri, int modeFlags) { Objects.requireNonNull(uri, "uri may not be null"); modeFlags &= (Intent.FLAG_GRANT_READ_URI_PERMISSION | Intent.FLAG_GRANT_WRITE_URI_PERMISSION); // If neither read nor write permission is specified there is nothing to do. if (modeFlags == 0) { return; } // Attempt to locate an existing record for the uri. for (Iterator<UriPermission> i = uriPermissions.iterator(); i.hasNext(); ) { UriPermission perm = i.next(); if (uri.equals(perm.getUri())) { // Reconstruct the current mode flags. int oldModeFlags = (perm.isReadPermission() ? Intent.FLAG_GRANT_READ_URI_PERMISSION : 0) | (perm.isWritePermission() ? Intent.FLAG_GRANT_WRITE_URI_PERMISSION : 0); // Apply the requested permission change. int newModeFlags = oldModeFlags & ~modeFlags; // Update the permission record if a change occurred. if (newModeFlags != oldModeFlags) { i.remove(); if (newModeFlags != 0) { addUriPermission(uri, newModeFlags); } } break; } } }
private void finishActivity() { ScrumptiousApplication app = (ScrumptiousApplication) getApplication(); if (FRIEND_PICKER.equals(getIntent().getData())) { if (friendPickerFragment != null) { app.setSelectedUsers(friendPickerFragment.getSelection()); } } else if (PLACE_PICKER.equals(getIntent().getData())) { if (placePickerFragment != null) { app.setSelectedPlace(placePickerFragment.getSelection()); } } setResult(RESULT_OK, null); finish(); }
private static boolean obtainDurablePermission(ContentResolver resolver, Uri document) { boolean weHaveDurablePermission=false; if (Build.VERSION.SDK_INT>=Build.VERSION_CODES.KITKAT) { int perms=Intent.FLAG_GRANT_READ_URI_PERMISSION | Intent.FLAG_GRANT_WRITE_URI_PERMISSION; try { resolver.takePersistableUriPermission(document, perms); for (UriPermission perm : resolver.getPersistedUriPermissions()) { if (perm.getUri().equals(document)) { weHaveDurablePermission=true; } } } catch (SecurityException e) { // OK, we were not offered any persistable permissions } } return(weHaveDurablePermission); }
@Subscribe(threadMode=ThreadMode.MAIN) public void onDocumentLoaded(DocumentStorageService.DocumentLoadedEvent event) { if (event.document.equals(getDocumentUri())) { editor.setText(event.text); editor.setVisibility(View.VISIBLE); progress.setVisibility(View.GONE); ((Contract)getActivity()) .applyDisplayName(getDocumentUri(), event.displayName); isLoaded=true; canWrite=event.canWrite; if (!canWrite) { editor.setEnabled(false); } } }
Uri requestUri = request.getImageUri(); if (!requestUri.equals(connectedStateLabel.getTag())) { if (user.optString("id").equals(userProfilePicID)) { connectedStateLabel.setCompoundDrawables(
if (prefetching || !pictureUri.equals(imageView.getTag())) { if (!prefetching) {
if (mCropImageUri == null || mCropImageUri.equals(Uri.EMPTY)) { if (CropImage.isExplicitCameraPermissionRequired(this)) {