Java Code Examples for android.widget.FilterQueryProvider

The following are top voted examples for showing how to use android.widget.FilterQueryProvider. These examples are extracted from open source projects. You can vote up the examples you like and your votes will be used in our system to generate more good examples.
Example 1
Project: KinoCast   File: SearchSuggestionAdapter.java   View source code 6 votes vote down vote up
public SearchSuggestionAdapter(Context context, int layout, Cursor c, String[] from, int[] to, int flags) {
    super(context, layout, c, from, to, flags);

    setFilterQueryProvider(new FilterQueryProvider() {
        public Cursor runQuery(CharSequence constraint) {
            MatrixCursor matrixCursor = new MatrixCursor(new String[] { "_id", "item" });

            if(constraint == null) return matrixCursor;
            String query = constraint.toString();
            if(TextUtils.isEmpty(query)) return matrixCursor;
            String suggestions[] = Parser.getInstance().getSearchSuggestions(query);
            if(suggestions == null) return matrixCursor;

            for (int i = 0; i < suggestions.length; i++) {
                matrixCursor.addRow(new Object[]{(i + 1), suggestions[i]});
            }

            return matrixCursor;
        }
    });
}
 
Example 2
Project: EngMyanDictionary   File: MainListFragment.java   View source code 6 votes vote down vote up
public void prepareSearch(CharSequence query) {
	if (mRecyclerView == null) return;
	
	Cursor cursor = null;
	if (!TextUtils.isEmpty(query)) {
		cursor = SearchQueryHelper.getInstance(getContext()).query(query);
	} else {
		cursor = SearchQueryHelper.getInstance(getContext()).querySuggestWord();
	}
	
	mListAdapter = new SearchListAdapter(getContext(), cursor, DictionaryDataProvider.COLUMN_WORD, 
			mRecyclerView, Constants.SEARCH_LIST_ITEM_LIMIT);
	mListAdapter.setFilterQueryProvider(new FilterQueryProvider() {
		
		@Override
		public Cursor runQuery(CharSequence constraint) {
			return SearchQueryHelper.getInstance(getContext()).query(constraint);
		}
	});
	mListAdapter.setOnItemClickListener(this);
	mRecyclerView.setAdapter(mListAdapter);
}
 
Example 3
Project: quiz_helper   File: Collins.java   View source code 5 votes vote down vote up
/**
 * @param context this
 * @param layout  support_simple_spinner_dropdown_item
 * @return
 */
public ListAdapter getAutoCompleteAdapter(Context context, int layout) {
    SimpleCursorAdapter adapter =
            new SimpleCursorAdapter(context, layout,
                    null,
                    new String[]{FIELD_HWD},
                    new int[]{android.R.id.text1},
                    0
            );
    adapter.setFilterQueryProvider(
            new FilterQueryProvider() {
                @Override
                public Cursor runQuery(CharSequence constraint) {
                    return getFilterCursor(constraint.toString());
                }
            }
    );
    adapter.setCursorToStringConverter(
            new SimpleCursorAdapter.CursorToStringConverter() {
                @Override
                public CharSequence convertToString(Cursor cursor) {
                    return cursor.getString(1);
                }
            }
    );

    return adapter;
}
 
Example 4
Project: quiz_helper   File: WebsterLearners.java   View source code 5 votes vote down vote up
public ListAdapter getAutoCompleteAdapter(Context context, int layout) {
    SimpleCursorAdapter adapter =
            new SimpleCursorAdapter(context, layout,
                    null,
                    new String[]{"hwd"},
                    new int[]{android.R.id.text1},
                    0
            );
    adapter.setFilterQueryProvider(
            new FilterQueryProvider() {
                @Override
                public Cursor runQuery(CharSequence constraint) {
                    return getFilterCursor(constraint.toString());
                }
            }
    );
    adapter.setCursorToStringConverter(
            new SimpleCursorAdapter.CursorToStringConverter() {
                @Override
                public CharSequence convertToString(Cursor cursor) {
                    return cursor.getString(1);
                }
            }
    );

    return adapter;
}
 
