List of usage examples for android.content UriMatcher NO_MATCH
int NO_MATCH
To view the source code for android.content UriMatcher NO_MATCH.
Click Source Link
From source file:fr.matthiasbosc.translucentmap.PlaceProvider.java
private static UriMatcher buildUriMatcher() { UriMatcher uriMatcher = new UriMatcher(UriMatcher.NO_MATCH); // URI for "Go" button uriMatcher.addURI(AUTHORITY, "search", SEARCH); // URI for suggestions in Search Dialog uriMatcher.addURI(AUTHORITY, SearchManager.SUGGEST_URI_PATH_QUERY, SUGGESTIONS); // URI for Details uriMatcher.addURI(AUTHORITY, "details", DETAILS); return uriMatcher; }
From source file:redgun.bakingapp.data.RecipesProvider.java
static UriMatcher buildUriMatcher() { // I know what you're thinking. Why create a UriMatcher when you can use regular // expressions instead? Because you're not crazy, that's why. // All paths added to the UriMatcher have a corresponding code to return when a match is // found. The code passed into the constructor represents the code to return for the root // URI. It's common to use NO_MATCH as the code for this case. final UriMatcher matcher = new UriMatcher(UriMatcher.NO_MATCH); final String authority = RecipesContract.CONTENT_AUTHORITY; // For each type of URI you want to add, create a corresponding code. matcher.addURI(authority, RecipesContract.PATH_RECIPE, RECIPES); return matcher; }
From source file:com.amazonaws.mobileconnectors.s3.transferutility.TransferDBBase.java
/** * Constructs TransferdatabaseBase with the given Context. * * @param context A Context instance./*from w ww .jav a 2 s .c o m*/ */ public TransferDBBase(Context context) { this.context = context; final String mAuthority = context.getApplicationContext().getPackageName(); databaseHelper = new TransferDatabaseHelper(this.context); database = databaseHelper.getWritableDatabase(); contentUri = Uri.parse("content://" + mAuthority + "/" + BASE_PATH); uriMatcher = new UriMatcher(UriMatcher.NO_MATCH); /* * The Uri of TRANSFERS is for all records in the table. */ uriMatcher.addURI(mAuthority, BASE_PATH, TRANSFERS); /* * The Uri of TRANSFER_ID is for a single transfer record. */ uriMatcher.addURI(mAuthority, BASE_PATH + "/#", TRANSFER_ID); /* * The Uri of TRANSFER_PART is for part records of a multipart upload. */ uriMatcher.addURI(mAuthority, BASE_PATH + "/part/#", TRANSFER_PART); /* * The Uri of TRANSFER_STATE is for records with a specific state. */ uriMatcher.addURI(mAuthority, BASE_PATH + "/state/*", TRANSFER_STATE); }
From source file:com.owncloud.android.providers.UsersAndGroupsSearchProvider.java
@Override public boolean onCreate() { mUriMatcher = new UriMatcher(UriMatcher.NO_MATCH); mUriMatcher.addURI(AUTHORITY, SearchManager.SUGGEST_URI_PATH_QUERY + "/*", SEARCH); return true;//from w w w . j ava 2 s. c o m }
From source file:org.voidsink.anewjkuapp.fragment.CurriculaFragment.java
@Override public void onStart() { super.onStart(); UriMatcher uriMatcher = new UriMatcher(UriMatcher.NO_MATCH); uriMatcher.addURI(KusssContentContract.AUTHORITY, KusssContentContract.Curricula.PATH_CONTENT_CHANGED, 0); mObserver = new BaseContentObserver(uriMatcher, this); getActivity().getContentResolver()/* w w w . j av a 2s .c o m*/ .registerContentObserver(KusssContentContract.Curricula.CONTENT_CHANGED_URI, false, mObserver); }
From source file:org.voidsink.anewjkuapp.fragment.ExamFragment.java
@Override public void onStart() { super.onStart(); UriMatcher uriMatcher = new UriMatcher(UriMatcher.NO_MATCH); uriMatcher.addURI(KusssContentContract.AUTHORITY, KusssContentContract.Exam.PATH_CONTENT_CHANGED, 0); mDataObserver = new BaseContentObserver(uriMatcher, this); getActivity().getContentResolver().registerContentObserver(KusssContentContract.Exam.CONTENT_CHANGED_URI, false, mDataObserver);/*w ww . ja v a2 s . com*/ }
From source file:org.voidsink.anewjkuapp.fragment.AssessmentDetailFragment.java
@Override public void onStart() { super.onStart(); UriMatcher uriMatcher = new UriMatcher(UriMatcher.NO_MATCH); uriMatcher.addURI(KusssContentContract.AUTHORITY, KusssContentContract.Assessment.PATH_CONTENT_CHANGED, 0); mObserver = new BaseContentObserver(uriMatcher, this); getActivity().getContentResolver()/* w w w.j a v a 2 s . c om*/ .registerContentObserver(KusssContentContract.Assessment.CONTENT_CHANGED_URI, false, mObserver); }
From source file:org.voidsink.anewjkuapp.fragment.StatFragmentDetail.java
@Override public void onStart() { super.onStart(); UriMatcher uriMatcher = new UriMatcher(UriMatcher.NO_MATCH); uriMatcher.addURI(KusssContentContract.AUTHORITY, KusssContentContract.Course.PATH_CONTENT_CHANGED, 0); uriMatcher.addURI(KusssContentContract.AUTHORITY, KusssContentContract.Assessment.PATH_CONTENT_CHANGED, 1); mDataObserver = new BaseContentObserver(uriMatcher, this); getActivity().getContentResolver().registerContentObserver(KusssContentContract.Course.CONTENT_CHANGED_URI, false, mDataObserver);/*from w w w .j av a 2 s . c o m*/ getActivity().getContentResolver() .registerContentObserver(KusssContentContract.Assessment.CONTENT_CHANGED_URI, false, mDataObserver); PreferenceManager.getDefaultSharedPreferences(getContext()).registerOnSharedPreferenceChangeListener(this); }
From source file:com.hybris.mobile.lib.commerce.provider.CatalogProvider.java
@Override public boolean onCreate() { authority = getContext().getString(R.string.sync_default_authority); String dbName = getContext().getString(R.string.sync_default_db_name); int dbVersion = getContext().getResources().getInteger(R.integer.sync_default_db_version); try {/* w ww . j a v a 2s .c o m*/ ComponentName componentName = new ComponentName(getContext(), this.getClass()); // Authority name from the manifest file String tmpAuthority = getContext().getPackageManager().getProviderInfo(componentName, PackageManager.GET_META_DATA).authority; if (StringUtils.isNotBlank(tmpAuthority)) { authority = tmpAuthority; } // Database configuration from manifest file Bundle bundle = getContext().getPackageManager().getProviderInfo(componentName, PackageManager.GET_META_DATA).metaData; if (bundle != null) { String dbNameTmp = bundle.getString(getContext().getString(R.string.sync_db_name)); int dbVersionTmp = bundle.getInt(getContext().getString(R.string.sync_db_version)); if (StringUtils.isNotBlank(dbNameTmp)) { dbName = dbNameTmp; } if (dbVersion != 0) { dbVersion = dbVersionTmp; } } // Account name and type componentName = new ComponentName(getContext(), CatalogAuthenticatorService.class); bundle = getContext().getPackageManager().getServiceInfo(componentName, PackageManager.GET_META_DATA).metaData; String accountName = bundle.getString(getContext().getString(R.string.sync_account_name)); String accountType = bundle.getString(getContext().getString(R.string.sync_account_type)); if (StringUtils.isBlank(accountName) || StringUtils.isBlank(accountType)) { throw new IllegalArgumentException( "You must provide the metadata " + getContext().getString(R.string.sync_account_name) + ", " + getContext().getString(R.string.sync_account_type) + " for " + this.getClass()); } account = new Account(accountType, accountName); } catch (PackageManager.NameNotFoundException e) { Log.e(TAG, "Package name not found. Details:" + e.getLocalizedMessage()); throw new IllegalArgumentException( "Error getting the information from the metadata of " + this.getClass()); } // Unit test case - the mock context does not have any package manager or provider info catch (UnsupportedOperationException e) { Log.e(TAG, "Unsupported operation:" + e.getLocalizedMessage()); } mDatabaseHelper = new CatalogDatabaseHelper(getContext(), dbName, dbVersion); URI_MATCHER = new UriMatcher(UriMatcher.NO_MATCH); URI_MATCHER.addURI(authority, CatalogContract.Provider.SEGMENT_GROUP, CatalogContract.Provider.CODE_GROUP); URI_MATCHER.addURI(authority, CatalogContract.Provider.SEGMENT_GROUP + "/*", CatalogContract.Provider.CODE_GROUP_ID); URI_MATCHER.addURI(authority, CatalogContract.Provider.SEGMENT_DATA, CatalogContract.Provider.CODE_DATA); URI_MATCHER.addURI(authority, CatalogContract.Provider.SEGMENT_DATA + "/*", CatalogContract.Provider.CODE_DATA_ID); URI_MATCHER.addURI(authority, CatalogContract.Provider.SEGMENT_DATA_DETAILS, CatalogContract.Provider.CODE_DATA_DETAILS); URI_MATCHER.addURI(authority, CatalogContract.Provider.SEGMENT_DATA_DETAILS + "/*", CatalogContract.Provider.CODE_DATA_DETAILS_ID); URI_MATCHER.addURI(authority, CatalogContract.Provider.SEGMENT_SYNC_GROUP + "/*", CatalogContract.Provider.CODE_SYNC_GROUP); return true; }
From source file:edu.stanford.mobisocial.dungbeetle.DungBeetleContentProvider.java
@Override public String getType(Uri uri) { int match = sUriMatcher.match(uri); if (match == UriMatcher.NO_MATCH) { return null; }/*ww w . ja v a 2 s . c o m*/ switch (match) { case OBJS: return "vnd.android.cursor.dir/vnd.mobisocial.obj"; case OBJS_ID: return "vnd.android.cursor.item/vnd.mobisocial.obj"; case FEEDS: return "vnd.android.cursor.dir/vnd.mobisocial.feed"; case FEEDS_ID: return "vnd.android.cursor.item/vnd.mobisocial.feed"; } throw new IllegalStateException("Unmatched-but-known content type"); }