{"id":13428030,"url":"https://github.com/lapism/search","last_synced_at":"2025-05-14T21:06:43.295Z","repository":{"id":43536981,"uuid":"43320624","full_name":"lapism/search","owner":"lapism","description":"Material You Search component for Android, SearchView","archived":false,"fork":false,"pushed_at":"2022-12-22T23:31:38.000Z","size":266,"stargazers_count":2228,"open_issues_count":1,"forks_count":375,"subscribers_count":73,"default_branch":"master","last_synced_at":"2025-04-13T17:46:48.350Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","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/lapism.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null},"funding":{"github":"lapism"}},"created_at":"2015-09-28T19:00:30.000Z","updated_at":"2025-04-13T01:36:29.000Z","dependencies_parsed_at":"2023-01-30T17:16:06.499Z","dependency_job_id":null,"html_url":"https://github.com/lapism/search","commit_stats":null,"previous_names":["lapism/searchview"],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lapism%2Fsearch","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lapism%2Fsearch/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lapism%2Fsearch/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lapism%2Fsearch/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/lapism","download_url":"https://codeload.github.com/lapism/search/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254227612,"owners_count":22035669,"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":[],"created_at":"2024-07-31T01:00:44.619Z","updated_at":"2025-05-14T21:06:38.277Z","avatar_url":"https://github.com/lapism.png","language":"Kotlin","readme":"![API](https://img.shields.io/badge/minSdk-21-brightgreen.svg?style=flat)\n![API](https://img.shields.io/badge/targetSdk-33-brightgreen.svg?style=flat)\n[![Kotlin Version](https://img.shields.io/badge/Kotlin-blue.svg)](https://kotlinlang.org)\n[![Maven Central](https://img.shields.io/maven-central/v/io.github.lapism/search)](https://s01.oss.sonatype.org/content/repositories/releases/io/github/lapism/search)\n[![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)\n\n## DEPRECATED  \n\nPlease use:\n - com.google.android.material.search.SearchBar\n - com.google.android.material.search.SearchView\n\n\n# Search\n\n - Search component for Android\n - Material You Design\n - Styling\n - Kotlin\n\n![Search](https://github.com/lapism/Search/blob/master/images/search.png)\n\n## Api\n - Java = 1.8\n - Kotlin = 1.8\n\nAdd the dependency to your gradle file:\n\n```groovy\nrepositories {\n    google()\n    mavenCentral()\n}\n\ndependencies {\n    implementation 'io.github.lapism:search:2.0.1'\n}\n```\n\n## Usage\n\n```java\n        binding.materialSearchView.requestFocus()\n        binding.materialSearchView.clearFocus()\n```\n\n### MaterialSearchBar\n\n```java\n        val toolbar = binding.materialSearchBar.getToolbar()\n        setSupportActionBar(toolbar)\n\n        binding.materialSearchBar.apply {\n            navigationIconCompat = NavigationIconCompat.SEARCH\n            setHint(getString(R.string.search))\n            setOnClickListener {\n                binding.materialSearchView.requestFocus()\n            }\n            setNavigationOnClickListener {\n                binding.materialSearchView.requestFocus()\n            }\n        }\n```\n\n### MaterialSearchView\n\n```java\n        binding.materialSearchView.apply {\n            addView(recyclerView)\n            navigationIconCompat = NavigationIconCompat.ARROW\n            setNavigationOnClickListener {\n                binding.materialSearchView.clearFocus()\n            }\n            setHint(getString(R.string.search))\n            setOnQueryTextListener(object : MaterialSearchView.OnQueryTextListener {\n                override fun onQueryTextChange(newText: CharSequence) {\n                    adapter.filter(newText)\n                }\n\n                override fun onQueryTextSubmit(query: CharSequence) {\n\n                }\n            })\n            setOnFocusChangeListener(object : MaterialSearchView.OnFocusChangeListener {\n                override fun onFocusChange(hasFocus: Boolean) {\n\n                }\n            })\n        }\n```\n\n### Layout\n\nYou have to use app theme Theme.Material3.* or Theme.MaterialComponents.*.\n\n```xml\n\u003c?xml version=\"1.0\" encoding=\"utf-8\"?\u003e\n\u003candroidx.coordinatorlayout.widget.CoordinatorLayout xmlns:android=\"http://schemas.android.com/apk/res/android\"\n    xmlns:app=\"http://schemas.android.com/apk/res-auto\"\n    xmlns:tools=\"http://schemas.android.com/tools\"\n    android:layout_width=\"match_parent\"\n    android:layout_height=\"match_parent\"\n    android:fitsSystemWindows=\"false\"\n    tools:context=\".activity.MainActivity\"\u003e\n\n    \u003ccom.google.android.material.appbar.AppBarLayout\n        android:layout_width=\"match_parent\"\n        android:layout_height=\"wrap_content\"\u003e\n\n        \u003c!-- Simple MaterialToolbar extension --\u003e\n        \u003ccom.lapism.search.widget.MaterialSearchBar\n            android:id=\"@+id/material_search_bar\"\n            android:layout_width=\"match_parent\"\n            android:layout_height=\"wrap_content\"\n            app:layout_scrollFlags=\"scroll|enterAlways|snap\" /\u003e\n\n    \u003c/com.google.android.material.appbar.AppBarLayout\u003e\n\n    \u003candroidx.fragment.app.FragmentContainerView\n        android:id=\"@+id/nav_host_fragment\"\n        android:name=\"androidx.navigation.fragment.NavHostFragment\"\n        android:layout_width=\"match_parent\"\n        android:layout_height=\"match_parent\"\n        app:defaultNavHost=\"true\"\n\n        app:layout_behavior=\"@string/material_search_bar_scrolling_view_behavior\"\n\n        app:navGraph=\"@navigation/mobile_navigation\" /\u003e\n\n    \u003ccom.lapism.search.widget.MaterialSearchView\n        android:id=\"@+id/material_search_view\"\n        android:layout_width=\"match_parent\"\n        android:layout_height=\"match_parent\"\n        app:layout_anchor=\"@id/material_search_bar\" /\u003e\n\n    \u003cBottomNavigationView\n        android:id=\"@+id/bottom_navigation_view\"\n        android:layout_width=\"match_parent\"\n        android:layout_height=\"wrap_content\"\n        android:layout_gravity=\"bottom\"\n        android:orientation=\"vertical\"\n        app:layout_insetEdge=\"bottom\"\n        app:menu=\"@menu/menu_bottom_nav\" /\u003e\n\n\u003c/androidx.coordinatorlayout.widget.CoordinatorLayout\u003e\n```\n\n### XML attributes\n\n```xml\n\n\u003cdeclare-styleable name=\"MaterialSearchBar\"\u003e\n    \u003cattr name=\"search_navigationIconCompat\" format=\"enum\"\u003e\n        \u003cenum name=\"none\" value=\"0\" /\u003e\n        \u003cenum name=\"arrow\" value=\"1\" /\u003e\n        \u003cenum name=\"search\" value=\"2\" /\u003e\n    \u003c/attr\u003e\n    \u003cattr name=\"search_navigationIcon\" format=\"reference\" /\u003e\n    \u003cattr name=\"search_navigationContentDescription\" format=\"reference\" /\u003e\n    \u003cattr name=\"search_navigationBackgroundColor\" format=\"reference\" /\u003e\n    \u003cattr name=\"search_navigationElevation\" format=\"dimension\" /\u003e\n    \u003cattr name=\"search_radius\" format=\"dimension\" /\u003e\n    \u003cattr name=\"android:hint\" /\u003e\n    \u003cattr name=\"android:layout_marginStart\" /\u003e\n    \u003cattr name=\"android:layout_marginEnd\" /\u003e\n    \u003cattr name=\"android:layout_marginTop\" /\u003e\n    \u003cattr name=\"android:layout_marginBottom\" /\u003e\n\u003c/declare-styleable\u003e\n\n\u003cdeclare-styleable name=\"MaterialSearchView\"\u003e\n    \u003cattr name=\"search_navigationIconCompat\" /\u003e\n    \u003cattr name=\"search_navigationIcon\" /\u003e\n    \u003cattr name=\"search_navigationContentDescription\" /\u003e\n    \u003cattr name=\"search_navigationBackgroundColor\" /\u003e\n    \u003cattr name=\"search_navigationElevation\" /\u003e\n    \u003cattr name=\"search_clearIcon\" format=\"reference\" /\u003e\n    \u003cattr name=\"search_dividerColor\" format=\"reference\" /\u003e\n    \u003cattr name=\"search_scrimColor\" format=\"reference\" /\u003e\n    \u003cattr name=\"android:hint\" /\u003e\n    \u003cattr name=\"android:imeOptions\" /\u003e\n    \u003cattr name=\"android:inputType\" /\u003e\n\u003c/declare-styleable\u003e\n```\n\n## Todo\n\n**Animation**\n\n- animation like Google, needs help :)\n\n## Author\n\n* **Martin Lapiš** - [GitHub](https://github.com/lapism)\n\n## License\n\nThis project is licensed under the Apache License 2.0 - see the [LICENSE](https://github.com/lapism/Search/blob/searchview/LICENSE) file for details.\n","funding_links":["https://github.com/sponsors/lapism"],"categories":["Libraries"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flapism%2Fsearch","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flapism%2Fsearch","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flapism%2Fsearch/lists"}