package com.revoapp.calendar.dialogs;

import android.app.Dialog;
import android.content.Context;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;

import com.revoapp.calendarapp.R;
import com.revoapp.calendar.helper.ThemeHelper;

public class AbstractDialog extends Dialog {
    protected TextView titleTV;
    protected Context context;

    public AbstractDialog(Context context, int layoutResource) {
        super(context, R.style.Theme_CustomDialog);
        setContentView(layoutResource);

        this.context = context;

        View view = findViewById(R.id.dialogMainLayout);
        if (view != null)
            view.setBackgroundResource(ThemeHelper
                    .get_background_dialogbox());

        setCanceledOnTouchOutside(true);

        titleTV = (TextView) findViewById(R.id.dialogTitle);

        Button closeDialogB = (Button) findViewById(R.id.closeDialogB);
        if (closeDialogB != null) {
            closeDialogB.setBackgroundResource(ThemeHelper
                    .get_button_dialogbox_close_selector());
            closeDialogB.setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View v) {
                    dismiss();
                }
            });
        }
    }
}