Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/lapism/search
Material You Search component for Android, SearchView
https://github.com/lapism/search
Last synced: 6 days ago
JSON representation
Material You Search component for Android, SearchView
- Host: GitHub
- URL: https://github.com/lapism/search
- Owner: lapism
- License: apache-2.0
- Created: 2015-09-28T19:00:30.000Z (about 9 years ago)
- Default Branch: master
- Last Pushed: 2022-12-22T23:31:38.000Z (almost 2 years ago)
- Last Synced: 2024-12-03T15:15:39.936Z (9 days ago)
- Language: Kotlin
- Homepage:
- Size: 260 KB
- Stars: 2,229
- Watchers: 74
- Forks: 377
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Funding: .github/FUNDING.yml
- License: LICENSE
Awesome Lists containing this project
- awesome-kotlin - search - Material Design Search component for Android, SearchView (Libraries)
README
![API](https://img.shields.io/badge/minSdk-21-brightgreen.svg?style=flat)
![API](https://img.shields.io/badge/targetSdk-33-brightgreen.svg?style=flat)
[![Kotlin Version](https://img.shields.io/badge/Kotlin-blue.svg)](https://kotlinlang.org)
[![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)
[![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)## DEPRECATED
Please use:
- com.google.android.material.search.SearchBar
- com.google.android.material.search.SearchView# Search
- Search component for Android
- Material You Design
- Styling
- Kotlin![Search](https://github.com/lapism/Search/blob/master/images/search.png)
## Api
- Java = 1.8
- Kotlin = 1.8Add the dependency to your gradle file:
```groovy
repositories {
google()
mavenCentral()
}dependencies {
implementation 'io.github.lapism:search:2.0.1'
}
```## Usage
```java
binding.materialSearchView.requestFocus()
binding.materialSearchView.clearFocus()
```### MaterialSearchBar
```java
val toolbar = binding.materialSearchBar.getToolbar()
setSupportActionBar(toolbar)binding.materialSearchBar.apply {
navigationIconCompat = NavigationIconCompat.SEARCH
setHint(getString(R.string.search))
setOnClickListener {
binding.materialSearchView.requestFocus()
}
setNavigationOnClickListener {
binding.materialSearchView.requestFocus()
}
}
```### MaterialSearchView
```java
binding.materialSearchView.apply {
addView(recyclerView)
navigationIconCompat = NavigationIconCompat.ARROW
setNavigationOnClickListener {
binding.materialSearchView.clearFocus()
}
setHint(getString(R.string.search))
setOnQueryTextListener(object : MaterialSearchView.OnQueryTextListener {
override fun onQueryTextChange(newText: CharSequence) {
adapter.filter(newText)
}override fun onQueryTextSubmit(query: CharSequence) {
}
})
setOnFocusChangeListener(object : MaterialSearchView.OnFocusChangeListener {
override fun onFocusChange(hasFocus: Boolean) {}
})
}
```### Layout
You have to use app theme Theme.Material3.* or Theme.MaterialComponents.*.
```xml
```
### XML attributes
```xml
```
## Todo
**Animation**
- animation like Google, needs help :)
## Author
* **Martin Lapiš** - [GitHub](https://github.com/lapism)
## License
This project is licensed under the Apache License 2.0 - see the [LICENSE](https://github.com/lapism/Search/blob/searchview/LICENSE) file for details.