Java 类android.widget.MultiAutoCompleteTextView 实例源码

项目:snu-artoon    文件:MainActivity.java   
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    autoComplete = (AutoCompleteTextView)findViewById(R.id.autoComplete);
    multiComplete = (MultiAutoCompleteTextView)findViewById(R.id.multiAutoComplete);

    // The lists to be shown to the user.
    String[] lists = {"Hello-World", "Hello-Thanks", "Hello-Morning",
                      "Bye-World", "Bye-Thanks", "Bye-Morning"};

    // To link the data and the view, we should use 'Adapter'.
    ArrayAdapter<String> adapter = new ArrayAdapter<String>(this,
            android.R.layout.simple_dropdown_item_1line,
            lists);

    // Link the adapter above to the view.
    autoComplete.setAdapter(adapter);


    // Set the tokenizer for the multiComplete.
    multiComplete.setTokenizer(new MultiAutoCompleteTextView.CommaTokenizer());
    multiComplete.setAdapter(adapter);
}
项目:DoneForAndroid    文件:NewDoneActivity.java   
private void saveActivityState() {
    MultiAutoCompleteTextView taskTextEditText = (MultiAutoCompleteTextView) findViewById(R.id.task_text_edit_text);
    if (taskTextEditText != null) {
        String taskText = taskTextEditText.getText().toString();

        if (!taskText.equals("")) {

            String[] state = new String[]{
                    taskText,
                    mTeam,
                    mDoneDate
            };
            Utils.setNewTaskActivityState(this, state);

            //Log.i(LOG_TAG, "Saved: " + state[0] + ", " + state[1]);
        } else
            Utils.clearNewTaskActivityState(this);
    }
}
项目:hooold    文件:CreateActivity.java   
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    String mAction = getIntent().getAction();
    getToolbar().setTitle(mAction + getString(R.string.activity_create_title_suffix));

    boolean isEdit = false;
    if (mAction != null) {
        isEdit = mAction.equals(Consts.MESSAGE_EDIT);
    }

    mContact.setTokenizer(new MultiAutoCompleteTextView.CommaTokenizer());
    BaseRecipientAdapter adapter = new BaseRecipientAdapter(
            BaseRecipientAdapter.QUERY_TYPE_PHONE, this);
    adapter.setShowMobileOnly(true);
    mContact.setAdapter(adapter);
    mContact.dismissDropDownOnItemSelected(true);

    if (isEdit) {
        mMessageId = getIntent().getExtras().getLong(Consts.KEY_MESSAGE_ID);
        Message message = Message.findById(Message.class, mMessageId);
        populate(message);
    } else {
        setDate(new Date());
    }
}
项目:android-support-learn    文件:AppCompatWidgetsTextInput.java   
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.appcompat_widgets_text_input);

    // Fetch the AutoCompleteTextView and set an adapter
    AutoCompleteTextView actv = (AutoCompleteTextView) findViewById(
            R.id.widgets_autocompletetextview);
    actv.setAdapter(new ArrayAdapter<>(this,
            android.R.layout.simple_dropdown_item_1line, Cheeses.sCheeseStrings));

    // Fetch the MultiAutoCompleteTextView and set an adapter and Tokenizer
    MultiAutoCompleteTextView mactv = (MultiAutoCompleteTextView) findViewById(
            R.id.widgets_multiautocompletetextview);
    mactv.setTokenizer(new MultiAutoCompleteTextView.CommaTokenizer());
    mactv.setAdapter(new ArrayAdapter<>(this,
            android.R.layout.simple_dropdown_item_1line, Cheeses.sCheeseStrings));
}
项目:YiBo    文件:EditCommentActivity.java   
@SuppressWarnings("unchecked")
@Override
   protected void onActivityResult(int requestCode, int resultCode, Intent data) {
       super.onActivityResult(requestCode, resultCode, data);

       switch(requestCode) {
       case Constants.REQUEST_CODE_USER_SELECTOR:
           if (resultCode == Constants.RESULT_CODE_SUCCESS) {
               List<User> userList = (List<User>)data.getSerializableExtra("LIST_USER");
               if (ListUtil.isEmpty(userList)) {
                userList = new ArrayList<User>();
               }
               MultiAutoCompleteTextView etText  =
                (MultiAutoCompleteTextView)this.findViewById(R.id.etText);
               StringBuilder mentions = new StringBuilder("");
               for (User user : userList) {
                   mentions.append(user.getMentionName()).append(" ");
               }
               int currentPos = etText.getSelectionStart();
               etText.getText().insert(currentPos, mentions);
           }
           break;
       default:
           break;
       }
   }
