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 InfoDialog extends Dialog implements OnClickListener {

	Button btnno;
	Activity main;
	public InfoDialog(Context context) {
		super(context);
		Typeface typeface=Typeface.createFromAsset(context.getAssets(),"fonts/UKIJTuT.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.info);
		TextView txt_msgtitle=(TextView)this.findViewById(R.id.txttema);
		TextView txt_msgmsg=(TextView)this.findViewById(R.id.txtmazmun);
	
		btnno=(Button)this.findViewById(R.id.noButton);
		btnno.setTypeface(typeface);
		txt_msgtitle.setTypeface(typeface);
		txt_msgmsg.setTypeface(typeface);
		btnno.setOnClickListener(this);
	}
	public InfoDialog(Context context,String info) {
		super(context);
		Typeface typeface=Typeface.createFromAsset(context.getAssets(),"fonts/UKIJTuT.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.info);
		TextView txt_msgtitle=(TextView)this.findViewById(R.id.txttema);
		TextView txt_msgmsg=(TextView)this.findViewById(R.id.txtmazmun);
	
		btnno=(Button)this.findViewById(R.id.noButton);
		btnno.setTypeface(typeface);
		txt_msgtitle.setTypeface(typeface);
		txt_msgmsg.setTypeface(typeface);
		txt_msgmsg.setText(info);
		btnno.setOnClickListener(this);
	}
	@Override
	public void onClick(View v) {
		/** When OK Button is clicked, dismiss the dialog */
		if(v==btnno)
		{
			this.dismiss();
		}
		
	}

}

