mitchtabian / Open-API-Android-App

Kotlin, MVI, Hilt, Retrofit2, Coroutines, Room Persistence, REST API, Token Authentication
692 stars 231 forks source link

Toolbar searchView Cancel Button Clicked not working #31

Open Morons opened 3 years ago

Morons commented 3 years ago

There is No setOnClickListener for the search_close_btn So here it is! Please Amend!

        // Cancel Button Clicked!
        val cancelButton = searchView.findViewById(R.id.search_close_btn) as View
        cancelButton.setOnClickListener {
            searchPlate.setText("")
            val searchQuery = searchPlate.text.toString()
            Log.e(Constants.GLOBAL_TAG, "SearchView: (cancel button) executing search...: $searchQuery")
            executeNewQuery(searchQuery)
            searchView.isIconified = true
        }