本文整理汇总了Java中android.net.Uri.isRelative方法的典型用法代码示例。如果您正苦于以下问题:Java Uri.isRelative方法的具体用法?Java Uri.isRelative怎么用?Java Uri.isRelative使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.net.Uri
的用法示例。
在下文中一共展示了Uri.isRelative方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: rewrite
import android.net.Uri; //导入方法依赖的package包/类
@NonNull
@Override
public Uri rewrite(WXSDKInstance instance, String type, Uri uri) {
if (TextUtils.isEmpty(instance.getBundleUrl())) {
return uri;
}
Uri base = Uri.parse(instance.getBundleUrl());
Uri.Builder resultBuilder = uri.buildUpon();
if (uri.isRelative()) {
//When uri is empty, means use the base url instead. Web broswer behave this way.
if(uri.getEncodedPath().length() == 0){
return base;
} else {
resultBuilder = buildRelativeURI(resultBuilder, base, uri);
return resultBuilder.build();
}
}
return uri;
}
示例2: getDrawable
import android.net.Uri; //导入方法依赖的package包/类
@Override
public Drawable getDrawable(String source) {
if (TextUtils.isEmpty(source)) {
return null;
}
final Uri uri = Uri.parse(source);
if (uri.isRelative()) {
return null;
}
final URLDrawable urlDrawable = new URLDrawable(mTextView.getResources(), null);
new LoadFromUriAsyncTask(mTextView, urlDrawable).execute(uri);
return urlDrawable;
}
示例3: locateReadPoint
import android.net.Uri; //导入方法依赖的package包/类
@Override
protected ReadPoint locateReadPoint(String section) {
ReadPoint readPoint = new ReadPoint();
readPoint.setId("1");
Uri suri = Uri.parse(section);
if (suri.isRelative()) {
suri = new Uri.Builder().scheme("file").path(getFile().getPath()).fragment(suri.getFragment()).build();
}
readPoint.setPoint(suri);
return readPoint;
}
示例4: locateReadPoint
import android.net.Uri; //导入方法依赖的package包/类
@Override
protected ReadPoint locateReadPoint(String section) {
ReadPoint point = null;
Uri suri = Uri.parse(Uri.decode(section));
if (suri.isRelative()) {
suri = new Uri.Builder().scheme("file").path(getFullBookContentDir().getPath()).appendPath(suri.getPath()).fragment(suri.getFragment()).build();
}
String file = suri.getLastPathSegment();
String sectionID = null;
for (Map.Entry<String,String> entry: docFiles.entrySet()) {
if (file.equals(entry.getValue())) {
sectionID = entry.getKey();
}
}
if (sectionID!=null) {
point = new ReadPoint();
point.setId(sectionID);
point.setPoint(suri);
}
return point;
}
示例5: rewrite
import android.net.Uri; //导入方法依赖的package包/类
@NonNull
@Override
public Uri rewrite(WXSDKInstance instance, String type, Uri uri) {
Uri base = Uri.parse(instance.getBundleUrl());
Uri.Builder resultBuilder = uri.buildUpon();
if (uri.isRelative()) {
resultBuilder = buildRelativeURI(resultBuilder, base, uri);
return resultBuilder.build();
}
return uri;
}
示例6: setupAppCallForWebFallbackDialog
import android.net.Uri; //导入方法依赖的package包/类
public static void setupAppCallForWebFallbackDialog(
AppCall appCall,
Bundle parameters,
DialogFeature feature) {
Validate.hasFacebookActivity(FacebookSdk.getApplicationContext());
Validate.hasInternetPermissions(FacebookSdk.getApplicationContext());
String featureName = feature.name();
Uri fallbackUrl = getDialogWebFallbackUri(feature);
if (fallbackUrl == null) {
throw new FacebookException(
"Unable to fetch the Url for the DialogFeature : '" + featureName + "'");
}
// Since we're talking to the server here, let's use the latest version we know about.
// We know we are going to be communicating over a bucketed protocol.
int protocolVersion = NativeProtocol.getLatestKnownVersion();
Bundle webParams = ServerProtocol.getQueryParamsForPlatformActivityIntentWebFallback(
appCall.getCallId().toString(),
protocolVersion,
parameters);
if (webParams == null) {
throw new FacebookException("Unable to fetch the app's key-hash");
}
// Now form the Uri
if (fallbackUrl.isRelative()) {
fallbackUrl = Utility.buildUri(
ServerProtocol.getDialogAuthority(),
fallbackUrl.toString(),
webParams);
} else {
fallbackUrl = Utility.buildUri(
fallbackUrl.getAuthority(),
fallbackUrl.getPath(),
webParams);
}
Bundle intentParameters = new Bundle();
intentParameters.putString(NativeProtocol.WEB_DIALOG_URL, fallbackUrl.toString());
intentParameters.putBoolean(NativeProtocol.WEB_DIALOG_IS_FALLBACK, true);
Intent webDialogIntent = new Intent();
NativeProtocol.setupProtocolRequestIntent(
webDialogIntent,
appCall.getCallId().toString(),
feature.getAction(),
NativeProtocol.getLatestKnownVersion(),
intentParameters);
webDialogIntent.setClass(FacebookSdk.getApplicationContext(), FacebookActivity.class);
webDialogIntent.setAction(FacebookDialogFragment.TAG);
appCall.setRequestIntent(webDialogIntent);
}
示例7: catUri
import android.net.Uri; //导入方法依赖的package包/类
public static Uri catUri(final Context context, final Uri folder, final String file)
{
if (file == null)
{
return null;
}
final Uri parsedFile = Uri.parse(file);
if (folder == null || !parsedFile.isRelative())
{
return parsedFile;
}
final String[] nameParts = file.split("/", -1);
Uri resUri = folder;
for (String part : nameParts)
{
if (part == null || resUri == null)
{
break;
}
Uri newUri = null;
if (AdapterBaseImpl.PLS.equals(part))
{
if (FileUtils.isContentUri(resUri))
{
newUri = AdapterDocuments.getParent(resUri);
}
else
{
newUri = FileUtils.getParentDirectory(resUri);
}
}
else
{
if (FileUtils.isContentUri(resUri))
{
newUri = AdapterDocuments.withAppendedPath(context, resUri, part);
}
else
{
newUri = Uri.withAppendedPath(resUri, part);
}
}
if (newUri != null)
{
resUri = newUri;
}
}
return resUri;
}