package com.upc.pbe.upcnews;

import android.app.Activity;
import android.app.ProgressDialog;
import android.content.Context;
import android.content.DialogInterface;
import android.view.KeyEvent;

public class CustomProgressDialog extends ProgressDialog implements DialogInterface.OnKeyListener
{

	Activity act;

	public CustomProgressDialog(Context context)
	{
		super(context);
		act = (Activity) context;
		this.setOnKeyListener(this);
	}
	
	public boolean onKey(DialogInterface dialog, int keyCode, KeyEvent event)
	{
		if (keyCode == KeyEvent.KEYCODE_BACK)
		{
			this.dismiss();
			((VideoActivity)act).quitPlayer();
			return true;
		}
		return false;
	}
}