package com.example.wallpapermagazine.recylcle;

import android.content.Intent;
import android.os.Bundle;

import androidx.activity.EdgeToEdge;
import androidx.appcompat.app.AppCompatActivity;
import androidx.core.graphics.Insets;
import androidx.core.view.ViewCompat;
import androidx.core.view.WindowInsetsCompat;
import androidx.recyclerview.widget.GridLayoutManager;
import androidx.recyclerview.widget.RecyclerView;

import com.example.wallpapermagazine.R;
import com.example.wallpapermagazine.Recycle_view;
import com.example.wallpapermagazine.ViewActivity;
import com.example.wallpapermagazine.WallPaperSelect;
import com.example.wallpapermagazine.action.InfoListWallPaperListener;

public class SeeAllActivity extends AppCompatActivity implements InfoListWallPaperListener{
private int op;
private RecyclerView recyclerView;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        EdgeToEdge.enable(this);
        setContentView(R.layout.activity_see_all);

        recyclerView=findViewById(R.id.recycler_view_see_all);
        op=getIntent().getIntExtra("nameop",0);
        setRecyclerviewWallpaper();

    }
    private void setRecyclerviewWallpaper() {

        Recycle_view recycle_View = new Recycle_view(10, 10, 15);
        GridLayoutManager gridLayoutManager = new GridLayoutManager(this, 3);
        recyclerView.setLayoutManager(gridLayoutManager);
        recyclerView.addItemDecoration(recycle_View);
        CataItemAdapter cataItemAdapter = new  CataItemAdapter(WallPaperSelect.getCataName(),op ,this);
        cataItemAdapter.setInfoWallPaperListener((InfoListWallPaperListener) this);
        recyclerView.setAdapter(cataItemAdapter);
    }

    @Override
    public void onItemClickAction(int nameop, int recop) {
        Intent intent = new Intent(getBaseContext(), ViewActivity.class);
        intent.putExtra("naop",nameop);
        intent.putExtra("dataop",recop);
        startActivity(intent);
    }
}