@Override protected void initData() { repository = (Repository) context.getIntent().getSerializableExtra(Constants.Extra.REPOSITORY); curBranch = repository.getMasterBranch(); setLoadCache(CacheUtils.contain(getCacheName())); if (currCodeTree == null) execute(); else { ViewUtils.setVisibility(listPopup, View.VISIBLE, R.anim.alpha_in); branch.setText(curBranch); codeAdapter.setCodeTree(currCodeTree); if (!currCodeTree.name.equals(CodeTree.ROOT)) pathView.resetView(currCodeTree.currEntry.getPath()); } }
private void fillTabs() { mActionBar.removeAllTabs(); mActionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS); mActionBar.setSubtitle( StringUtils.isBlank(mSelectBranchTag) ? mRepository.getMasterBranch() : mSelectBranchTag); mAdapter = new RepositoryAdapter(getSupportFragmentManager()); mPager = (ViewPager) findViewById(R.id.pager); mPager.setAdapter(mAdapter); mPager.setOnPageChangeListener( new OnPageChangeListener() { @Override public void onPageScrollStateChanged(int arg0) {} @Override public void onPageScrolled(int arg0, float arg1, int arg2) {} @Override public void onPageSelected(int arg0) { mActionBar.getTabAt(arg0).select(); } }); Tab tab = mActionBar .newTab() .setText(R.string.about) .setTabListener(new TabListener<SherlockFragmentActivity>(this, 0 + "", mPager)); mActionBar.addTab(tab, mCurrentTab == 0); tab = mActionBar .newTab() .setText(R.string.repo_files) .setTabListener(new TabListener<SherlockFragmentActivity>(this, 1 + "", mPager)); mActionBar.addTab(tab, mCurrentTab == 1); tab = mActionBar .newTab() .setText(getResources().getQuantityString(R.plurals.commit, 2)) .setTabListener(new TabListener<SherlockFragmentActivity>(this, 2 + "", mPager)); mActionBar.addTab(tab, mCurrentTab == 2); }