Code Monkey home page Code Monkey logo

hiddensearchwithrecyclerview's Introduction

Build Status License: MIT Download

Scroll Down To Search Recycler View

An easy way to search in your recycler view without having an always-on display search view.

default sample

How does it work?

Ever wanted a recycler view with a search bar? That's a simple library that lets you wrap your recyclerView into my custom layout which provides a hidden searchview which you can show by scrolling up/down the recycler.

Include

To include this library in your Android project you have to use gradle.

compile 'com.nicolettilu:hiddensearchwithrecyclerview:0.0.2'

Setup

Here's how it works:

<com.nicolettilu.hiddensearchwithrecyclerview.HiddenSearchWithRecyclerView
    android:layout_width="match_parent"
    android:layout_height="match_parent">
    <android.support.v7.widget.RecyclerView
        android:layout_width="match_parent"
        android:layout_height="match_parent" />
</com.nicolettilu.hiddensearchwithrecyclerview.HiddenSearchWithRecyclerView>

You need to wrap your RecyclerView with the custom layout the library provides. At the moment the library provides this configurations:

<attr name="filterWhileTyping" format="boolean"/> <!-- default value: true -->
<attr name="scrollToTopBeforeShow" format="boolean" /> <!-- default value: false -->
<attr name="scrollToBottomBeforeHide" format="boolean" /> <!-- default value: false -->
<attr name="visibleAtInit" format="boolean" /> <!-- default value: false -->
<attr name="hideAtScroll" format="boolean" /> <!-- default value: true -->

You can customize thos attributes in the XML file:

<com.nicolettilu.hiddensearchwithrecyclerview.HiddenSearchWithRecyclerView
        android:id="@+id/hidden_search_with_recycler"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        app:scrollToBottomBeforeHide="true"
        app:scrollToTopBeforeShow="true"
        app:filterWhileTyping="false"
        app:visibleAtInit="true">
        <!-- your RecyclerView here -->
</com.nicolettilu.hiddensearchwithrecyclerview.HiddenSearchWithRecyclerView>

And in code as well:

val hiddenSearchWithInRecycler = findViewById(R.id.hidden_search_with_recycler) as HiddenSearchWithRecyclerView

hiddenSearchWithInRecycler.hideAtScroll = true
hiddenSearchWithInRecycler.visibleAtInit = false
hiddenSearchWithInRecycler.scrollToBottomBeforeHide = false
hiddenSearchWithInRecycler.scrollToTopBeforeShow = false
hiddenSearchWithInRecycler.filterWhileTyping = true

Here as some example of the results:

  • Default example (no configurations set) default sample

  • Scroll at top/bottom before hide/show SearchView example scroll before hide sample

  • SearchView shown at init example show at init sample

   

The MIT License (MIT)

Copyright © <year> <copyright holders>

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

hiddensearchwithrecyclerview's People

Contributors

lucanicoletti avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.