コード例 #1
0
  public void setAdapter(CardRecipientAdapter adapter) {
    beneficiary_name_et.setDropDownHorizontalOffset(5);
    beneficiary_name_et.setThreshold(1);
    beneficiary_name_et.setAdapter(adapter);
    beneficiary_name_et.setOnItemClickListener(
        new OnItemClickListener() {

          @Override
          public void onItemClick(AdapterView<?> arg0, View arg1, int arg2, long arg3) {
            CardRecipient item = (CardRecipient) arg0.getAdapter().getItem(arg2);
            beneficiary_name_et.setText(item.getName());
            iban_et.setText(item.getCardNumber());
          }
        });
  }
コード例 #2
0
 private void initAutoCompleteTextView() {
   mAutoCompleteTextView = (AutoCompleteTextView) findViewById(R.id.address);
   mAdapter = new NavAutoCompleteAdapter(this);
   mAutoCompleteTextView.setAdapter(mAdapter);
   mAutoCompleteTextView.setOnItemClickListener(
       new OnItemClickListener() {
         @Override
         public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
           NavigationInfo navigationInfo = mAdapter.getNavigationInfo(position);
           if (navigationInfo != null) {
             mTitle.setText(navigationInfo.getTitle());
           }
         }
       });
   mAutoCompleteTextView.setOnFocusChangeListener(
       new OnFocusChangeListener() {
         @Override
         public void onFocusChange(View v, boolean hasFocus) {
           mQuickBar.setVisibility(hasFocus && mIsPortrait ? View.VISIBLE : View.INVISIBLE);
         }
       });
   onConfigurationChanged(getResources().getConfiguration());
   mAutoCompleteTextView.setDropDownHorizontalOffset(-76);
   mTitle = (EditText) findViewById(R.id.title);
   mClearAddress = (ImageView) findViewById(R.id.clear_address_button);
   mClearTitle = (ImageView) findViewById(R.id.clear_title_button);
   mAutoCompleteTextView.addTextChangedListener(new ClearTextWatcher(mClearAddress));
   mTitle.addTextChangedListener(new ClearTextWatcher(mClearTitle));
   mClearAddress.setOnClickListener(this);
   mClearTitle.setOnClickListener(this);
   ReflectHelper.invokeMethod(
       mAutoCompleteTextView,
       "setCornerListView",
       new Class[] {boolean.class},
       new Object[] {true});
 }