项目:Calendar_lunar    文件:EditEventView.java   
private MultiAutoCompleteTextView initMultiAutoCompleteTextView(RecipientEditTextView list) {
    if (ChipsUtil.supportsChipsUi()) {
        mAddressAdapter = new RecipientAdapter(mActivity);
        list.setAdapter((BaseRecipientAdapter) mAddressAdapter);
        list.setOnFocusListShrinkRecipients(false);
    } else {
        mAddressAdapter = new EmailAddressAdapter(mActivity);
        list.setAdapter((EmailAddressAdapter)mAddressAdapter);
    }
    list.setTokenizer(new Rfc822Tokenizer());
    list.setValidator(mEmailValidator);

    // NOTE: assumes no other filters are set
    list.setFilters(sRecipientFilters);

    return list;
}
项目:Multiplanner    文件:SearchFragment.java   
protected void setTextInTextViews(Location selectedItem) {
    if (plan.getFrom() != null) {
        // for(Location l : plan.getFrom())
        for (MultiAutoCompleteTextView view : textViews) {

            if (view.getText().toString().length() > 0
                    && !doesPlanContainthis(view.getText().toString())) {
                view.setText(selectedItem.getDisplayname());
                break;
            }
        }
    } else {
        textViews.get(0).setText(selectedItem.getDisplayname());
    }

}
项目:Multiplanner    文件:SearchFragment.java   
private int plannerSameSizeAsTextViews() {
    int plancount = 0;
    int textViewCount = 0;
    if (plan.getFrom() != null)
        plancount = plan.getFrom().size();
    for (MultiAutoCompleteTextView textView : textViews) {
        if (!textView.getText().toString().isEmpty())
            textViewCount++;
    }
    if (plancount == textViewCount)
        return 0;
    else if (plancount > textViewCount)
        return -1;
    else
        return 1;

}
项目:EosCommander    文件:UiUtils.java   
public static void setupAccountHistory( AutoCompleteTextView... autoTextViewArray ) {
    for ( AutoCompleteTextView actv : autoTextViewArray ) {
        AccountAdapter adapter = new AccountAdapter(actv.getContext(), R.layout.account_suggestion, R.id.eos_account);
        if (actv instanceof MultiAutoCompleteTextView) {
            ((MultiAutoCompleteTextView) actv).setTokenizer(new WhitSpaceTokenizer());
        }
        actv.setThreshold(1);
        actv.setAdapter(adapter);
    }
}
项目:buildAPKsApps    文件:RecipientsEditor.java   
RecipientsEditorTokenizer(Context context, MultiAutoCompleteTextView list) {
    mInflater = LayoutInflater.from(context);
    mList = list;

    final int size = android.R.style.TextAppearance_Small;
    final int color = 8;//android.R.styleable.Theme_textColorSecondary;
    mLabelSpan = new TextAppearanceSpan(context, size, color);
    mTypeSpan = new TextAppearanceSpan(context, size, color);
}
项目:UnifiedContactPicker    文件:ContactPickerFragment.java   
@Override
public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
    super.onViewCreated(view, savedInstanceState);
    this.mRecyclerView = (RecyclerView) view.findViewById(R.id.cp_listView);
    this.mNachoTextView = (NachoTextView) view.findViewById(R.id.nachoTextView);

    this.mNachoTextView.setTokenizer(new MultiAutoCompleteTextView.CommaTokenizer());
    this.mNachoTextView.setThreshold(3);
    this.mNachoTextView.setMaxLines(2);
    this.mNachoTextView.addChipTerminator(' ', ChipTerminatorHandler.BEHAVIOR_CHIPIFY_TO_TERMINATOR);
    this.mNachoTextView.setChipTokenizer(new SpanChipTokenizer<>(getContext(), new ContactChipCreator(), ChipSpan.class));

}
项目:bounswe2016group2    文件:SettingsFragment.java   
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
                         Bundle savedInstanceState) {
    // Inflate the diet_raw_layout for this fragment

    ViewGroup rootView = (ViewGroup)inflater.inflate(R.layout.fragment_settings, container, false);
    // Inflate the diet_raw_layout for this fragment


    lv = (ListView) rootView.findViewById(R.id.ingr_listviewSett);
    lv2 = (ListView) rootView.findViewById(R.id.dietListSett);
    calorieSeekBar = (RangeSeekBar<Integer>) rootView.findViewById(R.id.seekbarForCalorieSett);
    calorieSeekBar.setOnRangeSeekBarChangeListener(seekBarChnaged());
    fatSeekBar = (RangeSeekBar<Integer>) rootView.findViewById(R.id.seekBarForFatSett);
    fatSeekBar.setOnRangeSeekBarChangeListener(seekBarChnaged());
    proSeekBar = (RangeSeekBar<Integer>) rootView.findViewById(R.id.rangeSeekBarForProSett);
    proSeekBar.setOnRangeSeekBarChangeListener(seekBarChnaged());
    carbSeekBar = (RangeSeekBar<Integer>) rootView.findViewById(R.id.seekBarForCabSett);
    carbSeekBar.setOnRangeSeekBarChangeListener(seekBarChnaged());
    mtext1 = (MultiAutoCompleteTextView)rootView.findViewById(R.id.multiAutoCompleteTextView1Sett);
    saveBut = (Button) rootView.findViewById(R.id.saveDietSett);
    name = (EditText) rootView.findViewById(R.id.editTextNameSett);
    descr = (EditText)rootView.findViewById(R.id.editTextDescSett);
    return  rootView;


}
项目:Rhythm    文件:RhythmSandbox.java   
/**
 * Initialize a presenter for sandbox
 *
 * @param activity        Activity that hosts this sandbox
 * @param rootView        Root view of the sandbox
 * @param overlayInflater Overlay inflater used to inflate rhythm config
 */
