package io.openim.android.ouicore.widget;

import android.content.Context;
import android.view.Gravity;
import android.view.View;
import android.view.ViewGroup;
import android.view.WindowManager;

import androidx.annotation.NonNull;

import io.openim.android.ouicore.base.BaseDialog;
import io.openim.android.ouicore.databinding.LayoutCommonDialogBinding;
import io.openim.android.ouicore.databinding.LayoutCommonDialogWithTitleBinding;

public class CommonWithTitleDialog extends BaseDialog {
    public CommonWithTitleDialog(@NonNull Context context) {
        super(context);
        initView();
    }

    private LayoutCommonDialogWithTitleBinding mainView;

    private void initView() {
        mainView = LayoutCommonDialogWithTitleBinding.inflate(getLayoutInflater());
        setContentView(mainView.getRoot());


        WindowManager.LayoutParams params = getWindow().getAttributes();
        params.gravity = Gravity.CENTER;
        params.height = ViewGroup.LayoutParams.WRAP_CONTENT;
        params.width = ViewGroup.LayoutParams.WRAP_CONTENT;
        getWindow().setAttributes(params);
        getWindow().setBackgroundDrawableResource(android.R.color.transparent);
    }

    public LayoutCommonDialogWithTitleBinding getMainView() {
        return mainView;
    }



    public CommonWithTitleDialog atShow() {
        show();
        return this;
    }
}

