package com.fun.wave.pranksounds.main;

import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import androidx.fragment.app.Fragment;
import androidx.recyclerview.widget.GridLayoutManager;

import com.fun.wave.pranksounds.utils.App;
import com.fun.wave.pranksounds.utils.MyItemSpace;
import com.fun.pranksounds.databinding.FragmentMainBinding;

import java.util.Collections;


public class FragmentMain extends Fragment {


    private FragmentMainBinding binding;




    public FragmentMain() {
    }

    @SuppressWarnings("unused")
    public static FragmentMain newInstance() {
        FragmentMain fragment = new FragmentMain();
        Bundle args = new Bundle();
        fragment.setArguments(args);
        return fragment;
    }

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
    }

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
                             Bundle savedInstanceState) {
        binding = FragmentMainBinding.inflate(inflater);

        MyItemSpace itemHelper = new MyItemSpace(15, 15, 7);
        binding.recyclerView.addItemDecoration(itemHelper);
        binding.recyclerView.setLayoutManager(new GridLayoutManager(requireContext(), 2));
        Collections.shuffle(App.bean);
        binding.recyclerView.setAdapter(new AdapterMain(requireContext(), App.bean ));



        return binding.getRoot();
    }





}