package com.base.browserwhite.label;

import android.os.Bundle;
import android.view.View;
import android.widget.Button;

import androidx.appcompat.app.AppCompatActivity;
import androidx.viewpager2.widget.ViewPager2;

import com.base.browserwhite.R;
import com.base.browserwhite.label.fragment.RedFragment;

public class TestActivity extends AppCompatActivity {

    private ViewPager2 viewPager;
    private Button addButton, managerButton, resetButton;

    private ViewPager2Manager mViewPagerManager;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_test_label);
        viewPager = findViewById(R.id.viewPager);
        addButton = findViewById(R.id.addButton);
        managerButton = findViewById(R.id.managerButton);
        resetButton = findViewById(R.id.resetButton); // 获取重置按钮

        mViewPagerManager = new ViewPager2Manager(viewPager, this);
        addButton.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                mViewPagerManager.addFragment();
            }
        });

        managerButton.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                mViewPagerManager.manageFragments();
            }
        });

        resetButton.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                mViewPagerManager.resetFragments();
            }
        });

    }


}

