{"id":13644273,"url":"https://github.com/sahildave/Search-View-Layout","last_synced_at":"2025-04-21T07:30:40.500Z","repository":{"id":57744051,"uuid":"45060546","full_name":"sahildave/Search-View-Layout","owner":"sahildave","description":"Material Design Search View Layout, now implemented in Google Maps, Dialer, etc","archived":false,"fork":false,"pushed_at":"2018-09-24T12:46:26.000Z","size":1221,"stargazers_count":1108,"open_issues_count":4,"forks_count":155,"subscribers_count":25,"default_branch":"master","last_synced_at":"2025-04-10T06:42:19.201Z","etag":null,"topics":["android","android-library","material-design","search-interface","searchview"],"latest_commit_sha":null,"homepage":"","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/sahildave.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}},"created_at":"2015-10-27T18:12:12.000Z","updated_at":"2025-03-19T02:35:51.000Z","dependencies_parsed_at":"2022-08-31T08:41:27.646Z","dependency_job_id":null,"html_url":"https://github.com/sahildave/Search-View-Layout","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/sahildave%2FSearch-View-Layout","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sahildave%2FSearch-View-Layout/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sahildave%2FSearch-View-Layout/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sahildave%2FSearch-View-Layout/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sahildave","download_url":"https://codeload.github.com/sahildave/Search-View-Layout/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250014556,"owners_count":21360971,"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-design","search-interface","searchview"],"created_at":"2024-08-02T01:02:00.260Z","updated_at":"2025-04-21T07:30:39.568Z","avatar_url":"https://github.com/sahildave.png","language":"Java","readme":"#### THIS PROJECT IS DEPRECATED\nComponent is not maintained anymore.\n---\n\n\nImplementation of **Lollipop+ Dialer** and **Google Maps**.\n\n## DEMO\n\n![Screenshot](/demo.gif?raw=true)\n\n\n#### Add in View\nAdd to your layout by using the include tag.\n``` xml\n\u003cinclude layout=\"@layout/widget_search_bar\"/\u003e\n```\n---\n#### API\nThis overlays the full activity and shows the **fragment** which you have assigned by using `setExpandedContentFragment`.\n\n``` java\nsearchViewLayout.setExpandedContentFragment(this, new SearchStaticFragment());\n```\n---\nIf you want to **animate your Toolbar** too like the demo gif, you can enable it by using `handleToolbarAnimation`.\n\n``` java\nsearchViewLayout.handleToolbarAnimation(toolbar);\n```\n---\nSetting **Background colors for Transition**. Default should also work just fine:\n\n``` java\n// Create Drawable for collapsed state. Default color is android.R.color.transparent\nColorDrawable collapsed = new ColorDrawable(\n    ContextCompat.getColor(this, R.color.colorPrimary));\n\n// Create Drawable for expanded state. Default color is #F0F0F0\nColorDrawable expanded = new ColorDrawable(\n    ContextCompat.getColor(this, R.color.default_color_expanded));\n\n// Send both colors to searchViewLayout\nsearchViewLayout.setTransitionDrawables(collapsed, expanded);\n```\n---\n**Listen to search** complete by:\n``` java\nsearchViewLayout.setSearchListener(new SearchViewLayout.SearchListener() {\n    @Override\n    public void onFinished(String searchKeyword) {\n        searchViewLayout.collapse();\n        Snackbar.make(searchViewLayout, \"Search Done - \" + searchKeyword, Snackbar.LENGTH_LONG).show();\n    }\n});\n```\n---    \n**Listen to collapse/expand animation** by using `setOnToggleAnimationListener`. For eg the FAB in demo hides on expanded and shows on collapse.\n``` java\nsearchViewLayout.setOnToggleAnimationListener(new SearchViewLayout.OnToggleAnimationListener() {\n    @Override\n    public void onStart(boolean expanded) {\n        if(expanded) {\n            fab.hide();\n        } else {\n            fab.show();\n        }\n    }\n\n    @Override\n    public void onFinish(boolean expanded) { }\n});\n```\n---\n**Listen to search box** complete by:\n``` java\nsearchViewLayout.setSearchBoxListener(new SearchViewLayout.SearchBoxListener() {\n    @Override\n    public void beforeTextChanged(CharSequence s, int start, int count, int after) {\n    }\n    @Override\n    public void onTextChanged(CharSequence s, int start, int before, int count) {\n    }\n    @Override\n    public void afterTextChanged(Editable s) {\n    }\n});\n```\n---\n**Setting Hints**\n\nIf you want to set hints in the view, there are three APIs. `setCollapsedHint` would come up in the default/collapsed state. `setExpandedHint` would work for expanded state i.e. after click the view and the keyboard is up. `setHint` would set both the hints in one go, use this you want to show the same hint in both the states.\n\n``` java\nsearchViewLayout.setCollapsedHint(\"Collapsed Hint\");\nsearchViewLayout.setExpandedHint(\"Expanded Hint\");\nsearchViewLayout.setHint(\"Global Hint\");\n```\n**Setting Icons**\nUse `setCollapsedIcon`, `setExpandedBackIcon`, `setExpandedSearchIcon` to setup icons according to your choice. The argument should be a DrawableRes\n### NOTES\n\n1. If you want to add a scrolling widget in your `setExpandedContentFragment`, add a `onTouchListener` and disallow the parent intercept by using`v.getParent().requestDisallowInterceptTouchEvent(true);`Check out fragments in sample for the implement of ListView, RecyclerView and ScrollView.\n\n    ``` java\n    recyclerView.setOnTouchListener(new View.OnTouchListener() {\n        // Setting on Touch Listener for handling the touch inside ScrollView\n        @Override\n        public boolean onTouch(View v, MotionEvent event) {\n            // Disallow the touch request for parent scroll on touch of child view\n            v.getParent().requestDisallowInterceptTouchEvent(true);\n            return false;\n        }\n    });\n    \n    ```\n\n2. The default height of the view is `120dp` which is also present in the dimens.xml file as\n    ``` xml     \n    \u003cdimen name=\"search_view_layout_approx_height\"\u003e120dp\u003c/dimen\u003e\n    ```\n    You can use it for adding margin on top of your main content layout.\n    \n\n### GET\n\nAvailable at jCenter and mavenCentral.\n\n``` groovy\ndependencies {\n    compile 'xyz.sahildave:searchviewlayout:0.6'\n}\n```\n    \n### CHANGELOG\n\n### 0.6\n* Added support for API 15\n\n### 0.5\n* Added support for fragment-v4\n\n### 0.4\n* Moved anim files to /animator res dir\n\n### 0.3\n* Added search edit text API\n* Larger touch target\n\n### 0.2\n* Added APIs for setting icons\n* Improved animations by using `onAnimationUpdate`\n \n### 0.1\n* Added hints API.\n* Added `search_view_layout_approx_height` \n\n#### 0.0.2\n* Added API `setTransitionDrawables` which solves crashes in \u003c API 19\n\n#### Contribute\n\nContribute by creating issues (tagged enhancement, bugs) in the repo or create a pull request.\n","funding_links":[],"categories":["SearchView","Libs"],"sub_categories":["\u003cA NAME=\"Widget\"\u003e\u003c/A\u003eWidget"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsahildave%2FSearch-View-Layout","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsahildave%2FSearch-View-Layout","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsahildave%2FSearch-View-Layout/lists"}