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


Java Builder.appendPath方法代码示例

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


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

示例1: getSearchManagerSuggestions

import android.net.Uri.Builder; //导入方法依赖的package包/类
Cursor getSearchManagerSuggestions(SearchableInfo searchable, String query, int limit) {
    if (searchable == null) {
        return null;
    }
    String authority = searchable.getSuggestAuthority();
    if (authority == null) {
        return null;
    }
    Builder uriBuilder = new Builder().scheme(Utils.RESPONSE_CONTENT).authority(authority).query("").fragment("");
    String contentPath = searchable.getSuggestPath();
    if (contentPath != null) {
        uriBuilder.appendEncodedPath(contentPath);
    }
    uriBuilder.appendPath("search_suggest_query");
    String selection = searchable.getSuggestSelection();
    String[] selArgs = null;
    if (selection != null) {
        selArgs = new String[]{query};
    } else {
        uriBuilder.appendPath(query);
    }
    if (limit > 0) {
        uriBuilder.appendQueryParameter("limit", String.valueOf(limit));
    }
    return this.mContext.getContentResolver().query(uriBuilder.build(), null, selection, selArgs, null);
}
 
开发者ID:JackChan1999,项目名称:boohee_v5.6,代码行数:27,代码来源:SuggestionsAdapter.java

示例2: removeFilters

import android.net.Uri.Builder; //导入方法依赖的package包/类
/**
 * Removes any path elements that begin with a digit
 * 
 * @param uri
 *            The {@link Uri} that should be formatted
 * @return The formatted Uri.
 */
private Uri removeFilters(Uri uri) {
	// Remove any prior filters by only copying the segment of the path
	// that does not start with a number.
	Builder builder = uri.buildUpon();
	builder.path(null);
	List<String> pathSegments = uri.getPathSegments();
	for (String pathSegment : pathSegments) {
		if (!Character.isDigit(pathSegment.charAt(0))) {
			builder.appendPath(pathSegment);
		} else {
			break;
		}
	}
	builder.appendPath("");
	return builder.build();
}
 
开发者ID:genious7,项目名称:FanFictionReader,代码行数:24,代码来源:CommunityMenuActivity.java

示例3: buildSingleDeviceEventUri

import android.net.Uri.Builder; //导入方法依赖的package包/类
Uri buildSingleDeviceEventUri(@Nullable String eventNamePrefix, String deviceId) {
    Builder builder = devicesBaseUri.buildUpon()
            .appendPath(deviceId)
            .appendPath(EVENTS);
    if (truthy(eventNamePrefix)) {
        builder.appendPath(eventNamePrefix);
    }
    return builder.build();
}
 
开发者ID:Datatellit,项目名称:xlight_android_native,代码行数:10,代码来源:EventsDelegate.java

示例4: m2692a

import android.net.Uri.Builder; //导入方法依赖的package包/类
Cursor m2692a(SearchableInfo searchableInfo, String str, int i) {
    if (searchableInfo == null) {
        return null;
    }
    String suggestAuthority = searchableInfo.getSuggestAuthority();
    if (suggestAuthority == null) {
        return null;
    }
    String[] strArr;
    Builder fragment = new Builder().scheme("content").authority(suggestAuthority).query("").fragment("");
    String suggestPath = searchableInfo.getSuggestPath();
    if (suggestPath != null) {
        fragment.appendEncodedPath(suggestPath);
    }
    fragment.appendPath("search_suggest_query");
    String suggestSelection = searchableInfo.getSuggestSelection();
    if (suggestSelection != null) {
        strArr = new String[]{str};
    } else {
        fragment.appendPath(str);
        strArr = null;
    }
    if (i > 0) {
        fragment.appendQueryParameter("limit", String.valueOf(i));
    }
    return this.d.getContentResolver().query(fragment.build(), null, suggestSelection, strArr, null);
}
 
开发者ID:Qwaz,项目名称:solved-hacking-problem,代码行数:28,代码来源:da.java

示例5: buildResultUri

