Java Code Examples for android.app.SearchManager#SUGGEST_MIME_TYPE

The following examples show how to use android.app.SearchManager#SUGGEST_MIME_TYPE . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: VideoProvider.java    From tv-samples with Apache License 2.0 6 votes vote down vote up
@Override
public String getType(@NonNull Uri uri) {
    switch (sUriMatcher.match(uri)) {
        // The application is querying the db for its own contents.
        case VIDEO_WITH_CATEGORY:
            return VideoContract.VideoEntry.CONTENT_TYPE;
        case VIDEO:
            return VideoContract.VideoEntry.CONTENT_TYPE;

        // The Android TV global search is querying our app for relevant content.
        case SEARCH_SUGGEST:
            return SearchManager.SUGGEST_MIME_TYPE;
        case REFRESH_SHORTCUT:
            return SearchManager.SHORTCUT_MIME_TYPE;

        // We aren't sure what is being asked of us.
        default:
            throw new UnsupportedOperationException("Unknown uri: " + uri);
    }
}
 
Example 2
Source File: SearchRecentSuggestionsProvider.java    From android_9.0.0_r45 with Apache License 2.0 6 votes vote down vote up
/**
 * This method is provided for use by the ContentResolver.  Do not override, or directly
 * call from your own code.
 */
@Override
public String getType(Uri uri) {
    if (mUriMatcher.match(uri) == URI_MATCH_SUGGEST) {
        return SearchManager.SUGGEST_MIME_TYPE;
    }
    int length = uri.getPathSegments().size();
    if (length >= 1) {
        String base = uri.getPathSegments().get(0);
        if (base.equals(sSuggestions)) {
            if (length == 1) {
                return "vnd.android.cursor.dir/suggestion";
            } else if (length == 2) {
                return "vnd.android.cursor.item/suggestion";
            }
        }
    }            
    throw new IllegalArgumentException("Unknown Uri");
}
 
Example 3
Source File: VideoProvider.java    From androidtv-Leanback with Apache License 2.0 6 votes vote down vote up
@Override
public String getType(@NonNull Uri uri) {
    switch (sUriMatcher.match(uri)) {
        // The application is querying the db for its own contents.
        case VIDEO_WITH_CATEGORY:
            return VideoContract.VideoEntry.CONTENT_TYPE;
        case VIDEO:
            return VideoContract.VideoEntry.CONTENT_TYPE;

        // The Android TV global search is querying our app for relevant content.
        case SEARCH_SUGGEST:
            return SearchManager.SUGGEST_MIME_TYPE;
        case REFRESH_SHORTCUT:
            return SearchManager.SHORTCUT_MIME_TYPE;

        // We aren't sure what is being asked of us.
        default:
            throw new UnsupportedOperationException("Unknown uri: " + uri);
    }
}
 
Example 4
Source File: BrowserProvider.java    From coursera-android with MIT License 6 votes vote down vote up
@Override
public String getType(Uri url) {
    int match = URI_MATCHER.match(url);
    switch (match) {
        case URI_MATCH_BOOKMARKS:
            return "vnd.android.cursor.dir/bookmark";

        case URI_MATCH_BOOKMARKS_ID:
            return "vnd.android.cursor.item/bookmark";

        case URI_MATCH_SEARCHES:
            return "vnd.android.cursor.dir/searches";

        case URI_MATCH_SEARCHES_ID:
            return "vnd.android.cursor.item/searches";

        case URI_MATCH_SUGGEST:
            return SearchManager.SUGGEST_MIME_TYPE;

        default:
            throw new IllegalArgumentException("Unknown URL");
    }
}
 
Example 5
Source File: MyHoardContentProvider.java    From Wrox-ProfessionalAndroid-4E with Apache License 2.0 6 votes vote down vote up
@Nullable
@Override
public String getType(@NonNull Uri uri) {
  // Return a string that identifies the MIME type
  // for a Content Provider URI
  switch (uriMatcher.match(uri)) {
    case ALLROWS:
      return "vnd.android.cursor.dir/vnd.professionalandroid.lairs";
    case SINGLE_ROW:
      return "vnd.android.cursor.item/vnd.professionalandroid.lairs";
    // Listing 10-37
    case SEARCH :
      return SearchManager.SUGGEST_MIME_TYPE;
    default:
      throw new IllegalArgumentException("Unsupported URI: " + uri);
  }
}
 
Example 6
Source File: SymbolProvider.java    From ministocks with MIT License 5 votes vote down vote up
/**
 * All queries for this provider are for the search suggestion and shortcut
 * refresh mime type.
 */
@Override
public String getType(Uri uri) {
    switch (sURIMatcher.match(uri)) {
        case SEARCH_SUGGEST:
            return SearchManager.SUGGEST_MIME_TYPE;
        case SHORTCUT_REFRESH:
            return SearchManager.SHORTCUT_MIME_TYPE;
        default:
            throw new IllegalArgumentException("Unknown URL " + uri);
    }
}
 
Example 7
Source File: VideoContentProvider.java    From BuildingForAndroidTV with MIT License 5 votes vote down vote up
/**
 * This method is required in order to query the supported types.
 * It's also useful in our own query() method to determine the type of Uri received.
 */
@Override
public String getType(Uri uri) {
    switch (URI_MATCHER.match(uri)) {
        case SEARCH_SUGGEST:
            return SearchManager.SUGGEST_MIME_TYPE;
        case REFRESH_SHORTCUT:
            return SearchManager.SHORTCUT_MIME_TYPE;
        default:
            throw new IllegalArgumentException("Unknown URL " + uri);
    }
}
 