Example 5
Project: quiz_helper   File: Ode2.java   View source code 5 votes vote down vote up
/**
 * @param context this
 * @param layout  support_simple_spinner_dropdown_item
 * @return
 */
public ListAdapter getAutoCompleteAdapter(Context context, int layout) {
    SimpleCursorAdapter adapter =
            new SimpleCursorAdapter(context, layout,
                    null,
                    new String[]{FIELD_HWD},
                    new int[]{android.R.id.text1},
                    0
            );
    adapter.setFilterQueryProvider(
            new FilterQueryProvider() {
                @Override
                public Cursor runQuery(CharSequence constraint) {
                    return getFilterCursor(constraint.toString());
                }
            }
    );
    adapter.setCursorToStringConverter(
            new SimpleCursorAdapter.CursorToStringConverter() {
                @Override
                public CharSequence convertToString(Cursor cursor) {
                    return cursor.getString(1);
                }
            }
    );

    return adapter;
}
 
Example 6
Project: quiz_helper   File: CustomDictionary.java   View source code 5 votes vote down vote up
@Override
public ListAdapter getAutoCompleteAdapter(Context context, int layout) {
    SimpleCursorAdapter adapter =
            new SimpleCursorAdapter(context, layout, null,
                    new String[] {CustomDictionaryDbHelper.getHeadwordColumnName()},
                    new int[] {android.R.id.text1},
                    0
                    );
    adapter.setFilterQueryProvider(
            new FilterQueryProvider() {
                @Override
                public Cursor runQuery(CharSequence constraint) {
                    return mDbHelper.getFilterCursor(mDictId, constraint.toString());
                }
            }
    );

    adapter.setCursorToStringConverter(
            new SimpleCursorAdapter.CursorToStringConverter() {
                @Override
                public CharSequence convertToString(Cursor cursor) {
                    return cursor.getString(1);
                }
            }
    );

    return adapter;
}
 
Example 7
Project: ankihelper   File: Collins.java   View source code 5 votes vote down vote up
/**
 * @param context this
 * @param layout  support_simple_spinner_dropdown_item
 * @return
 */
public ListAdapter getAutoCompleteAdapter(Context context, int layout) {
    SimpleCursorAdapter adapter =
            new SimpleCursorAdapter(context, layout,
                    null,
                    new String[]{FIELD_HWD},
                    new int[]{android.R.id.text1},
                    0
            );
    adapter.setFilterQueryProvider(
            new FilterQueryProvider() {
                @Override
                public Cursor runQuery(CharSequence constraint) {
                    return getFilterCursor(constraint.toString());
                }
            }
    );
    adapter.setCursorToStringConverter(
            new SimpleCursorAdapter.CursorToStringConverter() {
                @Override
                public CharSequence convertToString(Cursor cursor) {
                    return cursor.getString(1);
                }
            }
    );

    return adapter;
}
 
Example 8
Project: ankihelper   File: WebsterLearners.java   View source code 5 votes vote down vote up
public ListAdapter getAutoCompleteAdapter(Context context, int layout) {
    SimpleCursorAdapter adapter =
            new SimpleCursorAdapter(context, layout,
                    null,
                    new String[]{"hwd"},
                    new int[]{android.R.id.text1},
                    0
            );
    adapter.setFilterQueryProvider(
            new FilterQueryProvider() {
                @Override
                public Cursor runQuery(CharSequence constraint) {
                    return getFilterCursor(constraint.toString());
                }
            }
    );
    adapter.setCursorToStringConverter(
            new SimpleCursorAdapter.CursorToStringConverter() {
                @Override
                public CharSequence convertToString(Cursor cursor) {
                    return cursor.getString(1);
                }
            }
    );

    return adapter;
}
 
Example 9
Project: ankihelper   File: Ode2.java   View source code 5 votes vote down vote up
/**
 * @param context this
 * @param layout  support_simple_spinner_dropdown_item
 * @return
 */
