GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - loukaspd/MultiSelectAutocomplete: EditText with Autocomplete Functionality that supports customizing how the items will be drawn

BranchesTags
Open more actions menu

Latest commit

 

History

29 Commits
29 Commits

Folders and files

NameName
Last commit message
Last commit date
.idea
.idea
 
 
gradle/wrapper
gradle/wrapper
 
 
multiselectautocomplete
multiselectautocomplete
 
 
sample
sample
 
 
.gitignore
.gitignore
 
 
LICENSE
LICENSE
 
 
Readme.md
Readme.md
 
 
build.gradle
build.gradle
 
 
gradle.properties
gradle.properties
 
 
gradlew
gradlew
 
 
gradlew.bat
gradlew.bat
 
 
settings.gradle
settings.gradle
 
 

Repository files navigation

Download

MultiSelectAutocomplete

EditText with Autocomplete Functionality based on Autocomplete library that supports customizing how the items will be drawn and Multiple selected items

    implementation 'gr.loukaspd:multiselectautocomplete:latest'
    implementation 'com.otaliastudios:autocomplete:1.1.0'
    implementation 'com.android.support:recyclerview-v7:27.1.1'

replace with latest version number

To see it in action, take a look at the sample app in the sample module.

Dependencies

This library uses the Autocomplete library.

Usage

  1. include <gr.loukaspd.multiselectautocomplete.MultiSelectAutocomplete> element in your layout file instead on EditText
  2. Stup the Autocomplete Element by calling input.initialize(IMultiSelectUi, ArrayList<T>)

IMultiSelectUi

This is an interface that controls how to draw the items inside the AutocompleteDropdown and the selected items inside the EditText

public interface IMultiSelectUi<T>  {

    /**
     * Extract the text from an item
     * @param item
     * @return
     */
    String getItemText(T item);

    /**
     * Layout file that will be used to inflate the autocomplete items
     * @return the layout file Resource Id
     */
    int autocompleteLayoutRes();

    /**
     * Update the view of the layout item
     * @param rootView the view inflated from {@link #autocompleteLayoutRes()}
     * @param item
     */
    void autocompleteUpdateView(View rootView, T item);


    /**
     * Layout file that will be used to inflate the selected items inside the input
     * @return the layout file Resource Id
     */
    int selectedItemLayoutRes();


    /**
     * Update the view of the layout item
     * @param rootView the view inflated from {@link #selectedItemLayoutRes()}
     * @param item
     */
    void selectedItemUpdateView(View rootView, T item);
}
  • getItemText(): returns the text representation from an item, used for filtering autocomplete items
  • autocompleteLayoutRes(): returns the resource id of the layout file that will be used to draw the items inside the autocomplete dialog
  • autocompleteUpdateView(View rootView, T item): update the view with data from the specified item inside the autocomplete dialog
  • selectedItemLayoutRes(): returns the resource id of the layout file that will be used to draw the selected items inside the EditText
  • selectedItemUpdateView(View rootView, T item): update the view with data from the specified item inside the EditText

XML Attributes

You can change view attributes directly from your layout's xml file or in your java/kotlin code:

Variable XML Attribute Type Description
supportMultiple supportMultiple boolean if EditText can have multiple selected items
showOptionsOnFocus showOptionsOnFocus boolean show the popup with autocomplete options when EditText gets focus
clearUnmatchedText clearUnmatchedText boolean clear all text that is not matched when EditText loses focus
showKeyboardOnFocus showKeyboardOnFocus boolean show the keyboard when EditText gets focus
removeSelectedItem removeSelectedItem boolean when an item is selected it will be removed from options popup
popupElevation popupElevation float sets the elevtion of the autocomplete popup
popupWidth popupWidth dimension set the width of the autocomplete popup window
popupHeight popupHeight dimension set the height of the autocomplete popup window

Programmatic Attributes

These must be set before calling the initialize method

  • setPopupBackground(Drawable drawable): set the background of the autocomplete popup window

About

EditText with Autocomplete Functionality that supports customizing how the items will be drawn

Topics

androidautocompleteedittextlibrary

Resources

Readme
Apache-2.0 license
Activity

Stars

2 stars

Watchers

1 watching

Forks

0 forks
Report repository

Releases

Packages

Used by

Contributors

Languages

You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.