From e978af2359a28d3e758d63ad49c88fa673c262a1 Mon Sep 17 00:00:00 2001 From: Fahim Salam Chowdhury Date: Wed, 18 May 2022 16:22:10 +0600 Subject: [PATCH] 316-Fix_searchView_seach_icon_placement_issue issue: https://gitlab.e.foundation/e/os/backlog/-/issues/316 Update searchView's searchIcon according to mockup design. - search icon should be outside the actual editable field of the edittext - search icon should have padding of 14dp --- app/ui/base/src/main/res/values/styles.xml | 5 +++++ .../legacy/src/main/java/com/fsck/k9/activity/MessageList.kt | 4 ++++ app/ui/legacy/src/main/res/values/dimensions.xml | 2 ++ 3 files changed, 11 insertions(+) diff --git a/app/ui/base/src/main/res/values/styles.xml b/app/ui/base/src/main/res/values/styles.xml index 9b3825838f..3136371b50 100644 --- a/app/ui/base/src/main/res/values/styles.xml +++ b/app/ui/base/src/main/res/values/styles.xml @@ -11,6 +11,7 @@ @color/color_default_ternary_text @color/color_default_primary_dark @color/color_default_primary_dark + @style/CustomSearchView + + \ No newline at end of file diff --git a/app/ui/legacy/src/main/java/com/fsck/k9/activity/MessageList.kt b/app/ui/legacy/src/main/java/com/fsck/k9/activity/MessageList.kt index e181cbe789..47a5dc234d 100644 --- a/app/ui/legacy/src/main/java/com/fsck/k9/activity/MessageList.kt +++ b/app/ui/legacy/src/main/java/com/fsck/k9/activity/MessageList.kt @@ -1059,6 +1059,10 @@ open class MessageList : searchView = searchItem.actionView as SearchView searchView.maxWidth = Int.MAX_VALUE searchView.queryHint = resources.getString(R.string.search_action) + val searchEditText = searchView.findViewById(androidx.appcompat.R.id.search_src_text) as SearchView.SearchAutoComplete + val searchIcon = ContextCompat.getDrawable(this, R.drawable.ic_magnify) + searchEditText.setCompoundDrawablesWithIntrinsicBounds(searchIcon, null, null, null) + searchEditText.compoundDrawablePadding = resources.getDimensionPixelSize(R.dimen.search_icon_searchView_padding) val searchManager = getSystemService(Context.SEARCH_SERVICE) as SearchManager searchView.setSearchableInfo(searchManager.getSearchableInfo(componentName)) searchView.setOnQueryTextListener(object : SearchView.OnQueryTextListener { diff --git a/app/ui/legacy/src/main/res/values/dimensions.xml b/app/ui/legacy/src/main/res/values/dimensions.xml index 0a478eab7a..b0aea872c4 100644 --- a/app/ui/legacy/src/main/res/values/dimensions.xml +++ b/app/ui/legacy/src/main/res/values/dimensions.xml @@ -7,4 +7,6 @@ 8dp 4dp 12dp + + 14dp -- GitLab