public ListAdapter getAutoCompleteAdapter(Context context, int layout) {
    SimpleCursorAdapter adapter =
            new SimpleCursorAdapter(context, layout,
                    null,
                    new String[]{FIELD_HWD},
                    new int[]{android.R.id.text1},
                    0
            );
    adapter.setFilterQueryProvider(
            new FilterQueryProvider() {
                @Override
                public Cursor runQuery(CharSequence constraint) {
                    return getFilterCursor(constraint.toString());
                }
            }
    );
    adapter.setCursorToStringConverter(
            new SimpleCursorAdapter.CursorToStringConverter() {
                @Override
                public CharSequence convertToString(Cursor cursor) {
                    return cursor.getString(1);
                }
            }
    );

    return adapter;
}
 
Example 10
Project: ankihelper   File: CustomDictionary.java   View source code 5 votes vote down vote up
@Override
public ListAdapter getAutoCompleteAdapter(Context context, int layout) {
    SimpleCursorAdapter adapter =
            new SimpleCursorAdapter(context, layout, null,
                    new String[] {CustomDictionaryDbHelper.getHeadwordColumnName()},
                    new int[] {android.R.id.text1},
                    0
                    );
    adapter.setFilterQueryProvider(
            new FilterQueryProvider() {
                @Override
                public Cursor runQuery(CharSequence constraint) {
                    return mDbHelper.getFilterCursor(mDictId, constraint.toString());
                }
            }
    );

    adapter.setCursorToStringConverter(
            new SimpleCursorAdapter.CursorToStringConverter() {
                @Override
                public CharSequence convertToString(Cursor cursor) {
                    return cursor.getString(1);
                }
            }
    );

    return adapter;
}
 
Example 11
Project: xowa_android   File: EditSummaryHandler.java   View source code 5 votes vote down vote up
public EditSummaryHandler(final Activity activity, View container,
                          AutoCompleteTextView summaryEditText, PageTitle title) {
    this.activity = activity;
    this.container = container;
    this.summaryEdit = summaryEditText;

    this.container.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            summaryEdit.requestFocus();
        }
    });

    EditSummaryAdapter adapter = new EditSummaryAdapter(activity, null, true);
    summaryEdit.setAdapter(adapter);
    adapter.setFilterQueryProvider(new FilterQueryProvider() {
        @Override
        public Cursor runQuery(CharSequence charSequence) {
            ContentProviderClient client = activity.getContentResolver()
                                   .acquireContentProviderClient(EditSummary.PERSISTENCE_HELPER
                                                                         .getBaseContentURI());
            try {
                return client.query(
                        EditSummary.PERSISTENCE_HELPER.getBaseContentURI(),
                        null,
                        "summary LIKE ?",
                        new String[] {charSequence + "%"},
                        "lastUsed DESC");
            } catch (RemoteException e) {
                // This shouldn't really be happening
                throw new RuntimeException(e);
            } finally {
                client.release();
            }
        }
    });

    setConditionalTextDirection(summaryEdit, title.getSite().getLanguageCode());
}
 
Example 12
Project: LyricHere   File: LyricCursorAdapter.java   View source code 5 votes vote down vote up
public LyricCursorAdapter(final Context context, int layout, Cursor c, String[] from, int[] to, int flags) {
    super(context, layout, c, from, to, flags);
    setFilterQueryProvider(new FilterQueryProvider() {
        @Override
        public Cursor runQuery(CharSequence constraint) {
            LogUtils.d(TAG, "runQuery: " + constraint);
            return DbUtils.searchByKeyword(context.getContentResolver(), constraint.toString());
        }
    });
}
 
Example 13
Project: ApkLauncher   File: AutoComplete4.java   View source code 5 votes vote down vote up
@Override
public Cursor runQueryOnBackgroundThread(CharSequence constraint) {
    FilterQueryProvider filter = getFilterQueryProvider();
    if (filter != null) {
        return filter.runQuery(constraint);
    }

    Uri uri = Uri.withAppendedPath(
            Contacts.CONTENT_FILTER_URI,
            Uri.encode(constraint.toString()));
    return mContent.query(uri, CONTACT_PROJECTION, null, null, null);
}
 
