{"id":24248944,"url":"https://github.com/ferfalk/simplesearchview","last_synced_at":"2025-02-26T09:12:04.436Z","repository":{"id":43642392,"uuid":"153153532","full_name":"Ferfalk/SimpleSearchView","owner":"Ferfalk","description":"A simple SearchView for Android based on Material Design","archived":false,"fork":false,"pushed_at":"2023-11-04T20:26:55.000Z","size":208,"stargazers_count":327,"open_issues_count":24,"forks_count":61,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-02-19T08:14:30.449Z","etag":null,"topics":["android","android-library","material","searchview"],"latest_commit_sha":null,"homepage":null,"language":"Kotlin","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/Ferfalk.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2018-10-15T17:22:48.000Z","updated_at":"2025-02-10T09:25:28.000Z","dependencies_parsed_at":"2024-01-16T09:52:19.103Z","dependency_job_id":"17a96419-24d8-4908-83d2-5de0f5bf753d","html_url":"https://github.com/Ferfalk/SimpleSearchView","commit_stats":null,"previous_names":[],"tags_count":9,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Ferfalk%2FSimpleSearchView","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Ferfalk%2FSimpleSearchView/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Ferfalk%2FSimpleSearchView/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Ferfalk%2FSimpleSearchView/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Ferfalk","download_url":"https://codeload.github.com/Ferfalk/SimpleSearchView/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":240822657,"owners_count":19863307,"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","android-library","material","searchview"],"created_at":"2025-01-15T00:49:12.754Z","updated_at":"2025-02-26T09:12:04.372Z","avatar_url":"https://github.com/Ferfalk.png","language":"Kotlin","funding_links":[],"categories":[],"sub_categories":[],"readme":"# SimpleSearchView\n[![API](https://img.shields.io/badge/API-16%2B-brightgreen.svg?style=flat)](https://android-arsenal.com/api?level=16)\n[![Release](https://img.shields.io/github/release/Ferfalk/SimpleSearchView/all.svg?style=flat)](https://jitpack.io/#Ferfalk/SimpleSearchView)\n[![Android Arsenal](https://img.shields.io/badge/Android%20Arsenal-SimpleSearchView-brightgreen.svg?style=flat)](https://android-arsenal.com/details/1/7287)\n\nA simple SearchView for Android based on Material Design\n\n* API 16+ *(Reveal animation for API 21 and above, fade animation otherwise)*\n* Two styles\n* Option to hide TabLayout automatically when it opens\n* Text and animations listeners\n* Customization options\n\n\u003cimg alt=\"Card sample\" width=\"360\" height=\"600\" src=\"https://user-images.githubusercontent.com/13675455/46987845-4091c180-d0cc-11e8-8904-87f3c24d4c0a.gif\" /\u003e\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u003cimg alt=\"Bar sample\" width=\"360\" height=\"600\" src=\"https://user-images.githubusercontent.com/13675455/46987873-60c18080-d0cc-11e8-8d10-2b8cf8a4124b.gif\" /\u003e\n\n\n## Download\n\nAdd the JitPack repository to the build.gradle file:\n```groovy\nallprojects {\n    repositories {\n        ...\n        maven { url 'https://jitpack.io' }\n    }\n}\n```\nAdd the Gradle dependency:\n```groovy\nimplementation 'com.github.Ferfalk:SimpleSearchView:0.2.1'\n```\n\n\n## Usage\nAdd SimpleSearchView to your AppBarLayout:\n\n```xml\n\u003candroid.support.design.widget.AppBarLayout\n    android:id=\"@+id/appbar\"\n    android:layout_width=\"match_parent\"\n    android:layout_height=\"wrap_content\"\n    android:background=\"@color/colorPrimary\"\n    android:theme=\"@style/AppTheme.AppBarOverlay\"\u003e\n\n    \u003cFrameLayout\n        android:id=\"@+id/toolbar_container\"\n        android:layout_width=\"match_parent\"\n        android:layout_height=\"wrap_content\"\u003e\n\n        \u003candroid.support.v7.widget.Toolbar\n            android:id=\"@+id/toolbar\"\n            android:layout_width=\"match_parent\"\n            android:layout_height=\"wrap_content\"\n            app:popupTheme=\"@style/AppTheme.PopupOverlay\"\n            app:subtitle=\"@string/app_subtitle\"\n            app:title=\"Example\" /\u003e\n\n        \u003ccom.ferfalk.simplesearchview.SimpleSearchView\n            android:id=\"@+id/searchView\"\n            android:layout_width=\"match_parent\"\n            android:layout_height=\"match_parent\"\n            android:background=\"@color/colorPrimary\" /\u003e\n    \u003c/FrameLayout\u003e\n\n\u003c/android.support.design.widget.AppBarLayout\u003e\n```\n\n[Setup with an MenuItem](#menuitem) or [Open manually](#open-and-close-manually)\n\nSetup the listener:  \n*Return true to override default behaviour*\n```java\nsimpleSearchView.setOnQueryTextListener(new SimpleSearchView.OnQueryTextListener() {\n            @Override\n            public boolean onQueryTextSubmit(String query) {\n                Log.d(\"SimpleSearchView\", \"Submit:\" + query);\n                return false;\n            }\n\n            @Override\n            public boolean onQueryTextChange(String newText) {\n                Log.d(\"SimpleSearchView\", \"Text changed:\" + newText);\n                return false;\n            }\n\n            @Override\n            public boolean onQueryTextCleared() {\n                Log.d(\"SimpleSearchView\", \"Text cleared\");\n                return false;\n            }\n        });\n```\n\n## Options\n\n### MenuItem\n*Open when the MenuItem is clicked*  \nAdd the search item to the menu xml:\n```xml\n\u003citem\n    android:id=\"@+id/action_search\"\n    android:icon=\"@drawable/ic_search_black_24dp\"\n    android:title=\"@string/search_hint\"\n    app:iconTint=\"@android:color/white\"\n    app:showAsAction=\"ifRoom\" /\u003e\n```\nSetup the MenuItem :\n```java\n@Override\npublic boolean onCreateOptionsMenu(Menu menu) {\n    MenuInflater inflater = getMenuInflater();\n    inflater.inflate(R.menu.main_menu, menu);\n\n    MenuItem item = menu.findItem(R.id.action_search);\n    searchView.setMenuItem(item);\n\n    return true;\n}\n```\n\n### TabLayout\n*Hides the TabLayout when the SimpleSearchView opens*  \nAdd it to the layout with a TabLayout:\n```xml\n\u003candroid.support.design.widget.AppBarLayout\n    android:id=\"@+id/appbar\"\n    android:layout_width=\"match_parent\"\n    android:layout_height=\"wrap_content\"\n    android:background=\"@color/colorPrimary\"\n    android:theme=\"@style/AppTheme.AppBarOverlay\"\u003e\n\n    \u003cFrameLayout\n        android:id=\"@+id/toolbar_container\"\n        android:layout_width=\"match_parent\"\n        android:layout_height=\"wrap_content\"\u003e\n\n        \u003candroid.support.v7.widget.Toolbar\n            android:id=\"@+id/toolbar\"\n            android:layout_width=\"match_parent\"\n            android:layout_height=\"wrap_content\"\n            app:popupTheme=\"@style/AppTheme.PopupOverlay\"\n            app:subtitle=\"@string/app_subtitle\"\n            app:title=\"Example\" /\u003e\n\n        \u003ccom.ferfalk.simplesearchview.SimpleSearchView\n            android:id=\"@+id/searchView\"\n            android:layout_width=\"match_parent\"\n            android:layout_height=\"match_parent\"\n            android:background=\"@color/colorPrimary\" /\u003e\n    \u003c/FrameLayout\u003e\n  \n    \u003candroid.support.design.widget.TabLayout\n        android:id=\"@+id/tabLayout\"\n        android:layout_width=\"match_parent\"\n        android:layout_height=\"wrap_content\"\n        app:tabGravity=\"fill\"\n        app:tabMode=\"fixed\"\u003e\n\n        \u003candroid.support.design.widget.TabItem\n            android:id=\"@+id/tabItem1\"\n            android:layout_width=\"wrap_content\"\n            android:layout_height=\"wrap_content\"\n            android:text=\"@string/tab_text_1\" /\u003e\n\n        \u003candroid.support.design.widget.TabItem\n            android:id=\"@+id/tabItem2\"\n            android:layout_width=\"wrap_content\"\n            android:layout_height=\"wrap_content\"\n            android:text=\"@string/tab_text_2\" /\u003e\n\n        \u003candroid.support.design.widget.TabItem\n            android:id=\"@+id/tabItem3\"\n            android:layout_width=\"wrap_content\"\n            android:layout_height=\"wrap_content\"\n            android:text=\"@string/tab_text_3\" /\u003e\n\n    \u003c/android.support.design.widget.TabLayout\u003e\n\n\u003c/android.support.design.widget.AppBarLayout\u003e\n```\nSetup the TabLayout:\n```java\nsimpleSearchView.setTabLayout(findViewById(R.id.tabLayout));\n```\n\n\n### Open and close manually\n```java\nsimpleSearchView.showSearch();\nsimpleSearchView.closeSearch();\n```\n\n### OnBackPressed\n*Closes the SimpleSearchView automatically*\n```java\n@Override\npublic void onBackPressed() {\n    if (searchView.onBackPressed()) {\n        return;\n    }\n\n    super.onBackPressed();\n}\n```\n\n### Voice search\n```\napp:voiceSearch=\"true\"\n```\nor\n```java\nsimpleSearchView.enableVoiceSearch(true);\n```\n\nHandle the result:  \n*Will set the query automatically*\n```java\n@Override\nprotected void onActivityResult(int requestCode, int resultCode, Intent data) {\n    if (searchView.onActivityResult(requestCode, resultCode, data)) {\n        return;\n    }\n\n    super.onActivityResult(requestCode, resultCode, data);\n}\n```\n\n### Style\nBar style *(default)*:\n```\napp:type=\"bar\"\n```\n\nCard style:\n```\napp:type=\"card\"\n```\n\n### Open and close listener\n```java\nsimpleSearchView.setOnSearchViewListener(new SimpleSearchView.SearchViewListener() {\n    @Override\n    public void onSearchViewShown() {\n        Log.d(\"SimpleSearchView\", \"onSearchViewShown\");\n    }\n\n    @Override\n    public void onSearchViewClosed() {\n        Log.d(\"SimpleSearchView\", \"onSearchViewClosed\");\n    }\n\n    @Override\n    public void onSearchViewShownAnimation() {\n        Log.d(\"SimpleSearchView\", \"onSearchViewShownAnimation\");\n    }\n\n    @Override\n    public void onSearchViewClosedAnimation() {\n        Log.d(\"SimpleSearchView\", \"onSearchViewClosedAnimation\");\n    }\n});\n```\n\n### Changing the reveal animation starting point\n```java\n// Adding padding to the animation because of the hidden menu item\nPoint revealCenter = simpleSearchView.getRevealAnimationCenter();\nrevealCenter.x -= DimensUtils.convertDpToPx(EXTRA_REVEAL_CENTER_PADDING, this);\n```\n\n### Attributes\n```xml\n\u003cstyle name=\"SimpleSearchViewStyle\"\u003e\n    \u003c!-- Change search style --\u003e\n    \u003citem name=\"type\"\u003ecard\u003c/item\u003e\n\n    \u003c!-- Change search hint --\u003e\n    \u003citem name=\"android:hint\"\u003eSample\u003c/item\u003e\n\n    \u003c!-- Change search inputType --\u003e\n    \u003citem name=\"android:inputType\"\u003etext\u003c/item\u003e\n\n    \u003c!-- Change search textColor --\u003e\n    \u003citem name=\"android:textColor\"\u003e@color/sample\u003c/item\u003e\n\n    \u003c!-- Search bar/card background --\u003e\n    \u003citem name=\"searchBackground\"\u003e@drawable/sample\u003c/item\u003e\n\n    \u003c!-- Change icons --\u003e\n    \u003citem name=\"searchBackIcon\"\u003e@drawable/sample\u003c/item\u003e\n    \u003citem name=\"searchClearIcon\"\u003e@drawable/sample\u003c/item\u003e\n    \u003citem name=\"searchVoiceIcon\"\u003e@drawable/sample\u003c/item\u003e\n\n    \u003c!-- Change icons tint --\u003e\n    \u003citem name=\"backIconTint\"\u003e1\u003c/item\u003e\n    \u003citem name=\"iconsTint\"\u003e1\u003c/item\u003e\n\n    \u003c!-- Change icons alpha --\u003e\n    \u003citem name=\"backIconAlpha\"\u003e0.8\u003c/item\u003e\n    \u003citem name=\"iconsAlpha\"\u003e0.8\u003c/item\u003e\n\n    \u003c!-- Change search input colors --\u003e\n    \u003citem name=\"cursorColor\"\u003e@color/sample\u003c/item\u003e\n    \u003citem name=\"hintColor\"\u003e@color/sample\u003c/item\u003e\n\n    \u003c!-- Enable voice search --\u003e\n    \u003citem name=\"voiceSearch\"\u003etrue\u003c/item\u003e\n\n    \u003c!-- Set voice search prompt --\u003e\n    \u003citem name=\"voiceSearchPrompt\"\u003eSample\u003c/item\u003e\n\u003c/style\u003e\n```\n\n## License\n    Copyright (C) 2018 Fernando Augusto Heeren Falkiewicz\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%2Fferfalk%2Fsimplesearchview","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fferfalk%2Fsimplesearchview","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fferfalk%2Fsimplesearchview/lists"}