view_toolbar_search: Switch to native toolbar for search

Signed-off-by: Aayush Gupta <aayushgupta219@gmail.com>
This commit is contained in:
Aayush Gupta
2024-12-12 18:53:29 +07:00
parent 3ec134279f
commit fd134096c8
12 changed files with 222 additions and 332 deletions

View File

@@ -23,13 +23,8 @@ import android.net.Uri
import android.os.Bundle
import android.text.Editable
import android.text.TextWatcher
import android.view.ContextThemeWrapper
import android.view.MenuInflater
import android.view.MenuItem
import android.view.View
import android.widget.PopupMenu
import androidx.activity.result.contract.ActivityResultContracts
import androidx.appcompat.content.res.AppCompatResources
import androidx.fragment.app.viewModels
import androidx.lifecycle.lifecycleScope
import androidx.navigation.fragment.findNavController
@@ -83,71 +78,44 @@ class AppsGamesFragment : BaseFragment<FragmentGenericWithSearchBinding>() {
}
// Toolbar
binding.layoutToolbarNative.apply {
imgActionPrimary.visibility = View.VISIBLE
imgActionSecondary.visibility = View.VISIBLE
imgActionPrimary.setOnClickListener { findNavController().navigateUp() }
imgActionSecondary.apply {
setImageDrawable(
AppCompatResources.getDrawable(requireContext(), R.drawable.ic_menu)
)
setOnClickListener {
showMenu(it)
}
}
inputSearch.addTextChangedListener(object : TextWatcher {
override fun onTextChanged(s: CharSequence?, start: Int, before: Int, count: Int) {
if (s.isNullOrEmpty()) {
updateController(viewModel.apps.value)
} else {
val filteredPackages = viewModel.apps.value?.filter {
it.displayName.contains(s, true) || it.packageName.contains(s, true)
}
updateController(filteredPackages)
binding.toolbar.apply {
inflateMenu(R.menu.menu_import_export)
setNavigationOnClickListener { findNavController().navigateUp() }
setOnMenuItemClickListener {
when (it.itemId) {
R.id.action_export -> {
startForDocumentExport.launch(
"aurora_store_apps_${Calendar.getInstance().time.time}.json"
)
true
}
else -> false
}
override fun afterTextChanged(s: Editable?) {}
override fun beforeTextChanged(
s: CharSequence?,
start: Int,
count: Int,
after: Int
) {
}
})
}
}
private fun showMenu(anchor: View) {
val popupMenu = PopupMenu(
ContextThemeWrapper(
requireContext(),
R.style.AppTheme_PopupMenu
), anchor
)
val inflater: MenuInflater = popupMenu.menuInflater
inflater.inflate(R.menu.menu_import_export, popupMenu.menu)
popupMenu.menu.removeItem(R.id.action_import)
popupMenu.setOnMenuItemClickListener { menuItem: MenuItem ->
when (menuItem.itemId) {
R.id.action_export -> {
startForDocumentExport.launch(
"aurora_store_apps_${Calendar.getInstance().time.time}.json"
)
true
}
else -> false
}
}
popupMenu.show()
binding.searchBar.addTextChangedListener(object : TextWatcher {
override fun onTextChanged(s: CharSequence?, start: Int, before: Int, count: Int) {
if (s.isNullOrEmpty()) {
updateController(viewModel.apps.value)
} else {
val filteredPackages = viewModel.apps.value?.filter {
it.displayName.contains(s, true) || it.packageName.contains(s, true)
}
updateController(filteredPackages)
}
}
override fun afterTextChanged(s: Editable?) {}
override fun beforeTextChanged(
s: CharSequence?,
start: Int,
count: Int,
after: Int
) {
}
})
}
private fun updateController(packages: List<App>?) {

View File

@@ -24,13 +24,8 @@ import android.net.Uri
import android.os.Bundle
import android.text.Editable
import android.text.TextWatcher
import android.view.ContextThemeWrapper
import android.view.MenuInflater
import android.view.MenuItem
import android.view.View
import android.widget.PopupMenu
import androidx.activity.result.contract.ActivityResultContracts
import androidx.appcompat.content.res.AppCompatResources
import androidx.fragment.app.viewModels
import androidx.lifecycle.lifecycleScope
import androidx.navigation.fragment.findNavController
@@ -71,46 +66,62 @@ class BlacklistFragment : BaseFragment<FragmentGenericWithSearchBinding>() {
}
// Toolbar
binding.layoutToolbarNative.apply {
imgActionPrimary.visibility = View.VISIBLE
imgActionSecondary.apply {
visibility = View.VISIBLE
setImageDrawable(
AppCompatResources.getDrawable(requireContext(), R.drawable.ic_menu)
)
setOnClickListener {
showMenu(it)
}
}
imgActionPrimary.setOnClickListener {
binding.toolbar.apply {
inflateMenu(R.menu.menu_blacklist)
setNavigationOnClickListener {
viewModel.blacklistProvider.blacklist = viewModel.selected
findNavController().navigateUp()
}
setOnMenuItemClickListener {
when (it.itemId) {
R.id.action_import -> {
startForDocumentImport.launch(arrayOf(Constants.JSON_MIME_TYPE))
}
inputSearch.addTextChangedListener(object : TextWatcher {
override fun onTextChanged(s: CharSequence?, start: Int, before: Int, count: Int) {
if (s.isNullOrEmpty()) {
updateController(viewModel.packages.value)
} else {
val filteredPackages = viewModel.packages.value?.filter {
it.applicationInfo!!.loadLabel(requireContext().packageManager)
.contains(s, true) || it.packageName.contains(s, true)
}
updateController(filteredPackages)
R.id.action_export -> {
startForDocumentExport.launch(
"aurora_store_apps_${Calendar.getInstance().time.time}.json"
)
}
R.id.action_select_all -> {
viewModel.selectAll()
binding.recycler.requestModelBuild()
true
}
R.id.action_remove_all -> {
viewModel.removeAll()
binding.recycler.requestModelBuild()
true
}
}
override fun afterTextChanged(s: Editable?) {}
override fun beforeTextChanged(
s: CharSequence?,
start: Int,
count: Int,
after: Int
) {
}
})
true
}
}
binding.searchBar.addTextChangedListener(object : TextWatcher {
override fun onTextChanged(s: CharSequence?, start: Int, before: Int, count: Int) {
if (s.isNullOrEmpty()) {
updateController(viewModel.packages.value)
} else {
val filteredPackages = viewModel.packages.value?.filter {
it.applicationInfo!!.loadLabel(requireContext().packageManager)
.contains(s, true) || it.packageName.contains(s, true)
}
updateController(filteredPackages)
}
}
override fun afterTextChanged(s: Editable?) {}
override fun beforeTextChanged(
s: CharSequence?,
start: Int,
count: Int,
after: Int
) {
}
})
}
override fun onPause() {
@@ -118,49 +129,6 @@ class BlacklistFragment : BaseFragment<FragmentGenericWithSearchBinding>() {
viewModel.blacklistProvider.blacklist = viewModel.selected
}
private fun showMenu(anchor: View) {
val popupMenu = PopupMenu(
ContextThemeWrapper(
requireContext(),
R.style.AppTheme_PopupMenu
), anchor
)
val inflater: MenuInflater = popupMenu.menuInflater
inflater.inflate(R.menu.menu_blacklist, popupMenu.menu)
popupMenu.setOnMenuItemClickListener { menuItem: MenuItem ->
when (menuItem.itemId) {
R.id.action_import -> {
startForDocumentImport.launch(arrayOf(Constants.JSON_MIME_TYPE))
true
}
R.id.action_export -> {
startForDocumentExport.launch(
"aurora_store_blacklist_${Calendar.getInstance().time.time}.json"
)
true
}
R.id.action_select_all -> {
viewModel.selectAll()
binding.recycler.requestModelBuild()
true
}
R.id.action_remove_all -> {
viewModel.removeAll()
binding.recycler.requestModelBuild()
true
}
else -> false
}
}
popupMenu.show()
}
private fun updateController(packages: List<PackageInfo>?) {
binding.recycler.withModels {
setFilterDuplicates(true)

View File

@@ -50,7 +50,6 @@ import com.aurora.store.view.epoxy.views.app.NoAppViewModel_
import com.aurora.store.view.epoxy.views.shimmer.AppListViewShimmerModel_
import com.aurora.store.view.ui.commons.BaseFragment
import com.aurora.store.viewmodel.search.SearchResultViewModel
import com.google.android.material.textfield.TextInputEditText
import dagger.hilt.android.AndroidEntryPoint
@AndroidEntryPoint
@@ -59,8 +58,6 @@ class SearchResultsFragment : BaseFragment<FragmentSearchResultBinding>(),
private val viewModel: SearchResultViewModel by viewModels()
private lateinit var searchView: TextInputEditText
private lateinit var sharedPreferences: SharedPreferences
private var query: String? = null
@@ -84,20 +81,20 @@ class SearchResultsFragment : BaseFragment<FragmentSearchResultBinding>(),
sharedPreferences.registerOnSharedPreferenceChangeListener(this)
// Toolbar
binding.layoutViewToolbar.apply {
searchView = inputSearch
imgActionPrimary.setOnClickListener {
binding.toolbar.apply {
setNavigationOnClickListener {
binding.searchBar.hideKeyboard()
findNavController().navigateUp()
}
imgActionSecondary.setOnClickListener {
findNavController().navigate(R.id.downloadFragment)
}
clearButton.apply {
visibility = if (query.isNullOrBlank()) View.GONE else View.VISIBLE
setOnClickListener {
searchView.text?.clear()
searchView.showKeyboard()
setOnMenuItemClickListener {
when (it.itemId) {
R.id.action_clear -> {
binding.searchBar.text?.clear()
binding.searchBar.showKeyboard()
}
R.id.action_download -> findNavController().navigate(R.id.downloadFragment)
}
true
}
}
@@ -186,30 +183,29 @@ class SearchResultsFragment : BaseFragment<FragmentSearchResultBinding>(),
}
}
} else {
binding.recycler
.withModels {
setFilterDuplicates(true)
binding.recycler.withModels {
setFilterDuplicates(true)
filteredAppList.forEach { app ->
add(
AppListViewModel_()
.id(app.id)
.app(app)
.click(View.OnClickListener {
searchView.hideKeyboard()
openDetailsFragment(app.packageName, app)
})
)
}
if (searchBundle.subBundles.isNotEmpty()) {
add(
AppProgressViewModel_()
.id("progress")
)
}
filteredAppList.forEach { app ->
add(
AppListViewModel_()
.id(app.id)
.app(app)
.click(View.OnClickListener {
binding.searchBar.hideKeyboard()
openDetailsFragment(app.packageName, app)
})
)
}
if (searchBundle.subBundles.isNotEmpty()) {
add(
AppProgressViewModel_()
.id("progress")
)
}
}
binding.recycler.adapter?.let {
if (it.itemCount < 10) {
viewModel.next(searchBundle.subBundles)
@@ -219,28 +215,22 @@ class SearchResultsFragment : BaseFragment<FragmentSearchResultBinding>(),
}
private fun attachSearch() {
searchView.addTextChangedListener(object : TextWatcher {
override fun beforeTextChanged(s: CharSequence, start: Int, count: Int, after: Int) {
}
binding.searchBar.addTextChangedListener(object : TextWatcher {
override fun beforeTextChanged(s: CharSequence, start: Int, count: Int, after: Int) {}
override fun onTextChanged(s: CharSequence, start: Int, before: Int, count: Int) {
if (s.isNotEmpty()) {
binding.layoutViewToolbar.clearButton.visibility = View.VISIBLE
} else {
binding.layoutViewToolbar.clearButton.visibility = View.GONE
}
binding.toolbar.menu.findItem(R.id.action_clear)?.isVisible = s.isNotBlank()
}
override fun afterTextChanged(s: Editable) {}
})
searchView.setOnEditorActionListener { _: TextView?, actionId: Int, _: KeyEvent? ->
binding.searchBar.setOnEditorActionListener { _: TextView?, actionId: Int, _: KeyEvent? ->
if (actionId == EditorInfo.IME_ACTION_SEARCH
|| actionId == KeyEvent.ACTION_DOWN
|| actionId == KeyEvent.KEYCODE_ENTER
) {
query = searchView.text.toString()
query = binding.searchBar.text.toString()
query?.let {
requireArguments().putString("query", it)
queryViewModel(it)
@@ -252,8 +242,8 @@ class SearchResultsFragment : BaseFragment<FragmentSearchResultBinding>(),
}
private fun updateQuery(query: String) {
searchView.text = Editable.Factory.getInstance().newEditable(query)
searchView.setSelection(query.length)
binding.searchBar.text = Editable.Factory.getInstance().newEditable(query)
binding.searchBar.setSelection(query.length)
queryViewModel(query)
}
@@ -277,7 +267,6 @@ class SearchResultsFragment : BaseFragment<FragmentSearchResultBinding>(),
.toList()
}
override fun onSharedPreferenceChanged(sharedPreferences: SharedPreferences?, key: String?) {
if (key == PREFERENCE_FILTER) query?.let { queryViewModel(it) }
}

View File

@@ -37,7 +37,6 @@ import com.aurora.store.databinding.FragmentSearchSuggestionBinding
import com.aurora.store.view.epoxy.views.SearchSuggestionViewModel_
import com.aurora.store.view.ui.commons.BaseFragment
import com.aurora.store.viewmodel.search.SearchSuggestionViewModel
import com.google.android.material.textfield.TextInputEditText
import dagger.hilt.android.AndroidEntryPoint
import kotlinx.coroutines.flow.collectLatest
import kotlinx.coroutines.launch
@@ -47,26 +46,21 @@ class SearchSuggestionFragment : BaseFragment<FragmentSearchSuggestionBinding>()
private val viewModel: SearchSuggestionViewModel by viewModels()
private lateinit var searchView: TextInputEditText
private var query: String = String()
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)
// Toolbar
binding.layoutToolbarSearch.apply {
searchView = inputSearch
imgActionPrimary.setOnClickListener {
searchView.hideKeyboard()
binding.toolbar.apply {
setNavigationOnClickListener {
binding.searchBar.hideKeyboard()
findNavController().navigateUp()
}
imgActionSecondary.setOnClickListener {
findNavController().navigate(R.id.downloadFragment)
}
clearButton.apply {
visibility = if (query.isBlank()) View.GONE else View.VISIBLE
setOnClickListener { searchView.text?.clear() }
setOnMenuItemClickListener {
when (it.itemId) {
R.id.action_clear -> binding.searchBar.text?.clear()
R.id.action_download -> findNavController().navigate(R.id.downloadFragment)
}
true
}
}
@@ -81,9 +75,7 @@ class SearchSuggestionFragment : BaseFragment<FragmentSearchSuggestionBinding>()
override fun onResume() {
super.onResume()
if (::searchView.isInitialized) {
searchView.showKeyboard()
}
binding.searchBar.showKeyboard()
}
private fun updateController(searchSuggestions: List<SearchSuggestEntry>) {
@@ -98,7 +90,7 @@ class SearchSuggestionFragment : BaseFragment<FragmentSearchSuggestionBinding>()
updateQuery(it.title)
}
.click { _ ->
searchView.hideKeyboard()
binding.searchBar.hideKeyboard()
search(it.title)
}
)
@@ -107,32 +99,30 @@ class SearchSuggestionFragment : BaseFragment<FragmentSearchSuggestionBinding>()
}
private fun setupSearch() {
searchView.addTextChangedListener(object : TextWatcher {
binding.searchBar.addTextChangedListener(object : TextWatcher {
override fun beforeTextChanged(s: CharSequence, start: Int, count: Int, after: Int) {}
override fun onTextChanged(s: CharSequence, start: Int, before: Int, count: Int) {
if (s.isNotEmpty()) {
query = s.toString()
val query = s.toString()
if (query.isNotEmpty()) {
viewModel.observeStreamBundles(query)
}
binding.layoutToolbarSearch.clearButton.visibility = View.VISIBLE
} else {
binding.layoutToolbarSearch.clearButton.visibility = View.GONE
}
binding.toolbar.menu.findItem(R.id.action_clear)?.isVisible = s.isNotBlank()
}
override fun afterTextChanged(s: Editable) {}
})
searchView.setOnEditorActionListener { _: TextView?, actionId: Int, _: KeyEvent? ->
binding.searchBar.setOnEditorActionListener { _: TextView?, actionId: Int, _: KeyEvent? ->
if (actionId == EditorInfo.IME_ACTION_SEARCH
|| actionId == KeyEvent.ACTION_DOWN
|| actionId == KeyEvent.KEYCODE_ENTER
) {
query = searchView.text.toString()
val query = binding.searchBar.text.toString()
if (query.isNotEmpty()) {
searchView.hideKeyboard()
binding.searchBar.hideKeyboard()
search(query)
return@setOnEditorActionListener true
}
@@ -142,8 +132,8 @@ class SearchSuggestionFragment : BaseFragment<FragmentSearchSuggestionBinding>()
}
private fun updateQuery(query: String) {
searchView.text = Editable.Factory.getInstance().newEditable(query)
searchView.setSelection(query.length)
binding.searchBar.text = Editable.Factory.getInstance().newEditable(query)
binding.searchBar.setSelection(query.length)
}
private fun search(query: String) {

View File

@@ -1,9 +0,0 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="960"
android:viewportHeight="960">
<path
android:pathData="M480,800q-33,0 -56.5,-23.5T400,720q0,-33 23.5,-56.5T480,640q33,0 56.5,23.5T560,720q0,33 -23.5,56.5T480,800ZM480,560q-33,0 -56.5,-23.5T400,480q0,-33 23.5,-56.5T480,400q33,0 56.5,23.5T560,480q0,33 -23.5,56.5T480,560ZM480,320q-33,0 -56.5,-23.5T400,240q0,-33 23.5,-56.5T480,160q33,0 56.5,23.5T560,240q0,33 -23.5,56.5T480,320Z"
android:fillColor="#e8eaed"/>
</vector>

View File

@@ -24,18 +24,35 @@
android:layout_height="match_parent"
android:orientation="vertical">
<include
android:id="@+id/layout_toolbar_native"
layout="@layout/view_toolbar_search" />
<androidx.appcompat.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:minHeight="?attr/actionBarSize"
android:theme="?attr/actionBarTheme"
app:navigationIcon="@drawable/ic_arrow_back">
<com.google.android.material.textfield.TextInputEditText
android:id="@+id/searchBar"
android:layout_width="match_parent"
android:layout_height="42dp"
android:background="@null"
android:hint="@string/search_hint"
android:imeOptions="flagNoExtractUi|actionSearch"
android:inputType="text"
android:paddingStart="@dimen/padding_large"
android:paddingEnd="@dimen/padding_normal"
android:singleLine="true" />
</androidx.appcompat.widget.Toolbar>
<com.airbnb.epoxy.EpoxyRecyclerView
android:id="@+id/recycler"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_below="@+id/layout_toolbar_native"
android:layout_below="@+id/toolbar"
android:clipToPadding="true"
android:paddingBottom="@dimen/height_bottom_adj"
app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager"
app:stackFromEnd="false"
tools:listitem="@layout/view_app_list" />
</RelativeLayout>
</RelativeLayout>

View File

@@ -30,15 +30,33 @@
android:layout_height="match_parent"
android:orientation="vertical">
<include
android:id="@+id/layout_view_toolbar"
layout="@layout/view_toolbar_search" />
<androidx.appcompat.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:minHeight="?attr/actionBarSize"
android:theme="?attr/actionBarTheme"
app:menu="@menu/menu_search"
app:navigationIcon="@drawable/ic_arrow_back">
<com.google.android.material.textfield.TextInputEditText
android:id="@+id/searchBar"
android:layout_width="match_parent"
android:layout_height="42dp"
android:background="@null"
android:hint="@string/search_hint"
android:imeOptions="flagNoExtractUi|actionSearch"
android:inputType="text"
android:paddingStart="@dimen/padding_large"
android:paddingEnd="@dimen/padding_normal"
android:singleLine="true" />
</androidx.appcompat.widget.Toolbar>
<com.google.android.material.divider.MaterialDivider
android:id="@+id/divider"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@id/layout_view_toolbar" />
android:layout_below="@id/toolbar" />
<com.airbnb.epoxy.EpoxyRecyclerView
android:id="@+id/recycler"

View File

@@ -19,6 +19,7 @@
<androidx.coordinatorlayout.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/coordinator"
android:layout_width="match_parent"
android:layout_height="match_parent"
@@ -29,15 +30,33 @@
android:layout_height="match_parent"
android:orientation="vertical">
<include
android:id="@+id/layout_toolbar_search"
layout="@layout/view_toolbar_search" />
<androidx.appcompat.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:minHeight="?attr/actionBarSize"
android:theme="?attr/actionBarTheme"
app:menu="@menu/menu_search"
app:navigationIcon="@drawable/ic_arrow_back">
<com.google.android.material.textfield.TextInputEditText
android:id="@+id/searchBar"
android:layout_width="match_parent"
android:layout_height="42dp"
android:background="@null"
android:hint="@string/search_hint"
android:imeOptions="flagNoExtractUi|actionSearch"
android:inputType="text"
android:paddingStart="@dimen/padding_large"
android:paddingEnd="@dimen/padding_normal"
android:singleLine="true" />
</androidx.appcompat.widget.Toolbar>
<com.google.android.material.divider.MaterialDivider
android:id="@+id/divider"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@id/layout_toolbar_search" />
android:layout_below="@id/toolbar" />
<com.airbnb.epoxy.EpoxyRecyclerView
android:id="@+id/recycler"
@@ -46,4 +65,4 @@
android:layout_below="@+id/divider"
tools:listitem="@layout/view_search_suggestion" />
</RelativeLayout>
</androidx.coordinatorlayout.widget.CoordinatorLayout>
</androidx.coordinatorlayout.widget.CoordinatorLayout>

View File

@@ -1,77 +0,0 @@
<?xml version="1.0" encoding="utf-8"?><!--
~ Aurora Store
~ Copyright (C) 2021, Rahul Kumar Patel <whyorean@gmail.com>
~
~ Aurora Store is free software: you can redistribute it and/or modify
~ it under the terms of the GNU General Public License as published by
~ the Free Software Foundation, either version 2 of the License, or
~ (at your option) any later version.
~
~ Aurora Store is distributed in the hope that it will be useful,
~ but WITHOUT ANY WARRANTY; without even the implied warranty of
~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
~ GNU General Public License for more details.
~
~ You should have received a copy of the GNU General Public License
~ along with Aurora Store. If not, see <http://www.gnu.org/licenses/>.
~
-->
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?actionBarSize"
android:paddingStart="@dimen/padding_large"
android:paddingEnd="@dimen/padding_large">
<androidx.appcompat.widget.AppCompatImageView
android:id="@+id/img_action_primary"
android:layout_width="@dimen/icon_size_default"
android:layout_height="@dimen/icon_size_default"
android:layout_centerVertical="true"
android:layout_marginEnd="@dimen/margin_small"
android:background="?selectableItemBackgroundBorderless"
android:contentDescription="@string/action_back"
app:srcCompat="@drawable/ic_arrow_back"
app:tint="?colorControlNormal" />
<com.google.android.material.textfield.TextInputEditText
android:id="@+id/input_search"
android:layout_width="match_parent"
android:layout_height="42dp"
android:layout_centerVertical="true"
android:layout_toStartOf="@id/clearButton"
android:layout_toEndOf="@id/img_action_primary"
android:background="@null"
android:hint="@string/search_hint"
android:imeOptions="flagNoExtractUi|actionSearch"
android:inputType="text"
android:paddingStart="@dimen/padding_large"
android:paddingEnd="@dimen/padding_normal"
android:singleLine="true" />
<com.google.android.material.button.MaterialButton
android:id="@+id/clearButton"
style="@style/Widget.Material3.Button.IconButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_toStartOf="@id/img_action_secondary"
android:contentDescription="@string/details_changelog"
android:visibility="gone"
app:icon="@drawable/ic_cancel"
app:iconTint="?attr/colorControlNormal" />
<androidx.appcompat.widget.AppCompatImageView
android:id="@+id/img_action_secondary"
android:layout_width="@dimen/icon_size_default"
android:layout_height="@dimen/icon_size_default"
android:layout_alignParentEnd="true"
android:layout_centerVertical="true"
android:layout_marginStart="@dimen/margin_small"
android:background="?selectableItemBackgroundBorderless"
android:contentDescription="@string/title_download_manager"
app:srcCompat="@drawable/ic_arrow_download"
app:tint="?colorControlNormal" />
</RelativeLayout>

View File

@@ -0,0 +1,15 @@
<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto">
<item
android:id="@+id/action_clear"
android:icon="@drawable/ic_cancel"
android:title="@string/action_clear"
android:visible="false"
app:showAsAction="ifRoom" />
<item
android:id="@+id/action_download"
android:icon="@drawable/ic_download_manager"
android:title="@string/title_download_manager"
app:showAsAction="ifRoom" />
</menu>

View File

@@ -5,6 +5,5 @@
<item name="chipStyle">@style/Chip.Filter</item>
<item name="preferenceTheme">@style/AppTheme.PreferenceThemeOverlay</item>
<item name="android:statusBarColor">@color/colorTransparent</item>
<item name="popupMenuStyle">@style/AppTheme.PopupMenu</item>
</style>
</resources>

View File

@@ -24,7 +24,6 @@
<item name="preferenceTheme">@style/AppTheme.PreferenceThemeOverlay</item>
<item name="bottomSheetStyle">@style/AppTheme.BottomSheetStyle</item>
<item name="android:statusBarColor">@color/colorTransparent</item>
<item name="popupMenuStyle">@style/AppTheme.PopupMenu</item>
</style>
<style name="AppTheme.Translucent" parent="Theme.Material3.DynamicColors.DayNight.NoActionBar">
@@ -48,12 +47,6 @@
<item name="widgetLayout">@layout/preference_material_switch</item>
</style>
<style name="AppTheme.PopupMenu" parent="Widget.Material3.PopupMenu">
<item name="android:popupBackground">?attr/colorSurfaceContainer</item>
<item name="android:textColor">?attr/colorOnSurface</item>
<item name="android:elevation">4dp</item>
</style>
<style name="Chip.Filter" parent="@style/Widget.Material3.Chip.Filter" />
<style name="Chip.TopChart" parent="@style/Widget.Material3.Chip.Filter">