From 5992b0c5670436ab21d116d6779b79b85bc84cc7 Mon Sep 17 00:00:00 2001 From: Bnyro Date: Wed, 8 Feb 2023 10:10:46 +0100 Subject: [PATCH] Fix history showing up when clearing search query --- .../java/com/github/libretube/services/DownloadService.kt | 2 +- .../java/com/github/libretube/ui/activities/MainActivity.kt | 5 +---- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/app/src/main/java/com/github/libretube/services/DownloadService.kt b/app/src/main/java/com/github/libretube/services/DownloadService.kt index 1b659610d..be0f1c969 100644 --- a/app/src/main/java/com/github/libretube/services/DownloadService.kt +++ b/app/src/main/java/com/github/libretube/services/DownloadService.kt @@ -41,6 +41,7 @@ import java.io.File import java.net.HttpURLConnection import java.net.SocketTimeoutException import java.net.URL +import java.util.concurrent.Executors import kotlinx.coroutines.CancellationException import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.Job @@ -54,7 +55,6 @@ import okio.BufferedSink import okio.buffer import okio.sink import okio.source -import java.util.concurrent.Executors /** * Download service with custom implementation of downloading using [HttpURLConnection]. diff --git a/app/src/main/java/com/github/libretube/ui/activities/MainActivity.kt b/app/src/main/java/com/github/libretube/ui/activities/MainActivity.kt index 5c13ab6ca..e52c91858 100644 --- a/app/src/main/java/com/github/libretube/ui/activities/MainActivity.kt +++ b/app/src/main/java/com/github/libretube/ui/activities/MainActivity.kt @@ -268,7 +268,6 @@ class MainActivity : BaseActivity() { searchView.setOnQueryTextListener(object : SearchView.OnQueryTextListener { override fun onQueryTextSubmit(query: String?): Boolean { navController.navigate(R.id.searchResultFragment, bundleOf("query" to query)) - searchViewModel.setQuery("") searchView.clearFocus() return true } @@ -318,10 +317,8 @@ class MainActivity : BaseActivity() { override fun onMenuItemActionCollapse(item: MenuItem): Boolean { if (binding.mainMotionLayout.progress == 0F) { - try { + runCatching { minimizePlayer() - } catch (e: Exception) { - // current fragment isn't the player fragment } } // Handover back press to `BackPressedDispatcher`