diff options
Diffstat (limited to 'app/src/main/java/xyz')
-rw-r--r-- | app/src/main/java/xyz/adjutor/aniki/anime/search/SearchAnimePage.kt | 17 | ||||
-rw-r--r-- | app/src/main/java/xyz/adjutor/aniki/manga/search/SearchMangaPage.kt | 3 |
2 files changed, 17 insertions, 3 deletions
diff --git a/app/src/main/java/xyz/adjutor/aniki/anime/search/SearchAnimePage.kt b/app/src/main/java/xyz/adjutor/aniki/anime/search/SearchAnimePage.kt index c1596c3..b624069 100644 --- a/app/src/main/java/xyz/adjutor/aniki/anime/search/SearchAnimePage.kt +++ b/app/src/main/java/xyz/adjutor/aniki/anime/search/SearchAnimePage.kt @@ -5,8 +5,10 @@ import android.os.Bundle import android.view.LayoutInflater import android.view.View import android.view.ViewGroup +import android.view.inputmethod.EditorInfo import android.view.inputmethod.InputMethodManager import android.widget.Button +import android.widget.TextView import androidx.fragment.app.Fragment import androidx.navigation.fragment.findNavController import androidx.recyclerview.widget.LinearLayoutManager @@ -48,11 +50,24 @@ class SearchAnimePage : Fragment() { findNavController().navigate(R.id.action_SearchAnimePage_to_HomePage) } - view.findViewById<Button>(R.id.button_query).setOnClickListener{ + view.findViewById<Button>(R.id.button_query).setOnClickListener { val userInput = view.findViewById<TextInputEditText>(R.id.tiet_query).text.toString() hideKeyboard() makeApiCall(view, baseUrl, userInput) } + + view.findViewById<TextInputEditText>(R.id.tiet_query) + .setOnEditorActionListener(TextView.OnEditorActionListener { v, actionId, event -> + if (actionId == EditorInfo.IME_ACTION_SEARCH) { + val userInput = + view.findViewById<TextInputEditText>(R.id.tiet_query).text.toString() + hideKeyboard() + makeApiCall(view, baseUrl, userInput) + return@OnEditorActionListener true + } + false + }) + } private fun hideKeyboard() { diff --git a/app/src/main/java/xyz/adjutor/aniki/manga/search/SearchMangaPage.kt b/app/src/main/java/xyz/adjutor/aniki/manga/search/SearchMangaPage.kt index 7866151..d236887 100644 --- a/app/src/main/java/xyz/adjutor/aniki/manga/search/SearchMangaPage.kt +++ b/app/src/main/java/xyz/adjutor/aniki/manga/search/SearchMangaPage.kt @@ -8,7 +8,6 @@ import android.view.ViewGroup import android.view.inputmethod.EditorInfo import android.view.inputmethod.InputMethodManager import android.widget.Button -import android.widget.EditText import android.widget.TextView.OnEditorActionListener import androidx.fragment.app.Fragment import androidx.navigation.fragment.findNavController @@ -58,7 +57,7 @@ class SearchMangaPage : Fragment() { makeApiCall(view, baseUrl, userInput) } - view.findViewById<EditText>(R.id.tiet_query) + view.findViewById<TextInputEditText>(R.id.tiet_query) .setOnEditorActionListener(OnEditorActionListener { v, actionId, event -> if (actionId == EditorInfo.IME_ACTION_SEARCH) { val userInput = |