{"id":13604222,"url":"https://github.com/arimorty/floatingsearchview","last_synced_at":"2025-05-14T12:10:38.364Z","repository":{"id":39618017,"uuid":"46643413","full_name":"arimorty/floatingsearchview","owner":"arimorty","description":"A search view that implements a floating search bar also known as persistent search","archived":false,"fork":false,"pushed_at":"2022-08-28T17:46:50.000Z","size":7915,"stargazers_count":3540,"open_issues_count":78,"forks_count":667,"subscribers_count":84,"default_branch":"master","last_synced_at":"2025-04-11T22:59:18.470Z","etag":null,"topics":["android","floatingsearchview","material-design","material-ui","persistent-search"],"latest_commit_sha":null,"homepage":"https://github.com/arimorty/floatingsearchview/blob/master/README.md","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/arimorty.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-11-22T02:38:32.000Z","updated_at":"2025-02-28T05:21:01.000Z","dependencies_parsed_at":"2022-08-30T09:20:38.671Z","dependency_job_id":null,"html_url":"https://github.com/arimorty/floatingsearchview","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/arimorty%2Ffloatingsearchview","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/arimorty%2Ffloatingsearchview/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/arimorty%2Ffloatingsearchview/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/arimorty%2Ffloatingsearchview/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/arimorty","download_url":"https://codeload.github.com/arimorty/floatingsearchview/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254140758,"owners_count":22021219,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["android","floatingsearchview","material-design","material-ui","persistent-search"],"created_at":"2024-08-01T19:00:41.827Z","updated_at":"2025-05-14T12:10:38.307Z","avatar_url":"https://github.com/arimorty.png","language":"Java","funding_links":[],"categories":["SearchView","Java"],"sub_categories":[],"readme":"Floating Search View [![Android Arsenal](https://img.shields.io/badge/Android%20Arsenal-Floating%20Search%20View-green.svg?style=true)](https://android-arsenal.com/details/1/2842)\n=============\n\nAn implementation of a floating search box with search suggestions, also called persistent search bar.\n\n![Alt text](/images/150696.gif)\n![Alt text](/images/1506tq.gif)\n![Alt text](/images/1508kn.gif)\n\n\nNote\n-----\n\nThis project is not being actively maintained. Have a look [here](https://github.com/arimorty/floatingsearchview/wiki) for information\nthat might help you make changes to your own copy of the code base.\n\n\n...\n\n\nUsage\n-----\n\n1. In your dependencies, add\n    ```\n         compile 'com.github.arimorty:floatingsearchview:2.1.1'\n    ```\n2. Add a FloatingSearchView to your view hierarchy, and make sure that it takes\n   up the full width and height of the screen\n3. Listen to query changes and provide suggestion items that implement SearchSuggestion\n\n**Example:**\n\n```xml\n       \u003ccom.arlib.floatingsearchview.FloatingSearchView\n                android:id=\"@+id/floating_search_view\"\n                android:layout_width=\"match_parent\"\n                android:layout_height=\"match_parent\"\n                app:floatingSearch_searchBarMarginLeft=\"@dimen/search_view_inset\"\n                app:floatingSearch_searchBarMarginTop=\"@dimen/search_view_inset\"\n                app:floatingSearch_searchBarMarginRight=\"@dimen/search_view_inset\"\n                app:floatingSearch_searchHint=\"Search...\"\n                app:floatingSearch_suggestionsListAnimDuration=\"250\"\n                app:floatingSearch_showSearchKey=\"false\"\n                app:floatingSearch_leftActionMode=\"showHamburger\"\n                app:floatingSearch_menu=\"@menu/menu_main\"\n                app:floatingSearch_close_search_on_keyboard_dismiss=\"true\"/\u003e\n```\n\n```\n  mSearchView.setOnQueryChangeListener(new FloatingSearchView.OnQueryChangeListener() {\n              @Override\n              public void onSearchTextChanged(String oldQuery, final String newQuery) {\n\n                  //get suggestions based on newQuery\n\n                  //pass them on to the search view\n                  mSearchView.swapSuggestions(newSuggestions);\n              }\n          });\n```\n\u003cbr/\u003e\n\n**Left action mode:**\n\nThe left action can be configured as follows:\n\nAdd \n```xml\n   app:floatingSearch_leftActionMode=\"[insert one of the options from table below]\"\n```\n\n\u003ctable\u003e\n    \u003ctr\u003e\n        \u003ctd\u003eshowHamburger\u003c/td\u003e\n        \u003ctd\u003e\u003cimg src=\"https://github.com/arimorty/floatingsearchview/blob/develop/images/vf2oi.gif\"/\u003e\u003c/td\u003e       \n    \u003c/tr\u003e    \n    \u003ctr\u003e\n       \u003ctd\u003eshowSearch\u003c/td\u003e\n       \u003ctd\u003e\u003cimg src=\"https://github.com/arimorty/floatingsearchview/blob/develop/images/vf91i.gif\"/\u003e\u003c/td\u003e        \n    \u003ctr\u003e\n        \u003ctd\u003eshowHome\u003c/td\u003e\n        \u003ctd\u003e\u003cimg src=\"https://github.com/arimorty/floatingsearchview/blob/develop/images/vf9cp.gif\"/\u003e\u003c/td\u003e       \n    \u003c/tr\u003e   \n    \u003ctr\u003e\n        \u003ctd\u003enoLeftAction\u003c/td\u003e\n        \u003ctd\u003e\u003cimg src=\"https://github.com/arimorty/floatingsearchview/blob/develop/images/vf2ii.gif\"/\u003e\u003c/td\u003e       \n    \u003c/tr\u003e\n\u003c/table\u003e\n\nListen to *hamburger* button clicks:\n```\n mSearchView.setOnLeftMenuClickListener(\n        new FloatingSearchView.OnLeftMenuClickListener() { ...} );          \n```\n\nTo quickly connect your **NavigationDrawer** to the *hamburger* button:\n```\n   mSearchView.attachNavigationDrawerToMenuButton(mDrawerLayout);\n```\n\nListen to home (back arrow) button clicks:\n```\n  mSearchView.setOnHomeActionClickListener(\n         new FloatingSearchView.OnHomeActionClickListener() { ... });       \n```\n\n\u003cbr/\u003e\n\n**Configure menu items:**\n\n![Alt text](/images/150sg9.gif)\n\nAdd a menu resource\n```xml\n    app:floatingSearch_menu=\"@menu/menu_main\"\n```\n\nIn the menu resource, set items' ```app:showAsAction=\"[insert one of the options described in the table below]\"```\n\n\u003ctable\u003e\n    \u003ctr\u003e\n        \u003ctd\u003enever\u003c/td\u003e\n        \u003ctd\u003ePuts the menu item in the overflow options popup\u003c/td\u003e\n    \u003c/tr\u003e\n    \u003ctr\u003e\n       \u003ctd\u003eifRoom\u003c/td\u003e\n       \u003ctd\u003eShows an action icon for the menu if the following conditions are met:\n       1. The search is not focused.\n       2. There is enough room for it.\n       \u003c/td\u003e\n    \u003c/tr\u003e\n    \u003ctr\u003e\n        \u003ctd\u003ealways\u003c/td\u003e\n        \u003ctd\u003eShows an action icon for the menu if there is room, regardless of whether the search is focused or not.\u003c/td\u003e\n    \u003c/tr\u003e   \n\u003c/table\u003e\n\nListen for item selections \n```  \n   mSearchView.setOnMenuItemClickListener(new FloatingSearchView.OnMenuItemClickListener() {\n      @Override\n      public void onMenuItemSelected(MenuItem item) {                  \n            \n      }\n   });\n```\n\n\u003cbr/\u003e\n\n\n**Configure suggestion item:**\n\nFirst, implement [SearchSuggestion](https://github.com/arimorty/floatingsearchview/blob/master/library/src/main/java/com/arlib/floatingsearchview/suggestions/model/SearchSuggestion.java) \n\n*Optional*:\n\nSet a callback for when a given suggestion is bound to the suggestion list.\n\nFor the history icons to show, you would need to implement this. Refer to the sample app for an [example implementation](https://github.com/arimorty/floatingsearchview/blob/master/sample/src/main/java/com/arlib/floatingsearchviewdemo/fragment/ScrollingSearchExampleFragment.java#L222).\n``` \n   mSearchView.setOnBindSuggestionCallback(new SearchSuggestionsAdapter.OnBindSuggestionCallback() {\n            @Override\n            public void onBindSuggestion(View suggestionView, ImageView leftIcon, TextView textView, SearchSuggestion item, int itemPosition) {\n\n                       //here you can set some attributes for the suggestion's left icon and text. For example,\n                       //you can choose your favorite image-loading library for setting the left icon's image. \n            }\n\n        });\n``` \n\n\u003cbr/\u003e\n\n**Styling:**\n\n\u003cimg src=\"https://github.com/arimorty/floatingsearchview/blob/develop/images/style_light.png\" width=\"350\"/\u003e\n\u003cimg src=\"https://github.com/arimorty/floatingsearchview/blob/develop/images/style_dark.png\" width=\"350\"/\u003e\n\nAvailable styling:\n\n```xml\n   \u003cstyle name=\"SearchView\"\u003e\n           \u003citem name=\"floatingSearch_backgroundColor\"\u003e\u003c/item\u003e\n           \u003citem name=\"floatingSearch_viewSearchInputTextColor\"\u003e\u003c/item\u003e\n           \u003citem name=\"floatingSearch_viewSuggestionItemTextColor\"\u003e\u003c/item\u003e\n           \u003citem name=\"floatingSearch_hintTextColor\"\u003e\u003c/item\u003e\n           \u003citem name=\"floatingSearch_dividerColor\"\u003e\u003c/item\u003e\n           \u003citem name=\"floatingSearch_clearBtnColor\"\u003e\u003c/item\u003e\n           \u003citem name=\"floatingSearch_leftActionColor\"\u003e\u003c/item\u003e\n           \u003citem name=\"floatingSearch_menuItemIconColor\"\u003e\u003c/item\u003e\n           \u003citem name=\"floatingSearch_suggestionRightIconColor\"\u003e\u003c/item\u003e\n           \u003citem name=\"floatingSearch_actionMenuOverflowColor\"\u003e\u003c/item\u003e\n   \u003c/style\u003e\n```\n### RxBinding Extension\nThe RxBinding library allows you to listen for query changes using RxJava Obervables. \n\n```java\nObservable\u003cCharSequence\u003e queryObservable = RxFloatingSearchView.queryChanges(view);\nqueryObservable.doOnNext { query -\u003e Toast.makeText(this, \"Query is %s\".format(query), Toast.LENGTH_LONG).show() }.subscribe();\n```\n\n### The Kotlin Extension\nThe Kotlin extension adds an extension function to the view for more goodness.\n\n```kotlin\nview.queryChanges(5).doOnNext { query -\u003e Toast.makeText(this, \"Query is %s\".format(query), Toast.LENGTH_LONG).show() }.subscribe()\n```\n\n\nLicense\n=======\n\n    Copyright (C) 2015 Ari C.\n\n    Licensed under the Apache License, Version 2.0 (the \"License\");\n    you may not use this file except in compliance with the License.\n    You may obtain a copy of the License at\n\n        http://www.apache.org/licenses/LICENSE-2.0\n\n    Unless required by applicable law or agreed to in writing, software\n    distributed under the License is distributed on an \"AS IS\" BASIS,\n    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n    See the License for the specific language governing permissions and\n    limitations under the License.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Farimorty%2Ffloatingsearchview","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Farimorty%2Ffloatingsearchview","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Farimorty%2Ffloatingsearchview/lists"}