E - entity element typepublic abstract class QueryAdapter<E>
extends android.widget.BaseAdapter
implements java.io.Closeable
BaseAdapter specifically for displaying items from a
EntityDataStore query. To use extend this class and implement performQuery()
and getView(Object, View, ViewGroup).| Modifier | Constructor and Description |
|---|---|
protected |
QueryAdapter()
Creates a new adapter instance without any type mapping.
|
protected |
QueryAdapter(io.requery.meta.EntityModel model,
java.lang.Class<E> type)
Creates a new adapter instance.
|
protected |
QueryAdapter(io.requery.meta.Type<E> type)
Creates a new adapter instance mapped to the given type.
|
| Modifier and Type | Method and Description |
|---|---|
void |
close()
Call this to clean up the underlying result.
|
int |
getCount() |
E |
getItem(int position) |
long |
getItemId(int position) |
abstract android.view.View |
getView(E item,
android.view.View convertView,
android.view.ViewGroup parent)
Called to display the data at the specified position for the given item.
|
android.view.View |
getView(int position,
android.view.View convertView,
android.view.ViewGroup parent) |
abstract io.requery.query.Result<E> |
performQuery()
Implement this method with your query operation.
|
void |
queryAsync()
Schedules the query to be run in the background.
|
void |
setExecutor(java.util.concurrent.ExecutorService executor)
Sets the
Executor used for running the query off the main thread. |
void |
setResult(io.requery.sql.ResultSetIterator<E> iterator)
Sets the results the adapter should display.
|
protected QueryAdapter(io.requery.meta.EntityModel model,
java.lang.Class<E> type)
model - database entity modeltype - entity class typeprotected QueryAdapter()
protected QueryAdapter(io.requery.meta.Type<E> type)
type - entity typepublic void close()
close in interface java.io.Closeableclose in interface java.lang.AutoCloseablepublic void setExecutor(java.util.concurrent.ExecutorService executor)
Executor used for running the query off the main thread.executor - ExecutorService to use for the background query.public void setResult(io.requery.sql.ResultSetIterator<E> iterator)
iterator - result set iteratorpublic void queryAsync()
setResult(ResultSetIterator) will be called to update the contents of the adapter.
Note if an Executor was not specified one will be created automatically to run the
query.public abstract io.requery.query.Result<E> performQuery()
setExecutor(ExecutorService)public E getItem(int position)
getItem in interface android.widget.Adapterpublic android.view.View getView(int position,
android.view.View convertView,
android.view.ViewGroup parent)
getView in interface android.widget.Adapterpublic abstract android.view.View getView(E item, android.view.View convertView, android.view.ViewGroup parent)
item - entity element to bind to the viewconvertView - view being recycledparent - parent viewpublic long getItemId(int position)
getItemId in interface android.widget.Adapterpublic int getCount()
getCount in interface android.widget.Adapter