Example 14
Project: downtown   File: QueryBuilder.java   View source code 5 votes vote down vote up
/**
 * Creates a SearchFilterProvider that searches through the columns set in {@link #setSearchColumns(String...)}.
 * @param context
 * @return
 */
public FilterQueryProvider createSearchFilterQueryProvider( final Context context, final Uri uri ) {
	return new FilterQueryProvider() {
		public Cursor runQuery(CharSequence constraint) {
			setSearchQuery( TextUtils.isEmpty( constraint ) ? null : constraint.toString() );
			return query( context, uri );
		}
	};
}
 
Example 15
Project: ApiDemos   File: AutoComplete4.java   View source code 5 votes vote down vote up
@Override
public Cursor runQueryOnBackgroundThread(CharSequence constraint) {
    FilterQueryProvider filter = getFilterQueryProvider();
    if (filter != null) {
        return filter.runQuery(constraint);
    }

    Uri uri = Uri.withAppendedPath(
            Contacts.CONTENT_FILTER_URI,
            Uri.encode(constraint.toString()));
    return mContent.query(uri, CONTACT_PROJECTION, null, null, null);
}
 
Example 16
Project: StoryTeller   File: MainActivity.java   View source code 5 votes vote down vote up
@Override
public void onLoadFinished(Loader loader, Cursor cursor) {
    Log.v(TAG, "Cursor retrieved");
    mCustomCursorAdapter = new CustomCursorAdapter(MainActivity.this, R.layout.story_layout,
            cursor, MainDatabase.TableStory.COLUMNS_SHOWN, to, 0, this);
    mStoriesGridView.setAdapter(mCustomCursorAdapter);

    mCustomCursorAdapter.setFilterQueryProvider(new FilterQueryProvider() {
        @Override
        public Cursor runQuery(CharSequence constraint) {
            return mStoryDataLayer.searchStoryByText(constraint.toString());
        }
    });
    setSupportProgressBarIndeterminateVisibility(false);
}
 
Example 17
Project: felix-on-android   File: AutoComplete4.java   View source code 5 votes vote down vote up
@Override
public Cursor runQueryOnBackgroundThread(CharSequence constraint) {
    FilterQueryProvider filter = getFilterQueryProvider();
    if (filter != null) {
        return filter.runQuery(constraint);
    }

    Uri uri = Uri.withAppendedPath(
            Contacts.CONTENT_FILTER_URI,
            Uri.encode(constraint.toString()));
    return mContent.query(uri, CONTACT_PROJECTION, null, null, null);
}
 
Example 18
Project: MEng   File: AutoComplete4.java   View source code 5 votes vote down vote up
@Override
public Cursor runQueryOnBackgroundThread(CharSequence constraint) {
    FilterQueryProvider filter = getFilterQueryProvider();
    if (filter != null) {
        return filter.runQuery(constraint);
    }

    Uri uri = Uri.withAppendedPath(
            Contacts.CONTENT_FILTER_URI,
            Uri.encode(constraint.toString()));
    return mContent.query(uri, CONTACT_PROJECTION, null, null, null);
}
 
Example 19
Project: codeexamples-android   File: AutoComplete4.java   View source code 5 votes vote down vote up
@Override
public Cursor runQueryOnBackgroundThread(CharSequence constraint) {
    FilterQueryProvider filter = getFilterQueryProvider();
    if (filter != null) {
        return filter.runQuery(constraint);
    }

    Uri uri = Uri.withAppendedPath(
            Contacts.CONTENT_FILTER_URI,
            Uri.encode(constraint.toString()));
    return mContent.query(uri, CONTACT_PROJECTION, null, null, null);
}
 
Example 20
Project: deview-2013-samples   File: AutoComplete4.java   View source code 5 votes vote down vote up
@Override
public Cursor runQueryOnBackgroundThread(CharSequence constraint) {
    FilterQueryProvider filter = getFilterQueryProvider();
    if (filter != null) {
        return filter.runQuery(constraint);
    }

    Uri uri = Uri.withAppendedPath(
            Contacts.CONTENT_FILTER_URI,
            Uri.encode(constraint.toString()));
    return mContent.query(uri, CONTACT_PROJECTION, null, null, null);
}
 
