本文整理汇总了Java中android.net.Uri.EMPTY属性的典型用法代码示例。如果您正苦于以下问题:Java Uri.EMPTY属性的具体用法?Java Uri.EMPTY怎么用?Java Uri.EMPTY使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类android.net.Uri
的用法示例。
在下文中一共展示了Uri.EMPTY属性的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: saveTheFile
private void saveTheFile(boolean saveAs) {
if (!saveAs && greatUri != null && greatUri.getUri() != null && greatUri.getUri() != Uri.EMPTY)
new SaveFileTask(this, greatUri, pageSystem.getAllText(mEditor.getText()
.toString()), currentEncoding, new SaveFileTask.SaveFileInterface() {
@Override
public void fileSaved(Boolean success) {
savedAFile(greatUri, true);
}
}).execute();
else {
if (Device.hasKitKatApi() && PreferenceHelper.getUseStorageAccessFramework(this)) {
Intent intent = new Intent(Intent.ACTION_CREATE_DOCUMENT);
intent.setType("*/*");
intent.putExtra(Intent.EXTRA_TITLE, greatUri.getFileName());
startActivityForResult(intent, SAVE_AS_REQUEST_CODE);
} else {
new NewFileDetailsDialog(
greatUri,
pageSystem.getAllText(mEditor.getText().toString()),
currentEncoding
).show(getFragmentManager().beginTransaction(), "dialog");
}
}
}
示例2: FrescoBasedReactTextInlineImageSpan
public FrescoBasedReactTextInlineImageSpan(
Resources resources,
int height,
int width,
@Nullable Uri uri,
ReadableMap headers,
AbstractDraweeControllerBuilder draweeControllerBuilder,
@Nullable Object callerContext) {
mDraweeHolder = new DraweeHolder(
GenericDraweeHierarchyBuilder.newInstance(resources)
.build()
);
mDraweeControllerBuilder = draweeControllerBuilder;
mCallerContext = callerContext;
mHeight = height;
mWidth = width;
mUri = (uri != null) ? uri : Uri.EMPTY;
mHeaders = headers;
}
示例3: onStart
@Override
public void onStart() {
// why show thumbnail in onStart? because we may not need download it from internet
if (mThumbnail != Uri.EMPTY) {
mThumbnailView = mImageLoader.showThumbnail(BigImageView.this, mThumbnail,
mInitScaleType);
addView(mThumbnailView);
}
if (mProgressIndicator != null) {
mProgressIndicatorView = mProgressIndicator.getView(BigImageView.this);
addView(mProgressIndicatorView);
mProgressIndicator.onStart();
}
if (mUserCallback != null) {
mUserCallback.onStart();
}
}
示例4: start
@Override
public Uri start(Activity activity, MediaResult mediaResult, PhotoParams photoParams) {
Log.d(getClass().getName(), "pick camera");
if (hasPicker(activity)) {
if (FeatureUtils.isSdAvailable()) {
Uri externalUri = createExternalUri(activity.getApplicationContext());
intent.putExtra(MediaStore.EXTRA_OUTPUT, externalUri);
grantReadWritePermission(activity, externalUri);
activity.startActivityForResult(intent, mediaResult.getRequestCode());
return externalUri;
} else {
mediaResultListener.onPickMediaResult(mediaResult,
activity.getString(R.string.error_please_plug_sd_card));
}
} else {
mediaResultListener.onPickMediaResult(mediaResult, photoParams.getNoGalleryMsg());
}
return Uri.EMPTY;
}
示例5: getResourceDrawableUri
public Uri getResourceDrawableUri(Context context, @Nullable String name) {
int resId = getResourceDrawableId(context, name);
return resId > 0 ? new Uri.Builder()
.scheme(LOCAL_RESOURCE_SCHEME)
.path(String.valueOf(resId))
.build() : Uri.EMPTY;
}
示例6: setUri
private void setUri(SimpleDraweeView view, String url) {
Uri uri = url == null ? Uri.EMPTY : Uri.parse(url);
DraweeController controller = Fresco.newDraweeControllerBuilder()
.setOldController(view.getController())
.setTapToRetryEnabled(true)
.setAutoPlayAnimations(true)
.setUri(uri)
.build();
view.setController(controller);
}
示例7: OnlineVideo
public OnlineVideo(PostsItem postsItem) {
String videoUrl = postsItem.getVideo_url();
String thumbnailUrl = postsItem.getThumbnail_url();
sourceUri = videoUrl == null ? Uri.EMPTY : Uri.parse(videoUrl);
thumbnailUri = thumbnailUrl == null ? Uri.EMPTY : Uri.parse(thumbnailUrl);
int videoWidth = postsItem.getThumbnail_width();
int videoHeight = postsItem.getThumbnail_height();
width = ExpressApplication.width;
if (videoWidth > 0) {
height = width * videoHeight / videoWidth;
} else {
height = width / 2;
}
}
示例8: getDataUri
@Override
public Uri getDataUri(QueryEnum query) {
if (query == VideoLibraryModel.VideoLibraryQueryEnum.VIDEOS
|| query == VideoLibraryModel.VideoLibraryQueryEnum.FILTERS) {
return ScheduleContract.Videos.CONTENT_URI;
} else if (query == VideoLibraryModel.VideoLibraryQueryEnum.MY_VIEWED_VIDEOS) {
return ScheduleContract.MyViewedVideos.CONTENT_URI;
}
return Uri.EMPTY;
}
示例9: parseSound
/**
* Parse path path to native URI.
*
* @param path
* Path to path file
*/
Uri parseSound (String path) {
if (path == null || path.isEmpty())
return Uri.EMPTY;
if (path.equalsIgnoreCase(DEFAULT_SOUND)) {
return RingtoneManager.getDefaultUri(RingtoneManager
.TYPE_NOTIFICATION);
}
return parse(path);
}
示例10: parse
/**
* The URI for a path.
*
* @param path
* The given path
*/
Uri parse (String path) {
if (path.startsWith("res:")) {
return getUriForResourcePath(path);
} else if (path.startsWith("file:///")) {
return getUriFromPath(path);
} else if (path.startsWith("file://")) {
return getUriFromAsset(path);
} else if (path.startsWith("http")){
return getUriFromRemote(path);
}
return Uri.EMPTY;
}
示例11: getUriFromPath
/**
* URI for a file.
*
* @param path
* Absolute path like file:///...
*
* @return
* URI pointing to the given path
*/
private Uri getUriFromPath(String path) {
String absPath = path.replaceFirst("file://", "");
File file = new File(absPath);
if (!file.exists()) {
Log.e("Asset", "File not found: " + file.getAbsolutePath());
return Uri.EMPTY;
}
return Uri.fromFile(file);
}
示例12: CropImageOptions
/**
* 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;
}
示例13: loadContactPicture
/**
* Load a contact picture and display it using the supplied {@link ContactBadge} instance.
* <p>
* <p>
* If a picture is found in the cache, it is displayed in the {@code ContactBadge}
* immediately. Otherwise a {@link ContactPictureLoader} is started to try to load the
* contact picture in a background thread.
* Depending on the result the contact picture or a fallback picture is shown (letter).
* </p>
*/
public void loadContactPicture(Contact contact, ContactBadge badge) {
String key = contact.getLookupKey();
// retrieve or create uri for the contact picture
Uri photoUri = contact.getPhotoUri();
if (photoUri == null) {
photoUri = ContactUriCache.getUriFromCache(key);
if (photoUri == Uri.EMPTY) {
// pseudo uri used as key to retrieve Uris from the cache
photoUri = Uri.parse("picture://1gravity.com/" + Uri.encode(key));
ContactUriCache.getInstance().put(key, photoUri);
}
}
// retrieve contact picture from cache
Bitmap bitmap = sPhotoCache.get(photoUri, sDummyBitmap); // can handle Null keys
if (bitmap != null && bitmap != sDummyBitmap) {
// 1) picture found --> update the contact badge
badge.setBitmap(bitmap);
} else if (photoUri == Uri.EMPTY || bitmap == sDummyBitmap) {
// 2) we already tried to retrieve the contact picture before (unsuccessfully)
// --> "letter" contact image
badge.setCharacter(contact.getContactLetter(), contact.getContactColor());
} else {
synchronized (badge) {
boolean hasLoaderAssociated = hasLoaderAssociated(key, badge);
if (!hasLoaderAssociated) {
// 3a) temporary "letter" contact image till the contact picture is loaded (if there's any)
badge.setCharacter(contact.getContactLetter(), contact.getContactColor());
// 3b) load the contact picture
ContactPictureLoader loader = new ContactPictureLoader(key, badge, contact.getPhotoUri(), mRoundContactPictures);
badge.setKey(key);
try {
sExecutor.execute(loader);
} catch (Exception ignore) {
}
}
}
}
}
示例14: paused
static public void paused(Context ctxt) {
Log.d("AVP", "Sending paused intent");
Intent i = new Intent(intentPaused, Uri.EMPTY, ctxt.getApplicationContext(), TorrentObserverService.class);
ctxt.getApplicationContext().startService(i);
}
示例15: resumed
static public void resumed(Context ctxt) {
Log.d("AVP", "Sending resumed intent");
Intent i = new Intent(intentResumed, Uri.EMPTY, ctxt.getApplicationContext(), TorrentObserverService.class);
ctxt.getApplicationContext().startService(i);
}