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


Java Uri.Builder方法代码示例

本文整理汇总了Java中android.net.Uri.Builder方法的典型用法代码示例。如果您正苦于以下问题:Java Uri.Builder方法的具体用法?Java Uri.Builder怎么用?Java Uri.Builder使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在android.net.Uri的用法示例。


在下文中一共展示了Uri.Builder方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: appendParams

import android.net.Uri; //导入方法依赖的package包/类
protected String appendParams(String url, Map<String, String> params)
{
    if (url == null || params == null || params.isEmpty())
    {
        return url;
    }
    Uri.Builder builder = Uri.parse(url).buildUpon();
    Set<String> keys = params.keySet();
    Iterator<String> iterator = keys.iterator();
    while (iterator.hasNext())
    {
        String key = iterator.next();
        builder.appendQueryParameter(key, params.get(key));
    }
    return builder.build().toString();
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:17,代码来源:GetBuilder.java

示例2: toLocalUri

import android.net.Uri; //导入方法依赖的package包/类
@Override
public LocalFilesystemURL toLocalUri(Uri inputURL) {
    if (!"content".equals(inputURL.getScheme())) {
        return null;
    }
    String subPath = inputURL.getEncodedPath();
    if (subPath.length() > 0) {
        subPath = subPath.substring(1);
    }
    Uri.Builder b = new Uri.Builder()
        .scheme(LocalFilesystemURL.FILESYSTEM_PROTOCOL)
        .authority("localhost")
        .path(name)
        .appendPath(inputURL.getAuthority());
    if (subPath.length() > 0) {
        b.appendEncodedPath(subPath);
    }
    Uri localUri = b.encodedQuery(inputURL.getEncodedQuery())
        .encodedFragment(inputURL.getEncodedFragment())
        .build();
    return LocalFilesystemURL.parse(localUri);
}
 
开发者ID:disit,项目名称:siiMobilityAppKit,代码行数:23,代码来源:ContentFilesystem.java

示例3: wrapPageName

import android.net.Uri; //导入方法依赖的package包/类
private String wrapPageName(String pageName, String url) {
  if(TextUtils.equals(pageName, WXPerformance.DEFAULT)){
    pageName=url;
    try {
      Uri uri=Uri.parse(url);
      if(uri!=null){
        Uri.Builder builder=new Uri.Builder();
        builder.scheme(uri.getScheme());
        builder.authority(uri.getAuthority());
        builder.path(uri.getPath());
        pageName=builder.toString();
      }
    } catch (Exception e) {
    }
  }
  return pageName;
}
 
开发者ID:weexext,项目名称:ucar-weex-core,代码行数:18,代码来源:WXSDKInstance.java

示例4: playMovieSeriesItem

import android.net.Uri; //导入方法依赖的package包/类
private void playMovieSeriesItem(String url, String playtoken, String netResVideoId) {
    if (TextUtils.isEmpty(url))
        return;
    Uri.Builder builder = Uri.parse(url).buildUpon();
    builder.appendQueryParameter("playtype", "demand");
    builder.appendQueryParameter("protocol", "http");
    builder.appendQueryParameter("accesstoken", MobileDataManager.getAccessToken());
    builder.appendQueryParameter("programid", netResVideoId);
    builder.appendQueryParameter("playtoken", playtoken);
    builder.appendQueryParameter("verifycode", "" + 33); // 33
    // verifycode
    builder.appendQueryParameter("rate", "normal");
    String playUrl = builder.build().toString();
    this.mPlayUrl = playUrl;
    Logger.d("playurl:  " + playUrl);
    mVideoPlayer.stopPlayback();
    mVideoPlayer.setVideoPath(playUrl);
}
 
开发者ID:iPanelkegy,项目名称:MobileMedia,代码行数:19,代码来源:SystemVideoPlayerActivity.java

示例5: playMovieSeriesItem

import android.net.Uri; //导入方法依赖的package包/类
private void playMovieSeriesItem(String url, String playtoken, String netResVideoId) {
    if (TextUtils.isEmpty(url))
        return;
    Uri.Builder builder = Uri.parse(url).buildUpon();
    builder.appendQueryParameter("playtype", "demand");
    builder.appendQueryParameter("protocol", "http");
    builder.appendQueryParameter("accesstoken", MobileDataManager.getAccessToken());
    builder.appendQueryParameter("programid", netResVideoId);
    builder.appendQueryParameter("playtoken", playtoken);
    builder.appendQueryParameter("verifycode", "" + 33); // 33
    // verifycode
    builder.appendQueryParameter("rate", "normal");
    String playUrl = builder.build().toString();
    this.mPlayUrl = playUrl;
    Logger.d("playurl:  " + playUrl);
    mVideoPlayer.setVideoPath(playUrl);
    mVideoPlayer.requestFocus();
}
 
开发者ID:iPanelkegy,项目名称:MobileMedia,代码行数:19,代码来源:VitamioVideoPlayerActivity.java

示例6: buildUrl

import android.net.Uri; //导入方法依赖的package包/类
private String buildUrl(String method, String query) {
    Uri.Builder uriBuilder = ENDPOINT.buildUpon()
            .appendQueryParameter("method", method);

    if (method.equals(SEARCH_METHOD)) {
        uriBuilder.appendQueryParameter("text", query);
    }

    return uriBuilder.build().toString();
}
 
开发者ID:rsippl,项目名称:AndroidProgramming3e,代码行数:11,代码来源:FlickrFetchr.java

示例7: buildUri

import android.net.Uri; //导入方法依赖的package包/类
public static Uri buildUri(String authority, String path, Bundle parameters) {
    Uri.Builder builder = new Uri.Builder();
    builder.scheme(URL_SCHEME);
    builder.authority(authority);
    builder.path(path);
    for (String key : parameters.keySet()) {
        Object parameter = parameters.get(key);
        if (parameter instanceof String) {
            builder.appendQueryParameter(key, (String) parameter);
        }
    }
    return builder.build();
}
 
开发者ID:MobileDev418,项目名称:chat-sdk-android-push-firebase,代码行数:14,代码来源:Utility.java

示例8: getEncodedQuery

import android.net.Uri; //导入方法依赖的package包/类
public String getEncodedQuery() {
    Uri.Builder builder = new Uri.Builder();
    for (Entry<String,String> param : mParams.entrySet()) {
        builder.appendQueryParameter(param.getKey(), param.getValue());
    }
    return builder.build().getEncodedQuery();
}
 
开发者ID:WrBug,项目名称:GravityBox,代码行数:8,代码来源:RequestParams.java

示例9: JSPackagerClient

import android.net.Uri; //导入方法依赖的package包/类
public JSPackagerClient(String clientId, PackagerConnectionSettings settings, Map<String, RequestHandler> requestHandlers) {
  super();

  Uri.Builder builder = new Uri.Builder();
  builder.scheme("ws")
    .encodedAuthority(settings.getDebugServerHost())
    .appendPath("message")
    .appendQueryParameter("device", AndroidInfoHelpers.getFriendlyDeviceName())
    .appendQueryParameter("app", settings.getPackageName())
    .appendQueryParameter("clientid", clientId);
  String url = builder.build().toString();

  mWebSocket = new ReconnectingWebSocket(url, this);
  mRequestHandlers = requestHandlers;
}
 
开发者ID:qq565999484,项目名称:RNLearn_Project1,代码行数:16,代码来源:JSPackagerClient.java

示例10: getProfilePictureUri

import android.net.Uri; //导入方法依赖的package包/类
public static Uri getProfilePictureUri(
        String userId,
        int width,
        int height) {

    Validate.notNullOrEmpty(userId, "userId");

    width = Math.max(width, UNSPECIFIED_DIMENSION);
    height = Math.max(height, UNSPECIFIED_DIMENSION);

    if (width == UNSPECIFIED_DIMENSION && height == UNSPECIFIED_DIMENSION) {
        throw new IllegalArgumentException("Either width or height must be greater than 0");
    }

    Uri.Builder builder =
            new Uri.Builder()
                    .scheme(SCHEME)
                    .authority(AUTHORITY)
                    .path(String.format(Locale.US, PATH, userId));

    if (height != UNSPECIFIED_DIMENSION) {
        builder.appendQueryParameter(HEIGHT_PARAM, String.valueOf(height));
    }

    if (width != UNSPECIFIED_DIMENSION) {
        builder.appendQueryParameter(WIDTH_PARAM, String.valueOf(width));
    }

    builder.appendQueryParameter(MIGRATION_PARAM, MIGRATION_VALUE);

    return builder.build();
}
 
开发者ID:eviltnan,项目名称:kognitivo,代码行数:33,代码来源:ImageRequest.java

示例11: buildPath

import android.net.Uri; //导入方法依赖的package包/类
/**
 * Create API endpoint with given params (optional)
 * @param path
 * @param params
 * @return
 */
private static String buildPath(String path, Map<String, String> params) {
    Uri.Builder builder = Uri.parse(BuildConfig.HOST + path).buildUpon();
    if (params != null) {
        for (Map.Entry<String, String> entry : params.entrySet()) {
            builder.appendQueryParameter(entry.getKey(), entry.getValue());
        }
    }
    return builder.build().toString();
}
 
开发者ID:Dentacoin,项目名称:aftercare-app-android,代码行数:16,代码来源:DCApiManager.java

示例12: toLocalUri

import android.net.Uri; //导入方法依赖的package包/类
@Override
public LocalFilesystemURL toLocalUri(Uri inputURL) {
    if (!"file".equals(inputURL.getScheme())) {
        return null;
    }
    File f = new File(inputURL.getPath());
    // Removes and duplicate /s (e.g. file:///a//b/c)
    Uri resolvedUri = Uri.fromFile(f);
    String rootUriNoTrailingSlash = rootUri.getEncodedPath();
    rootUriNoTrailingSlash = rootUriNoTrailingSlash.substring(0, rootUriNoTrailingSlash.length() - 1);
    if (!resolvedUri.getEncodedPath().startsWith(rootUriNoTrailingSlash)) {
        return null;
    }
    String subPath = resolvedUri.getEncodedPath().substring(rootUriNoTrailingSlash.length());
    // Strip leading slash
    if (!subPath.isEmpty()) {
        subPath = subPath.substring(1);
    }
    Uri.Builder b = new Uri.Builder()
        .scheme(LocalFilesystemURL.FILESYSTEM_PROTOCOL)
        .authority("localhost")
        .path(name);
    if (!subPath.isEmpty()) {
        b.appendEncodedPath(subPath);
    }
    if (f.isDirectory()) {
        // Add trailing / for directories.
        b.appendEncodedPath("");
    }
    return LocalFilesystemURL.parse(b.build());
}
 
开发者ID:alex-shpak,项目名称:keemob,代码行数:32,代码来源:LocalFilesystem.java

示例13: attachGetParameters

import android.net.Uri; //导入方法依赖的package包/类
/**
 * Converts and attaches GET parameters to specified path.
 *
 * @param path Path on which to attach parameters.
 * @param params Params to convert and attach.
 * @return Path with attached parameters.
 */
private static String attachGetParameters(String path, Map<String, Object> params) {
  if (params == null) {
    return path;
  }
  Uri.Builder builder = Uri.parse(path).buildUpon();
  for (Map.Entry<String, Object> pair : params.entrySet()) {
    if (pair.getValue() == null) {
      continue;
    }
    builder.appendQueryParameter(pair.getKey(), pair.getValue().toString());
  }
  return builder.build().toString();
}
 
开发者ID:Leanplum,项目名称:Leanplum-Android-SDK,代码行数:21,代码来源:Util.java

示例14: withParam

import android.net.Uri; //导入方法依赖的package包/类
@NonNull
@Override
public Uri.Builder withParam(@NonNull Uri.Builder uriBuilder)
{
    return mDelegate.withParam(uriBuilder).appendQueryParameter("caller_is_syncadapter", "true");
}
 
开发者ID:dmfs,项目名称:ContentPal,代码行数:7,代码来源:SyncParams.java

示例15: testAppendQueryParameterIfNotNullForNullValue

import android.net.Uri; //导入方法依赖的package包/类
@Test
public void testAppendQueryParameterIfNotNullForNullValue() {
    Uri.Builder builder = new Uri.Builder();
    LiUriUtils.appendQueryParameterIfNotNull(builder, "test", null);
    Assert.assertEquals("", builder.toString());
}
 
开发者ID:lithiumtech,项目名称:li-android-sdk-core,代码行数:7,代码来源:LiUriLiCoreSDKUtilsTest.java


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