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.databinding.MainFragmentBinding;
import com.fun.wave.pranksounds.utils.App;
import com.fun.wave.pranksounds.utils.ItemDec;

import java.util.Collections;


public class MainFragment extends Fragment {


    private MainFragmentBinding binding;




    public MainFragment() {
    }

    @SuppressWarnings("unused")
    public static MainFragment newInstance() {
        MainFragment fragment = new MainFragment();
        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 = MainFragmentBinding.inflate(inflater);

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



        return binding.getRoot();
    }





}