/** {@inheritDoc} */ @Override protected void onResume() { super.onResume(); // Update add to contacts status updateAddToContactsStatus(ViewUtil.isCompoundChecked(getContentView(), R.id.addToContacts)); flagPaused = false; }
/** {@inheritDoc} */ @Override protected void onDestroy() { super.onDestroy(); if (flagPaused) { return; } if (ViewUtil.isCompoundChecked(getContentView(), R.id.addToContacts) && responseCode.equals(AuthorizationResponse.ACCEPT)) { // Add to contacts Spinner groupSpinner = (Spinner) findViewById(R.id.selectGroupSpinner); ContactListUtils.addContact( request.contact.getProtocolProvider(), (MetaContactGroup) groupSpinner.getSelectedItem(), request.contact.getAddress()); } request.notifyResponseReceived(responseCode); }
/** {@inheritDoc} */ @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.authorization_requested); long requestId = getIntent().getLongExtra(EXTRA_REQUEST_ID, -1); if (requestId == -1) throw new IllegalArgumentException(); this.request = AuthorizationHandlerImpl.getRequest(requestId); View content = findViewById(android.R.id.content); ViewUtil.setTextViewValue( content, R.id.requestInfo, getString( R.string.service_gui_AUTHORIZATION_REQUESTED_INFO, request.contact.getDisplayName())); ViewUtil.setTextViewValue( content, R.id.addToContacts, getString(R.string.service_gui_ADD_AUTHORIZED_CONTACT, request.contact.getDisplayName())); Spinner contactGroupSpinner = (Spinner) findViewById(R.id.selectGroupSpinner); contactGroupSpinner.setAdapter(new MetaContactGroupAdapter(this)); CompoundButton addToContactsCb = (CompoundButton) findViewById(R.id.addToContacts); addToContactsCb.setOnCheckedChangeListener( new CompoundButton.OnCheckedChangeListener() { @Override public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { updateAddToContactsStatus(isChecked); } }); }
/** * The method is fired when <tt>Activity</tt> is paused. Then it may be destroyed and recreated * later, so we mark flag paused here to prevent from discarding the request too early in * <tt>onDestroy</tt> event. This happens when device is rotated. */ @Override protected void onSaveInstanceState(Bundle outState) { super.onSaveInstanceState(outState); this.flagPaused = true; }