Esempio n. 1
0
  private Cursor getWord(Uri uri) {
    String rowId = uri.getLastPathSegment();
    String[] columns =
        new String[] {DictionaryDatabase.KEY_WORD, DictionaryDatabase.KEY_DEFINITION};

    return mDictionary.getWord(rowId, columns);
  }
Esempio n. 2
0
  private Cursor search(String query) {
    query = query.toLowerCase();
    String[] columns =
        new String[] {
          BaseColumns._ID, DictionaryDatabase.KEY_WORD, DictionaryDatabase.KEY_DEFINITION
        };

    return mDictionary.getWordMatches(query, columns);
  }
Esempio n. 3
0
  private Cursor getSuggestions(String query) {
    query = query.toLowerCase();
    String[] columns =
        new String[] {
          BaseColumns._ID,
          DictionaryDatabase.KEY_WORD,
          DictionaryDatabase.KEY_DEFINITION,
          /* SearchManager.SUGGEST_COLUMN_SHORTCUT_ID,
          (only if you want to refresh shortcuts) */
          SearchManager.SUGGEST_COLUMN_INTENT_DATA_ID
        };

    return mDictionary.getWordMatches(query, columns);
  }
Esempio n. 4
0
  private Cursor refreshShortcut(Uri uri) {
    /* This won't be called with the current implementation, but if we include
     * {@link SearchManager#SUGGEST_COLUMN_SHORTCUT_ID} as a column in our suggestions table, we
     * could expect to receive refresh queries when a shortcutted suggestion is displayed in
     * Quick Search Box. In which case, this method will query the table for the specific
     * word, using the given item Uri and provide all the columns originally provided with the
     * suggestion query.
     */
    String rowId = uri.getLastPathSegment();
    String[] columns =
        new String[] {
          BaseColumns._ID,
          DictionaryDatabase.KEY_WORD,
          DictionaryDatabase.KEY_DEFINITION,
          SearchManager.SUGGEST_COLUMN_SHORTCUT_ID,
          SearchManager.SUGGEST_COLUMN_INTENT_DATA_ID
        };

    return mDictionary.getWord(rowId, columns);
  }