Suggestive - An Android UI library that allows easy implementation of (text) input suggestion popup windows.

Overview

Suggestive 🍌

An Android UI library that allows easy implementation of (text) input suggestion popup windows.

  • Implement filtering using the onQuery callback
  • Creates suggestion popups from RecyclerView adapters
  • Creates suggestion popups from any View
  • Works and animates well with soft keyboard visibility changes
  • Automatically closes on back press if hosted in an AppCompatActivity

Gradle

Include the Bintray JCenter repository in the root build.gradle:

allprojects {
    repositories {
        maven {
            url  "https://jcenter.bintray.com"
        }
    }
}

Add the dependency to app build.gradle:

dependencies {
    implementation 'dev.xtr.suggestive:suggestive:1.0.3'
}

Sample

Create a suggestion popup from a recycler adapter
To create a popup window of a RecyclerView use Suggestive.recycler().
All named arguments are optional and set to their default in this sample.

// Create a suggestion popup containing a recycler view
Suggestive.recycler(

    // anchor to queryEditText
    queryEditText,
    
    // use the recycler view adapter
    adapter,
    
    // only invoke onQuery at a minimum input of 3 characters
    minCharacters = 3,
            
    // attaches the text change listener that invokes [onQuery]
    attachTextChangeListener = true,
    
    // invoke onQuery with a minimum delay of 200 ms
    onQueryThrottle = 200,
    
    // align the popup to the start of the anchor view
    gravity = Gravity.START,
    
    // use the background drawable for the popup window background
    backgroundDrawable = ContextCompat.getDrawable(this, R.drawable.popup_rounded_bg)!!,
    
    // constrains the popup windows width to the width of anchor
    constrainWidthToAnchorBounds = true,
    
    // hide the popup window when anchor loses focus
    hideOnBlur = true,
    
    // show the popup above or below anchor based on available space around anchor
    preferredPosition = SuggestionWindow.PreferredPosition.BEST_FIT,
    
    // dismisses the popup when the back button is pressed
    dismissOnBackPress = true,
    
    // the input query callback, called for every text change event on anchor
    //  (with exclusions as mandated by the minCharacters and onQueryThrottle options)
    onQuery = { query ->
    vm.search(query)
})

Create a suggestion popup from a view
To create a popup window of a view use Suggestive.view(), this method takes the same arguments as recycler().

val view: View = //...
Suggestive.view(anchorView, view)

Manipulate the popup manually
Both factory methods on the Suggestive object return instances of SuggestionWindow.
Use methods on this object to manipulate the popup manually:

val popup = Suggestive.view(anchorView, view)
popup.show() // popup.isHidden = true
popup.hide() // popup.isHidden = false
popup.requestLayout() // relayout the popup content view

Demo

See the demo gif below or try it out on Google Play:

Suggestive Demo GIF

Used By

Stockfix - Notification Drawer Stock Monitor

You might also like...
BottomSheet-Android - A simple customizable BottomSheet Library for Android Kotlin

BottomSheet-Android A simple customizable BottomSheet Library for Android Kotlin

Android library that provides the floating action button to sheet transition from Google's Material Design.
Android library that provides the floating action button to sheet transition from Google's Material Design.

MaterialSheetFab Library that implements the floating action button to sheet transition from Google's Material Design documentation. It can be used wi

Simple library which enable you to add a drawer(slide-out) navigation to your android application
Simple library which enable you to add a drawer(slide-out) navigation to your android application

SimpleSideDrawer is an android library to add a drawer navigation into your android application. This library has high affinity with other libraries l

Android Library for a DrawerLayout similar to the one in Google Apps
Android Library for a DrawerLayout similar to the one in Google Apps

GoogleNavigationDrawerMenu This project aims to let you use a ListView menu similar to the one in the new Google Apps (Keep, Play Music...) without ha

An Android library for managing multiple stacks of fragments
An Android library for managing multiple stacks of fragments

FragNav Android library for managing multiple stacks of fragments (e.g., Bottom Navigation , Navigation Drawer). This library does NOT include the UI

A floating menu library for Android.
A floating menu library for Android.

Hover Hover is a floating menu implementation for Android. Goals The goals of Hover are to: Provide an easy-to-use, out-of-the-box floating menu imple

Spotify like android material bottom navigation bar library.
Spotify like android material bottom navigation bar library.

SuperBottomBar About Spotify like android material bottom navigation bar library. GIF Design Credits All design and inspiration credits belongs to Spo

Suhuf is an android library that is used to build bottom sheets in an elegant way.

Suhuf is an android library that is used to build bottom sheets in an elegant way.

Neat library, that provides a simple way to implement guillotine-styled animation

Guillotine animation Neat library, that provides a simple way to implement guillotine-styled animation Check this [project on Dribbble] (https://dribb

Owner
xtr.dev
xtr.dev
Nested popup menus with smooth height animations

cascade cascade builds nested popup menus with smooth height animations. It is designed to be a drop-in replacement for PopupMenu so using it in your

Saket Narayan 1.6k Jan 6, 2023
** A slide-out menu implementation, which allows users to navigate between views in your app.

MenuDrawer A slide-out menu implementation, which allows users to navigate between views in your app. Most commonly the menu is revealed by either dra

Simon Vig Therkildsen 2.6k Dec 8, 2022
An Android library that allows you to easily create applications with slide-in menus. You may use it in your Android apps provided that you cite this project and include the license in your app. Thanks!

SlidingMenu (Play Store Demo) SlidingMenu is an Open Source Android library that allows developers to easily create applications with sliding menus li

Jeremy Feinstein 11.1k Dec 21, 2022
An Android Library that allows users to pull down a menu and select different actions. It can be implemented inside ScrollView, GridView, ListView.

AndroidPullMenu AndroidPullMenu is an Open Source Android library that allows developers to easily create applications with pull menu. The aim of this

Armando TBA 181 Nov 29, 2022
🚀 A very customizable library that allows you to present menu items (from menu resource and/or other sources) to users as a bottom sheet.

SlidingUpMenu A library that allows you to present menu items (from menu resource and/or other sources) to users as a bottom sheet. Gradle Dependency

Rasheed Sulayman 26 Jul 17, 2022
Implementation of "Side Navigation" or "Fly-in app menu" pattern for Android (based on Google+ app)

Android SideNavigation Library Implementation of "Side Navigation" or "Fly-in app menu" pattern for Android (based on Google+ app). Description The Go

Evgeny Shishkin 319 Nov 25, 2022
A powerful & customizable menu implementation for android.

A powerful & customizable menu implementation for android. It supports any level of nested menu structures along with custom header and footer views, and much more. Follow the steps below to import the library to your project. You will also find some sample codes.

Nowrose Muhammad Ragib 5 Nov 8, 2022
Simple and easy to use circular menu widget for Android.

Deprecated This project is no longer maintained. No new issues or pull requests will be accepted. You can still use the source or fork the project to

Anup Cowkur 420 Nov 25, 2022
A customizable and easy to use BottomBar navigation view with sleek animations, with support for ViewPager, ViewPager2, NavController, and badges.

AnimatedBottomBar A customizable and easy to use bottom bar view with sleek animations. Examples Playground app Download the playground app from Googl

Joery 1.2k Dec 30, 2022