Skip to content

Commit 593c71c

Browse files
authored
Merge pull request #423 from lapism/dev
Version 1.1.0
2 parents 93c89ff + 92678fd commit 593c71c

22 files changed

+358
-334
lines changed

.github/FUNDING.yml

100644100755
File mode changed.

.gitignore

100644100755
File mode changed.

README.md

Lines changed: 19 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
![API](https://img.shields.io/badge/API-26%2B-brightgreen.svg?style=flat)
22
[![Kotlin Version](https://img.shields.io/badge/Kotlin-1.5.31-blue.svg)](https://kotlinlang.org)
3-
[![Download](https://img.shields.io/maven-metadata/v?metadataUrl=https%3A%2F%2Frepo1.maven.org%2Fmaven2%2Fio%2Fgithub%2Flapism%2Fsearch%2Fmaven-metadata.xml) ](https://repo1.maven.org/maven2/io/github/lapism/search/1.0.0/)
3+
[![Download](https://img.shields.io/maven-metadata/v?metadataUrl=https%3A%2F%2Frepo1.maven.org%2Fmaven2%2Fio%2Fgithub%2Flapism%2Fsearch%2Fmaven-metadata.xml) ](https://repo1.maven.org/maven2/io/github/lapism/search/)
44
[![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)
55

66
# Search
@@ -23,59 +23,46 @@
2323

2424
Add the dependency to your gradle file:
2525
```groovy
26-
repositories {
27-
google()
28-
mavenCentral()
29-
}
30-
31-
dependencies {
32-
implementation 'io.github.lapism:search:1.0.0'
33-
}
26+
repositories {
27+
google()
28+
mavenCentral()
29+
}
30+
31+
dependencies {
32+
implementation 'io.github.lapism:search:1.1.0'
33+
}
3434
```
3535

3636
## Usage
37-
private fun clearFocusOnSearch() {
38-
binding.materialSearchView.clearFocus()
39-
binding.materialSearchView.visibility = View.GONE
40-
}
41-
42-
private fun requestFocusOnSearch() {
43-
binding.materialSearchView.visibility = View.VISIBLE
37+
```java
4438
binding.materialSearchView.requestFocus()
45-
}
39+
binding.materialSearchView.clearFocus()
40+
```
4641

4742
### MaterialSearchBar
4843
```java
4944
val toolbar = binding.materialSearchBar.getToolbar()
5045
setSupportActionBar(toolbar)
5146

52-
val actionBar = supportActionBar
53-
actionBar?.setIcon(R.drawable.new_ic_outline_search_24)
54-
5547
binding.materialSearchBar.apply {
48+
navigationIconCompat = NavigationIconCompat.SEARCH
5649
setHint(getString(R.string.search))
5750
setOnClickListener {
58-
requestFocusOnSearch()
51+
binding.materialSearchView.requestFocus()
5952
}
6053
setNavigationOnClickListener {
61-
requestFocusOnSearch()
54+
binding.materialSearchView.requestFocus()
6255
}
6356
}
6457
```
6558

6659
### MaterialSearchView
6760
```java
6861
binding.materialSearchView.apply {
69-
visibility = View.GONE
7062
addView(recyclerView)
71-
setNavigationIcon(
72-
ContextCompat.getDrawable(
73-
this@MainActivity,
74-
R.drawable.search_ic_outline_arrow_back_24
75-
)
76-
)
63+
navigationIconCompat = NavigationIconCompat.ARROW
7764
setNavigationOnClickListener {
78-
clearFocusOnSearch()
65+
binding.materialSearchView.clearFocus()
7966
}
8067
setHint(getString(R.string.search))
8168
setBackgroundColor(
@@ -124,7 +111,6 @@ You have to use app theme Theme.Material3.* or Theme.MaterialComponents.*.
124111
android:id="@+id/material_search_bar"
125112
android:layout_width="match_parent"
126113
android:layout_height="wrap_content"
127-
android:layout_marginBottom="@dimen/dp_0"
128114
app:layout_scrollFlags="scroll|enterAlways|snap" />
129115

130116
</com.google.android.material.appbar.AppBarLayout>
@@ -167,9 +153,9 @@ You have to use app theme Theme.Material3.* or Theme.MaterialComponents.*.
167153
<enum name="search" value="2" />
168154
</attr>
169155
<attr name="search_navigationIcon" format="reference" />
156+
<attr name="search_navigationContentDescription" format="reference" />
170157
<attr name="search_backgroundColor" format="reference" />
171158
<attr name="search_radius" format="integer" />
172-
173159
<attr name="android:elevation" />
174160
<attr name="android:hint" />
175161
<attr name="android:layout_marginStart" />
@@ -181,11 +167,11 @@ You have to use app theme Theme.Material3.* or Theme.MaterialComponents.*.
181167
<declare-styleable name="MaterialSearchView">
182168
<attr name="search_navigationIconCompat" />
183169
<attr name="search_navigationIcon" />
170+
<attr name="search_navigationContentDescription" />
184171
<attr name="search_backgroundColor" />
185172
<attr name="search_clearIcon" format="reference" />
186173
<attr name="search_dividerColor" format="reference" />
187174
<attr name="search_scrimColor" format="reference" />
188-
189175
<attr name="android:hint" />
190176
<attr name="android:imeOptions" />
191177
<attr name="android:inputType" />

build.gradle

100644100755
Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,6 @@ android {
1010
defaultConfig {
1111
minSdk 26
1212
targetSdk 31
13-
versionCode 1010000
14-
versionName "1.1.0"
1513
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
1614
consumerProguardFiles "consumer-rules.pro"
1715
}
@@ -44,14 +42,14 @@ android {
4442
dependencies {
4543

4644
// Core
47-
implementation 'androidx.core:core-ktx:1.7.0-alpha02'
48-
implementation 'androidx.appcompat:appcompat:1.4.0-alpha03'
49-
implementation 'com.google.android.material:material:1.5.0-alpha03'
45+
implementation 'androidx.core:core-ktx:1.7.0-rc01'
46+
implementation 'androidx.appcompat:appcompat:1.4.0-beta01'
47+
implementation 'com.google.android.material:material:1.5.0-alpha04'
5048
}
5149

5250
ext {
5351
PUBLISH_GROUP_ID = 'io.github.lapism'
54-
PUBLISH_VERSION = '1.0.0'
52+
PUBLISH_VERSION = '1.1.0'
5553
PUBLISH_ARTIFACT_ID = 'search'
5654
PUBLISH_DESCRIPTION = 'Material You Search component for Android, SearchView'
5755
PUBLISH_URL = 'https://github.com/lapism/search'
@@ -65,6 +63,4 @@ ext {
6563
PUBLISH_SCM_URL = 'https://github.com/lapism/search/tree/master'
6664
}
6765

68-
apply from: "${rootProject.projectDir}/scripts/publish-module.gradle"
69-
70-
// ./gradlew search:publishReleasePublicationToSonatypeRepository
66+
apply from: "${rootProject.projectDir}/scripts/publish-module.gradle"

consumer-rules.pro

100644100755
File mode changed.

proguard-rules.pro

100644100755
File mode changed.

src/main/AndroidManifest.xml

100644100755
File mode changed.

src/main/kotlin/com/lapism/search/internal/ClippableFrameLayout.kt renamed to src/main/kotlin/com/lapism/search/internal/ClippableRoundedCornerLayout.kt

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,18 @@ import android.util.AttributeSet
77
import android.widget.FrameLayout
88

99

10-
class ClippableFrameLayout @JvmOverloads constructor(
10+
class ClippableRoundedCornerLayout @JvmOverloads constructor(
1111
context: Context,
1212
attrs: AttributeSet? = null,
1313
defStyleAttr: Int = 0,
1414
defStyleRes: Int = 0
1515
) : FrameLayout(context, attrs, defStyleAttr, defStyleRes) {
1616

17-
private var path: Path? = null
17+
// *********************************************************************************************
18+
// TODO CLIP ANIMATION
19+
var path: Path? = null
1820

21+
// *********************************************************************************************
1922
override fun dispatchDraw(canvas: Canvas?) {
2023
if (path == null) {
2124
super.dispatchDraw(canvas)

src/main/kotlin/com/lapism/search/internal/FocusEditText.kt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,10 @@ class FocusEditText @JvmOverloads constructor(
1212
defStyleAttr: Int = 0
1313
) : AppCompatEditText(context, attrs, defStyleAttr) {
1414

15+
// *********************************************************************************************
1516
private var textClear: Boolean = false
1617

18+
// *********************************************************************************************
1719
override fun onKeyPreIme(keyCode: Int, event: KeyEvent?): Boolean {
1820
if (keyCode == KeyEvent.KEYCODE_BACK && event?.action == KeyEvent.ACTION_UP && textClear) {
1921
if (hasFocus()) {
@@ -29,6 +31,7 @@ class FocusEditText @JvmOverloads constructor(
2931
text?.clear()
3032
}
3133

34+
// *********************************************************************************************
3235
fun setTextClearOnBackPressed(clear: Boolean) {
3336
textClear = clear
3437
}

src/main/kotlin/com/lapism/search/internal/TouchObserverFrameLayout.kt

Lines changed: 0 additions & 16 deletions
This file was deleted.

0 commit comments

Comments
 (0)