use of me.zhanghai.android.douya.ui.TabFragmentPagerAdapter in project Douya by DreaminginCodeZH.
the class BroadcastActivityDialogFragment method onActivityCreated.
@Override
public void onActivityCreated(Bundle savedInstanceState) {
super.onActivityCreated(savedInstanceState);
mTabAdapter = new TabFragmentPagerAdapter(this);
mTabAdapter.addTab(new TabFragmentPagerAdapter.FragmentCreator() {
@Override
public Fragment createFragment() {
return BroadcastLikerListFragment.newInstance(mBroadcast);
}
}, null);
mTabAdapter.addTab(new TabFragmentPagerAdapter.FragmentCreator() {
@Override
public Fragment createFragment() {
return BroadcastRebroadcasterListFragment.newInstance(mBroadcast);
}
}, null);
updateTabTitle();
mViewPager.setOffscreenPageLimit(mTabAdapter.getCount() - 1);
mViewPager.setAdapter(mTabAdapter);
mTabLayout.setupWithViewPager(mViewPager);
mPositiveButton.setText(R.string.ok);
mPositiveButton.setVisibility(View.VISIBLE);
mPositiveButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
dismiss();
}
});
mNegativeButton.setVisibility(View.GONE);
mNeutralButton.setVisibility(View.GONE);
}
use of me.zhanghai.android.douya.ui.TabFragmentPagerAdapter in project Douya by DreaminginCodeZH.
the class HomeFragment method onActivityCreated.
@Override
public void onActivityCreated(Bundle savedInstanceState) {
super.onActivityCreated(savedInstanceState);
AppCompatActivity activity = (AppCompatActivity) getActivity();
activity.setSupportActionBar(mToolbar);
mTabAdapter = new TabFragmentPagerAdapter(this);
mTabAdapter.addTab(new TabFragmentPagerAdapter.FragmentCreator() {
@Override
public Fragment createFragment() {
return HomeBroadcastListFragment.newInstance();
}
}, getString(R.string.home_broadcast));
mTabAdapter.addTab(new TabFragmentPagerAdapter.FragmentCreator() {
@Override
public Fragment createFragment() {
return NotYetImplementedFragment.newInstance();
}
}, getString(R.string.home_discover));
mTabAdapter.addTab(new TabFragmentPagerAdapter.FragmentCreator() {
@Override
public Fragment createFragment() {
return NotYetImplementedFragment.newInstance();
}
}, getString(R.string.home_online));
mViewPager.setOffscreenPageLimit(mTabAdapter.getCount() - 1);
mViewPager.setAdapter(mTabAdapter);
mTabLayout.setupWithViewPager(mViewPager);
}
Aggregations