Example 21
Project: android_xcore   File: XListFragment.java   View source code 5 votes vote down vote up
@Override
public void onLoadFinished(Loader<Cursor> loader, Cursor cursor) {
       ListAdapter adapter = getListAdapter();
	FragmentActivity activity = getActivity();
	if (activity == null) {
		return;
	}
	if (adapter == null || !(adapter instanceof CursorAdapter)) {
		BaseAdapter baseAdapter = createAdapter(activity, cursor);
		ViewBinder adapterViewBinder = getAdapterViewBinder();
		if (adapterViewBinder != null && baseAdapter instanceof ISetViewBinder) {
               ((ISetViewBinder)baseAdapter).setViewBinder(adapterViewBinder);
		}
           if (baseAdapter instanceof CursorAdapter) {
               ((CursorAdapter)baseAdapter).setFilterQueryProvider(new FilterQueryProvider() {

                   @Override
                   public Cursor runQuery(CharSequence constraint) {
                       return runSearchQuery(getActivity(), constraint);
                   }

               });
           }
		adapter = baseAdapter;
		setListAdapter(adapter);
	} else {
		((CursorAdapter) adapter).swapCursor(cursor);
	}
       //plugins
       List<IFragmentPlugin> listFragmentPlugins = XCoreHelper.get(getActivity()).getListFragmentPlugins();
       if (listFragmentPlugins != null) {
           for(IFragmentPlugin plugin : listFragmentPlugins) {
               plugin.onLoadFinished(this, loader, cursor);
           }
       }
       setLoaderWork(false, LOADER_PRIORITY_HIGH);
       checkStatus("onLoadFinished");
}
 
Example 22
Project: letv   File: CursorAdapter.java   View source code 4 votes vote down vote up
public FilterQueryProvider getFilterQueryProvider() {
    return this.mFilterQueryProvider;
}
 
Example 23
Project: letv   File: CursorAdapter.java   View source code 4 votes vote down vote up
public void setFilterQueryProvider(FilterQueryProvider filterQueryProvider) {
    this.mFilterQueryProvider = filterQueryProvider;
}
 
Example 24
Project: letv   File: CursorAdapter.java   View source code 4 votes vote down vote up
public FilterQueryProvider getFilterQueryProvider() {
    return this.mFilterQueryProvider;
}
 
Example 25
Project: letv   File: CursorAdapter.java   View source code 4 votes vote down vote up
public void setFilterQueryProvider(FilterQueryProvider filterQueryProvider) {
    this.mFilterQueryProvider = filterQueryProvider;
}
 
Example 26
Project: boohee_v5.6   File: CursorAdapter.java   View source code 4 votes vote down vote up
public FilterQueryProvider getFilterQueryProvider() {
    return this.mFilterQueryProvider;
}
 
Example 27
Project: boohee_v5.6   File: CursorAdapter.java   View source code 4 votes vote down vote up
public void setFilterQueryProvider(FilterQueryProvider filterQueryProvider) {
    this.mFilterQueryProvider = filterQueryProvider;
}
 
