Java Code Examples for android.net.Uri#EMPTY
The following examples show how to use
android.net.Uri#EMPTY .
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: SystemService.java From sana.mobile with BSD 3-Clause "New" or "Revised" License | 6 votes |
@Override protected void onHandleIntent(Intent intent) { Uri data = Uri.EMPTY; switch (intent.getFlags()) { case (EXPORT_DB): // Should be the file Uri we want to write to Uri out = intent.getData(); break; case (IMPORT_DB): // Should be the file Uri we want to read from Uri in = intent.getData(); break; default: } }
Example 2
Source File: RingTonePlayer.java From android-ringtone-picker with Apache License 2.0 | 6 votes |
/** * Play the ringtone for the given uri. * * @param uri uri of the ringtone to play. * @throws IOException if it cannot play the ringtone. */ void playRingtone(@Nullable final Uri uri) throws IOException, IllegalArgumentException, SecurityException, IllegalStateException { if (mMediaPlayer.isPlaying()) { mMediaPlayer.stop(); } mMediaPlayer.reset(); if (uri == null || uri == Uri.EMPTY) { Log.w(RingTonePlayer.class.getName(), "playRingtone: Uri is null or empty."); return; } mMediaPlayer.setDataSource(mContext, uri); mMediaPlayer.prepare(); mMediaPlayer.start(); }
Example 3
Source File: DynamicLink.java From firebase-android-sdk with Apache License 2.0 | 5 votes |
/** @return the iPad parameters ID of the app. */ @NonNull public Uri getFallbackUrl() { Uri fallbackUrl = parameters.getParcelable(KEY_ANDROID_FALLBACK_LINK); if (fallbackUrl == null) { fallbackUrl = Uri.EMPTY; } return fallbackUrl; }
Example 4
Source File: CameraActivity.java From Camera2 with Apache License 2.0 | 5 votes |
/** * If the current photo is a photo sphere, this will launch the * Photo Sphere panorama viewer. */ @Override public void onExternalViewer() { if (mPanoramaViewHelper == null) { return; } final FilmstripItem data = getCurrentLocalData(); if (data == null) { Log.w(TAG, "Cannot open null data."); return; } final Uri contentUri = data.getData().getUri(); if (contentUri == Uri.EMPTY) { Log.w(TAG, "Cannot open empty URL."); return; } if (data.getMetadata().isUsePanoramaViewer()) { mPanoramaViewHelper.showPanorama(CameraActivity.this, contentUri); } else if (data.getMetadata().isHasRgbzData()) { mPanoramaViewHelper.showRgbz(contentUri); if (mSettingsManager.getBoolean(SettingsManager.SCOPE_GLOBAL, Keys .KEY_SHOULD_SHOW_REFOCUS_VIEWER_CLING)) { mSettingsManager.set(SettingsManager.SCOPE_GLOBAL, Keys.KEY_SHOULD_SHOW_REFOCUS_VIEWER_CLING, false); mCameraAppUI.clearClingForViewer(CameraAppUI.BottomPanel.VIEWER_REFOCUS); } } }
Example 5
Source File: AppShortcutsHelper.java From rcloneExplorer with MIT License | 5 votes |
public static void addRemoteToHomeScreen(Context context, RemoteItem remoteItem) { String id = getUniqueIdFromString(remoteItem.getName()); Intent intent = new Intent(Intent.ACTION_MAIN, Uri.EMPTY, context, MainActivity.class); intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK); intent.putExtra(APP_SHORTCUT_REMOTE_NAME, remoteItem.getName()); ShortcutInfoCompat shortcutInfo = new ShortcutInfoCompat.Builder(context, id) .setShortLabel(remoteItem.getName()) .setIcon(IconCompat.createWithResource(context, AppShortcutsHelper.getRemoteIcon(remoteItem.getType(), remoteItem.isCrypt()))) .setIntent(intent) .build(); ShortcutManagerCompat.requestPinShortcut(context, shortcutInfo, null); }
Example 6
Source File: EncounterFragmentActivity.java From sana.mobile with BSD 3-Clause "New" or "Revised" License | 5 votes |
@Override protected void onCreate(Bundle savedState) { super.onCreate(savedState); if (getIntent() != null && getIntent().getData() != null) mUri = getIntent().getData(); if (mUri != null && mUri != Uri.EMPTY) { } }
Example 7
Source File: ComposerActivityTest.java From twitter-kit-android with Apache License 2.0 | 5 votes |
@Before public void setUp() { mockContext = mock(Context.class); mockSession = mock(TwitterSession.class); mockAuthToken = mock(TwitterAuthToken.class); mockUri = Uri.EMPTY; when(mockSession.getAuthToken()).thenReturn(mockAuthToken); }
Example 8
Source File: DynamicLink.java From firebase-android-sdk with Apache License 2.0 | 5 votes |
/** @return the meta-tag image link. */ @NonNull public Uri getImageUrl() { Uri imageUrl = parameters.getParcelable(KEY_SOCIAL_IMAGE_LINK); if (imageUrl == null) { imageUrl = Uri.EMPTY; } return imageUrl; }
Example 9
Source File: ComposerControllerTest.java From twitter-kit-android with Apache License 2.0 | 5 votes |
@Test public void testComposerCallbacksImpl_onTextChangedOk() { mockTwitterSession = mock(TwitterSession.class); controller = new ComposerController(mockComposerView, mockTwitterSession, Uri.EMPTY, ANY_TEXT, ANY_HASHTAG, mockFinisher, mockDependencyProvider); final ComposerController.ComposerCallbacks callbacks = controller.new ComposerCallbacksImpl(); callbacks.onTextChanged(TWEET_TEXT); verify(mockComposerView).setCharCount(REMAINING_CHAR_COUNT); verify(mockComposerView).setCharCountTextStyle(R.style.tw__ComposerCharCount); verify(mockComposerView).postTweetEnabled(true); }
Example 10
Source File: FilmstripView.java From Camera2 with Apache License 2.0 | 5 votes |
private Uri getCurrentUri() { ViewItem curr = mViewItems[BUFFER_CENTER]; if (curr == null) { return Uri.EMPTY; } return mDataAdapter.getFilmstripItemAt(curr.getAdapterIndex()).getData().getUri(); }
Example 11
Source File: CameraActivity.java From Camera2 with Apache License 2.0 | 5 votes |
private void setNfcBeamPushUriFromData(FilmstripItem data) { final Uri uri = data.getData().getUri(); if (uri != Uri.EMPTY) { mNfcPushUris[0] = uri; } else { mNfcPushUris[0] = null; } }
Example 12
Source File: RCTResourceDrawableIdHelper.java From react-native-image-sequence with MIT License | 5 votes |
public Uri getResourceDrawableUri(Context context, @Nullable String name) { int resId = getResourceDrawableId(context, name); return resId > 0 ? new Uri.Builder() .scheme(UriUtil.LOCAL_RESOURCE_SCHEME) .path(String.valueOf(resId)) .build() : Uri.EMPTY; }
Example 13
Source File: SSIActivityRunner.java From sana.mobile with BSD 3-Clause "New" or "Revised" License | 4 votes |
protected Intent handleCancel(Intent request, Intent response) { Logf.I(TAG, "handleCancel(Intent,Intent)"); // Default Intent we return Intent output = new Intent(Intents.ACTION_FINISH); Uri uri = (request != null) ? ((request.getData() != null) ? request.getData() : Uri.EMPTY) : Uri.EMPTY; int uDescriptor = Uris.getDescriptor(uri); switch (Intents.parseActionDescriptor(request)) { case Intents.PICK: switch (uDescriptor) { case Uris.SUBJECT_DIR: output.setAction(Intent.ACTION_PICK).setData(Observers.CONTENT_URI); break; case Uris.PROCEDURE_DIR: output.setAction(Intent.ACTION_PICK).setData(Subjects.CONTENT_URI); break; case Uris.ENCOUNTER_DIR: output.setAction(Intent.ACTION_PICK).setData(Procedures.CONTENT_URI); default: output.setAction(Intents.ACTION_FINISH); } break; // Expect a Cancel back on a view - for now we always go case Intents.VIEW: switch (uDescriptor) { case Uris.SUBJECT_ITEM: case Uris.SUBJECT_UUID: output.setAction(Intent.ACTION_PICK).setData(Procedures.CONTENT_URI); break; // Should restart the case Uris.PROCEDURE_ITEM: case Uris.PROCEDURE_UUID: output.setAction(Intents.ACTION_RUN_PROCEDURE).setData(uri); break; case Uris.ENCOUNTER_ITEM: case Uris.ENCOUNTER_UUID: output.setAction(Intent.ACTION_PICK).setData(Encounters.CONTENT_URI); break; default: } break; case Intents.RUN: case Intents.RUN_PROCEDURE: output.setAction(Intent.ACTION_PICK).setData(Procedures.CONTENT_URI); break; case Intents.RESUME_PROCEDURE: output.setAction(Intent.ACTION_PICK).setData(Encounters.CONTENT_URI); break; default: } return output; }
Example 14
Source File: StatsDataSource.java From TelePlus-Android with GNU General Public License v2.0 | 4 votes |
/** * Creates the stats data source. * * @param dataSource The wrapped {@link DataSource}. */ public StatsDataSource(DataSource dataSource) { this.dataSource = Assertions.checkNotNull(dataSource); lastOpenedUri = Uri.EMPTY; lastResponseHeaders = Collections.emptyMap(); }
Example 15
Source File: CropImageOptions.java From timecat with Apache License 2.0 | 4 votes |
/** * Init options with defaults. */ public CropImageOptions() { DisplayMetrics dm = Resources.getSystem().getDisplayMetrics(); cropShape = CropImageView.CropShape.RECTANGLE; snapRadius = TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 3, dm); touchRadius = TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 24, dm); guidelines = CropImageView.Guidelines.ON_TOUCH; scaleType = CropImageView.ScaleType.FIT_CENTER; showCropOverlay = true; showProgressBar = true; autoZoomEnabled = true; multiTouchEnabled = false; maxZoom = 4; initialCropWindowPaddingRatio = 0.1f; fixAspectRatio = false; aspectRatioX = 1; aspectRatioY = 1; borderLineThickness = TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 3, dm); borderLineColor = Color.argb(170, 255, 255, 255); borderCornerThickness = TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 2, dm); borderCornerOffset = TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 5, dm); borderCornerLength = TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 14, dm); borderCornerColor = Color.WHITE; guidelinesThickness = TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 1, dm); guidelinesColor = Color.argb(170, 255, 255, 255); backgroundColor = Color.argb(119, 0, 0, 0); minCropWindowWidth = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 42, dm); minCropWindowHeight = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 42, dm); minCropResultWidth = 40; minCropResultHeight = 40; maxCropResultWidth = 99999; maxCropResultHeight = 99999; activityTitle = ""; activityMenuIconColor = 0; outputUri = Uri.EMPTY; outputCompressFormat = Bitmap.CompressFormat.JPEG; outputCompressQuality = 90; outputRequestWidth = 0; outputRequestHeight = 0; outputRequestSizeOptions = CropImageView.RequestSizeOptions.NONE; noOutputImage = false; initialCropWindowRectangle = null; initialRotation = -1; allowRotation = true; allowCounterRotation = false; rotationDegrees = 90; }
Example 16
Source File: TestSimpleOperation.java From arca-android with BSD 3-Clause "New" or "Revised" License | 4 votes |
public TestSimpleOperation(final ContentValues[] data) { this(Uri.EMPTY, data, null, null); }
Example 17
Source File: CropImageOptions.java From Android-Image-Cropper with Apache License 2.0 | 4 votes |
/** Init options with defaults. */ public CropImageOptions() { DisplayMetrics dm = Resources.getSystem().getDisplayMetrics(); cropShape = CropImageView.CropShape.RECTANGLE; snapRadius = TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 3, dm); touchRadius = TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 24, dm); guidelines = CropImageView.Guidelines.ON_TOUCH; scaleType = CropImageView.ScaleType.FIT_CENTER; showCropOverlay = true; showProgressBar = true; autoZoomEnabled = true; multiTouchEnabled = false; maxZoom = 4; initialCropWindowPaddingRatio = 0.1f; fixAspectRatio = false; aspectRatioX = 1; aspectRatioY = 1; borderLineThickness = TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 3, dm); borderLineColor = Color.argb(170, 255, 255, 255); borderCornerThickness = TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 2, dm); borderCornerOffset = TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 5, dm); borderCornerLength = TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 14, dm); borderCornerColor = Color.WHITE; guidelinesThickness = TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 1, dm); guidelinesColor = Color.argb(170, 255, 255, 255); backgroundColor = Color.argb(119, 0, 0, 0); minCropWindowWidth = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 42, dm); minCropWindowHeight = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 42, dm); minCropResultWidth = 40; minCropResultHeight = 40; maxCropResultWidth = 99999; maxCropResultHeight = 99999; activityTitle = ""; activityMenuIconColor = 0; outputUri = Uri.EMPTY; outputCompressFormat = Bitmap.CompressFormat.JPEG; outputCompressQuality = 90; outputRequestWidth = 0; outputRequestHeight = 0; outputRequestSizeOptions = CropImageView.RequestSizeOptions.NONE; noOutputImage = false; initialCropWindowRectangle = null; initialRotation = -1; allowRotation = true; allowFlipping = true; allowCounterRotation = false; rotationDegrees = 90; flipHorizontally = false; flipVertically = false; cropMenuCropButtonTitle = null; cropMenuCropButtonIcon = 0; }
Example 18
Source File: Uris.java From sana.mobile with BSD 3-Clause "New" or "Revised" License | 2 votes |
/** * Utility function to return a Uri whose path can be used for web based * services. POST and PUT methods will remove the trailing ID or UUID if * present. * @param iri * @param method * @return */ public static Uri iriToUri(Uri iri, String method) { Uri result = Uri.EMPTY; return result; }
Example 19
Source File: RingtonePickerDialog.java From android-ringtone-picker with Apache License 2.0 | 2 votes |
/** * Set the Uri of the ringtone show as selected when dialog shows. If the given Uri is not * in the ringtone list, no ringtone will displayed as selected by default. This is optional * parameter to set. * * @param currentRingtoneUri Uri of the ringtone. * @return {@link Builder} */ public Builder setCurrentRingtoneUri(@Nullable final Uri currentRingtoneUri) { if (currentRingtoneUri != null && currentRingtoneUri != Uri.EMPTY) mCurrentRingtoneUri = currentRingtoneUri.toString(); return this; }
Example 20
Source File: UriUtil.java From sana.mobile with BSD 3-Clause "New" or "Revised" License | 2 votes |
/** * Copy constructor utility. * * @param uri The uri to copy. * @return A copy of the input parameter or Uri.EMPTY; */ public static Uri copyInstance(Uri uri) { return (uri == null) ? Uri.EMPTY : Uri.parse(uri.toString()); }