package com.example.mynotepad.Dialogs.FoldersCustomDialog;

import android.app.Activity;
import android.app.Dialog;
import android.graphics.drawable.ColorDrawable;
import android.view.View;
import android.widget.LinearLayout;

import androidx.recyclerview.widget.RecyclerView;

import com.example.mynotepad.R;

public class FoldersDialog {
    private RecyclerView recyclerView;
    private LinearLayout addNewFolder;

    public void showDialog(final Activity activity){
        Dialog dialog = new Dialog(activity);
        dialog.getWindow().setBackgroundDrawable(new ColorDrawable(android.graphics.Color.TRANSPARENT));
        dialog.setCancelable(true);
        dialog.setContentView(R.layout.dialog_folders);
        addNewFolder = dialog.findViewById(R.id.addFolder);
        recyclerView = dialog.findViewById(R.id.recyclerView2);
        dialog.show();

        addNewFolder.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                CreateNewFolderDialog createNewFolderDialog = new CreateNewFolderDialog();
                createNewFolderDialog.showDialog(activity);
                createNewFolderDialog.setOnCreateNewFolderDialogClickListener(new OnCreateNewFolderDialogClickListener() {
                    @Override
                    public void onDoneClicked(String newFolderName) {
                        //todo save new folder in sharedPrefrences
                    }
                });
            }
        });
    }
}