Example 8
Source File: SearchProvider.java    From aedict with GNU General Public License v3.0 5 votes vote down vote up
@Override
public String getType(Uri uri) {
	switch (uriMatcher.match(uri)) {
	case SEARCH_SUGGEST:
		return SearchManager.SUGGEST_MIME_TYPE;

	default:
		throw new IllegalArgumentException("Unknown URI " + uri);
	}
}
 
Example 9
Source File: SearchProviderBase.java    From iview-android-tv with MIT License 5 votes vote down vote up
@Override
public String getType(Uri uri) {
    switch (getUriMatcher().match(uri)) {
        case SEARCH_SUGGEST:
            return SearchManager.SUGGEST_MIME_TYPE;
        case REFRESH_SHORTCUT:
            return SearchManager.SHORTCUT_MIME_TYPE;
        default:
            throw new IllegalArgumentException("Unknown URL " + uri);
    }
}
 
Example 10
Source File: EarthquakeSearchProvider.java    From Wrox-ProfessionalAndroid-4E with Apache License 2.0 5 votes vote down vote up
@Nullable
@Override
public String getType(@NonNull Uri uri) {
  switch (uriMatcher.match(uri)) {
    case SEARCH_SUGGESTIONS:
      return SearchManager.SUGGEST_MIME_TYPE;
    default:
      throw new IllegalArgumentException("Unsupported URI: " + uri);
  }
}
 
Example 11
Source File: EarthquakeSearchProvider.java    From Wrox-ProfessionalAndroid-4E with Apache License 2.0 5 votes vote down vote up
@Nullable
@Override
public String getType(@NonNull Uri uri) {
  switch (uriMatcher.match(uri)) {
    case SEARCH_SUGGESTIONS:
      return SearchManager.SUGGEST_MIME_TYPE;
    default:
      throw new IllegalArgumentException("Unsupported URI: " + uri);
  }
}
 
Example 12
Source File: EarthquakeSearchProvider.java    From Wrox-ProfessionalAndroid-4E with Apache License 2.0 5 votes vote down vote up
@Nullable
@Override
public String getType(@NonNull Uri uri) {
  switch (uriMatcher.match(uri)) {
    case SEARCH_SUGGESTIONS:
      return SearchManager.SUGGEST_MIME_TYPE;
    default:
      throw new IllegalArgumentException("Unsupported URI: " + uri);
  }
}
 
Example 13
Source File: EarthquakeSearchProvider.java    From Wrox-ProfessionalAndroid-4E with Apache License 2.0 5 votes vote down vote up
@Nullable
@Override
public String getType(@NonNull Uri uri) {
  switch (uriMatcher.match(uri)) {
    case SEARCH_SUGGESTIONS:
      return SearchManager.SUGGEST_MIME_TYPE;
    default:
      throw new IllegalArgumentException("Unsupported URI: " + uri);
  }
}
 
Example 14
Source File: EarthquakeSearchProvider.java    From Wrox-ProfessionalAndroid-4E with Apache License 2.0 5 votes vote down vote up
@Nullable
@Override
public String getType(@NonNull Uri uri) {
  switch (uriMatcher.match(uri)) {
    case SEARCH_SUGGESTIONS:
      return SearchManager.SUGGEST_MIME_TYPE;
    default:
      throw new IllegalArgumentException("Unsupported URI: " + uri);
  }
}
 
Example 15
Source File: EarthquakeSearchProvider.java    From Wrox-ProfessionalAndroid-4E with Apache License 2.0 5 votes vote down vote up
@Nullable
@Override
public String getType(@NonNull Uri uri) {
  switch (uriMatcher.match(uri)) {
    case SEARCH_SUGGESTIONS:
      return SearchManager.SUGGEST_MIME_TYPE;
    default:
      throw new IllegalArgumentException("Unsupported URI: " + uri);
  }
}
 
Example 16
Source File: EarthquakeSearchProvider.java    From Wrox-ProfessionalAndroid-4E with Apache License 2.0 5 votes vote down vote up
@Nullable
@Override
public String getType(@NonNull Uri uri) {
  switch (uriMatcher.match(uri)) {
    case SEARCH_SUGGESTIONS:
      return SearchManager.SUGGEST_MIME_TYPE;
    default:
      throw new IllegalArgumentException("Unsupported URI: " + uri);
  }
}
 
Example 17
Source File: EarthquakeSearchProvider.java    From Wrox-ProfessionalAndroid-4E with Apache License 2.0 5 votes vote down vote up
@Nullable
@Override
public String getType(@NonNull Uri uri) {
  switch (uriMatcher.match(uri)) {
    case SEARCH_SUGGESTIONS:
      return SearchManager.SUGGEST_MIME_TYPE;
    default:
      throw new IllegalArgumentException("Unsupported URI: " + uri);
  }
}
 
Example 18
Source File: EarthquakeSearchProvider.java    From Wrox-ProfessionalAndroid-4E with Apache License 2.0 5 votes vote down vote up
@Nullable
@Override
public String getType(@NonNull Uri uri) {
  switch (uriMatcher.match(uri)) {
    case SEARCH_SUGGESTIONS:
      return SearchManager.SUGGEST_MIME_TYPE;
    default:
      throw new IllegalArgumentException("Unsupported URI: " + uri);
  }
}
 
Example 19
Source File: YalpStoreSuggestionProvider.java    From YalpStore with GNU General Public License v2.0 4 votes vote down vote up
@Override
public String getType(Uri uri) {
    return SearchManager.SUGGEST_MIME_TYPE;
}