Search in sources :

Example 16 with FragmentsPagerAdapter

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());
        }
    });
}
Also used : FragmentsPagerAdapter(com.fastaccess.ui.adapter.FragmentsPagerAdapter) TabLayout(android.support.design.widget.TabLayout)

Example 17 with FragmentsPagerAdapter

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());
        }
    });
}
Also used : FragmentsPagerAdapter(com.fastaccess.ui.adapter.FragmentsPagerAdapter) TabLayout(android.support.design.widget.TabLayout)

Aggregations

FragmentsPagerAdapter (com.fastaccess.ui.adapter.FragmentsPagerAdapter)17 TabLayout (android.support.design.widget.TabLayout)11 ViewPager (android.support.v4.view.ViewPager)7 Commit (com.fastaccess.data.dao.model.Commit)1 Gist (com.fastaccess.data.dao.model.Gist)1 Issue (com.fastaccess.data.dao.model.Issue)1 Login (com.fastaccess.data.dao.model.Login)1 PullRequest (com.fastaccess.data.dao.model.PullRequest)1 IssueTimelineFragment (com.fastaccess.ui.modules.repos.issues.issue.details.timeline.IssueTimelineFragment)1 PullRequestTimelineFragment (com.fastaccess.ui.modules.repos.pull_requests.pull_request.details.timeline.timeline.PullRequestTimelineFragment)1 Date (java.util.Date)1