import android.net.Uri.Builder; //导入方法依赖的package包/类
public static Uri buildResultUri(String authority, String database, int version, String table, 
		long rowId) {
	if (authority == null 
			|| database == null 
			|| table == null) {
		return null;
	}
	
	Uri baseUri = Uri.parse("content://" + authority);
	if (baseUri == null) {
		return null;
	}
	
	Builder builder = baseUri.buildUpon();
	if (builder == null) {
		return null;
	}
	
	builder.appendPath(ProviderResultUriParser.BASE_RESULT);
	builder.appendPath(database);
	builder.appendPath(String.valueOf(version));
	builder.appendPath(table);
	
	if (rowId > 0) { 
		builder.appendPath(String.valueOf(rowId));
	}
	
	return builder.build();
}
 
开发者ID:dailystudio,项目名称:devbricks,代码行数:30,代码来源:ProviderUriBuilder.java

示例6: buildCommandUri

import android.net.Uri.Builder; //导入方法依赖的package包/类
public static Uri buildCommandUri(String authority,
		Class<? extends DatabaseObject> klass,
		int version,
		String command) {
	if (authority == null 
			|| klass == null
			|| version < 0
			|| command == null) {
		return null;
	}
	
	Uri baseUri = Uri.parse("content://" + authority);
	if (baseUri == null) {
		return null;
	}
	
	Builder builder = baseUri.buildUpon();
	if (builder == null) {
		return null;
	}
	
	final String database = DatabaseObject.classToDatabase(klass);
	final String table = DatabaseObject.classToTable(klass);
	
	if (database == null 
			|| table == null) {
		return null;
	}
	
	builder.appendPath(ProviderCommandUriParser.BASE_COMMAND);
	builder.appendPath(database);
	builder.appendPath(String.valueOf(version));
	builder.appendPath(table);
	builder.appendPath(command);
	
	return builder.build();
}
 
开发者ID:dailystudio,项目名称:devbricks,代码行数:38,代码来源:ProviderUriBuilder.java

示例7: getUri

import android.net.Uri.Builder; //导入方法依赖的package包/类
@Override
protected Uri getUri(int currentPage) {
	Builder uri = mUri.buildUpon();
	uri.appendPath("0");
	uri.appendPath(mSort.getId() + "");
	uri.appendPath(currentPage + "");
	uri.appendPath("");
	return uri.build();
}
 
开发者ID:genious7,项目名称:FanFictionReader,代码行数:10,代码来源:CommunityMenuLoaders.java

示例8: generateBootstrapEndpoint

import android.net.Uri.Builder; //导入方法依赖的package包/类
/**
 * Generates a general bootstrap endpoint with the specified parameters.
 *
 * @param siteId    The Id of the article's site.
 * @param articleId The Id of the collection's article.
 * @param opts      Optional parameters to pass in. Currently takes in pageNumber param for Bootstrap page number.
 * @return The init endpoint with the specified parameters.
 * @throws UnsupportedEncodingException
 * @throws MalformedURLException
 */
public static String generateBootstrapEndpoint(String siteId,String articleId,Map<String, Object>... opts)throws UnsupportedEncodingException {
    // Casting
    final String article64 = Helpers.generateBase64String(articleId);

    // Build the URL
    Builder uriBuilder = new Uri.Builder()
            .scheme(LivefyreConfig.scheme)
            .authority(LivefyreConfig.bootstrapDomain + "." + LivefyreConfig.getConfiguredNetworkID())
            .appendPath("bs3")
            .appendPath("v3.1")
            .appendPath(LivefyreConfig.getConfiguredNetworkID())
            .appendPath(siteId)
            .appendPath(article64);

    if (opts.length <= 0) {
        uriBuilder.appendPath("init");
    } else {
        if (opts[0].get("pageNumber") instanceof Integer) {
            String page = opts[0].get("pageNumber").toString() + ".json";
            uriBuilder.appendPath(page);
        } else {
            throw new IllegalArgumentException("Bootstrap page number must be an Integer");
        }
    }

    return uriBuilder.toString();
}
 
开发者ID:Livefyre,项目名称:StreamHub-Android-Comments-App,代码行数:38,代码来源:BootstrapClient.java

