mirror of
https://github.com/commons-app/apps-android-commons.git
synced 2025-10-26 12:23:58 +01:00
Remove irrelevant CursorAdapter bits
This commit is contained in:
parent
f35d565e97
commit
45a1f546e3
1 changed files with 4 additions and 39 deletions
|
|
@ -12,6 +12,7 @@ import android.view.Gravity;
|
|||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.Adapter;
|
||||
import android.widget.ProgressBar;
|
||||
|
||||
import fr.free.nrw.commons.R;
|
||||
|
|
@ -21,6 +22,7 @@ public class NearbyListFragment extends ListFragment {
|
|||
private LatLng mLatestLocation;
|
||||
private int mImageSize;
|
||||
private boolean mItemClicked;
|
||||
Adapter mAdapter;
|
||||
|
||||
private static final String TAG = "NearbyListFragment";
|
||||
|
||||
|
|
@ -46,15 +48,10 @@ public class NearbyListFragment extends ListFragment {
|
|||
ViewGroup root = (ViewGroup) view.getRootView();
|
||||
root.addView(progressBar);
|
||||
|
||||
// For the cursor adapter, specify which columns go into which views
|
||||
String[] fromColumns = {ContactsContract.Data.DISPLAY_NAME};
|
||||
int[] toViews = {android.R.id.text1}; // The TextView in simple_list_item_1
|
||||
|
||||
//TODO: Original is an AttractionAdapter. Not a CursorAdapter.
|
||||
// Create an empty adapter we will use to display the loaded data.
|
||||
// We pass null for the cursor, then update it in onLoadFinished()
|
||||
mAdapter = new SimpleCursorAdapter(this,
|
||||
android.R.layout.simple_list_item_1, null,
|
||||
fromColumns, toViews, 0);
|
||||
mAdapter = new SimpleCursorAdapter(this, android.R.layout.simple_list_item_1, null, fromColumns, toViews, 0);
|
||||
setListAdapter(mAdapter);
|
||||
|
||||
// Prepare the loader. Either re-connect with an existing one,
|
||||
|
|
@ -64,41 +61,9 @@ public class NearbyListFragment extends ListFragment {
|
|||
}
|
||||
|
||||
|
||||
// This is the Adapter being used to display the list's data
|
||||
SimpleCursorAdapter mAdapter;
|
||||
|
||||
// These are the Contacts rows that we will retrieve
|
||||
static final String[] PROJECTION = new String[] {ContactsContract.Data._ID,
|
||||
ContactsContract.Data.DISPLAY_NAME};
|
||||
|
||||
// This is the select criteria
|
||||
static final String SELECTION = "((" +
|
||||
ContactsContract.Data.DISPLAY_NAME + " NOTNULL) AND (" +
|
||||
ContactsContract.Data.DISPLAY_NAME + " != '' ))";
|
||||
|
||||
|
||||
// Called when a new Loader needs to be created
|
||||
public Loader<Cursor> onCreateLoader(int id, Bundle args) {
|
||||
// Now create and return a CursorLoader that will take care of
|
||||
// creating a Cursor for the data being displayed.
|
||||
return new CursorLoader(this, ContactsContract.Data.CONTENT_URI,
|
||||
PROJECTION, SELECTION, null, null);
|
||||
}
|
||||
|
||||
// Called when a previously created loader has finished loading
|
||||
public void onLoadFinished(Loader<Cursor> loader, Cursor data) {
|
||||
// Swap the new cursor in. (The framework will take care of closing the
|
||||
// old cursor once we return.)
|
||||
mAdapter.swapCursor(data);
|
||||
}
|
||||
|
||||
// Called when a previously created loader is reset, making the data unavailable
|
||||
public void onLoaderReset(Loader<Cursor> loader) {
|
||||
// This is called when the last Cursor provided to onLoadFinished()
|
||||
// above is about to be closed. We need to make sure we are no
|
||||
// longer using it.
|
||||
mAdapter.swapCursor(null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onListItemClick(ListView l, View v, int position, long id) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue