use of android.support.v4.app.FragmentPagerAdapter in project BookReader by JustWayward.
the class BookDetailCommunityActivity method initDatas.
@Override
public void initDatas() {
mDatas = Arrays.asList(getResources().getStringArray(R.array.bookdetail_community_tabs));
mTabContents = new ArrayList<>();
mTabContents.add(BookDetailDiscussionFragment.newInstance(bookId));
mTabContents.add(BookDetailReviewFragment.newInstance(bookId));
mAdapter = new FragmentPagerAdapter(getSupportFragmentManager()) {
@Override
public int getCount() {
return mTabContents.size();
}
@Override
public Fragment getItem(int position) {
return mTabContents.get(position);
}
};
}
use of android.support.v4.app.FragmentPagerAdapter in project BookReader by JustWayward.
the class SubCategoryListActivity method initDatas.
@Override
public void initDatas() {
mDatas = Arrays.asList(getResources().getStringArray(R.array.sub_tabs));
mPresenter.attachView(this);
mPresenter.getCategoryListLv2();
mTabContents = new ArrayList<>();
mTabContents.add(SubCategoryFragment.newInstance(cate, "", gender, Constant.CateType.NEW));
mTabContents.add(SubCategoryFragment.newInstance(cate, "", gender, Constant.CateType.HOT));
mTabContents.add(SubCategoryFragment.newInstance(cate, "", gender, Constant.CateType.REPUTATION));
mTabContents.add(SubCategoryFragment.newInstance(cate, "", gender, Constant.CateType.OVER));
mAdapter = new FragmentPagerAdapter(getSupportFragmentManager()) {
@Override
public int getCount() {
return mTabContents.size();
}
@Override
public Fragment getItem(int position) {
return mTabContents.get(position);
}
};
}
use of android.support.v4.app.FragmentPagerAdapter in project BookReader by JustWayward.
the class SubRankActivity method initDatas.
@Override
public void initDatas() {
mDatas = Arrays.asList(getResources().getStringArray(R.array.sub_rank_tabs));
mTabContents = new ArrayList<>();
mTabContents.add(SubRankFragment.newInstance(week));
mTabContents.add(SubRankFragment.newInstance(month));
mTabContents.add(SubRankFragment.newInstance(all));
mAdapter = new FragmentPagerAdapter(getSupportFragmentManager()) {
@Override
public int getCount() {
return mTabContents.size();
}
@Override
public Fragment getItem(int position) {
return mTabContents.get(position);
}
};
}
use of android.support.v4.app.FragmentPagerAdapter in project PocketHub by pockethub.
the class FragmentPagerAdapter method clearAdapter.
/**
* This methods clears any fragments that may not apply to the newly
* selected org.
*
* @return this adapter
*/
public FragmentPagerAdapter clearAdapter() {
if (tags.isEmpty()) {
return this;
}
FragmentTransaction transaction = fragmentManager.beginTransaction();
for (String tag : tags) {
Fragment fragment = fragmentManager.findFragmentByTag(tag);
if (fragment != null) {
transaction.remove(fragment);
}
}
transaction.commit();
tags.clear();
return this;
}
use of android.support.v4.app.FragmentPagerAdapter in project priend by TakoJ.
the class CommunityActivity method onCreate.
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_community);
// Create the adapter that will return a fragment for each section
mPagerAdapter = new FragmentPagerAdapter(getSupportFragmentManager()) {
private final Fragment[] mFragments = new Fragment[] { new RecentPostsFragment(), new MyPostsFragment(), new MyTopPostsFragment() };
private final String[] mFragmentNames = new String[] { getString(R.string.heading_recent), getString(R.string.heading_my_posts), getString(R.string.heading_my_top_posts) };
@Override
public Fragment getItem(int position) {
return mFragments[position];
}
@Override
public int getCount() {
return mFragments.length;
}
@Override
public CharSequence getPageTitle(int position) {
return mFragmentNames[position];
}
};
// Set up the ViewPager with the sections adapter.
mViewPager = (ViewPager) findViewById(R.id.container);
mViewPager.setAdapter(mPagerAdapter);
TabLayout tabLayout = (TabLayout) findViewById(R.id.tabs);
tabLayout.setupWithViewPager(mViewPager);
// Button launches NewPostActivity
findViewById(R.id.fab_new_post).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
startActivity(new Intent(CommunityActivity.this, NewPostActivity.class));
}
});
}
Aggregations