Search in sources :

Example 1 with NestedPageWithSrlFragment

use of me.dkzwm.widget.srl.sample.ui.fragment.NestedPageWithSrlFragment in project SmoothRefreshLayout by dkzwm.

the class TestNestedViewPagerActivity method onCreate.

@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_with_nested_viewpager);
    final Toolbar toolbar = findViewById(R.id.toolbar);
    setSupportActionBar(toolbar);
    toolbar.setNavigationIcon(R.drawable.arrow_back_white_72x72);
    toolbar.setNavigationOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            onBackPressed();
        }
    });
    ViewPager viewPager = findViewById(R.id.viewPager_with_nested_pager);
    List<NestedPageWithSrlFragment> fragments = new ArrayList<>();
    for (int color : sColors) {
        fragments.add(NestedPageWithSrlFragment.newInstance(color));
    }
    ViewPagerAdapter adapter = new ViewPagerAdapter(getSupportFragmentManager(), fragments);
    viewPager.setAdapter(adapter);
}
Also used : NestedPageWithSrlFragment(me.dkzwm.widget.srl.sample.ui.fragment.NestedPageWithSrlFragment) ArrayList(java.util.ArrayList) ViewPagerAdapter(me.dkzwm.widget.srl.sample.adapter.ViewPagerAdapter) View(android.view.View) ViewPager(androidx.viewpager.widget.ViewPager) Toolbar(androidx.appcompat.widget.Toolbar)

Aggregations

View (android.view.View)1 Toolbar (androidx.appcompat.widget.Toolbar)1 ViewPager (androidx.viewpager.widget.ViewPager)1 ArrayList (java.util.ArrayList)1 ViewPagerAdapter (me.dkzwm.widget.srl.sample.adapter.ViewPagerAdapter)1 NestedPageWithSrlFragment (me.dkzwm.widget.srl.sample.ui.fragment.NestedPageWithSrlFragment)1