package com.uoit.freeroomfinder;

import android.content.Context;
import android.os.AsyncTask;

public class QueryTask extends AsyncTask<Context, Void, Boolean> {
	
	private OnFinshedTaskListener listener;
	
	@Override
	protected Boolean doInBackground(Context... params) {
		DatabaseInterface dbi = new DatabaseInterface(params[0]);
		RoomsBooked.results = dbi.getBooking();
		//publishProgress((Void) null);
		return true;
		
	}
	
	/*@Override
	protected void onProgressUpdate(Void... values)
	{
		refreshList();
	}*/

	@Override
	protected void onPostExecute(final Boolean success) {
		
		if(listener != null)
		{
			listener.onFinishedTaskListener();
		}
	}

	@Override
	protected void onCancelled() {
	}
	
	public void setOnFinshedTaskListener(OnFinshedTaskListener listener){
		this.listener = listener;
	}
}
@@ -267,16 +267,63 @@
 rams) %7B%0A
+%09%09//TODO see if this can fail and catch errors%0A
 %09%09Databa
@@ -422,150 +422,28 @@
 ;%0A%09%09
-//publishProgress((Void) null);%0A%09%09return true;%0A%09%09%0A%09%7D%0A%09%0A%09/*@Override%0A%09protected void onProgressUpdate(Void... values)%0A%09%7B%0A%09%09refreshList();%0A%09%7D*/%0A
+return true;%0A%09%09%0A%09%7D%0A%09
 %0A%09@O
@@ -508,16 +508,35 @@
 s) %7B%0A%09%09%0A
+%09%09if(success)%0A%09%09%7B%0A%09
 %09%09if(lis
@@ -550,23 +550,25 @@
 = null)%0A
+%09
 %09%09%7B%0A%09%09%09
+%09
 listener
@@ -594,16 +594,57 @@
 ener();%0A
+%09%09%09%7D%0A%09%09%7D%0A%09%09else%0A%09%09%7B%0A%09%09%09//TODO show error%0A
 %09%09%7D%0A%09%7D%0A%0A

cleaned up query task