Exemplo n.º 1
0
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    mApp = ImApp.getApplication(this);
    mHandler = new SimpleAlertHandler(this);
    resolveIntent(getIntent());

    setContentView(R.layout.add_contact_activity);

    BrandingResources brandingRes = mApp.getBrandingResource(mProviderId);
    setTitle(brandingRes.getString(BrandingResourceIDs.STRING_ADD_CONTACT_TITLE));

    BhoTextView label = (BhoTextView) findViewById(R.id.input_contact_label);
    label.setText(brandingRes.getString(BrandingResourceIDs.STRING_LABEL_INPUT_CONTACT));

    mAddressList = (MultiAutoCompleteTextView) findViewById(R.id.email);
    mAddressList.setAdapter(new EmailAddressAdapter(this));
    mAddressList.setTokenizer(new Rfc822Tokenizer());
    mAddressList.addTextChangedListener(mTextWatcher);

    mListSpinner = (Spinner) findViewById(R.id.choose_list);

    Cursor c = queryContactLists();
    int initSelection =
        searchInitListPos(c, getIntent().getStringExtra(ImServiceConstants.EXTRA_INTENT_LIST_NAME));
    SimpleCursorAdapter adapter =
        new SimpleCursorAdapter(
            this,
            android.R.layout.simple_spinner_item,
            c,
            new String[] {Imps.ContactList.NAME},
            new int[] {android.R.id.text1});
    adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
    mListSpinner.setAdapter(adapter);
    mListSpinner.setSelection(initSelection);

    mInviteButton = (BhoButton) findViewById(R.id.invite);
    mInviteButton.setText(brandingRes.getString(BrandingResourceIDs.STRING_BUTTON_ADD_CONTACT));
    mInviteButton.setOnClickListener(mButtonHandler);
    mInviteButton.setEnabled(false);
  }
Exemplo n.º 2
0
 public void afterTextChanged(Editable s) {
   mInviteButton.setEnabled(s.length() != 0);
 }