Skip to content

Commit

Permalink
Merge pull request #423 from lapism/dev
Browse files Browse the repository at this point in the history
Version 1.1.0
  • Loading branch information
lapism authored Oct 29, 2021
2 parents 93c89ff + 92678fd commit 593c71c
Show file tree
Hide file tree
Showing 22 changed files with 358 additions and 334 deletions.
Empty file modified .github/FUNDING.yml
100644 → 100755
Empty file.
Empty file modified .gitignore
100644 → 100755
Empty file.
52 changes: 19 additions & 33 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
![API](https://img.shields.io/badge/API-26%2B-brightgreen.svg?style=flat)
[![Kotlin Version](https://img.shields.io/badge/Kotlin-1.5.31-blue.svg)](https://kotlinlang.org)
[![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/)
[![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/)
[![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)

# Search
Expand All @@ -23,59 +23,46 @@

Add the dependency to your gradle file:
```groovy
repositories {
google()
mavenCentral()
}
dependencies {
implementation 'io.github.lapism:search:1.0.0'
}
repositories {
google()
mavenCentral()
}
dependencies {
implementation 'io.github.lapism:search:1.1.0'
}
```

## Usage
private fun clearFocusOnSearch() {
binding.materialSearchView.clearFocus()
binding.materialSearchView.visibility = View.GONE
}

private fun requestFocusOnSearch() {
binding.materialSearchView.visibility = View.VISIBLE
```java
binding.materialSearchView.requestFocus()
}
binding.materialSearchView.clearFocus()
```

### MaterialSearchBar
```java
val toolbar = binding.materialSearchBar.getToolbar()
setSupportActionBar(toolbar)

val actionBar = supportActionBar
actionBar?.setIcon(R.drawable.new_ic_outline_search_24)

binding.materialSearchBar.apply {
navigationIconCompat = NavigationIconCompat.SEARCH
setHint(getString(R.string.search))
setOnClickListener {
requestFocusOnSearch()
binding.materialSearchView.requestFocus()
}
setNavigationOnClickListener {
requestFocusOnSearch()
binding.materialSearchView.requestFocus()
}
}
```

### MaterialSearchView
```java
binding.materialSearchView.apply {
visibility = View.GONE
addView(recyclerView)
setNavigationIcon(
ContextCompat.getDrawable(
this@MainActivity,
R.drawable.search_ic_outline_arrow_back_24
)
)
navigationIconCompat = NavigationIconCompat.ARROW
setNavigationOnClickListener {
clearFocusOnSearch()
binding.materialSearchView.clearFocus()
}
setHint(getString(R.string.search))
setBackgroundColor(
Expand Down Expand Up @@ -124,7 +111,6 @@ You have to use app theme Theme.Material3.* or Theme.MaterialComponents.*.
android:id="@+id/material_search_bar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="@dimen/dp_0"
app:layout_scrollFlags="scroll|enterAlways|snap" />

</com.google.android.material.appbar.AppBarLayout>
Expand Down Expand Up @@ -167,9 +153,9 @@ You have to use app theme Theme.Material3.* or Theme.MaterialComponents.*.
<enum name="search" value="2" />
</attr>
<attr name="search_navigationIcon" format="reference" />
<attr name="search_navigationContentDescription" format="reference" />
<attr name="search_backgroundColor" format="reference" />
<attr name="search_radius" format="integer" />

<attr name="android:elevation" />
<attr name="android:hint" />
<attr name="android:layout_marginStart" />
Expand All @@ -181,11 +167,11 @@ You have to use app theme Theme.Material3.* or Theme.MaterialComponents.*.
<declare-styleable name="MaterialSearchView">
<attr name="search_navigationIconCompat" />
<attr name="search_navigationIcon" />
<attr name="search_navigationContentDescription" />
<attr name="search_backgroundColor" />
<attr name="search_clearIcon" format="reference" />
<attr name="search_dividerColor" format="reference" />
<attr name="search_scrimColor" format="reference" />

<attr name="android:hint" />
<attr name="android:imeOptions" />
<attr name="android:inputType" />
Expand Down
14 changes: 5 additions & 9 deletions build.gradle
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@ android {
defaultConfig {
minSdk 26
targetSdk 31
versionCode 1010000
versionName "1.1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
consumerProguardFiles "consumer-rules.pro"
}
Expand Down Expand Up @@ -44,14 +42,14 @@ android {
dependencies {

// Core
implementation 'androidx.core:core-ktx:1.7.0-alpha02'
implementation 'androidx.appcompat:appcompat:1.4.0-alpha03'
implementation 'com.google.android.material:material:1.5.0-alpha03'
implementation 'androidx.core:core-ktx:1.7.0-rc01'
implementation 'androidx.appcompat:appcompat:1.4.0-beta01'
implementation 'com.google.android.material:material:1.5.0-alpha04'
}

ext {
PUBLISH_GROUP_ID = 'io.github.lapism'
PUBLISH_VERSION = '1.0.0'
PUBLISH_VERSION = '1.1.0'
PUBLISH_ARTIFACT_ID = 'search'
PUBLISH_DESCRIPTION = 'Material You Search component for Android, SearchView'
PUBLISH_URL = 'https://github.com/lapism/search'
Expand All @@ -65,6 +63,4 @@ ext {
PUBLISH_SCM_URL = 'https://github.com/lapism/search/tree/master'
}

apply from: "${rootProject.projectDir}/scripts/publish-module.gradle"

// ./gradlew search:publishReleasePublicationToSonatypeRepository
apply from: "${rootProject.projectDir}/scripts/publish-module.gradle"
Empty file modified consumer-rules.pro
100644 → 100755
Empty file.
Empty file modified proguard-rules.pro
100644 → 100755
Empty file.
Empty file modified src/main/AndroidManifest.xml
100644 → 100755
Empty file.
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,18 @@ import android.util.AttributeSet
import android.widget.FrameLayout


class ClippableFrameLayout @JvmOverloads constructor(
class ClippableRoundedCornerLayout @JvmOverloads constructor(
context: Context,
attrs: AttributeSet? = null,
defStyleAttr: Int = 0,
defStyleRes: Int = 0
) : FrameLayout(context, attrs, defStyleAttr, defStyleRes) {

private var path: Path? = null
// *********************************************************************************************
// TODO CLIP ANIMATION
var path: Path? = null

// *********************************************************************************************
override fun dispatchDraw(canvas: Canvas?) {
if (path == null) {
super.dispatchDraw(canvas)
Expand Down
3 changes: 3 additions & 0 deletions src/main/kotlin/com/lapism/search/internal/FocusEditText.kt
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,10 @@ class FocusEditText @JvmOverloads constructor(
defStyleAttr: Int = 0
) : AppCompatEditText(context, attrs, defStyleAttr) {

// *********************************************************************************************
private var textClear: Boolean = false

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

// *********************************************************************************************
fun setTextClearOnBackPressed(clear: Boolean) {
textClear = clear
}
Expand Down

This file was deleted.

Loading

0 comments on commit 593c71c

Please sign in to comment.