private void getBranches() {
    GetRepoBranchesClient repoBranchesClient = new GetRepoBranchesClient(getActivity(), repoInfo);
    repoBranchesClient
        .observable()
        .observeOn(AndroidSchedulers.mainThread())
        .subscribe(
            new BranchesCallback(repoInfo) {

              @Override
              protected void showBranches(String[] branches, int defaultBranchPosition) {
                if (branches != null && branches.length > 0) {
                  pref_repo_default_branch.setEntries(branches);
                  pref_repo_default_branch.setEntryValues(branches);
                  pref_repo_default_branch.setValueIndex(defaultBranchPosition);
                  pref_repo_default_branch.setEnabled(true);
                }
              }
            });
  }
  private void changeBranch() {
    GetRepoBranchesClient repoBranchesClient = new GetRepoBranchesClient(this, getRepoInfo());
    repoBranchesClient.setOnResultCallback(
        new DialogBranchesCallback(this, getRepoInfo()) {
          @Override
          protected void onBranchSelected(String branch) {
            currentRepo.default_branch = branch;
            if (getSupportActionBar() != null) {
              getSupportActionBar().setSubtitle(branch);
            }
            if (listFragments != null) {
              for (Fragment fragment : listFragments) {
                if (fragment instanceof BranchManager) {
                  ((BranchManager) fragment).setCurrentBranch(branch);
                }
              }
            }
          }

          @Override
          protected void onNoBranches() {}
        });
    repoBranchesClient.execute();
  }