package com.genlot.station.viewpagertest;

import android.annotation.SuppressLint;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.MotionEvent;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ListView;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.fragment.app.Fragment;

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

/**
 * Copyright (C), 2019-2020, Genlot
 *
 * @author 詹子聪
 * @date 2020/6/23 15:42
 * Description:
 */
public class DemoFragment extends Fragment {
    private ListView ll_test;
    private DemoAdapter adapter;

    @SuppressLint("ClickableViewAccessibility")
    @Nullable
    @Override
    public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
        View view = inflater.inflate(R.layout.fragment_demo, null);

        ll_test = view.findViewById(R.id.ll_test);
        List<String> demoStringList = new ArrayList<>();
        demoStringList.add("dddd");
        demoStringList.add("ddd");
        demoStringList.add("ddd");
        demoStringList.add("afds");
        demoStringList.add("afdasfeww");
        adapter = new DemoAdapter(getActivity(), demoStringList);
        ll_test.setAdapter(adapter);

        ll_test.setOnTouchListener(new View.OnTouchListener() {
            @Override
            public boolean onTouch(View v, MotionEvent event) {
                // 手动设置指示器颜色
                //((IPagerFuture)getActivity()).setRedCircle(3);

                return false;
            }
        });
        return view;
    }
}