Example 28
Project: Ouroboros   File: CatalogFragment.java   View source code 4 votes vote down vote up
@Override
public void onCreateOptionsMenu(Menu menu, MenuInflater inflater){
    inflater.inflate(R.menu.menu_catalog, menu);
    MenuItem replyButton = menu.findItem(R.id.action_reply);
    MenuItem openExternalButton = menu.findItem(R.id.action_external_browser);
    MenuItem menuLayout = menu.findItem(R.id.action_menu_layout);
    MenuItem shareButton = menu.findItem(R.id.menu_item_share);
    MenuItem sortBy = menu.findItem(R.id.action_sort_by);

    replyButton.setVisible(true);
    openExternalButton.setVisible(true);
    menuLayout.setVisible(true);
    sortBy.setVisible(true);
    shareButton.setVisible(true);
    shareActionProvider = MenuItemCompat.getActionProvider(shareButton);

    MenuItem searchButton = menu.findItem(R.id.action_search);
    searchButton.setVisible(true);
    SearchView searchView = (SearchView) searchButton.getActionView();
    searchView.setIconifiedByDefault(false);
    searchView.setSubmitButtonEnabled(false);
    searchView.setOnQueryTextListener(new SearchView.OnQueryTextListener() {
        @Override
        public boolean onQueryTextSubmit(String query) {
            return false;
        }

        @Override
        public boolean onQueryTextChange(String newText) {
            Log.d(LOG_TAG, "query=" + newText);
            catalogAdapter.setFilterQueryProvider(new FilterQueryProvider() {
                @Override
                public Cursor runQuery(CharSequence constraint) {
                    return infiniteDbHelper.searchCatalogForThread(constraint.toString(), SettingsHelper.getSortByMethod(getContext()));
                }
            });
            catalogAdapter.getFilter().filter(newText);
            return true;
        }
    });
}
 
Example 29
Project: Ouroboros   File: ThreadFragment.java   View source code 4 votes vote down vote up
@Override
public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
    MenuItem goToBottomButton = menu.findItem(R.id.action_scroll_bottom);
    MenuItem goToTopButton = menu.findItem(R.id.action_scroll_top);
    MenuItem replyButton = menu.findItem(R.id.action_reply);
    MenuItem watchlistButton = menu.findItem(R.id.action_add_watchlist);
    MenuItem refreshButton = menu.findItem(R.id.action_refresh);
    MenuItem galleryButton = menu.findItem(R.id.action_gallery);
    MenuItem saveAllImagesButton = menu.findItem(R.id.action_save_all_images);
    MenuItem openExternalButton = menu.findItem(R.id.action_external_browser);
    MenuItem shareButton = menu.findItem(R.id.menu_item_share);
    MenuItem menuLayout = menu.findItem(R.id.action_menu_layout);

    MenuItem searchButton = menu.findItem(R.id.action_search);
    searchButton.setVisible(true);
    final SearchView searchView = (SearchView) searchButton.getActionView();
    searchView.setIconifiedByDefault(false);
    searchView.setSubmitButtonEnabled(false);
    searchView.setOnQueryTextListener(new SearchView.OnQueryTextListener() {
        @Override
        public boolean onQueryTextSubmit(String query) {
            return false;
        }

        @Override
        public boolean onQueryTextChange(String newText) {
            threadAdapter.setFilterQueryProvider(new FilterQueryProvider() {
                @Override
                public Cursor runQuery(CharSequence constraint) {
                    return infiniteDbHelper.searchThreadForString(constraint.toString(), resto);
                }
            });
            threadAdapter.getFilter().filter(newText);
            return true;
        }
    });

    MenuItemCompat.setOnActionExpandListener(searchButton, this);

    refreshButton.setVisible(true);
    goToBottomButton.setVisible(true);
    goToTopButton.setVisible(true);
    replyButton.setVisible(true);
    galleryButton.setVisible(true);
    saveAllImagesButton.setVisible(true);
    openExternalButton.setVisible(true);
    shareButton.setVisible(true);
    watchlistButton.setVisible(true);
    menuLayout.setVisible(true);

    super.onCreateOptionsMenu(menu, inflater);
}
 