示例9: generateWriteURL

import android.net.Uri.Builder; //导入方法依赖的package包/类
/**
 * @param collectionId The Id of the collection.
 * @param userToken    The token of the logged in user.
 * @param endpoint
 * @return
 * @throws MalformedURLException
 */
public static String generateWriteURL(
        String collectionId, String userToken, String endpoint)
        throws MalformedURLException {
    final Builder uriBuilder = new Uri.Builder().scheme(LivefyreConfig.scheme)
            .authority(LivefyreConfig.quillDomain + "." + LivefyreConfig.getConfiguredNetworkID())
            .appendPath("api").appendPath("v3.0").appendPath("collection")
            .appendPath(collectionId).appendPath("post");
    if (LFSConstants.LFSPostTypeReview == endpoint)
        uriBuilder.appendPath(endpoint).appendPath("");
    else
        uriBuilder.appendPath("");
    Log.d("Write URL", "" + uriBuilder.toString());
    return uriBuilder.toString();
}
 
开发者ID:Livefyre,项目名称:StreamHub-Android-Comments-App,代码行数:22,代码来源:WriteClient.java

示例10: buildUri

import android.net.Uri.Builder; //导入方法依赖的package包/类
private static Uri buildUri(@NonNull final String... paths) {
    Builder builder = BASE_CONTENT_URI.buildUpon();
    for (String path : paths) {
        builder.appendPath(path);
    }

    return get(builder.build());
}
 
开发者ID:reark,项目名称:reark,代码行数:9,代码来源:GitHubProvider.java

示例11: configureLoader

import android.net.Uri.Builder; //导入方法依赖的package包/类
@Override
public void configureLoader(CursorLoader loader, long directoryId) {
    final Builder builder;
    if (isSearchMode()) {
        builder = Email.CONTENT_FILTER_URI.buildUpon();
        String query = getQueryString();
        builder.appendPath(TextUtils.isEmpty(query) ? "" : query);
    } 
    else {
        builder = Email.CONTENT_URI.buildUpon();
        if (isSectionHeaderDisplayEnabled()) {
            builder.appendQueryParameter(ScContactsContract.ContactCounts.ADDRESS_BOOK_INDEX_EXTRAS, "true");
        }
    }
    builder.appendQueryParameter(ScContactsContract.DIRECTORY_PARAM_KEY, String.valueOf(directoryId));
    builder.appendQueryParameter(ScContactsContract.REMOVE_DUPLICATE_ENTRIES, "true");
    loader.setUri(builder.build());

    if (getContactNameDisplayOrder() == ScContactsContract.Preferences.DISPLAY_ORDER_PRIMARY) {
        loader.setProjection(EmailQuery.PROJECTION_PRIMARY);
    } 
    else {
        loader.setProjection(EmailQuery.PROJECTION_ALTERNATIVE);
    }

    if (getSortOrder() == ScContactsContract.Preferences.SORT_ORDER_PRIMARY) {
        loader.setSortOrder(Email.SORT_KEY_PRIMARY);
    } 
    else {
        loader.setSortOrder(Email.SORT_KEY_ALTERNATIVE);
    }
}
 
开发者ID:SilentCircle,项目名称:silent-contacts-android,代码行数:33,代码来源:EmailAddressListAdapter.java

示例12: constructReturnData

import android.net.Uri.Builder; //导入方法依赖的package包/类
protected Uri constructReturnData(Long personId, Long contactMethodId){
	Builder builder = ContentUris.appendId(Contacts.People.CONTENT_URI.buildUpon(), personId);
	builder.appendPath(Contacts.People.ContactMethods.CONTENT_DIRECTORY);
	builder.appendPath(contactMethodId.toString());
	Uri returnData = builder.build();
	return returnData;
}
 
开发者ID:SpencerRiddering,项目名称:flingtap-done,代码行数:8,代码来源:SelectPostalContactMethodActivity.java

示例13: createFakeUri

import android.net.Uri.Builder; //导入方法依赖的package包/类
private static Uri createFakeUri(String... pathSegments) {
  Builder builder = Uri.parse("content://com.fakedomain.base").buildUpon();

  for (String path : pathSegments) {
    builder.appendPath(path);
  }

  return builder.build();
}
 
