use of android.content.UriMatcher in project android_frameworks_base by ParanoidAndroid.
the class UriMatcherTest method testContentUris.
@SmallTest
public void testContentUris() {
UriMatcher matcher = new UriMatcher(ROOT);
matcher.addURI("people", null, PEOPLE);
matcher.addURI("people", "#", PEOPLE_ID);
matcher.addURI("people", "#/phones", PEOPLE_PHONES);
matcher.addURI("people", "#/phones/blah", PEOPLE_PHONES_ID);
matcher.addURI("people", "#/phones/#", PEOPLE_PHONES_ID);
matcher.addURI("people", "#/addresses", PEOPLE_ADDRESSES);
matcher.addURI("people", "#/addresses/#", PEOPLE_ADDRESSES_ID);
matcher.addURI("people", "#/contact-methods", PEOPLE_CONTACTMETH);
matcher.addURI("people", "#/contact-methods/#", PEOPLE_CONTACTMETH_ID);
matcher.addURI("calls", null, CALLS);
matcher.addURI("calls", "#", CALLS_ID);
matcher.addURI("caller-id", null, CALLERID);
matcher.addURI("caller-id", "*", CALLERID_TEXT);
matcher.addURI("filter-recent", null, FILTERRECENT);
matcher.addURI("auth", "another/path/segment", ANOTHER_PATH_SEGMENT);
checkAll(matcher);
}
use of android.content.UriMatcher in project SeriesGuide by UweTrottmann.
the class SeriesGuideProvider method buildUriMatcher.
/**
* Build and return a {@link UriMatcher} that catches all {@link Uri} variations supported by
* this {@link ContentProvider}.
*/
private static UriMatcher buildUriMatcher() {
final UriMatcher matcher = new UriMatcher(UriMatcher.NO_MATCH);
final String authority = SgApp.CONTENT_AUTHORITY;
// Shows
matcher.addURI(authority, SeriesGuideContract.PATH_SHOWS, SHOWS);
matcher.addURI(authority, SeriesGuideContract.PATH_SHOWS + "/" + SeriesGuideContract.PATH_FILTER + "/*", SHOWS_FILTERED);
matcher.addURI(authority, SeriesGuideContract.PATH_SHOWS + "/" + SeriesGuideContract.PATH_WITH_LAST_EPISODE, SHOWS_WITH_LAST_EPISODE);
matcher.addURI(authority, SeriesGuideContract.PATH_SHOWS + "/" + SeriesGuideContract.PATH_WITH_NEXT_EPISODE, SHOWS_WITH_NEXT_EPISODE);
matcher.addURI(authority, SeriesGuideContract.PATH_SHOWS + "/*", SHOWS_ID);
// Episodes
matcher.addURI(authority, SeriesGuideContract.PATH_EPISODES, EPISODES);
matcher.addURI(authority, SeriesGuideContract.PATH_EPISODES + "/" + SeriesGuideContract.PATH_OFSEASON + "/" + SeriesGuideContract.PATH_WITHSHOW + "/*", EPISODES_OFSEASON_WITHSHOW);
matcher.addURI(authority, SeriesGuideContract.PATH_EPISODES + "/" + SeriesGuideContract.PATH_OFSEASON + "/*", EPISODES_OFSEASON);
matcher.addURI(authority, SeriesGuideContract.PATH_EPISODES + "/" + SeriesGuideContract.PATH_OFSHOW + "/*", EPISODES_OFSHOW);
matcher.addURI(authority, SeriesGuideContract.PATH_EPISODES + "/" + SeriesGuideContract.PATH_WITHSHOW, EPISODES_WITHSHOW);
matcher.addURI(authority, SeriesGuideContract.PATH_EPISODES + "/" + SeriesGuideContract.PATH_WITHSHOW + "/*", EPISODES_ID_WITHSHOW);
matcher.addURI(authority, SeriesGuideContract.PATH_EPISODES + "/*", EPISODES_ID);
// Seasons
matcher.addURI(authority, SeriesGuideContract.PATH_SEASONS, SEASONS);
matcher.addURI(authority, SeriesGuideContract.PATH_SEASONS + "/" + SeriesGuideContract.PATH_OFSHOW + "/*", SEASONS_OFSHOW);
matcher.addURI(authority, SeriesGuideContract.PATH_SEASONS + "/*", SEASONS_ID);
// Lists
matcher.addURI(authority, SeriesGuideContract.PATH_LISTS, LISTS);
matcher.addURI(authority, SeriesGuideContract.PATH_LISTS + "/" + SeriesGuideContract.PATH_WITH_LIST_ITEM_ID + "/*", LISTS_WITH_LIST_ITEM_ID);
matcher.addURI(authority, SeriesGuideContract.PATH_LISTS + "/*", LISTS_ID);
// List items
matcher.addURI(authority, SeriesGuideContract.PATH_LIST_ITEMS, LIST_ITEMS);
matcher.addURI(authority, SeriesGuideContract.PATH_LIST_ITEMS + "/" + SeriesGuideContract.PATH_WITH_DETAILS, LIST_ITEMS_WITH_DETAILS);
matcher.addURI(authority, SeriesGuideContract.PATH_LIST_ITEMS + "/*", LIST_ITEMS_ID);
// Movies
matcher.addURI(authority, SeriesGuideContract.PATH_MOVIES, MOVIES);
matcher.addURI(authority, SeriesGuideContract.PATH_MOVIES + "/*", MOVIES_ID);
// Activity
matcher.addURI(authority, SeriesGuideContract.PATH_ACTIVITY, ACTIVITY);
// Search
matcher.addURI(authority, SeriesGuideContract.PATH_EPISODESEARCH + "/" + SeriesGuideContract.PATH_SEARCH, EPISODESEARCH);
matcher.addURI(authority, SeriesGuideContract.PATH_EPISODESEARCH + "/*", EPISODESEARCH_ID);
// Suggestions
matcher.addURI(authority, SearchManager.SUGGEST_URI_PATH_QUERY, SEARCH_SUGGEST);
matcher.addURI(authority, SearchManager.SUGGEST_URI_PATH_QUERY + "/*", SEARCH_SUGGEST);
// Ops
matcher.addURI(authority, SeriesGuideContract.PATH_RENEWFTSTABLE, RENEW_FTSTABLE);
return matcher;
}
use of android.content.UriMatcher in project android-ui-design-pattern by MathieuCalba.
the class YANAProvider method buildUriMatcher.
protected static UriMatcher buildUriMatcher(final String authority) {
final UriMatcher matcher = new UriMatcher(UriMatcher.NO_MATCH);
if (BuildConfig.DEBUG) {
Log.d(TAG, "authority=[" + authority + "]");
}
/* ARTICLES */
matcher.addURI(authority, YANAContract.PATH_ARTICLE + SEPARATOR + YANAContract.PATH_FEED + NUMBER + SEPARATOR + YANAContract.PATH_CATEGORY + NUMBER, ARTICLE_BY_FEED_ID_AND_CATEGORY_ID);
matcher.addURI(authority, YANAContract.PATH_ARTICLE + SEPARATOR + YANAContract.PATH_CATEGORY + NUMBER, ARTICLE_BY_CATEGORY_ID);
matcher.addURI(authority, YANAContract.PATH_ARTICLE + SEPARATOR + YANAContract.PATH_FEED + NUMBER, ARTICLE_BY_FEED_ID);
matcher.addURI(authority, YANAContract.PATH_ARTICLE + NUMBER, ARTICLE_ID);
matcher.addURI(authority, YANAContract.PATH_ARTICLE, ARTICLE);
/* FEEDS */
matcher.addURI(authority, YANAContract.PATH_FEED + NUMBER, FEED_ID);
matcher.addURI(authority, YANAContract.PATH_FEED, FEED);
/* CATEGORIES */
matcher.addURI(authority, YANAContract.PATH_CATEGORY + NUMBER, CATEGORY_ID);
matcher.addURI(authority, YANAContract.PATH_CATEGORY, CATEGORY);
return matcher;
}
use of android.content.UriMatcher in project BeyondUPnP by kevinshine.
the class SystemProvider method buildUriMatcher.
/**
* Build and return a {@link UriMatcher} that catches all {@link Uri}
* variations supported by this {@link ContentProvider}.
*/
private static UriMatcher buildUriMatcher() {
final UriMatcher matcher = new UriMatcher(UriMatcher.NO_MATCH);
final String authority = BeyondUpnpContract.CONTENT_AUTHORITY;
matcher.addURI(authority, "playlist_item", PLAYLIST_ITEM);
matcher.addURI(authority, "playlist_item/*", PLAYLIST_ITEM_ID);
return matcher;
}
use of android.content.UriMatcher in project QuantumFlux by himanshu-soni.
the class UriMatcherHelper method init.
public void init(Context context, TableDetailsCache detailsCache) {
mUriMatcher = new UriMatcher(UriMatcher.NO_MATCH);
int matcherInterval = MATCHER_CODE_INTERVALS;
for (Class<?> dataModelObject : ReflectionHelper.getDomainClasses(context, ReflectionHelper.TableType.TABLE)) {
TableDetails tableDetails = detailsCache.findTableDetails(context, dataModelObject);
mMatcherCodes.put(matcherInterval, tableDetails);
mUriMatcher.addURI(mAuthority, tableDetails.getTableName(), matcherInterval + MATCHER_ALL);
mUriMatcher.addURI(mAuthority, tableDetails.getTableName() + "/*", matcherInterval + MATCHER_SINGLE);
matcherInterval += MATCHER_CODE_INTERVALS;
}
}
Aggregations