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