当前位置: 首页>>代码示例>>Java>>正文


Java Uri.isRelative方法代码示例

本文整理汇总了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;
}
 
开发者ID:weexext,项目名称:ucar-weex-core,代码行数:22,代码来源:DefaultUriAdapter.java

示例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;
}
 
开发者ID:didikee,项目名称:cnBetaGeek,代码行数:14,代码来源:PicassoImageGetter.java

示例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;
}
 
开发者ID:quaap,项目名称:BookyMcBookface,代码行数:15,代码来源:HtmlBook.java

示例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;
}
 
开发者ID:quaap,项目名称:BookyMcBookface,代码行数:29,代码来源:EpubBook.java

示例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;


}
 
开发者ID:erguotou520,项目名称:weex-uikit,代码行数:15,代码来源:DefaultUriAdapter.java

示例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);
}
 
开发者ID:eviltnan,项目名称:kognitivo,代码行数:55,代码来源:DialogPresenter.java

示例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;
}
 
开发者ID:mkulesh,项目名称:microMathematics,代码行数:52,代码来源:FileUtils.java


注:本文中的android.net.Uri.isRelative方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。