开发者ID:futuresimple,项目名称:android-db-commons,代码行数:10,代码来源:BatcherTest.java

示例14: buildQueryUri

import android.net.Uri.Builder; //导入方法依赖的package包/类
public static Uri buildQueryUri(String authority,
									Class<? extends DatabaseObject> klass,
									int version,
									long serial,
									boolean cursorOnly) {
		if (authority == null 
				|| klass == null 
				|| version < 0) {
			return null;
		}
		
		Uri baseUri = Uri.parse("content://" + authority);
		if (baseUri == null) {
			return null;
		}
		
		Builder builder = baseUri.buildUpon();
		if (builder == null) {
			return null;
		}
		
		final String database = DatabaseObject.classToDatabase(klass);
		final String table = DatabaseObject.classToTable(klass);
		
		if (database == null 
				|| table == null) {
			return null;
		}
		
		builder.appendPath(cursorOnly ?
				ProviderQueryUriParser.BASE_QUERY_CURSOR : ProviderQueryUriParser.BASE_QUERY);
		builder.appendPath(database);
		builder.appendPath(String.valueOf(version));
		builder.appendPath(table);
//		if (serial > 0) {
//			builder.appendPath(String.valueOf(serial));
//		}
		
		Uri uri = builder.build();
		if (uri == null) {
			return null;
		}
		
		if (serial > 0) {
			uri = attachSerialParamter(uri, String.valueOf(serial));
		}
		
		return uri;
	}
 
开发者ID:dailystudio,项目名称:devbricks,代码行数:50,代码来源:ProviderUriBuilder.java

示例15: configureLoader

import android.net.Uri.Builder; //导入方法依赖的package包/类
@Override
public void configureLoader(CursorLoader loader, long directoryId) {
    if (loader instanceof ProfileAndContactsLoader) {
        ((ProfileAndContactsLoader) loader).setLoadProfile(shouldIncludeProfile());
    }

    ContactListFilter filter = getFilter();
    if (isSearchMode()) {
        String query = getQueryString();
        if (query == null) {
            query = "";
        }
        query = query.trim();
        if (TextUtils.isEmpty(query)) {
            // Regardless of the directory, we don't want anything returned,
            // so let's just send a "nothing" query to the local directory.
            loader.setUri(RawContacts.CONTENT_URI);
            loader.setProjection(getProjection(false));
            loader.setSelection("0");
        } 
        else {
            Builder builder = RawContacts.CONTENT_FILTER_URI.buildUpon();
            builder.appendPath(query);      // Builder will encode the query
            builder.appendQueryParameter(ScContactsContract.DIRECTORY_PARAM_KEY, String.valueOf(directoryId));
            if (directoryId != Directory.DEFAULT && directoryId != Directory.LOCAL_INVISIBLE) {
                builder.appendQueryParameter(ScContactsContract.LIMIT_PARAM_KEY,
                        String.valueOf(getDirectoryResultLimit()));
            }
            builder.appendQueryParameter(SearchSnippetColumns.SNIPPET_ARGS_PARAM_KEY, SNIPPET_ARGS);
            builder.appendQueryParameter(SearchSnippetColumns.DEFERRED_SNIPPETING_KEY,"1");
            loader.setUri(builder.build());
            loader.setProjection(getProjection(true));
        }
    } else {
        configureUri(loader, directoryId, filter);
        loader.setProjection(getProjection(false));
        configureSelection(loader, directoryId, filter);
    }

    String sortOrder;
    if (getSortOrder() == ScContactsContract.Preferences.SORT_ORDER_PRIMARY) {
        sortOrder = RawContacts.SORT_KEY_PRIMARY;
    } else {
        sortOrder = RawContacts.SORT_KEY_ALTERNATIVE;
    }
    loader.setSortOrder(sortOrder);
}
 
开发者ID:SilentCircle,项目名称:silent-contacts-android,代码行数:48,代码来源:ScDefaultContactListAdapter.java


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