Example 30
Project: hut   File: ActionsAdapter.java   View source code 4 votes vote down vote up
public ActionsAdapter(Context c, final ActionsProvider.Category category, final ViewBinder viewBinder) {
    super(c, R.layout.item, App.actions().query(category, ""), COLUMNS, VIEWS);
    if (mMissingIcon == null) {
        mMissingIcon = c.getPackageManager().getDefaultActivityIcon();
    }
    setFilterQueryProvider(new FilterQueryProvider() {
        public Cursor runQuery(CharSequence constraint) {
            return App.actions().query(category, constraint.toString());
        }
    });
    setViewBinder(new SimpleCursorAdapter.ViewBinder() {
        @Override
        public boolean setViewValue(final View view, final Cursor cursor, final int columnIndex) {
            if (view instanceof ImageView) {
                final ImageView imageView = (ImageView) view;
                final String uri = cursor.getString(columnIndex);
                Drawable d = mCache.get(uri);
                if (d != null) {
                    imageView.setImageDrawable(d);
                } else {
                    imageView.setImageDrawable(null);
                    imageView.post(new Runnable() {
                        public void run() {
                            try {
                                Drawable drawable = null;
                                if (uri != null) {
                                    if (uri.startsWith("data:image/png;base64,")) {
                                        String b64 = uri.substring(uri.indexOf(",") + 1);
                                        byte[] raw = Base64.decode(b64, 0);
                                        drawable = new BitmapDrawable(BitmapFactory.decodeByteArray(raw, 0, raw.length));
                                    } else {
                                        InputStream inputStream = view.getContext().getContentResolver().openInputStream(Uri.parse(uri));
                                        drawable = Drawable.createFromStream(inputStream, uri);
                                    }
                                }
                                if (drawable != null) {
                                    mCache.put(uri, drawable);
                                } else {
                                    mCache.put(uri, mMissingIcon);
                                }
                                notifyDataSetChanged();
                            } catch (FileNotFoundException e) {
                                mCache.put(uri, mMissingIcon);
                            }
                        }
                    });
                }
                return true;
            }
            return viewBinder != null && viewBinder.setViewValue(view, cursor, columnIndex);
        }
    });
}
 
Example 31
Project: MiBandDecompiled   File: CursorAdapter.java   View source code 4 votes vote down vote up
public FilterQueryProvider getFilterQueryProvider()
{
    return mFilterQueryProvider;
}
 
Example 32
Project: MiBandDecompiled   File: CursorAdapter.java   View source code 4 votes vote down vote up
public void setFilterQueryProvider(FilterQueryProvider filterqueryprovider)
{
    mFilterQueryProvider = filterqueryprovider;
}
 
Example 33
Project: MyCTFWriteUps   File: CursorAdapter.java   View source code 4 votes vote down vote up
public FilterQueryProvider getFilterQueryProvider()
{
    return mFilterQueryProvider;
}
 
Example 34
Project: MyCTFWriteUps   File: CursorAdapter.java   View source code 4 votes vote down vote up
public void setFilterQueryProvider(FilterQueryProvider filterqueryprovider)
{
    mFilterQueryProvider = filterqueryprovider;
}
 
Example 35
Project: Thrift-box   File: CursorTreeAdapter.java   View source code 4 votes vote down vote up
/**
 * @see android.widget.CursorAdapter#getFilterQueryProvider()
 */
public FilterQueryProvider getFilterQueryProvider() {
    return mFilterQueryProvider;
}
 
Example 36
Project: Thrift-box   File: CursorTreeAdapter.java   View source code 4 votes vote down vote up
/**
 * @see android.widget.CursorAdapter#setFilterQueryProvider(android.widget.FilterQueryProvider)
 */
public void setFilterQueryProvider(FilterQueryProvider filterQueryProvider) {
    mFilterQueryProvider = filterQueryProvider;
}
 
