package com.yono.messeripos;

import android.app.Dialog;
import android.app.ProgressDialog;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.RelativeLayout;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;

import com.google.android.material.bottomsheet.BottomSheetBehavior;
import com.google.android.material.bottomsheet.BottomSheetDialog;
import com.google.android.material.bottomsheet.BottomSheetDialogFragment;
import com.yono.messeripos.utils.Utils;

public class ForgotCode extends BottomSheetDialogFragment {
    Utils utils;
    BottomSheetBehavior sheetBehavior;
    BottomSheetDialog sheetDialog;
    RelativeLayout fpCode;
    View view;

    Context context;
    public ForgotCode(Context c) {
        context = c;
    }

    @NonNull
    @Override
    public Dialog onCreateDialog(@Nullable Bundle savedInstanceState) {
        sheetDialog = (BottomSheetDialog) super.onCreateDialog(savedInstanceState);

//        inflating layout
        view = View.inflate(getContext(), R.layout.forgot_password_code, null);

//        bindUI
        fpCode = view.findViewById(R.id.fpCode);

//        utils
        utils = new Utils();

        sheetDialog.setContentView(view);

        sheetBehavior = BottomSheetBehavior.from((View) (view.getParent()));

//        get Window size
        int setHeight = utils.getWindowHeight() - (utils.getWindowHeight() * 5) / 100;

//        set max height
        sheetBehavior.setPeekHeight(setHeight);
        fpCode.setMinimumHeight(setHeight);

        return sheetDialog;
    }
}
