package com.example.prettywallpapers.fragment;

import android.annotation.SuppressLint;
import android.os.Bundle;

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

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

import com.example.prettywallpapers.R;
import com.example.prettywallpapers.PrettyWallPaper;
import com.example.prettywallpapers.prettyadapter.WallpaperAdapter;

public class CategoryFragment extends Fragment {
    private RecyclerView recyclerView_prettywall;
    @SuppressLint("MissingInflatedId")
    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
                             Bundle savedInstanceState) {
        // Inflate the layout for this fragment
        View view = inflater.inflate(R.layout.fragment_home, container, false);
        recyclerView_prettywall = view.findViewById(R.id.recyclerview_pretty);
        setPrettyWallpaper();
        return view;
    }
    private void setPrettyWallpaper() {
        GridLayoutManager gridLayoutManager = new GridLayoutManager(getActivity(),1);
        recyclerView_prettywall.setLayoutManager(gridLayoutManager);
        WallpaperAdapter wallpaperAdapter = new WallpaperAdapter(PrettyWallPaper.getCategorylist(),getActivity());
        recyclerView_prettywall.setAdapter(wallpaperAdapter);
    }
}