public RhythmSandbox(AppCompatActivity activity, View rootView, RhythmOverlayInflater overlayInflater) {
    mActivity = activity;
    mOverlayInflater = overlayInflater;

    // Find and init preview layout
    mPreview = (RhythmFrameLayout) rootView.findViewById(R.id.preview);
    mPreview.setRhythmDrawable(new RhythmDrawable(null));

    // Find and init overlay config text box
    mOverlayConfig = (MultiAutoCompleteTextView) rootView.findViewById(R.id.config);
    mOverlayConfig.setHorizontallyScrolling(true);

    // Fix config text box metrics
    int i4dp = activity.getResources().getDimensionPixelOffset(R.dimen.i4dp);
    Utils.setExactMetrics(mOverlayConfig, i4dp * 6, i4dp * 5, i4dp * 3);

    // Enable auto-complete for config
    ArrayAdapter<String> adapter = new ArrayAdapter<>(activity, android.R.layout.simple_dropdown_item_1line, ALL_CONFIG_WORDS);
    mOverlayConfig.setTokenizer(new ConfigTokenizer());
    mOverlayConfig.setAdapter(adapter);

    // Find and init Apply button
    final Button applyButton = (Button) rootView.findViewById(R.id.apply);
    applyButton.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            updatePreview();
        }
    });
}
项目:daxSmail    文件:MessageCompose.java   
private void addAddresses(MultiAutoCompleteTextView view, String addresses) {
    if (StringUtils.isNullOrEmpty(addresses)) {
        return;
    }
    for (String address : addresses.split(",")) {
        addAddress(view, new Address(address, ""));
    }
}
项目:daxSmail    文件:MessageCompose.java   
private void addAddresses(MultiAutoCompleteTextView view, Address[] addresses) {
    if (addresses == null) {
        return;
    }
    for (Address address : addresses) {
        addAddress(view, address);
    }
}
项目:qksms    文件:AutoCompleteContactView.java   
private void init(Context context) {
    mContext = (QKActivity) context;

    mAdapter = new BaseRecipientAdapter(BaseRecipientAdapter.QUERY_TYPE_PHONE, getContext());

    setThreshold(1);
    setTokenizer(new MultiAutoCompleteTextView.CommaTokenizer());
    setAdapter(mAdapter);
    setOnItemClickListener(this);

    LiveViewManager.registerView(QKPreference.FONT_FAMILY, this, key -> {
        setTypeface(FontManager.getFont(mContext));
    });

    LiveViewManager.registerView(QKPreference.FONT_WEIGHT, this, key -> {
        setTypeface(FontManager.getFont(mContext));
    });

    LiveViewManager.registerView(QKPreference.FONT_SIZE, this, key -> {
        setTextSize(TypedValue.COMPLEX_UNIT_SP, FontManager.getTextSize(mContext, FontManager.TEXT_TYPE_PRIMARY));
    });

    LiveViewManager.registerView(QKPreference.BACKGROUND, this, key -> {
        setTextColor(ThemeManager.getTextOnBackgroundPrimary());
        setHintTextColor(ThemeManager.getTextOnBackgroundSecondary());
    });

    LiveViewManager.registerView(QKPreference.MOBILE_ONLY, this, key -> {
        if (mAdapter != null) {
            SharedPreferences prefs1 = mContext.getPrefs();
            mAdapter.setShowMobileOnly(prefs1.getBoolean(SettingsFragment.MOBILE_ONLY, false));
        }
    });
}
项目:box-android-share-sdk    文件:InviteCollaboratorsFragment.java   
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View view = inflater.inflate(R.layout.fragment_invite_collaborators, container, false);

    mFilterTerm = "";
    mRoleButton = (Button) view.findViewById(R.id.invite_collaborator_role);
    mRoleButton.setOnClickListener(this);
    mAutoComplete = (ChipCollaborationView) view.findViewById(R.id.invite_collaborator_autocomplete);
    mAutoComplete.setTokenizer(new MultiAutoCompleteTextView.CommaTokenizer());
    mAdapter = createInviteeAdapter(getActivity());
    mAdapter.setInviteeAdapterListener(this);
    mAutoComplete.setAdapter(mAdapter);
    mAutoComplete.setTokenListener(this);

    mCollabInitialsView = (CollaboratorsInitialsView) view.findViewById(R.id.collaboratorsInitialsView);
    mCollabInitialsView.setArguments((BoxCollaborationItem)mShareItem, mController);

    // Get serialized roles or fetch them if they are not available
    if (getCollaborationItem() != null && getCollaborationItem().getAllowedInviteeRoles() != null) {
        if(getCollaborationItem().getPermissions().contains(BoxItem.Permission.CAN_INVITE_COLLABORATOR)) {
            mRoles = getCollaborationItem().getAllowedInviteeRoles();
            BoxCollaboration.Role selectedRole = mRoles.get(0);
            setSelectedRole(selectedRole);
        } else {
            showNoPermissionToast();
            getActivity().finish();
        }
    } else {
        fetchRoles();
    }

    fetchInvitees();
    if (getArguments().getBoolean(EXTRA_USE_CONTACTS_PROVIDER)){
        requestPermissionsIfNecessary();
    }

    return view;
}
项目:CodeColors    文件:DefStyleHandler.java   
/**
 * Returns the default style attribute depending on the view class.
 * <p>
 * Order matters: a {@link CheckBox} is also {@link Button}, so we have to be careful when returning the default
 * style attribute.
 */
