use of com.fastaccess.ui.adapter.FragmentsPagerAdapter in project FastHub by k0shk0sh.
the class RepoIssuesPagerFragment method onFragmentCreated.
@Override
protected void onFragmentCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
String repoId = getArguments().getString(BundleConstant.ID);
String login = getArguments().getString(BundleConstant.EXTRA);
if (login == null || repoId == null)
throw new NullPointerException("repoId || login is null???");
pager.setAdapter(new FragmentsPagerAdapter(getChildFragmentManager(), FragmentPagerAdapterModel.buildForRepoIssue(getContext(), login, repoId)));
tabs.setupWithViewPager(pager);
if (savedInstanceState != null && !counts.isEmpty()) {
Stream.of(counts).forEach(this::updateCount);
}
tabs.addOnTabSelectedListener(new TabLayout.ViewPagerOnTabSelectedListener(pager) {
@Override
public void onTabReselected(TabLayout.Tab tab) {
super.onTabReselected(tab);
onScrollTop(tab.getPosition());
}
});
}
use of com.fastaccess.ui.adapter.FragmentsPagerAdapter in project FastHub by k0shk0sh.
the class SearchActivity method onCreate.
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setTitle("");
pager.setAdapter(new FragmentsPagerAdapter(getSupportFragmentManager(), FragmentPagerAdapterModel.buildForSearch(this)));
tabs.setupWithViewPager(pager);
searchEditText.setAdapter(getAdapter());
searchEditText.setOnItemClickListener((parent, view, position, id) -> getPresenter().onSearchClicked(pager, searchEditText));
if (!tabsCountSet.isEmpty()) {
setupTab();
}
if (savedInstanceState == null && getIntent() != null) {
if (getIntent().hasExtra("search")) {
searchEditText.setText(getIntent().getStringExtra("search"));
getPresenter().onSearchClicked(pager, searchEditText);
}
}
tabs.addOnTabSelectedListener(new TabLayout.ViewPagerOnTabSelectedListener(pager) {
@Override
public void onTabReselected(TabLayout.Tab tab) {
super.onTabReselected(tab);
onScrollTop(tab.getPosition());
}
});
}
Aggregations