@Override public void onPageSelected(int position) { super.onPageSelected(position); final String id = CommitUtils.abbreviate(ids[position].toString()); getSupportActionBar().setTitle(getString(R.string.commit_prefix) + id); }
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_pager); setSupportActionBar((android.support.v7.widget.Toolbar) findViewById(R.id.toolbar)); pager = finder.find(R.id.vp_pages); repository = getIntent().getParcelableExtra(EXTRA_REPOSITORY); ids = getCharSequenceArrayExtra(EXTRA_BASES); initialPosition = getIntExtra(EXTRA_POSITION); adapter = new CommitPagerAdapter(this, repository, ids); pager.setAdapter(adapter); pager.setOnPageChangeListener(this); pager.scheduleSetItem(initialPosition, this); onPageSelected(initialPosition); ActionBar actionBar = getSupportActionBar(); actionBar.setDisplayHomeAsUpEnabled(true); actionBar.setSubtitle(InfoUtils.createRepoId(repository)); avatars.bind(actionBar, repository.owner()); }