package com.example.applock.allmanager;


import android.content.Context;
import android.graphics.Typeface;
import android.os.Bundle;
import android.view.Gravity;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.view.Window;
import android.view.WindowManager;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.fragment.app.DialogFragment;

import com.example.applock.databinding.DialogSuccessBinding;
import com.example.applock.listener.LockListener;
import com.example.applock.listener.PermissionBtnListener;
import com.example.applock.R;
import com.example.applock.listener.SwitchListener;

public class SuccessDialog extends DialogFragment {
    private DialogSuccessBinding successBinding;
    private Context mContext;
    private String msg;


    public SuccessDialog(Context context, String message) {
        mContext = context;
        msg = message;
    }

    @Nullable
    @Override
    public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
        successBinding = DialogSuccessBinding.inflate(inflater, null, false);
        init();
        return successBinding.getRoot();
    }




    private void init() {
        setCancelable(true);
        Window window = getDialog().getWindow();
        window.setBackgroundDrawableResource(R.color.nobackground);
        window.getDecorView().setPadding(0, 0, 0, 0);
        WindowManager.LayoutParams lockwin = window.getAttributes();
        lockwin.gravity = Gravity.CENTER;
        lockwin.width = WindowManager.LayoutParams.MATCH_PARENT;
        lockwin.height = WindowManager.LayoutParams.WRAP_CONTENT;
        window.setAttributes(lockwin);
        successBinding.title.setText(msg);
        successBinding.okBtn.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                dismiss();
            }
        });

    }

}
