Ejemplo n.º 1
0
  @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);
  }
Ejemplo n.º 2
0
  @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());
  }