0
0
mirror of https://github.com/mediathekview/zapp.git synced 2024-09-20 04:12:14 +02:00

Remove SearchView

This commit is contained in:
Christine Coenen 2023-08-18 15:44:22 +02:00
parent 835977b311
commit 283a4b2323
2 changed files with 5 additions and 27 deletions

View File

@ -22,8 +22,6 @@ import com.google.android.material.appbar.AppBarLayout
import com.google.android.material.appbar.AppBarLayout.LayoutParams.SCROLL_FLAG_ENTER_ALWAYS
import com.google.android.material.appbar.AppBarLayout.LayoutParams.SCROLL_FLAG_NO_SCROLL
import com.google.android.material.appbar.AppBarLayout.LayoutParams.SCROLL_FLAG_SCROLL
import com.google.android.material.search.SearchView
import com.google.android.material.search.SearchView.TransitionListener
import de.christinecoenen.code.zapp.R
import de.christinecoenen.code.zapp.app.settings.repository.SettingsRepository
import de.christinecoenen.code.zapp.databinding.ActivityMainBinding
@ -43,15 +41,6 @@ class MainActivity : AppCompatActivity(), MenuProvider {
private val requestPermissionLauncher =
registerForActivityResult(ActivityResultContracts.RequestPermission()) {}
private val searchViewTransitionListener =
TransitionListener { _, _, newState ->
if (newState == SearchView.TransitionState.SHOWN) {
binding.bottomNavigation.isVisible = false
} else if (newState == SearchView.TransitionState.HIDDEN) {
binding.bottomNavigation.isVisible = true
}
}
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
@ -80,12 +69,7 @@ class MainActivity : AppCompatActivity(), MenuProvider {
binding.bottomNavigation.setupWithNavController(navController)
binding.searchView.addTransitionListener(searchViewTransitionListener)
searchViewTransitionListener.onStateChanged(
binding.searchView,
binding.searchView.currentTransitionState,
binding.searchView.currentTransitionState
)
binding.searchbar.setOnClickListener { onSearchBarClick() }
addMenuProvider(this)
@ -131,7 +115,6 @@ class MainActivity : AppCompatActivity(), MenuProvider {
override fun onDestroy() {
super.onDestroy()
binding.searchView.removeTransitionListener(searchViewTransitionListener)
navController.removeOnDestinationChangedListener(::onDestinationChanged)
_binding = null
}
@ -148,6 +131,10 @@ class MainActivity : AppCompatActivity(), MenuProvider {
return navController.navigateUp(appBarConfiguration) || super.onSupportNavigateUp()
}
private fun onSearchBarClick() {
}
private fun requestPermissions() {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) {
if (ContextCompat.checkSelfPermission(

View File

@ -40,15 +40,6 @@
</com.google.android.material.appbar.AppBarLayout>
<com.google.android.material.search.SearchView
android:id="@+id/search_view"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:hint="@string/search_query_hint_zapp"
app:layout_anchor="@id/searchbar">
<!-- Search suggestions/results go here (ScrollView, RecyclerView, etc.). -->
</com.google.android.material.search.SearchView>
<androidx.fragment.app.FragmentContainerView
android:id="@+id/nav_host_fragment"
android:name="androidx.navigation.fragment.NavHostFragment"