package xn.hxp.weidith;

import android.app.Dialog;
import android.content.Context;
import android.graphics.Color;
import android.graphics.drawable.ColorDrawable;
import android.os.Bundle;
import android.view.Gravity;
import android.view.View;
import android.view.Window;
import android.view.WindowManager;

import androidx.annotation.NonNull;

import xn.hxp.databinding.DialogPlanBinding;

public class PlanDialog extends Dialog {
    private DialogPlanBinding binding;
    private View.OnClickListener alreadyClickListener;
    private View.OnClickListener otherClickListener;

    public PlanDialog(@NonNull Context context, View.OnClickListener alreadyClickListener, View.OnClickListener otherClickListener) {
        super(context);
        this.alreadyClickListener = alreadyClickListener;
        this.otherClickListener = otherClickListener;
        Window window = getWindow();
        requestWindowFeature(Window.FEATURE_NO_TITLE);
        if (null != window) {
            window.setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));
            window.setGravity(Gravity.CENTER);
            window.setLayout(
                    WindowManager.LayoutParams.MATCH_PARENT,
                    WindowManager.LayoutParams.WRAP_CONTENT
            );
        }

    }

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        binding = DialogPlanBinding.inflate(getLayoutInflater());
        setContentView(binding.getRoot());
        binding.alreadyRL.setOnClickListener(alreadyClickListener);
        binding.otherRL.setOnClickListener(otherClickListener);
    }

    @Override
    protected void onStop() {
        super.onStop();
    }
}
