當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。