Example 37
Project: kidsdialer   File: FavoritesManagerActivity.java   View source code 4 votes vote down vote up
private void populateContactList() {
	// Build adapter with contact entries
	/*
	 * while (cursor.moveToNext()) {
	 * 
	 * String contactId =
	 * cursor.getString(cursor.getColumnIndex(ContactsContract
	 * .Contacts._ID)); String contactName =
	 * cursor.getString(cursor.getColumnIndex
	 * (ContactsContract.Contacts.DISPLAY_NAME)); //String contactPhone =
	 * cursor
	 * .getString(cursor.getColumnIndex(ContactsContract.CommonDataKinds
	 * .Phone.NUMBER)); Log.d(TAG,contactId + " "+ contactName+ " "); String
	 * hasPhone =
	 * cursor.getString(cursor.getColumnIndex(ContactsContract.Contacts
	 * .HAS_PHONE_NUMBER)); if (Integer.parseInt(hasPhone) > 0 ) { // You
	 * know it has a number so now query it like this Cursor phones =
	 * getContentResolver().query(
	 * ContactsContract.CommonDataKinds.Phone.CONTENT_URI, null,
	 * ContactsContract.CommonDataKinds.Phone.CONTACT_ID +" = "+ contactId,
	 * null, null); while (phones.moveToNext()) { String phoneNumber =
	 * phones.getString(phones.getColumnIndex(
	 * ContactsContract.CommonDataKinds.Phone.NUMBER ) ) ;
	 * Log.d(TAG,"   "+phoneNumber); } phones.close(); } }
	 */

	String[] fields = new String[] { ContactsContract.Data.DISPLAY_NAME,
			Phone.NUMBER };

	String[] favoritesFields = new String[] { TableDefs.CONTACT_NAME,
			TableDefs.CONTACT_PHONES };

	contactsCursor = getContacts(null);
	
	mContactListAdapter = new ListCursorAdapter // SimpleCursorAdapter
	(this, R.layout.contact_entry_v, contactsCursor, fields, new int[] {
			R.id.contactEntryText, R.id.contactPhoneText });

	FilterQueryProvider filterQueryProvider = new FilterQueryProvider() {
           public Cursor runQuery(CharSequence constraint) {
               // Search for states whose names begin with the specified letters.
               Cursor cursor = getContacts(
                       	(constraint != null ? constraint.toString() : null)
                       );
               return cursor;
           }
       };
	
	mContactListAdapter.setFilterQueryProvider( filterQueryProvider );
	
	mContactList.setOnItemClickListener(new ContactOnItemClickListener());
	mContactList.setAdapter(mContactListAdapter);

	mFavoriteDataProvider = new FavoriteDataProvider(this);

	mFavoritesListAdapter = new SimpleCursorAdapter(this,
			R.layout.contact_entry_v,
			mFavoriteDataProvider.getFavoriteCursor(), favoritesFields,
			new int[] { R.id.contactEntryText, R.id.contactPhoneText },
			SimpleCursorAdapter.FLAG_REGISTER_CONTENT_OBSERVER);

	mFavoritetList
			.setOnItemClickListener(new FavoritesOnItemClickListener());
	mFavoritetList.setAdapter(mFavoritesListAdapter);
}
 
Example 38
Project: SuperSelector   File: RecyclerViewCursorAdapter.java   View source code 2 votes vote down vote up
/**
 * Returns the query filter provider used for filtering. When the
 * provider is null, no filtering occurs.
 *
 * @return the current filter query provider or null if it does not exist
 * @see #setFilterQueryProvider(FilterQueryProvider)
 * @see #runQueryOnBackgroundThread(CharSequence)
 */
public FilterQueryProvider getFilterQueryProvider() {
    return mFilterQueryProvider;
}
 
Example 39
Project: SuperSelector   File: RecyclerViewCursorAdapter.java   View source code 2 votes vote down vote up
/**
 * Sets the query filter provider used to filter the current Cursor.
 * The provider's
 * {@link FilterQueryProvider#runQuery(CharSequence)}
 * method is invoked when filtering is requested by a client of
 * this adapter.
 *
 * @param filterQueryProvider the filter query provider or null to remove it
 * @see #getFilterQueryProvider()
 * @see #runQueryOnBackgroundThread(CharSequence)
 */
public void setFilterQueryProvider(FilterQueryProvider filterQueryProvider) {
    mFilterQueryProvider = filterQueryProvider;
}
 
Example 40
Project: News24x7-news-from-every-part-of-the-world   File: CursorRecyclerViewAdapter.java   View source code 2 votes vote down vote up
/**
 * Returns the query filter provider used for filtering. When the
 * provider is null, no filtering occurs.
 *
 * @return the current filter query provider or null if it does not exist
 *
 * @see #setFilterQueryProvider(android.widget.FilterQueryProvider)
 * @see #runQueryOnBackgroundThread(CharSequence)
 */
public FilterQueryProvider getFilterQueryProvider() {
    return mFilterQueryProvider;
}