Java 类android.support.v7.widget.AppCompatAutoCompleteTextView 实例源码

项目:place-search-dialog    文件:PlaceSearchDialog.java   
public void init() {

        locationET = (AppCompatAutoCompleteTextView) findViewById(R.id.place_search_dialog_location_ET);
        locationTIL = (TextInputLayout) findViewById(R.id.place_search_dialog_location_TIL);
        cancelTV = (AppCompatTextView) findViewById(R.id.place_search_dialog_cancel_TV);
        okTV = (AppCompatTextView) findViewById(R.id.place_search_dialog_ok_TV);
        headerImageIV = (ImageView) findViewById(R.id.place_search_dialog_header_image_IV);

        okTV.setOnClickListener(this);
        cancelTV.setOnClickListener(this);

        buildDialog();

        locationET.setOnItemClickListener(mAutocompleteClickListener);
        mAdapter = new PlaceAutocompleteAdapter(context, mGoogleApiClient, BOUNDS_WORLD, null);
        locationET.setThreshold(3);
        locationET.setAdapter(mAdapter);
    }
项目:Umbrella_android    文件:LocationDialog.java   
@Override
public boolean isValid(AppCompatAutoCompleteTextView view) {
    boolean value;
    try {
        Address address = autoComplete(mAutocompleteLocation.getText().toString()).get(0);
        if (address.getCountryCode().toLowerCase().equals("") && address.getCountryName().equals("")) {
            value = false;
        } else {
            mChosenAddress = address.getCountryName();
            value = true;
        }
    } catch (Exception e) {
        value = false;
    }

    return value;
}
项目:ForPDA    文件:QmsBlackListFragment.java   
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
    super.onCreateView(inflater, container, savedInstanceState);
    ViewStub viewStub = (ViewStub) findViewById(R.id.toolbar_content);
    viewStub.setLayoutResource(R.layout.toolbar_qms_black_list);
    viewStub.inflate();
    nickField = (AppCompatAutoCompleteTextView) findViewById(R.id.qms_black_list_nick_field);
    return view;
}
项目:ForPDA    文件:ChatThemeCreator.java   
public ChatThemeCreator(QmsChatFragment fragment) {
    this.fragment = fragment;
    viewStub = (ViewStub) this.fragment.findViewById(R.id.toolbar_content);
    viewStub.setLayoutResource(R.layout.toolbar_qms_new_theme);
    viewStub.inflate();
    nickField = (AppCompatAutoCompleteTextView) this.fragment.findViewById(R.id.qms_theme_nick_field);
    titleField = (AppCompatEditText) this.fragment.findViewById(R.id.qms_theme_title_field);
    this.userId = this.fragment.currentChat.getUserId();
    this.userNick = this.fragment.currentChat.getNick();
    this.themeTitle = this.fragment.currentChat.getTitle();
    initCreatorViews();
}
项目:CodeColors    文件:AppCompatDefStyleHandler.java   
@SuppressLint({"PrivateResource", "InlinedApi"})
@Override
protected int getDefaultViewDefStyleAttr(View view) {
    if (view instanceof AppCompatRadioButton) {
        return R.attr.radioButtonStyle;
    } else if (view instanceof AppCompatCheckBox) {
        return R.attr.checkboxStyle;
    } else if (view instanceof AppCompatButton) {
        return R.attr.buttonStyle;
    } else if (view instanceof AppCompatMultiAutoCompleteTextView) {
        return R.attr.autoCompleteTextViewStyle;
    } else if (view instanceof AppCompatAutoCompleteTextView) {
        return R.attr.autoCompleteTextViewStyle;
    } else if (view instanceof AppCompatEditText) {
        return R.attr.editTextStyle;
    } else if (view instanceof AppCompatCheckedTextView) {
        return Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1 ?
                android.R.attr.checkedTextViewStyle : 0;
    } else if (view instanceof AppCompatTextView) {
        return android.R.attr.textViewStyle;
    } else if (view instanceof AppCompatSpinner) {
        return R.attr.spinnerStyle;
    } else if (view instanceof AppCompatImageButton) {
        return R.attr.imageButtonStyle;
    } else if (view instanceof AppCompatRatingBar) {
        return R.attr.ratingBarStyle;
    } else if (view instanceof AppCompatSeekBar) {
        return R.attr.seekBarStyle;
    } else {
        return super.getDefaultViewDefStyleAttr(view);
    }
}
项目:Umbrella_android    文件:LocationDialog.java   
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
    View view = inflater.inflate(R.layout.location_view, container, false);
    mButtonCancel = (TextView) view.findViewById(R.id.place_search_dialog_cancel_TV);
    mButtonOk = (TextView) view.findViewById(R.id.place_search_dialog_ok_TV);
    mAutocompleteLocation = (AppCompatAutoCompleteTextView) view.findViewById(R.id.place_search_dialog_location_ET);
    mValidator = new Validator(this);
    mValidator.setValidationListener(this);
    mValidator.put(mAutocompleteLocation, new AutocompleteLocationRule());
    initOkButtons();
    initAutoCompleteOnItemClick();
    initAutoCompleteOnFocusChange();
    return view;
}
项目:BonjourBrowser    文件:RegisterServiceActivity.java   
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
    View view = inflater.inflate(R.layout.fragment_register_service, container, false);
    serviceNameEditText = (EditText) view.findViewById(R.id.service_name);
    regTypeEditText = (AppCompatAutoCompleteTextView) view.findViewById(R.id.reg_type);
    portEditText = (EditText) view.findViewById(R.id.port);

    serviceNameEditText.setOnEditorActionListener(this);
    regTypeEditText.setOnEditorActionListener(this);
    portEditText.setOnEditorActionListener(this);

    adapter = new TxtRecordsAdapter(getContext(), new HashMap<String, String>()){

        @Override
        public void onItemClick(View view, int position) {
            AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
            final String key = getKey(position);
            String value = getValue(position);
            // Inflate and set the layout for the dialog
            // Pass null as the parent view because its going in the dialog layout
            builder.setMessage("Do you really want to delete " + key + "=" + value + " ?")
                    .setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener() {
                        @Override
                        public void onClick(DialogInterface dialog, int id1) {
                            mRecords.remove(key);
                            adapter.swap(mRecords);
                            adapter.notifyDataSetChanged();
                        }
                    })
                    .setNegativeButton(android.R.string.cancel, new DialogInterface.OnClickListener() {
                        @Override
                        public void onClick(DialogInterface dialog, int id1) {

                        }
                    });
            builder.create().show();
        }
    };

    RecyclerView recyclerView = (RecyclerView) view.findViewById(R.id.recycler_view);
    recyclerView.setLayoutManager(new LinearLayoutManager(view.getContext(), LinearLayoutManager.VERTICAL, false));
    recyclerView.setAdapter(adapter);

    List<String> regTypes = BonjourApplication.getRegTypeManager(getContext()).getListRegTypes();
    regTypeEditText.setAdapter(new ArrayAdapter<>(getContext(), android.R.layout.select_dialog_item, regTypes));

    view.findViewById(R.id.fab).setOnClickListener(this);

    return view;
}