예제 #1
0
 protected void accountSelected(final Account account) {
   switch (account.getProvider()) {
     case SUCCESSWHALE:
     case BUFFER:
       this.enabledPostToAccounts.setAccount(account);
       new PostToAccountLoaderTask(
               getApplicationContext(), this.llSubAccounts, this.enabledPostToAccounts)
           .executeOnExecutor(this.exec, account);
       break;
     default:
       this.llSubAccounts.setVisibility(View.GONE);
   }
 }
예제 #2
0
  protected void askPost() {
    final Account account = getSelectedAccount();
    final Set<ServiceRef> svcs = this.enabledPostToAccounts.copyOfServices();
    final AlertDialog.Builder dlgBld = new AlertDialog.Builder(this);

    String msg;
    switch (account.getProvider()) {
      case SUCCESSWHALE:
      case BUFFER:
        msg =
            String.format(
                "Post to these %s accounts?%n%s",
                account.getUiTitle(), ServiceRef.humanList(svcs, "\n"));
        break;
      default:
        msg = String.format("Post to %s?", account.getUiTitle());
    }
    dlgBld.setMessage(msg);

    dlgBld.setPositiveButton(
        "Post",
        new DialogInterface.OnClickListener() {
          @Override
          public void onClick(final DialogInterface dialog, final int which) {
            submitPost(account, svcs);
          }
        });

    dlgBld.setNegativeButton(
        "Cancel",
        new DialogInterface.OnClickListener() {
          @Override
          public void onClick(final DialogInterface dialog, final int whichButton) {
            dialog.cancel();
          }
        });

    dlgBld.show();
  }