use of com.fastaccess.ui.adapter.FragmentsPagerAdapter in project FastHub by k0shk0sh.
the class ProfilePagerFragment method onFragmentCreated.
@Override
protected void onFragmentCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
if (getArguments() == null) {
throw new RuntimeException("Bundle is null?");
}
String login = getArguments().getString(BundleConstant.EXTRA);
if (login == null) {
throw new RuntimeException("user is null?");
}
FragmentsPagerAdapter adapter = new FragmentsPagerAdapter(getChildFragmentManager(), FragmentPagerAdapterModel.buildForProfile(getContext(), login));
tabs.setTabGravity(TabLayout.GRAVITY_FILL);
tabs.setTabMode(TabLayout.MODE_SCROLLABLE);
pager.setAdapter(adapter);
tabs.setupWithViewPager(pager);
}
use of com.fastaccess.ui.adapter.FragmentsPagerAdapter in project FastHub by k0shk0sh.
the class IssuePagerActivity method onSetupIssue.
@Override
public void onSetupIssue(boolean isUpdate) {
hideProgress();
if (getPresenter().getIssue() == null) {
return;
}
onUpdateMenu();
Issue issueModel = getPresenter().getIssue();
setTaskName(issueModel.getRepoId() + " - " + issueModel.getTitle());
setTitle(String.format("#%s", issueModel.getNumber()));
if (getSupportActionBar() != null) {
getSupportActionBar().setSubtitle(issueModel.getRepoId());
}
updateViews(issueModel);
if (isUpdate) {
IssueTimelineFragment issueDetailsView = getIssueTimelineFragment();
if (issueDetailsView != null && getPresenter().getIssue() != null) {
issueDetailsView.onUpdateHeader();
}
} else {
if (pager.getAdapter() == null) {
Logger.e(getPresenter().commentId);
pager.setAdapter(new FragmentsPagerAdapter(getSupportFragmentManager(), FragmentPagerAdapterModel.buildForIssues(this, getPresenter().commentId)));
} else {
onUpdateTimeline();
}
}
if (!getPresenter().isLocked() || getPresenter().isOwner()) {
pager.addOnPageChangeListener(new ViewPager.SimpleOnPageChangeListener() {
@Override
public void onPageSelected(int position) {
super.onPageSelected(position);
hideShowFab();
}
});
}
hideShowFab();
}
use of com.fastaccess.ui.adapter.FragmentsPagerAdapter in project FastHub by k0shk0sh.
the class PullRequestPagerActivity method onSetupIssue.
@Override
public void onSetupIssue(boolean update) {
hideProgress();
if (getPresenter().getPullRequest() == null) {
return;
}
invalidateOptionsMenu();
PullRequest pullRequest = getPresenter().getPullRequest();
setTaskName(pullRequest.getRepoId() + " - " + pullRequest.getTitle());
updateViews(pullRequest);
if (update) {
PullRequestTimelineFragment issueDetailsView = getPullRequestTimelineFragment();
if (issueDetailsView != null && getPresenter().getPullRequest() != null) {
issueDetailsView.onUpdateHeader();
}
} else {
if (pager.getAdapter() == null) {
pager.setAdapter(new FragmentsPagerAdapter(getSupportFragmentManager(), FragmentPagerAdapterModel.buildForPullRequest(this, pullRequest)));
tabs.setupWithViewPager(pager);
tabs.addOnTabSelectedListener(new TabLayout.ViewPagerOnTabSelectedListener(pager) {
@Override
public void onTabReselected(TabLayout.Tab tab) {
super.onTabReselected(tab);
onScrollTop(tab.getPosition());
}
});
} else {
onUpdateTimeline();
}
}
pager.addOnPageChangeListener(new ViewPager.SimpleOnPageChangeListener() {
@Override
public void onPageSelected(int position) {
hideShowFab();
super.onPageSelected(position);
}
});
initTabs(pullRequest);
hideShowFab();
AnimHelper.mimicFabVisibility(getPresenter().hasReviewComments(), prReviewHolder, null);
reviewsCount.setText(String.format("%s", getPresenter().getCommitComment().size()));
}
use of com.fastaccess.ui.adapter.FragmentsPagerAdapter in project FastHub by k0shk0sh.
the class UserPagerActivity method onInitOrg.
@Override
public void onInitOrg(boolean isMember) {
hideProgress();
FragmentsPagerAdapter adapter = new FragmentsPagerAdapter(getSupportFragmentManager(), FragmentPagerAdapterModel.buildForOrg(this, login, isMember));
pager.setAdapter(adapter);
tabs.setTabGravity(TabLayout.GRAVITY_FILL);
tabs.setTabMode(TabLayout.MODE_SCROLLABLE);
tabs.setupWithViewPager(pager);
setTaskName(login);
}
use of com.fastaccess.ui.adapter.FragmentsPagerAdapter in project FastHub by k0shk0sh.
the class UserPagerActivity method onCreate.
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
Login currentUser = Login.getUser();
if (currentUser == null) {
onRequireLogin();
return;
}
if (savedInstanceState == null) {
if (getIntent() != null && getIntent().getExtras() != null) {
login = getIntent().getExtras().getString(BundleConstant.EXTRA);
isOrg = getIntent().getExtras().getBoolean(BundleConstant.EXTRA_TYPE);
index = getIntent().getExtras().getInt(BundleConstant.EXTRA_TWO, -1);
if (!InputHelper.isEmpty(login)) {
if (isOrg) {
getPresenter().checkOrgMembership(login);
} else {
if (!Login.getUser().getLogin().equalsIgnoreCase(login))
getPresenter().onCheckBlocking(login);
}
}
} else {
Login user = Login.getUser();
if (user == null) {
onRequireLogin();
return;
}
login = user.getLogin();
}
}
if (InputHelper.isEmpty(login)) {
finish();
return;
}
setTaskName(login);
setTitle(login);
if (login.equalsIgnoreCase(currentUser.getLogin())) {
selectProfile();
}
if (!isOrg) {
FragmentsPagerAdapter adapter = new FragmentsPagerAdapter(getSupportFragmentManager(), FragmentPagerAdapterModel.buildForProfile(this, login));
pager.setAdapter(adapter);
tabs.setTabGravity(TabLayout.GRAVITY_FILL);
tabs.setTabMode(TabLayout.MODE_SCROLLABLE);
tabs.setupWithViewPager(pager);
if (savedInstanceState == null) {
if (index != -1) {
pager.setCurrentItem(index);
}
}
} else {
if (getPresenter().getIsMember() == -1) {
getPresenter().checkOrgMembership(login);
} else {
onInitOrg(getPresenter().isMember == 1);
}
}
tabs.addOnTabSelectedListener(new TabLayout.ViewPagerOnTabSelectedListener(pager) {
@Override
public void onTabReselected(TabLayout.Tab tab) {
super.onTabReselected(tab);
onScrollTop(tab.getPosition());
}
});
pager.addOnPageChangeListener(new ViewPager.SimpleOnPageChangeListener() {
@Override
public void onPageSelected(int position) {
super.onPageSelected(position);
hideShowFab(position);
}
});
if (!isOrg) {
if (savedInstanceState != null && !counts.isEmpty()) {
Stream.of(counts).forEach(this::updateCount);
}
}
hideShowFab(pager.getCurrentItem());
}
Aggregations