From 7a558f68f5a71a6e35d1f27633769bde66ff9335 Mon Sep 17 00:00:00 2001 From: tibbi Date: Fri, 6 Jan 2023 17:48:24 +0100 Subject: [PATCH] fixing a top Search menu related glitch --- app/build.gradle | 2 +- .../smsmessenger/activities/MainActivity.kt | 16 ++++++++++------ 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index ab23e4d4..a05b17d1 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -63,7 +63,7 @@ android { } dependencies { - implementation 'com.github.SimpleMobileTools:Simple-Commons:ae8c57858f' + implementation 'com.github.SimpleMobileTools:Simple-Commons:71f9297e2e' implementation 'org.greenrobot:eventbus:3.3.1' implementation 'com.github.tibbi:IndicatorFastScroll:4524cd0b61' implementation 'com.github.tibbi:android-smsmms:33fcaf94d9' diff --git a/app/src/main/kotlin/com/simplemobiletools/smsmessenger/activities/MainActivity.kt b/app/src/main/kotlin/com/simplemobiletools/smsmessenger/activities/MainActivity.kt index d869b7c4..4e0db7c6 100644 --- a/app/src/main/kotlin/com/simplemobiletools/smsmessenger/activities/MainActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/smsmessenger/activities/MainActivity.kt @@ -141,21 +141,25 @@ class MainActivity : SimpleActivity() { main_menu.getToolbar().inflateMenu(R.menu.menu_main) main_menu.toggleHideOnScroll(true) main_menu.setupMenu() - main_menu.onSearchOpenListener = { - search_holder.fadeIn() - conversations_fab.beGone() - } main_menu.onSearchClosedListener = { search_holder.animate().alpha(0f).setDuration(SHORT_ANIMATION_DURATION).withEndAction { search_holder.beGone() searchTextChanged("", true) }.start() - - conversations_fab.beVisible() } main_menu.onSearchTextChangedListener = { text -> + if (text.isNotEmpty()) { + if (search_holder.alpha < 1f) { + search_holder.fadeIn() + } + } else { + search_holder.animate().alpha(0f).setDuration(SHORT_ANIMATION_DURATION).withEndAction { + search_holder.beGone() + searchTextChanged("", true) + }.start() + } searchTextChanged(text) }