/** * Method fired when "add" button is clicked. * * @param v add button's <tt>View</tt> */ public void onAddClicked(View v) { Spinner accountsSpiner = (Spinner) findViewById(R.id.selectAccountSpinner); Account selectedAcc = (Account) accountsSpiner.getSelectedItem(); if (selectedAcc == null) { logger.error("No account selected"); return; } ProtocolProviderService pps = selectedAcc.getProtocolProvider(); if (pps == null) { logger.error("No provider registered for account " + selectedAcc.getAccountName()); return; } View content = findViewById(android.R.id.content); String contactAddress = ViewUtil.getTextViewValue(content, R.id.editContactName); String displayName = ViewUtil.getTextViewValue(content, R.id.editDisplayName); if (displayName != null && displayName.length() > 0) { addRenameListener(pps, null, contactAddress, displayName); } Spinner groupSpinner = (Spinner) findViewById(R.id.selectGroupSpinner); ContactListUtils.addContact( pps, (MetaContactGroup) groupSpinner.getSelectedItem(), contactAddress); finish(); }
/** {@inheritDoc} */ @Override protected void onDestroy() { super.onDestroy(); if (!cancelled) { View content = findViewById(android.R.id.content); authWindow.setUsername(ViewUtil.getTextViewValue(content, R.id.username)); authWindow.setPassword(ViewUtil.getTextViewValue(content, R.id.password)); authWindow.setRememberPassword(ViewUtil.isCompoundChecked(content, R.id.store_password)); } if (!paused) { authWindow.setCanceled(cancelled); authWindow.windowClosed(); } }