/** {@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); } }); }
/** {@inheritDoc} */ @Override public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) { super.onCreateOptionsMenu(menu, inflater); inflater.inflate(R.menu.actionbar_toggle_menu, menu); // Binds the button CompoundButton cBox = (CompoundButton) menu.findItem(R.id.toggleView).getActionView().findViewById(android.R.id.toggle); cBox.setOnCheckedChangeListener( new CompoundButton.OnCheckedChangeListener() { public void onCheckedChanged(CompoundButton cb, boolean checked) { model.setChecked(checked); } }); // Set label text ((TextView) menu.findItem(R.id.toggleView).getActionView().findViewById(android.R.id.text1)) .setText(getArguments().getString(ARG_LABEL_TEXT)); this.menu = menu; updateChecked(); }