List of usage examples for android.net Uri equals
public boolean equals(Object o)
From source file:rikka.materialpreference.RingtonePreference.java
public boolean onActivityResult(int requestCode, int resultCode, Intent data) { if (requestCode == mRequestCode) { if (data != null) { Uri uri = data.getParcelableExtra(RingtoneManager.EXTRA_RINGTONE_PICKED_URI); if ((uri == null || !uri.equals(mUri)) && callChangeListener(mUri != null ? mUri.toString() : "")) { //Log.d(TAG, uri == null ? "null" : uri.toString()); mUri = uri;/*w w w . ja v a2 s . co m*/ onSaveRingtone(mUri); } } return true; } return false; }
From source file:info.tongrenlu.FullScreenPlayerActivity.java
private void updateFromParams(Intent intent) { String title = intent.getStringExtra(MusicService.PARAM_TITLE); if (!TextUtils.isEmpty(title)) { //getSupportActionBar().setDisplayHomeAsUpEnabled(true); //getSupportActionBar().setTitle(title); mLine1.setText(title);/* w w w .j a va 2 s . co m*/ } Uri artUri = intent.getParcelableExtra(MusicService.PARAM_COVER); if (artUri != null && !artUri.equals(mCurrentArtUri)) { mCurrentArtUri = artUri; Glide.with(this.getApplicationContext()).load(mCurrentArtUri).into(mBackgroundImage); } }
From source file:com.polyvi.xface.extension.zip.XZipExt.java
/** * 2???/* ww w .ja v a2s . c o m*/ * * @param srcFileUri * uri * @param targetUri * uri * @return true: ?false: ?? */ private boolean areFilesSame(Uri srcFileUri, Uri targetUri) { return srcFileUri.equals(targetUri); }
From source file:info.guardianproject.otr.app.im.app.ContactListFilterView.java
public void doFilter(Uri uri, String filterString) { if (uri != null && !uri.equals(mUri)) { mUri = uri;// www . j av a2s . c o m } doFilter(filterString); }
From source file:com.android.unit_tests.CheckinProviderTest.java
@MediumTest public void testStatsUpdate() { ContentResolver r = getContext().getContentResolver(); // First, delete any existing data associated with the TEST tag. Uri uri = Checkin.updateStats(r, Checkin.Stats.Tag.TEST, 0, 0); assertNotNull(uri);/*from ww w .jav a 2s . c om*/ assertEquals(1, r.delete(uri, null, null)); assertFalse(r.query(uri, null, null, null, null).moveToNext()); // Now, add a known quantity to the TEST tag. Uri u2 = Checkin.updateStats(r, Checkin.Stats.Tag.TEST, 1, 0.5); assertFalse(uri.equals(u2)); Cursor c = r.query(u2, null, null, null, null); assertTrue(c.moveToNext()); assertEquals(1, c.getInt(c.getColumnIndex(Checkin.Stats.COUNT))); assertEquals(0.5, c.getDouble(c.getColumnIndex(Checkin.Stats.SUM))); assertFalse(c.moveToNext()); // Only one. // Add another known quantity to TEST (should sum with the first). Uri u3 = Checkin.updateStats(r, Checkin.Stats.Tag.TEST, 2, 1.0); assertEquals(u2, u3); c.requery(); assertTrue(c.moveToNext()); assertEquals(3, c.getInt(c.getColumnIndex(Checkin.Stats.COUNT))); assertEquals(1.5, c.getDouble(c.getColumnIndex(Checkin.Stats.SUM))); assertFalse(c.moveToNext()); // Only one. // Now subtract the values; the whole row should disappear. Uri u4 = Checkin.updateStats(r, Checkin.Stats.Tag.TEST, -3, -1.5); assertNull(u4); c.requery(); assertFalse(c.moveToNext()); // Row has been deleted. c.close(); }
From source file:com.tct.mail.browse.ConversationPagerAdapter.java
private boolean isEqualWithCachedUri(Conversation conv1, Conversation conv2) { if (conv1 != null && conv2 != null) { Uri uri1 = ConversationCursor.uriFromCachingUri(conv1.uri); Uri uri2 = ConversationCursor.uriFromCachingUri(conv2.uri); return uri1.equals(uri2); }/*ww w.java 2 s . c o m*/ return false; }
From source file:app.axe.imooc.zxing.app.CaptureActivity.java
protected Result scanningImage(Uri path) { if (path == null || path.equals("")) { return null; }/*from w w w. j a v a 2 s .c o m*/ // DecodeHintType EncodeHintType Hashtable<DecodeHintType, String> hints = new Hashtable<DecodeHintType, String>(); hints.put(DecodeHintType.CHARACTER_SET, "utf-8"); // ?? try { Bitmap scanBitmap = BitmapFactory.decodeStream(getContentResolver().openInputStream(uri)); RGBLuminanceSource source = new RGBLuminanceSource(scanBitmap); BinaryBitmap bitmap1 = new BinaryBitmap(new HybridBinarizer(source)); QRCodeReader reader = new QRCodeReader(); return reader.decode(bitmap1, hints); } catch (Exception e) { e.printStackTrace(); } return null; }
From source file:com.remobile.file.LocalFilesystem.java
@Override public JSONObject copyFileToURL(LocalFilesystemURL destURL, String newName, Filesystem srcFs, LocalFilesystemURL srcURL, boolean move) throws IOException, InvalidModificationException, JSONException, NoModificationAllowedException, FileExistsException { // Check to see if the destination directory exists String newParent = this.filesystemPathForURL(destURL); File destinationDir = new File(newParent); if (!destinationDir.exists()) { // The destination does not exist so we should fail. throw new FileNotFoundException("The source does not exist"); }//from w w w . j a v a 2s . c o m // Figure out where we should be copying to final LocalFilesystemURL destinationURL = makeDestinationURL(newName, srcURL, destURL, srcURL.isDirectory); Uri dstNativeUri = toNativeUri(destinationURL); Uri srcNativeUri = srcFs.toNativeUri(srcURL); // Check to see if source and destination are the same file if (dstNativeUri.equals(srcNativeUri)) { throw new InvalidModificationException("Can't copy onto itself"); } if (move && !srcFs.canRemoveFileAtLocalURL(srcURL)) { throw new InvalidModificationException("Source URL is read-only (cannot move)"); } File destFile = new File(dstNativeUri.getPath()); if (destFile.exists()) { if (!srcURL.isDirectory && destFile.isDirectory()) { throw new InvalidModificationException("Can't copy/move a file to an existing directory"); } else if (srcURL.isDirectory && destFile.isFile()) { throw new InvalidModificationException("Can't copy/move a directory to an existing file"); } } if (srcURL.isDirectory) { // E.g. Copy /sdcard/myDir to /sdcard/myDir/backup if (dstNativeUri.toString().startsWith(srcNativeUri.toString() + '/')) { throw new InvalidModificationException("Can't copy directory into itself"); } copyDirectory(srcFs, srcURL, destFile, move); } else { copyFile(srcFs, srcURL, destFile, move); } return makeEntryForURL(destinationURL); }
From source file:com.google.sample.castcompanionlibrary.notification.VideoCastNotificationService.java
private void setupNotification(final MediaInfo info) throws TransientNetworkDisconnectionException, NoConnectionException { if (null == info) { return;/*from w w w . j a v a2 s . c o m*/ } if (null != mBitmapDecoderTask) { mBitmapDecoderTask.cancel(false); } Uri imgUri = null; try { if (!info.getMetadata().hasImages()) { build(info, null, mIsPlaying); return; } else { imgUri = info.getMetadata().getImages().get(0).getUrl(); if (imgUri.equals(mVideoArtUri)) { build(info, mVideoArtBitmap, mIsPlaying); return; } } } catch (CastException e) { LOGE(TAG, "Failed to build notification"); } mBitmapDecoderTask = new FetchBitmapTask(400, 400) { @Override protected void onPostExecute(Bitmap bitmap) { try { mVideoArtBitmap = Utils.scaleCenterCrop(bitmap, 256, 256); build(info, mVideoArtBitmap, mIsPlaying); } catch (CastException e) { LOGE(TAG, "Failed to set notification for " + info.toString(), e); } catch (TransientNetworkDisconnectionException e) { LOGE(TAG, "Failed to set notification for " + info.toString(), e); } catch (NoConnectionException e) { LOGE(TAG, "Failed to set notification for " + info.toString(), e); } if (mVisible) { startForeground(NOTIFICATION_ID, mNotification); } if (this == mBitmapDecoderTask) { mBitmapDecoderTask = null; } } }; mBitmapDecoderTask.start(imgUri); }
From source file:org.dmfs.tasks.notification.NotificationUpdaterService.java
private boolean containsTask(ArrayList<ContentSet> tasks, Uri taskUri) { for (ContentSet contentSet : tasks) { if (taskUri.equals(contentSet.getUri())) { return true; }// ww w .jav a 2 s. com } return false; }