package fr.free.nrw.commons.nearby;


import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.support.v4.app.ListFragment;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import fr.free.nrw.commons.R;

public class NearbyListFragment extends ListFragment {

    private LatLng mLatestLocation;
    private int mImageSize;
    private boolean mItemClicked;

    private static final String TAG = "NearbyListFragment";

    public NearbyListFragment() {
    }

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
                             Bundle savedInstanceState) {

        Log.d(TAG, "NearbyListFragment created");

        View view = inflater.inflate(R.layout.fragment_nearby, container, false);


        return view;
    }
}

@@ -57,16 +57,58 @@
 Bundle;%0A
+import android.provider.ContactsContract;%0A
 import a
@@ -202,16 +202,141 @@
 oid.
-util.Log
+support.v4.view.ViewPager;%0Aimport android.support.v4.widget.SimpleCursorAdapter;%0Aimport android.util.Log;%0Aimport android.view.Gravity
 ;%0Aim
@@ -425,16 +425,51 @@
 ewGroup;
+%0Aimport android.widget.ProgressBar;
 %0A%0Aimport
@@ -1045,20 +1045,2962 @@
     
-return view;
+// Create a progress bar to display while the list loads%0A        ProgressBar progressBar = new ProgressBar(getActivity());%0A        progressBar.setLayoutParams(new ViewGroup.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT,%0A                ViewGroup.LayoutParams.WRAP_CONTENT));%0A        progressBar.setIndeterminate(true);%0A        getListView().setEmptyView(progressBar);%0A        // Must add the progress bar to the root of the layout%0A        ViewGroup root = (ViewGroup) view.getRootView();%0A        root.addView(progressBar);%0A%0A        // For the cursor adapter, specify which columns go into which views%0A        String%5B%5D fromColumns = %7BContactsContract.Data.DISPLAY_NAME%7D;%0A        int%5B%5D toViews = %7Bandroid.R.id.text1%7D; // The TextView in simple_list_item_1%0A%0A        // Create an empty adapter we will use to display the loaded data.%0A        // We pass null for the cursor, then update it in onLoadFinished()%0A        mAdapter = new SimpleCursorAdapter(this,%0A                android.R.layout.simple_list_item_1, null,%0A                fromColumns, toViews, 0);%0A        setListAdapter(mAdapter);%0A%0A        // Prepare the loader.  Either re-connect with an existing one,%0A        // or start a new one.%0A        getLoaderManager().initLoader(0, null, this);%0A        return view;%0A    %7D%0A%0A%0A    // This is the Adapter being used to display the list's data%0A    SimpleCursorAdapter mAdapter;%0A%0A    // These are the Contacts rows that we will retrieve%0A    static final String%5B%5D PROJECTION = new String%5B%5D %7BContactsContract.Data._ID,%0A            ContactsContract.Data.DISPLAY_NAME%7D;%0A%0A    // This is the select criteria%0A    static final String SELECTION = %22((%22 +%0A            ContactsContract.Data.DISPLAY_NAME + %22 NOTNULL) AND (%22 +%0A            ContactsContract.Data.DISPLAY_NAME + %22 != '' ))%22;%0A%0A%0A    // Called when a new Loader needs to be created%0A    public Loader%3CCursor%3E onCreateLoader(int id, Bundle args) %7B%0A        // Now create and return a CursorLoader that will take care of%0A        // creating a Cursor for the data being displayed.%0A        return new CursorLoader(this, ContactsContract.Data.CONTENT_URI,%0A                PROJECTION, SELECTION, null, null);%0A    %7D%0A%0A    // Called when a previously created loader has finished loading%0A    public void onLoadFinished(Loader%3CCursor%3E loader, Cursor data) %7B%0A        // Swap the new cursor in.  (The framework will take care of closing the%0A        // old cursor once we return.)%0A        mAdapter.swapCursor(data);%0A    %7D%0A%0A    // Called when a previously created loader is reset, making the data unavailable%0A    public void onLoaderReset(Loader%3CCursor%3E loader) %7B%0A        // This is called when the last Cursor provided to onLoadFinished()%0A        // above is about to be closed.  We need to make sure we are no%0A        // longer using it.%0A        mAdapter.swapCursor(null);%0A    %7D%0A%0A    @Override%0A    public void onListItemClick(ListView l, View v, int position, long id) %7B%0A        // Do something when a list item is clicked
 %0A   

Add progress bar in ListView