brianbaliat / SearchView

Persistent SearchView Library in Material Design.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

SearchView

I AM WORKING ON THIS PROJECT FINALLY AGAIN... Next version will be ASAP

Persistent SearchView Library like Play Store.
Check the sample project very thoroughly !!!
Features: Material Design, Toolbar / Menu item version, History, Styling.
Google Material Design Pattern:
https://www.google.com/design/spec/patterns/search.html
Version history here:
https://bintray.com/lapism/maven/searchview/view
Material colors in the project:
https://gist.github.com/lapism/3b417142300d9dbde3b4
Sample application on:
Get it on Google Play

Because I have done firstly this library as a private project, I would like to know if someone of you use my library in your application. If yes, please send me a name of your app and link to Play Store and I will promote your app in Readme.

Apps using this library:

Service Notes
Business Card Reader
Toiletto
Zikobot
AllWeather
Karaoke Online Sing & Record
Playbuzz
MovieTracker
MaxTorz
RealTime Subscriber YouTube
Lucidity - Lucid Dream Journal
Guide COC

Known bugs:

  • no divider when SearchView starts.
  • no keyboard when SearchView is in landscape mode.

Usage

Add the dependencies to your gradle file:

dependencies {
    compile 'com.lapism:searchview:4.0'
}

Screenshot 1 Screenshot 2 Screenshot 3

Code:

@Override
public boolean onOptionsItemSelected(MenuItem item) {
    switch (item.getItemId()) {
        case R.id.action_search: {
            mSearchView.show(true/false); // animate, ONLY FOR MENU ITEM !
            return true;
        }
        default:
            return super.onOptionsItemSelected(item);
    }
}

XML:

<com.lapism.searchview.SearchView
    android:id="@+id/searchView"
    android:layout_width="match_parent"
    android:layout_height="match_parent" />

VERSION CODES

SearchView identifies its layout style through versions. Currently, there are two values, namely SearchView.VERSION_TOOLBAR for the persistent view, and SearchView.VERSION_MENU_ITEM for the view that appears on a menuitem press. The version may be defined through setVersion

Styling SearchView:

<attr name="search_height" format="dimension" />
<attr name="search_version" format="enum">
    <enum name="toolbar" value="1000" />
    <enum name="menu_item" value="1001" />
</attr>
<attr name="search_version_margins" format="enum">
    <enum name="toolbar_small" value="2000" />
    <enum name="toolbar_big" value="2001" />
    <enum name="menu_item" value="2002" />
</attr>
<attr name="search_theme" format="enum">
    <enum name="light" value="3000" />
    <enum name="dark" value="3001" />
</attr>
<attr name="search_navigation_icon" format="integer" />
<attr name="search_icon_color" format="color" />
<attr name="search_background_color" format="color" />
<attr name="search_text_color" format="color" />
<attr name="search_text_highlight_color" format="color" />
<attr name="search_text_size" format="dimension" />
<attr name="search_text_style" format="enum">
    <enum name="normal" value="0" />
    <enum name="bold" value="1" />
    <enum name="italic" value="2" />
    <enum name="bold_italic" value="3" />
</attr>
<attr name="search_hint" format="string" />
<attr name="search_hint_color" format="color" />
<attr name="search_divider" format="boolean" />
<attr name="search_voice" format="boolean" />
<attr name="search_voice_text" format="string" />
<attr name="search_animation_duration" format="integer" />
<attr name="search_shadow" format="boolean" />
<attr name="search_shadow_color" format="boolean" />
<attr name="search_elevation" format="dimension" />
<attr name="search_clear_on_open" format="boolean" />
<attr name="search_clear_on_close" format="boolean" />
<attr name="search_hide_on_keyboard_close" format="boolean" />
<attr name="search_cursor_drawable" format="integer" />

About

Persistent SearchView Library in Material Design.

License:Apache License 2.0


Languages

Language:Java 100.0%