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.os.Bundle
import android.text.Editable import android.text.Editable
import android.text.TextWatcher import android.text.TextWatcher
import android.view.ContextThemeWrapper
import android.view.MenuInflater
import android.view.MenuItem
import android.view.View import android.view.View
import android.widget.PopupMenu
import androidx.activity.result.contract.ActivityResultContracts import androidx.activity.result.contract.ActivityResultContracts
import androidx.appcompat.content.res.AppCompatResources
import androidx.fragment.app.viewModels import androidx.fragment.app.viewModels
import androidx.lifecycle.lifecycleScope import androidx.lifecycle.lifecycleScope
import androidx.navigation.fragment.findNavController import androidx.navigation.fragment.findNavController
@@ -83,71 +78,44 @@ class AppsGamesFragment : BaseFragment<FragmentGenericWithSearchBinding>() {
} }
// Toolbar // Toolbar
binding.layoutToolbarNative.apply { binding.toolbar.apply {
imgActionPrimary.visibility = View.VISIBLE inflateMenu(R.menu.menu_import_export)
imgActionSecondary.visibility = View.VISIBLE setNavigationOnClickListener { findNavController().navigateUp() }
setOnMenuItemClickListener {
imgActionPrimary.setOnClickListener { findNavController().navigateUp() } when (it.itemId) {
imgActionSecondary.apply { R.id.action_export -> {
setImageDrawable( startForDocumentExport.launch(
AppCompatResources.getDrawable(requireContext(), R.drawable.ic_menu) "aurora_store_apps_${Calendar.getInstance().time.time}.json"
) )
setOnClickListener { true
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)
} }
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>?) { private fun updateController(packages: List<App>?) {

View File

@@ -24,13 +24,8 @@ import android.net.Uri
import android.os.Bundle import android.os.Bundle
import android.text.Editable import android.text.Editable
import android.text.TextWatcher import android.text.TextWatcher
import android.view.ContextThemeWrapper
import android.view.MenuInflater
import android.view.MenuItem
import android.view.View import android.view.View
import android.widget.PopupMenu
import androidx.activity.result.contract.ActivityResultContracts import androidx.activity.result.contract.ActivityResultContracts
import androidx.appcompat.content.res.AppCompatResources
import androidx.fragment.app.viewModels import androidx.fragment.app.viewModels
import androidx.lifecycle.lifecycleScope import androidx.lifecycle.lifecycleScope
import androidx.navigation.fragment.findNavController import androidx.navigation.fragment.findNavController
@@ -71,46 +66,62 @@ class BlacklistFragment : BaseFragment<FragmentGenericWithSearchBinding>() {
} }
// Toolbar // Toolbar
binding.layoutToolbarNative.apply { binding.toolbar.apply {
imgActionPrimary.visibility = View.VISIBLE inflateMenu(R.menu.menu_blacklist)
imgActionSecondary.apply { setNavigationOnClickListener {
visibility = View.VISIBLE
setImageDrawable(
AppCompatResources.getDrawable(requireContext(), R.drawable.ic_menu)
)
setOnClickListener {
showMenu(it)
}
}
imgActionPrimary.setOnClickListener {
viewModel.blacklistProvider.blacklist = viewModel.selected viewModel.blacklistProvider.blacklist = viewModel.selected
findNavController().navigateUp() findNavController().navigateUp()
} }
setOnMenuItemClickListener {
when (it.itemId) {
R.id.action_import -> {
startForDocumentImport.launch(arrayOf(Constants.JSON_MIME_TYPE))
}
inputSearch.addTextChangedListener(object : TextWatcher { R.id.action_export -> {
override fun onTextChanged(s: CharSequence?, start: Int, before: Int, count: Int) { startForDocumentExport.launch(
if (s.isNullOrEmpty()) { "aurora_store_apps_${Calendar.getInstance().time.time}.json"
updateController(viewModel.packages.value) )
} else { }
val filteredPackages = viewModel.packages.value?.filter {
it.applicationInfo!!.loadLabel(requireContext().packageManager) R.id.action_select_all -> {
.contains(s, true) || it.packageName.contains(s, true) viewModel.selectAll()
} binding.recycler.requestModelBuild()
updateController(filteredPackages) true
}
R.id.action_remove_all -> {
viewModel.removeAll()
binding.recycler.requestModelBuild()
true
} }
} }
true
override fun afterTextChanged(s: Editable?) {} }
override fun beforeTextChanged(
s: CharSequence?,
start: Int,
count: Int,
after: Int
) {
}
})
} }
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() { override fun onPause() {
@@ -118,49 +129,6 @@ class BlacklistFragment : BaseFragment<FragmentGenericWithSearchBinding>() {
viewModel.blacklistProvider.blacklist = viewModel.selected 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>?) { private fun updateController(packages: List<PackageInfo>?) {
binding.recycler.withModels { binding.recycler.withModels {
setFilterDuplicates(true) 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.epoxy.views.shimmer.AppListViewShimmerModel_
import com.aurora.store.view.ui.commons.BaseFragment import com.aurora.store.view.ui.commons.BaseFragment
import com.aurora.store.viewmodel.search.SearchResultViewModel import com.aurora.store.viewmodel.search.SearchResultViewModel
import com.google.android.material.textfield.TextInputEditText
import dagger.hilt.android.AndroidEntryPoint import dagger.hilt.android.AndroidEntryPoint
@AndroidEntryPoint @AndroidEntryPoint
@@ -59,8 +58,6 @@ class SearchResultsFragment : BaseFragment<FragmentSearchResultBinding>(),
private val viewModel: SearchResultViewModel by viewModels() private val viewModel: SearchResultViewModel by viewModels()
private lateinit var searchView: TextInputEditText
private lateinit var sharedPreferences: SharedPreferences private lateinit var sharedPreferences: SharedPreferences
private var query: String? = null private var query: String? = null
@@ -84,20 +81,20 @@ class SearchResultsFragment : BaseFragment<FragmentSearchResultBinding>(),
sharedPreferences.registerOnSharedPreferenceChangeListener(this) sharedPreferences.registerOnSharedPreferenceChangeListener(this)
// Toolbar // Toolbar
binding.layoutViewToolbar.apply { binding.toolbar.apply {
searchView = inputSearch setNavigationOnClickListener {
imgActionPrimary.setOnClickListener { binding.searchBar.hideKeyboard()
findNavController().navigateUp() findNavController().navigateUp()
} }
imgActionSecondary.setOnClickListener { setOnMenuItemClickListener {
findNavController().navigate(R.id.downloadFragment) when (it.itemId) {
} R.id.action_clear -> {
clearButton.apply { binding.searchBar.text?.clear()
visibility = if (query.isNullOrBlank()) View.GONE else View.VISIBLE binding.searchBar.showKeyboard()
setOnClickListener { }
searchView.text?.clear() R.id.action_download -> findNavController().navigate(R.id.downloadFragment)
searchView.showKeyboard()
} }
true
} }
} }
@@ -186,30 +183,29 @@ class SearchResultsFragment : BaseFragment<FragmentSearchResultBinding>(),
} }
} }
} else { } else {
binding.recycler binding.recycler.withModels {
.withModels { setFilterDuplicates(true)
setFilterDuplicates(true)
filteredAppList.forEach { app -> filteredAppList.forEach { app ->
add( add(
AppListViewModel_() AppListViewModel_()
.id(app.id) .id(app.id)
.app(app) .app(app)
.click(View.OnClickListener { .click(View.OnClickListener {
searchView.hideKeyboard() binding.searchBar.hideKeyboard()
openDetailsFragment(app.packageName, app) openDetailsFragment(app.packageName, app)
}) })
) )
}
if (searchBundle.subBundles.isNotEmpty()) {
add(
AppProgressViewModel_()
.id("progress")
)
}
} }
if (searchBundle.subBundles.isNotEmpty()) {
add(
AppProgressViewModel_()
.id("progress")
)
}
}
binding.recycler.adapter?.let { binding.recycler.adapter?.let {
if (it.itemCount < 10) { if (it.itemCount < 10) {
viewModel.next(searchBundle.subBundles) viewModel.next(searchBundle.subBundles)
@@ -219,28 +215,22 @@ class SearchResultsFragment : BaseFragment<FragmentSearchResultBinding>(),
} }
private fun attachSearch() { private fun attachSearch() {
searchView.addTextChangedListener(object : TextWatcher { binding.searchBar.addTextChangedListener(object : TextWatcher {
override fun beforeTextChanged(s: CharSequence, start: Int, count: Int, after: Int) { override fun beforeTextChanged(s: CharSequence, start: Int, count: Int, after: Int) {}
}
override fun onTextChanged(s: CharSequence, start: Int, before: Int, count: Int) { override fun onTextChanged(s: CharSequence, start: Int, before: Int, count: Int) {
if (s.isNotEmpty()) { binding.toolbar.menu.findItem(R.id.action_clear)?.isVisible = s.isNotBlank()
binding.layoutViewToolbar.clearButton.visibility = View.VISIBLE
} else {
binding.layoutViewToolbar.clearButton.visibility = View.GONE
}
} }
override fun afterTextChanged(s: Editable) {} override fun afterTextChanged(s: Editable) {}
}) })
searchView.setOnEditorActionListener { _: TextView?, actionId: Int, _: KeyEvent? -> binding.searchBar.setOnEditorActionListener { _: TextView?, actionId: Int, _: KeyEvent? ->
if (actionId == EditorInfo.IME_ACTION_SEARCH if (actionId == EditorInfo.IME_ACTION_SEARCH
|| actionId == KeyEvent.ACTION_DOWN || actionId == KeyEvent.ACTION_DOWN
|| actionId == KeyEvent.KEYCODE_ENTER || actionId == KeyEvent.KEYCODE_ENTER
) { ) {
query = searchView.text.toString() query = binding.searchBar.text.toString()
query?.let { query?.let {
requireArguments().putString("query", it) requireArguments().putString("query", it)
queryViewModel(it) queryViewModel(it)
@@ -252,8 +242,8 @@ class SearchResultsFragment : BaseFragment<FragmentSearchResultBinding>(),
} }
private fun updateQuery(query: String) { private fun updateQuery(query: String) {
searchView.text = Editable.Factory.getInstance().newEditable(query) binding.searchBar.text = Editable.Factory.getInstance().newEditable(query)
searchView.setSelection(query.length) binding.searchBar.setSelection(query.length)
queryViewModel(query) queryViewModel(query)
} }
@@ -277,7 +267,6 @@ class SearchResultsFragment : BaseFragment<FragmentSearchResultBinding>(),
.toList() .toList()
} }
override fun onSharedPreferenceChanged(sharedPreferences: SharedPreferences?, key: String?) { override fun onSharedPreferenceChanged(sharedPreferences: SharedPreferences?, key: String?) {
if (key == PREFERENCE_FILTER) query?.let { queryViewModel(it) } 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.epoxy.views.SearchSuggestionViewModel_
import com.aurora.store.view.ui.commons.BaseFragment import com.aurora.store.view.ui.commons.BaseFragment
import com.aurora.store.viewmodel.search.SearchSuggestionViewModel import com.aurora.store.viewmodel.search.SearchSuggestionViewModel
import com.google.android.material.textfield.TextInputEditText
import dagger.hilt.android.AndroidEntryPoint import dagger.hilt.android.AndroidEntryPoint
import kotlinx.coroutines.flow.collectLatest import kotlinx.coroutines.flow.collectLatest
import kotlinx.coroutines.launch import kotlinx.coroutines.launch
@@ -47,26 +46,21 @@ class SearchSuggestionFragment : BaseFragment<FragmentSearchSuggestionBinding>()
private val viewModel: SearchSuggestionViewModel by viewModels() private val viewModel: SearchSuggestionViewModel by viewModels()
private lateinit var searchView: TextInputEditText
private var query: String = String()
override fun onViewCreated(view: View, savedInstanceState: Bundle?) { override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState) super.onViewCreated(view, savedInstanceState)
// Toolbar // Toolbar
binding.layoutToolbarSearch.apply { binding.toolbar.apply {
searchView = inputSearch setNavigationOnClickListener {
imgActionPrimary.setOnClickListener { binding.searchBar.hideKeyboard()
searchView.hideKeyboard()
findNavController().navigateUp() findNavController().navigateUp()
} }
imgActionSecondary.setOnClickListener { setOnMenuItemClickListener {
findNavController().navigate(R.id.downloadFragment) when (it.itemId) {
} R.id.action_clear -> binding.searchBar.text?.clear()
clearButton.apply { R.id.action_download -> findNavController().navigate(R.id.downloadFragment)
visibility = if (query.isBlank()) View.GONE else View.VISIBLE }
setOnClickListener { searchView.text?.clear() } true
} }
} }
@@ -81,9 +75,7 @@ class SearchSuggestionFragment : BaseFragment<FragmentSearchSuggestionBinding>()
override fun onResume() { override fun onResume() {
super.onResume() super.onResume()
if (::searchView.isInitialized) { binding.searchBar.showKeyboard()
searchView.showKeyboard()
}
} }
private fun updateController(searchSuggestions: List<SearchSuggestEntry>) { private fun updateController(searchSuggestions: List<SearchSuggestEntry>) {
@@ -98,7 +90,7 @@ class SearchSuggestionFragment : BaseFragment<FragmentSearchSuggestionBinding>()
updateQuery(it.title) updateQuery(it.title)
} }
.click { _ -> .click { _ ->
searchView.hideKeyboard() binding.searchBar.hideKeyboard()
search(it.title) search(it.title)
} }
) )
@@ -107,32 +99,30 @@ class SearchSuggestionFragment : BaseFragment<FragmentSearchSuggestionBinding>()
} }
private fun setupSearch() { 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 beforeTextChanged(s: CharSequence, start: Int, count: Int, after: Int) {}
override fun onTextChanged(s: CharSequence, start: Int, before: Int, count: Int) { override fun onTextChanged(s: CharSequence, start: Int, before: Int, count: Int) {
if (s.isNotEmpty()) { if (s.isNotEmpty()) {
query = s.toString() val query = s.toString()
if (query.isNotEmpty()) { if (query.isNotEmpty()) {
viewModel.observeStreamBundles(query) 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) {} override fun afterTextChanged(s: Editable) {}
}) })
searchView.setOnEditorActionListener { _: TextView?, actionId: Int, _: KeyEvent? -> binding.searchBar.setOnEditorActionListener { _: TextView?, actionId: Int, _: KeyEvent? ->
if (actionId == EditorInfo.IME_ACTION_SEARCH if (actionId == EditorInfo.IME_ACTION_SEARCH
|| actionId == KeyEvent.ACTION_DOWN || actionId == KeyEvent.ACTION_DOWN
|| actionId == KeyEvent.KEYCODE_ENTER || actionId == KeyEvent.KEYCODE_ENTER
) { ) {
query = searchView.text.toString() val query = binding.searchBar.text.toString()
if (query.isNotEmpty()) { if (query.isNotEmpty()) {
searchView.hideKeyboard() binding.searchBar.hideKeyboard()
search(query) search(query)
return@setOnEditorActionListener true return@setOnEditorActionListener true
} }
@@ -142,8 +132,8 @@ class SearchSuggestionFragment : BaseFragment<FragmentSearchSuggestionBinding>()
} }
private fun updateQuery(query: String) { private fun updateQuery(query: String) {
searchView.text = Editable.Factory.getInstance().newEditable(query) binding.searchBar.text = Editable.Factory.getInstance().newEditable(query)
searchView.setSelection(query.length) binding.searchBar.setSelection(query.length)
} }
private fun search(query: String) { 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:layout_height="match_parent"
android:orientation="vertical"> android:orientation="vertical">
<include <androidx.appcompat.widget.Toolbar
android:id="@+id/layout_toolbar_native" android:id="@+id/toolbar"
layout="@layout/view_toolbar_search" /> 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 <com.airbnb.epoxy.EpoxyRecyclerView
android:id="@+id/recycler" android:id="@+id/recycler"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:layout_below="@+id/layout_toolbar_native" android:layout_below="@+id/toolbar"
android:clipToPadding="true" android:clipToPadding="true"
android:paddingBottom="@dimen/height_bottom_adj" android:paddingBottom="@dimen/height_bottom_adj"
app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager" app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager"
app:stackFromEnd="false" app:stackFromEnd="false"
tools:listitem="@layout/view_app_list" /> tools:listitem="@layout/view_app_list" />
</RelativeLayout> </RelativeLayout>

View File

@@ -30,15 +30,33 @@
android:layout_height="match_parent" android:layout_height="match_parent"
android:orientation="vertical"> android:orientation="vertical">
<include <androidx.appcompat.widget.Toolbar
android:id="@+id/layout_view_toolbar" android:id="@+id/toolbar"
layout="@layout/view_toolbar_search" /> 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 <com.google.android.material.divider.MaterialDivider
android:id="@+id/divider" android:id="@+id/divider"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_below="@id/layout_view_toolbar" /> android:layout_below="@id/toolbar" />
<com.airbnb.epoxy.EpoxyRecyclerView <com.airbnb.epoxy.EpoxyRecyclerView
android:id="@+id/recycler" android:id="@+id/recycler"

View File

@@ -19,6 +19,7 @@
<androidx.coordinatorlayout.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android" <androidx.coordinatorlayout.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools" xmlns:tools="http://schemas.android.com/tools"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/coordinator" android:id="@+id/coordinator"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
@@ -29,15 +30,33 @@
android:layout_height="match_parent" android:layout_height="match_parent"
android:orientation="vertical"> android:orientation="vertical">
<include <androidx.appcompat.widget.Toolbar
android:id="@+id/layout_toolbar_search" android:id="@+id/toolbar"
layout="@layout/view_toolbar_search" /> 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 <com.google.android.material.divider.MaterialDivider
android:id="@+id/divider" android:id="@+id/divider"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_below="@id/layout_toolbar_search" /> android:layout_below="@id/toolbar" />
<com.airbnb.epoxy.EpoxyRecyclerView <com.airbnb.epoxy.EpoxyRecyclerView
android:id="@+id/recycler" android:id="@+id/recycler"
@@ -46,4 +65,4 @@
android:layout_below="@+id/divider" android:layout_below="@+id/divider"
tools:listitem="@layout/view_search_suggestion" /> tools:listitem="@layout/view_search_suggestion" />
</RelativeLayout> </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="chipStyle">@style/Chip.Filter</item>
<item name="preferenceTheme">@style/AppTheme.PreferenceThemeOverlay</item> <item name="preferenceTheme">@style/AppTheme.PreferenceThemeOverlay</item>
<item name="android:statusBarColor">@color/colorTransparent</item> <item name="android:statusBarColor">@color/colorTransparent</item>
<item name="popupMenuStyle">@style/AppTheme.PopupMenu</item>
</style> </style>
</resources> </resources>

View File

@@ -24,7 +24,6 @@
<item name="preferenceTheme">@style/AppTheme.PreferenceThemeOverlay</item> <item name="preferenceTheme">@style/AppTheme.PreferenceThemeOverlay</item>
<item name="bottomSheetStyle">@style/AppTheme.BottomSheetStyle</item> <item name="bottomSheetStyle">@style/AppTheme.BottomSheetStyle</item>
<item name="android:statusBarColor">@color/colorTransparent</item> <item name="android:statusBarColor">@color/colorTransparent</item>
<item name="popupMenuStyle">@style/AppTheme.PopupMenu</item>
</style> </style>
<style name="AppTheme.Translucent" parent="Theme.Material3.DynamicColors.DayNight.NoActionBar"> <style name="AppTheme.Translucent" parent="Theme.Material3.DynamicColors.DayNight.NoActionBar">
@@ -48,12 +47,6 @@
<item name="widgetLayout">@layout/preference_material_switch</item> <item name="widgetLayout">@layout/preference_material_switch</item>
</style> </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.Filter" parent="@style/Widget.Material3.Chip.Filter" />
<style name="Chip.TopChart" parent="@style/Widget.Material3.Chip.Filter"> <style name="Chip.TopChart" parent="@style/Widget.Material3.Chip.Filter">