-
-
Notifications
You must be signed in to change notification settings - Fork 79
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
12 changed files
with
75 additions
and
55 deletions.
There are no files selected for viewing
17 changes: 0 additions & 17 deletions
17
app/src/main/java/com/kylecorry/trail_sense/shared/extensions/SearchViewExtensions.kt
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
9 changes: 3 additions & 6 deletions
9
app/src/main/java/com/kylecorry/trail_sense/shared/lists/GroupListManagerExtensions.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
32 changes: 32 additions & 0 deletions
32
app/src/main/java/com/kylecorry/trail_sense/shared/views/SearchView.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
package com.kylecorry.trail_sense.shared.views | ||
|
||
import android.content.Context | ||
import android.util.AttributeSet | ||
import android.widget.FrameLayout | ||
import androidx.core.widget.addTextChangedListener | ||
import com.kylecorry.trail_sense.R | ||
import com.kylecorry.trail_sense.databinding.ViewSearchBinding | ||
|
||
class SearchView(context: Context, attrs: AttributeSet?) : FrameLayout(context, attrs) { | ||
private val binding: ViewSearchBinding | ||
private var onSearch: ((String) -> Unit)? = null | ||
|
||
var query: String | ||
get() = binding.searchViewEditText.text.toString() | ||
set(value) { | ||
binding.searchViewEditText.setText(value) | ||
} | ||
|
||
init { | ||
inflate(context, R.layout.view_search, this) | ||
binding = ViewSearchBinding.bind(this) | ||
binding.searchViewEditText.addTextChangedListener { | ||
onSearch?.invoke(binding.searchViewEditText.text.toString()) | ||
} | ||
} | ||
|
||
fun setOnSearchListener(listener: ((String) -> Unit)?) { | ||
onSearch = listener | ||
} | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" | ||
xmlns:app="http://schemas.android.com/apk/res-auto" | ||
android:layout_width="match_parent" | ||
android:layout_height="wrap_content" | ||
android:layout_margin="2dp" | ||
android:background="@drawable/rounded_rectangle" | ||
android:backgroundTint="?attr/colorBackgroundFloating" | ||
android:elevation="2dp"> | ||
|
||
<com.google.android.material.textfield.TextInputLayout | ||
android:id="@+id/search_view_text_input_layout" | ||
android:layout_width="match_parent" | ||
android:layout_height="wrap_content" | ||
app:boxBackgroundMode="none" | ||
app:endIconMode="clear_text" | ||
app:hintEnabled="false" | ||
app:startIconDrawable="@drawable/ic_search"> | ||
|
||
<com.google.android.material.textfield.TextInputEditText | ||
android:id="@+id/search_view_edit_text" | ||
android:layout_width="match_parent" | ||
android:layout_height="wrap_content" | ||
android:hint="@string/search" /> | ||
|
||
</com.google.android.material.textfield.TextInputLayout> | ||
</FrameLayout> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters