mirror of
https://github.com/commons-app/apps-android-commons.git
synced 2025-10-26 20:33:53 +01:00
Put TaskListener in separate file and implement onTaskStarted and onTaskFinished
This commit is contained in:
parent
26ab3faf1e
commit
f0843ca4f6
2 changed files with 20 additions and 8 deletions
|
|
@ -27,7 +27,8 @@ import java.util.List;
|
|||
|
||||
import fr.free.nrw.commons.R;
|
||||
|
||||
public class NearbyListFragment extends ListFragment {
|
||||
|
||||
public class NearbyListFragment extends ListFragment implements TaskListener {
|
||||
|
||||
private NearbyAsyncTask nearbyAsyncTask;
|
||||
private NearbyAdapter mAdapter;
|
||||
|
|
@ -44,11 +45,6 @@ public class NearbyListFragment extends ListFragment {
|
|||
public NearbyListFragment() {
|
||||
}
|
||||
|
||||
public interface TaskListener {
|
||||
void onTaskStarted();
|
||||
|
||||
void onTaskFinished(List<Place> result);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCreate(Bundle savedInstanceState) {
|
||||
|
|
@ -91,9 +87,16 @@ public class NearbyListFragment extends ListFragment {
|
|||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onTaskStarted() {
|
||||
isTaskRunning = true;
|
||||
progressDialog = ProgressDialog.show(getActivity(), "Loading", "Please wait a moment!");
|
||||
progressDialog = ProgressDialog.show(CopyOfMainActivity.this, "Loading", "Please wait a moment!");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onTaskFinished(List<Place> result) {
|
||||
if (progressDialog != null) {
|
||||
progressDialog.dismiss();
|
||||
}
|
||||
}
|
||||
|
||||
private class NearbyAsyncTask extends AsyncTask<Void, Integer, List<Place>> {
|
||||
|
|
|
|||
|
|
@ -0,0 +1,9 @@
|
|||
package fr.free.nrw.commons.nearby;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface TaskListener {
|
||||
void onTaskStarted();
|
||||
|
||||
void onTaskFinished(List<Place> result);
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue