package fishrungames.bashgid.core;

import android.os.AsyncTask;
import android.os.Handler;
import android.os.Message;
import fishrungames.bashgid.MainActivity;
import fishrungames.bashgid.core.AlbumManager.AlbumFullData;

public class DatabaseGetAlbumTask extends AsyncTask<String, Integer, Long>
{

	AlbumFullData album = null;
	
	public Handler mHandler;

	protected Long doInBackground(String... queryArr)
	{
		String albumName = queryArr[0];
		
		album = MainActivity.getInstance().albumDataSource.GetAlbumFullData(albumName);
		
		return (long) 0;
	}

	protected void onProgressUpdate(Integer... progress)
	{
		Message completeMessage = mHandler.obtainMessage(MainActivity.DATABASE_GET_ALBUM_STATE_UPDATE, album);

		completeMessage.sendToTarget();

	}

	protected void onPostExecute(Long result)
	{
		Message completeMessage = mHandler.obtainMessage(MainActivity.DATABASE_GET_ALBUM_STATE_FINISHED, album);

		completeMessage.sendToTarget();
	}
}