Skip to content

Commit

Permalink
Release/1.1.2 (#122)
Browse files Browse the repository at this point in the history
  • Loading branch information
kelianClerc committed Oct 20, 2022
1 parent 22f7329 commit 5681717
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 2 deletions.
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
buildscript {

ext {
grapes_version = '1.1.1'
grapes_version = '1.1.2'

kotlin_version = '1.7.10'
firebase_app_distribution_version = '2.1.2'
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package com.spendesk.grapes.bottomsheet.searchable

import android.app.Dialog
import android.content.DialogInterface
import android.os.Bundle
import android.os.Handler
import android.os.Looper
Expand Down Expand Up @@ -51,6 +52,7 @@ class SearchableBottomSheetDialogFragment : BottomSheetDialogFragment() {

var onItemClicked: ((item: SimpleListModel) -> Unit)? = null
var onSearchInputChanged: ((searchInput: String) -> Unit)? = null
var onCancelListener: (() -> Unit)? = null

// endregion Observable properties

Expand Down Expand Up @@ -148,9 +150,14 @@ class SearchableBottomSheetDialogFragment : BottomSheetDialogFragment() {
}
}

override fun onCancel(dialog: DialogInterface) {
onCancelListener?.invoke()
super.onCancel(dialog)
}

private fun bindView() {
binding?.apply {
searchableSheetHeaderCloseButton.setOnClickListener { dismiss() }
searchableSheetHeaderCloseButton.setOnClickListener { dialog?.cancel() }
searchableSheetSearchInput.getEditText().afterTextChangedWith(EDITTEXT_TEXT_CHANGED_DELAY) { withActivityAttached { runOnUiThread { onSearchInputChanged?.invoke(it.trim()) } } }
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -155,5 +155,6 @@ class BottomSheetsFragment : Fragment(R.layout.fragment_home_bottom_sheets) {
.apply {
onItemClicked = { requireActivity().shortToaster("Search result clicked: $it"); dismiss() }
onSearchInputChanged = { requireActivity().shortToaster("Search input: $it") }
onCancelListener = { requireActivity().shortToaster("Cancel dialog without clicking on an item") }
}
}

0 comments on commit 5681717

Please sign in to comment.