package xn.xxp.home.setting;

import android.os.Bundle;
import android.text.TextUtils;
import android.view.View;

import androidx.activity.EdgeToEdge;
import androidx.annotation.NonNull;
import androidx.appcompat.app.AppCompatActivity;
import androidx.core.graphics.Insets;
import androidx.core.view.ViewCompat;
import androidx.core.view.WindowInsetsCompat;

import com.blankj.utilcode.util.Utils;
import com.njlz.face.FaceUtils;

import java.util.List;

import xn.xxp.R;
import xn.xxp.databinding.ActivityFaceListBinding;

public class FaceListActivity extends AppCompatActivity {

    private FaceAdapter faceAdapter;
    private ActivityFaceListBinding binding;
    private List<String> faceIdList;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        binding = ActivityFaceListBinding.inflate(getLayoutInflater());
        setContentView(binding.getRoot());
        FaceUtils.getInstance().init(Utils.getApp());
        faceIdList = FaceUtils.getInstance().getAllFaceId();
        faceAdapter = new FaceAdapter(faceIdList);
        binding.faceGV.setAdapter(faceAdapter);
        binding.back.setOnClickListener(v -> finish());
        if (null != faceIdList && !faceIdList.isEmpty()) {
            binding.size.setText("共" + faceIdList.size() + "人");
        }
    }

    @Override
    protected void onDestroy() {
        super.onDestroy();
        FaceUtils.getInstance().destroy();
    }
}