package com.webclip.base;

import android.os.Bundle;
import android.view.View;
import android.view.WindowManager;

import androidx.appcompat.app.ActionBar;
import androidx.appcompat.app.AppCompatActivity;
import androidx.recyclerview.widget.LinearLayoutManager;

import com.webclip.base.comm.CommonAdapter;
import com.webclip.base.comm.ViewHolder;
import com.webclip.base.databinding.ScheduleMainBinding;

import java.util.ArrayList;
import java.util.List;


public class TestActivity extends AppCompatActivity {

    ScheduleMainBinding activityStartBinding;

    CommonAdapter commonHotGameAdapter;

    List<Integer> liveList = new ArrayList<>();
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        getWindow().setNavigationBarColor(getColor(R.color.white));
        super.onCreate(savedInstanceState);
        View decor = getWindow().getDecorView();
        getWindow().setFlags(WindowManager.LayoutParams.FLAG_HARDWARE_ACCELERATED, WindowManager.LayoutParams.FLAG_HARDWARE_ACCELERATED);
        decor.setSystemUiVisibility(View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR);
        ActionBar actionBar = getSupportActionBar();
        if (actionBar != null) {
            actionBar.hide();
        }
        activityStartBinding = ScheduleMainBinding.inflate(getLayoutInflater());
        setContentView(activityStartBinding.getRoot());

        initAdapter();
        initAdapterData();
    }


    private void initAdapterData() {
        LinearLayoutManager linearLayoutManager = new LinearLayoutManager(this);
        linearLayoutManager.setOrientation(LinearLayoutManager.HORIZONTAL);
        activityStartBinding.dateSelector.dateList.setLayoutManager(linearLayoutManager);
        commonHotGameAdapter = new CommonAdapter<Integer>(TestActivity.this, R.layout.date_item, liveList) {
            @Override
            public void convert(ViewHolder holder, Integer s, int index) {

            }
        };
        activityStartBinding.dateSelector.dateList.setAdapter(commonHotGameAdapter);
    }

    private void initAdapter() {

        for (int i = 0 ;i<20;i++){
            liveList.add(i);
        }

        activityStartBinding.scheduleList.setLayoutManager(new LinearLayoutManager(this));
        commonHotGameAdapter = new CommonAdapter<Integer>(TestActivity.this, R.layout.schedule_item, liveList) {
            @Override
            public void convert(ViewHolder holder, Integer s, int index) {

            }
        };
        activityStartBinding.scheduleList.setAdapter(commonHotGameAdapter);
    }


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