package com.prank.sound.funnyapp.activity;


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

import androidx.appcompat.app.AppCompatActivity;
import androidx.recyclerview.widget.GridLayoutManager;

import com.prank.sound.funnyapp.MyApp;
import com.prank.sound.funnyapp.databinding.ActivityMainBinding;
import com.prank.sound.funnyapp.myadapter.AdapterMain;
import com.prank.sound.funnyapp.mytool.Decoration;
import com.prank.sound.funnyapp.mytool.Common;

public class MainActivity extends AppCompatActivity {

    private ActivityMainBinding activityMainBinding;


    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        activityMainBinding = ActivityMainBinding.inflate(getLayoutInflater());
        setContentView(activityMainBinding.getRoot());
        Common.setStatusBarTextColor(this, true);


        Decoration itemHelper = new Decoration(10, 10, 0);
        activityMainBinding.recyclerView.addItemDecoration(itemHelper);
        activityMainBinding.recyclerView.setLayoutManager(new GridLayoutManager(this, 2));
        activityMainBinding.recyclerView.setAdapter(new AdapterMain(this, MyApp.bean));
        initClick();



    }

    private void initClick(){
        activityMainBinding.rlRecord.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Intent intent = new Intent(MainActivity.this, RecordActivity.class);
                startActivity(intent);
            }
        });
        activityMainBinding.rlLike.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Intent intent = new Intent(MainActivity.this, CollectionActivity.class);
                startActivity(intent);
            }
        });
    }

}