@SuppressLint({"InlinedApi", "PrivateResource"})
protected int getDefaultViewDefStyleAttr(View view) {
    if (view instanceof RadioButton) {
        return android.R.attr.radioButtonStyle;
    } else if (view instanceof CheckBox) {
        return android.R.attr.checkboxStyle;
    } else if (view instanceof Button) {
        return android.R.attr.buttonStyle;
    } else if (view instanceof MultiAutoCompleteTextView) {
        return android.R.attr.autoCompleteTextViewStyle;
    } else if (view instanceof AutoCompleteTextView) {
        return android.R.attr.autoCompleteTextViewStyle;
    } else if (view instanceof EditText) {
        return android.R.attr.editTextStyle;
    } else if (view instanceof CheckedTextView) {
        return Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1 ?
                android.R.attr.checkedTextViewStyle : 0;
    } else if (view instanceof TextView) {
        return android.R.attr.textViewStyle;
    } else if (view instanceof Spinner) {
        return android.R.attr.spinnerStyle;
    } else if (view instanceof ImageButton) {
        return android.R.attr.imageButtonStyle;
    } else if (view instanceof RatingBar) {
        return android.R.attr.ratingBarStyle;
    } else if (view instanceof SeekBar) {
        return android.R.attr.seekBarStyle;
    } else {
        return 0;
    }
}
项目:ApkLauncher    文件:AutoComplete6.java   
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.autocomplete_6);

    ArrayAdapter<String> adapter = new ArrayAdapter<String>(this,
            android.R.layout.simple_dropdown_item_1line, COUNTRIES);
    MultiAutoCompleteTextView textView = (MultiAutoCompleteTextView) findViewById(R.id.edit);
    textView.setAdapter(adapter);
    textView.setTokenizer(new MultiAutoCompleteTextView.CommaTokenizer());
}
项目:Shaarlier    文件:AutoCompleteWrapper.java   
public AutoCompleteWrapper(final MultiAutoCompleteTextView textView, Context context) {
    this.a_textView = textView;
    this.a_context = context;

    this.a_textView.setTokenizer(new SpaceTokenizer());

    this.adapter = new ArrayAdapter<>(a_context, R.layout.tags_list);
    this.a_textView.setAdapter(this.adapter);
    this.a_textView.setThreshold(1);
    updateTagsView();

    AutoCompleteRetriever task = new AutoCompleteRetriever();
    task.execute();
}
项目:ApiDemos    文件:AutoComplete6.java   
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.autocomplete_6);

    ArrayAdapter<String> adapter = new ArrayAdapter<String>(this,
            android.R.layout.simple_dropdown_item_1line, COUNTRIES);
    MultiAutoCompleteTextView textView = (MultiAutoCompleteTextView) findViewById(R.id.edit);
    textView.setAdapter(adapter);
    textView.setTokenizer(new MultiAutoCompleteTextView.CommaTokenizer());
}
项目:k-9    文件:MessageCompose.java   
private void addAddresses(MultiAutoCompleteTextView view, String addresses) {
    if (StringUtils.isNullOrEmpty(addresses)) {
        return;
    }
    for (String address : addresses.split(",")) {
        addAddress(view, new Address(address, ""));
    }
}
项目:k-9    文件:MessageCompose.java   
private void addAddresses(MultiAutoCompleteTextView view, Address[] addresses) {
    if (addresses == null) {
        return;
    }
    for (Address address : addresses) {
        addAddress(view, address);
    }
}
项目:YiBo    文件:EditRetweetActivity.java   
@SuppressWarnings("unchecked")
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
    super.onActivityResult(requestCode, resultCode, data);

    switch(requestCode) {
    case Constants.REQUEST_CODE_IMG_SELECTOR:
    case Constants.REQUEST_CODE_CAMERA:
        break;
    case Constants.REQUEST_CODE_USER_SELECTOR:
        if (resultCode == Constants.RESULT_CODE_SUCCESS) {
            List<User> userList = (List<User>)data.getSerializableExtra("LIST_USER");
               if (ListUtil.isEmpty(userList)) {
                userList = new ArrayList<User>();
               }
            MultiAutoCompleteTextView etText = (MultiAutoCompleteTextView)this.findViewById(R.id.etText);
            StringBuilder mentions = new StringBuilder();
            for (User user : userList) {
                mentions.append(user.getMentionName()).append(" ");
            }
            int currentPos = etText.getSelectionStart();
            etText.getText().insert(currentPos, mentions);
        }
        break;
    default:
        break;
    }
}
项目:prive-android    文件:AddContactActivity.java   
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    mApp = (ImApp)getApplication();
    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));

    TextView label = (TextView) 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 = (Button) findViewById(R.id.invite);
    mInviteButton.setText(brandingRes.getString(BrandingResourceIDs.STRING_BUTTON_ADD_CONTACT));
    mInviteButton.setOnClickListener(mButtonHandler);
    mInviteButton.setEnabled(false);
}
项目:felix-on-android    文件:AutoComplete6.java   
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.autocomplete_6);

    ArrayAdapter<String> adapter = new ArrayAdapter<String>(this,
            android.R.layout.simple_dropdown_item_1line, COUNTRIES);
    MultiAutoCompleteTextView textView = (MultiAutoCompleteTextView) findViewById(R.id.edit);
    textView.setAdapter(adapter);
    textView.setTokenizer(new MultiAutoCompleteTextView.CommaTokenizer());
}
项目:MEng    文件:AutoComplete6.java   
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.autocomplete_6);

    ArrayAdapter<String> adapter = new ArrayAdapter<String>(this,
            android.R.layout.simple_dropdown_item_1line, COUNTRIES);
    MultiAutoCompleteTextView textView = (MultiAutoCompleteTextView) findViewById(R.id.edit);
    textView.setAdapter(adapter);
    textView.setTokenizer(new MultiAutoCompleteTextView.CommaTokenizer());
}
项目:k-9-master    文件:MessageCompose.java   
private void addAddresses(MultiAutoCompleteTextView view, String addresses) {
    if (StringUtils.isNullOrEmpty(addresses)) {
        return;
    }
    for (String address : addresses.split(",")) {
        addAddress(view, new Address(address, ""));
    }
}
项目:k-9-master    文件:MessageCompose.java   
private void addAddresses(MultiAutoCompleteTextView view, Address[] addresses) {
    if (addresses == null) {
        return;
    }
    for (Address address : addresses) {
        addAddress(view, address);
    }
}
项目:Multiplanner    文件:SearchFragment.java   
private void enableButton() {
    int containing = 0;
    for (MultiAutoCompleteTextView view : textViews) {
        if (!view.getText().toString().isEmpty())
            containing++;
    }
    if (autoTo.getText().toString().isEmpty()) {
        okbutton.setEnabled(false);
        return;
    }
    if (containing > 0) {
        okbutton.setEnabled(true);
    } else
        okbutton.setEnabled(false);
}
项目:Multiplanner    文件:SearchFragment.java   
private MultiAutoCompleteTextView getTextWithoutPlan() {
    if (plan.getTo() == null
            || !plan.getTo().getDisplayname()
                    .equals(autoTo.getText().toString()))
        return autoTo;
    if (plan.getFrom() == null)
        return textViews.get(0);
    else {
        for (int i = 0; i < plan.getFrom().size(); i++) {
            String text = textViews.get(i).getText().toString();
            String planText = plan.getFrom().get(i).getDisplayname();
            if (!text.equals(planText))
                return textViews.get(i);

        }
        for (int i = 0; i < textViews.size(); i++) {
            if (textViews.get(i).getText().toString().length() > 0) {
                if (i > (plan.getFrom().size() - 1))
                    return textViews.get(i);
                else if (plan.getFrom().get(i).getDisplayname()
                        .equals(textViews.get(i).getText().toString()))
                    continue;
                else
                    return textViews.get(i);
            }

        }
    }

    return null;

}
项目:Multiplanner    文件:SearchFragment.java   
private MultiAutoCompleteTextView createNewMultiCompleteTextView() {

        MultiAutoCompleteTextView view = new MultiAutoCompleteTextView(
                getActivity());
        view.setLayoutParams(textViews.get(0).getLayoutParams());
        view.setAdapter(adapter);
        setupTextViewDropdowns(view);
        view.setHint(getActivity().getString(R.string.from));
        textViews.add(view);
        setupImeTypesAndListner(view);
        setupfocusCHangeListener(view);

        return view;

    }
