コード例 #1
0
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    User owner = repository.getOwner();

    ActionBar actionBar = getSupportActionBar();
    actionBar.setTitle(repository.getName());
    actionBar.setSubtitle(owner.getLogin());
    actionBar.setDisplayHomeAsUpEnabled(true);

    if (owner.getAvatarUrl() != null && RepositoryUtils.isComplete(repository)) configurePager();
    else {
      avatars.bind(getSupportActionBar(), owner);
      ViewUtils.setGone(loadingBar, false);
      setGone(true);
      new RefreshRepositoryTask(this, repository) {

        @Override
        protected void onSuccess(Repository fullRepository) throws Exception {
          super.onSuccess(fullRepository);

          repository = fullRepository;
          configurePager();
        }

        @Override
        protected void onException(Exception e) throws RuntimeException {
          super.onException(e);

          ToastUtils.show(RepositoryViewActivity.this, string.error_repo_load);
          ViewUtils.setGone(loadingBar, true);
        }
      }.execute();
    }
  }
コード例 #2
0
 private void configurePager() {
   avatars.bind(getSupportActionBar(), repository.getOwner());
   configureTabPager();
   ViewUtils.setGone(loadingBar, true);
   setGone(false);
 }