package com.example.chemical.ui.plan.change;

import android.os.Bundle;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;

import com.example.chemical.databinding.ActivityChangeCabinetBinding;
import com.example.chemical.ui.common.BaseCountDownActivity;
import com.example.chemical.ui.plan.FragmentCallBack;
import com.example.chemical.ui.plan.room.bean.locker.CabinetLayerSelect;

/**
 * 更换位置
 */
public class ChangeCabinetActivity extends BaseCountDownActivity<ActivityChangeCabinetBinding> {
    private ActivityChangeCabinetBinding binding;
    private ChangeCabinetAdapter changeCabinetAdapter;
    private CabinetLayerSelect cabinetLayerSelect;

    @NonNull
    @Override
    protected ActivityChangeCabinetBinding createViewBinding() {
        return binding = ActivityChangeCabinetBinding.inflate(getLayoutInflater());
    }

    @Override
    protected void initViews(@Nullable Bundle savedInstanceState) {
        super.initViews(savedInstanceState);
//        List<HxpCabinetVo> hxpCabinetVoList = RoomTool.getInstance().hxpCabinetDAO().getAll();
//        for (int i = 0; i < hxpCabinetVoList.size(); i++) {
//            HxpCabinetVo s = hxpCabinetVoList.get(i);
//        }
//        changeCabinetAdapter = new ChangeCabinetAdapter(this, hxpCabinetVoList, fragmentCallBack);
//        binding.cabinetVP.registerOnPageChangeCallback(new ViewPager2.OnPageChangeCallback() {
//            @Override
//            public void onPageSelected(int position) {
//                super.onPageSelected(position);
//                binding.countTV.setText((position + 1) + "/" + changeCabinetAdapter.getItemCount());
//            }
//        });
//        binding.nextBT.setOnClickListener(view -> binding.cabinetVP.setCurrentItem(binding.cabinetVP.getCurrentItem() + 1, true));
//        binding.lastBT.setOnClickListener(view -> binding.cabinetVP.setCurrentItem(binding.cabinetVP.getCurrentItem() - 1, true));
//        binding.cabinetVP.setAdapter(changeCabinetAdapter);
//
//        binding.cancelBT.setOnClickListener(v -> finish());
//
//        binding.confirmBT.setOnClickListener(v -> {
//            Intent intent = new Intent();
//            Bundle bundle = new Bundle();
//            bundle.putSerializable("Change", cabinetLayerSelect);
//            intent.putExtra("data", bundle);
//            setResult(RESULT_OK, intent);
//            finish();
//        });
    }

    @Override
    protected void initData() {
        super.initData();
    }

    FragmentCallBack fragmentCallBack = new FragmentCallBack() {
        @Override
        public void onSelected(CabinetLayerSelect lastSelectInfo) {
            cabinetLayerSelect = lastSelectInfo;
        }
    };

    @Override
    protected void cdTime(int cd) {

    }
}