Show ContributorsTab only if you have permission to (#402)

add isRepoAdmin

extend Adapters

add check to RepoDetails

refactor var names

reformat code

Co-authored-by: 6543 <6543@obermui.de>
Co-authored-by: M M Arif <mmarif@swatian.com>
Reviewed-on: https://gitea.com/gitnex/GitNex/pulls/402
Reviewed-by: M M Arif <mmarif@swatian.com>
This commit is contained in:
6543
2020-04-14 19:25:36 +00:00
parent ab47e409e9
commit b8d8b34b0e
9 changed files with 682 additions and 575 deletions

View File

@@ -125,6 +125,15 @@ public class RepoDetailActivity extends BaseActivity implements BottomSheetRepoF
}
}
// only show Collaborators if you have permission to
final View collaboratorTab = vg.getChildAt(9);
if (tinyDb.getBoolean("isRepoAdmin")) {
collaboratorTab.setVisibility(View.VISIBLE);
}
else {
collaboratorTab.setVisibility(View.GONE);
}
mViewPager.addOnPageChangeListener(new TabLayout.TabLayoutOnPageChangeListener(tabLayout));
tabLayout.addOnTabSelectedListener(new TabLayout.ViewPagerOnTabSelectedListener(mViewPager));