private void setupAccounts( final Bundle savedInstanceState, final Collection<Account> accounts, final Config conf) { String accountId = null; Account account = null; if (savedInstanceState != null) accountId = savedInstanceState.getString(ARG_ACCOUNT_ID); if (accountId == null) accountId = this.intentExtras.getString(ARG_ACCOUNT_ID); if (accountId != null) { account = conf.getAccount(accountId); final List<String> svcs = this.intentExtras.getStringArrayList(ARG_SVCS); LOG.i("accountId=%s svcs=%s", account.getId(), svcs); this.enabledPostToAccounts.setAccount(account); this.enabledPostToAccounts.fromBundle(savedInstanceState); if (svcs != null && !this.enabledPostToAccounts.isServicesPreSpecified()) { for (String svc : svcs) { this.enabledPostToAccounts.enable(ServiceRef.parseServiceMeta(svc)); } this.enabledPostToAccounts.setServicesPreSpecified(true); } } else { this.askAccountOnActivate = true; } this.spnAccount = (Spinner) findViewById(R.id.spnAccount); this.accountAdaptor = new AccountAdaptor(getBaseContext(), accounts); this.spnAccount.setAdapter(this.accountAdaptor); setSelectedAccount(account); this.spnAccount.setOnItemSelectedListener(this.accountOnItemSelectedListener); this.llSubAccounts = (ViewGroup) findViewById(R.id.llSubAccounts); }
protected void submitPost(final Account account, final Set<ServiceRef> svcs) { final String body = this.txtBody.getText().toString(); final Intent recoveryIntent = new Intent(getBaseContext(), PostActivity.class) .putExtra(ARG_ACCOUNT_ID, account.getId()) .putExtra(ARG_IN_REPLY_TO_UID, this.inReplyToUid) .putExtra(ARG_IN_REPLY_TO_SID, this.inReplyToSid) .putExtra(ARG_ATTACHMENT, this.attachment) .putExtra(ARG_BODY, body); final ArrayList<String> svcsLst = new ArrayList<String>(); for (ServiceRef svc : svcs) { svcsLst.add(svc.toServiceMeta()); } recoveryIntent.putStringArrayListExtra(ARG_SVCS, svcsLst); new PostTask( getApplicationContext(), new PostRequest( account, svcs, body, this.inReplyToSid, this.attachment, recoveryIntent)) .execute(); finish(); }