package fishrungames.bashgid.core;



import android.os.AsyncTask;
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
import fishrungames.bashgid.MainActivity;

public class NewsDownloadTask extends AsyncTask<Bundle, Integer, Long>
{

	public Handler mHandler;

	protected Long doInBackground(Bundle... queryArr)
	{
		
		
		for (int i = 0; i < NewsManager.urlArr.length; i++)
		{
			NewsManager.LoadNewsAndImagesFromRss(NewsManager.urlArr[i]);
		}
		
		return (long) 0;
	}

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

		completeMessage.sendToTarget();

	}

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

		completeMessage.sendToTarget();
	}

}
