package com.sabirjan.Dialog;



import com.sabirjan.android.R;

import android.app.Activity;
import android.app.Dialog;
import android.content.Context;
import android.graphics.Typeface;
import android.view.View;
import android.view.Window;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.TextView;

/** Class Must extends with Dialog */
/** Implement onClickListener to dismiss dialog when OK Button is pressed */
public class TordinEzdaxDialog extends Dialog implements OnClickListener{

	Button btnYes;
	Button btnno;
	Activity main;
	Context Maincontext;
	TorDinIzDax tordin;
	public TordinEzdaxDialog(Context context) {
		super(context);
		Maincontext=context;
		Typeface typeface=Typeface.createFromAsset(context.getAssets(),"fonts/UKIJTuzQ.ttf");
		main=(Activity) context;
		/** 'Window.FEATURE_NO_TITLE' - Used to hide the title */
		requestWindowFeature(Window.FEATURE_NO_TITLE);
		/** Design the dialog in main.xml file */
		setContentView(R.layout.dialogexit);
		TextView txt_msgtitle=(TextView)this.findViewById(R.id.txtdilalogtitle);
		TextView txt_msgmsg=(TextView)this.findViewById(R.id.txtdilalogmsg);
		
		btnYes=(Button)this.findViewById(R.id.yesButton);
		btnno=(Button)this.findViewById(R.id.noButton);
		btnYes.setTypeface(typeface);
		btnno.setTypeface(typeface);
		txt_msgtitle.setTypeface(typeface);
		txt_msgmsg.setTypeface(typeface);
		btnYes.setOnClickListener(this);
		btnno.setOnClickListener(this);
	}
	public TordinEzdaxDialog(Context context,String msg,TorDinIzDax _tordin) {
		super(context);
		Maincontext=context;
		tordin=_tordin;
		Typeface typeface=Typeface.createFromAsset(context.getAssets(),"fonts/UKIJTuzQ.ttf");
		main=(Activity) context;
		/** 'Window.FEATURE_NO_TITLE' - Used to hide the title */
		requestWindowFeature(Window.FEATURE_NO_TITLE);
		/** Design the dialog in main.xml file */
		setContentView(R.layout.dialogexit);
		TextView txt_msgtitle=(TextView)this.findViewById(R.id.txtdilalogtitle);
		TextView txt_msgmsg=(TextView)this.findViewById(R.id.txtdilalogmsg);
		txt_msgmsg.setText(msg);
		txt_msgtitle.setText(" ﻛﻪﭼﯘﺭﯗﯓ");
		btnYes=(Button)this.findViewById(R.id.yesButton);
		btnno=(Button)this.findViewById(R.id.noButton);
		btnYes.setTypeface(typeface);
		btnno.setTypeface(typeface);
		txt_msgtitle.setTypeface(typeface);
		txt_msgmsg.setTypeface(typeface);
		btnYes.setOnClickListener(this);
		btnno.setOnClickListener(this);
	}
	@Override
	public void onClick(View v) {
		/** When OK Button is clicked, dismiss the dialog */
		if(v==btnno)
		{
			this.dismiss();
		}
		else if(v==btnYes)
		{	
			tordin.TorDinIzdayman();
		//	InfoDialog cls=new InfoDialog(Maincontext," ﻛﻪﭼﯘﺭﯗﯓ"," ﺑﯘ ﻳﻪﺭ ﺗﯧﺨﻰ ﺋﻪﻣﻪﻟﮕﻪ ﺋﺎﺷﯘﺭﯗﻟﻤﯩﻐﺎﻥ\n http://www.izda.com");
			this.dismiss();
		//	cls.show();
		}
	}

}

