Esempio n. 1
0
  @Override
  public void invalidateOptionsMenu() {
    super.invalidateOptionsMenu();

    if (applyItem != null)
      applyItem.setEnabled(adapter != null && !TextUtils.isEmpty(adapter.getCommentText()));
  }
  @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();
    }
  }
Esempio n. 3
0
  @Override
  protected void setCurrentItem(int position) {
    super.setCurrentItem(position);

    adapter.setCurrentItem(position);
  }
Esempio n. 4
0
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    configureTabPager();
  }
 @Override
 public void onBackPressed() {
   if (adapter == null || pager.getCurrentItem() != ITEM_CODE || !adapter.onBackPressed())
     super.onBackPressed();
 }