项目:Multiplanner    文件:SearchFragment.java   
private void setupfocusCHangeListener(MultiAutoCompleteTextView view) {
    view.setOnFocusChangeListener(new OnFocusChangeListener() {

        @Override
        public void onFocusChange(View v, boolean hasFocus) {
            // TODO Auto-generated method stub
            if (hasFocus)
                ScrollToView(v);
        }
    });
}
项目:codeexamples-android    文件:AutoComplete6.java   
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.autocomplete_6);

    ArrayAdapter<String> adapter = new ArrayAdapter<String>(this,
            android.R.layout.simple_dropdown_item_1line, COUNTRIES);
    MultiAutoCompleteTextView textView = (MultiAutoCompleteTextView) findViewById(R.id.edit);
    textView.setAdapter(adapter);
    textView.setTokenizer(new MultiAutoCompleteTextView.CommaTokenizer());
}
项目:Onosendai    文件:PostActivity.java   
private void setupTextBody () {
    this.txtBody = (MultiAutoCompleteTextView) findViewById(R.id.txtBody);
    final TextView txtCharRemaining = (TextView) findViewById(R.id.txtCharRemaining);
    this.txtBody.addTextChangedListener(new TextCounterWatcher(txtCharRemaining, this.txtBody));

    if (Intent.ACTION_SEND.equals(getIntent().getAction()) && "text/plain".equals(getIntent().getType())) {
        final String intentText = getIntent().getStringExtra(Intent.EXTRA_TEXT);
        if (intentText != null) {
            this.txtBody.setText(intentText);
            this.txtBody.setSelection(this.txtBody.getText().length());
        }
    }
}
项目:deview-2013-samples    文件:AutoComplete6.java   
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.autocomplete_6);

    ArrayAdapter<String> adapter = new ArrayAdapter<String>(this,
            android.R.layout.simple_dropdown_item_1line, COUNTRIES);
    MultiAutoCompleteTextView textView = (MultiAutoCompleteTextView) findViewById(R.id.edit);
    textView.setAdapter(adapter);
    textView.setTokenizer(new MultiAutoCompleteTextView.CommaTokenizer());
}
项目:WheredWeEat    文件:NewVisitActivity.java   
private void populateContactSearch() {
    List<String> contacts = new ArrayList<String>();
    ContentResolver cr = this.getContentResolver();
    Cursor cursor = cr.query(ContactsContract.Contacts.CONTENT_URI, CONTACT_COLUMNS, null, null, null);
    while (cursor.moveToNext()) {
        String name = cursor.getString(0);
        contacts.add(name);
    }
    cursor.close();

    ArrayAdapter<String> adapter = new ArrayAdapter<String>(this, R.layout.contact_list_item, contacts.toArray(new String[] {}));
    MultiAutoCompleteTextView txtFriends = (MultiAutoCompleteTextView) findViewById(R.id.newVisitFriends);
    txtFriends.setAdapter(adapter);
    txtFriends.setTokenizer(new MultiAutoCompleteTextView.CommaTokenizer());
}
项目:PeSanKita-android    文件:RecipientsEditor.java   
RecipientsEditorTokenizer(Context context, MultiAutoCompleteTextView list) {
    mList = list;
    mContext = context;
}
项目:Cable-Android    文件:RecipientsEditor.java   
RecipientsEditorTokenizer(Context context, MultiAutoCompleteTextView list) {
    mList = list;
    mContext = context;
}
项目:MDPreference    文件:EditText.java   
/**
 * Sets the Tokenizer that will be used to determine the relevant
 * range of the text where the user is typing.
 * <p>Only work when autoCompleMode is AUTOCOMPLETE_MODE_MULTI</p>
 */
public void setTokenizer(MultiAutoCompleteTextView.Tokenizer t) {
    if(mAutoCompleteMode != AUTOCOMPLETE_MODE_MULTI)
        return;
    ((MultiAutoCompleteTextView)mInputView).setTokenizer(t);
}