MainActivity: Move search FAB to fragment_apps_games layout
Signed-off-by: Aayush Gupta <aayushgupta219@gmail.com>
This commit is contained in:
@@ -130,7 +130,6 @@ class MainActivity : AppCompatActivity() {
|
||||
|
||||
attachNavigation()
|
||||
attachDrawer()
|
||||
attachSearch()
|
||||
|
||||
/*Check only if download to external storage is enabled*/
|
||||
if (Preferences.getBoolean(this, Preferences.PREFERENCE_DOWNLOAD_EXTERNAL)) {
|
||||
@@ -183,7 +182,6 @@ class MainActivity : AppCompatActivity() {
|
||||
if (navDestination !is FloatingWindow) {
|
||||
when (navDestination.id) {
|
||||
in topLevelFrags -> {
|
||||
B.searchFab.visibility = View.VISIBLE
|
||||
B.navView.visibility = View.VISIBLE
|
||||
B.toolbar.visibility = View.VISIBLE
|
||||
B.drawerLayout.setDrawerLockMode(LOCK_MODE_UNLOCKED)
|
||||
@@ -223,18 +221,11 @@ class MainActivity : AppCompatActivity() {
|
||||
}
|
||||
|
||||
private fun hideTopLevelOnlyViews() {
|
||||
B.searchFab.visibility = View.GONE
|
||||
B.navView.visibility = View.GONE
|
||||
B.toolbar.visibility = View.GONE
|
||||
B.drawerLayout.setDrawerLockMode(LOCK_MODE_LOCKED_CLOSED)
|
||||
}
|
||||
|
||||
private fun attachSearch() {
|
||||
B.searchFab.setOnClickListener {
|
||||
navController.navigate(R.id.searchSuggestionFragment)
|
||||
}
|
||||
}
|
||||
|
||||
private fun attachNavigation() {
|
||||
val bottomNavigationView: BottomNavigationView = B.navView
|
||||
bottomNavigationView.setupWithNavController(navController)
|
||||
|
||||
@@ -24,6 +24,7 @@ import android.view.View
|
||||
import androidx.fragment.app.Fragment
|
||||
import androidx.fragment.app.FragmentManager
|
||||
import androidx.lifecycle.Lifecycle
|
||||
import androidx.navigation.fragment.findNavController
|
||||
import androidx.viewpager2.adapter.FragmentStateAdapter
|
||||
import com.aurora.store.R
|
||||
import com.aurora.store.data.providers.AuthProvider
|
||||
@@ -85,6 +86,10 @@ class AppsContainerFragment : Fragment(R.layout.fragment_apps_games) {
|
||||
) { tab: TabLayout.Tab, position: Int ->
|
||||
tab.text = tabTitles[position]
|
||||
}.attach()
|
||||
|
||||
binding.searchFab.setOnClickListener {
|
||||
findNavController().navigate(R.id.searchSuggestionFragment)
|
||||
}
|
||||
}
|
||||
|
||||
override fun onDestroyView() {
|
||||
|
||||
@@ -24,6 +24,7 @@ import android.view.View
|
||||
import androidx.fragment.app.Fragment
|
||||
import androidx.fragment.app.FragmentManager
|
||||
import androidx.lifecycle.Lifecycle
|
||||
import androidx.navigation.fragment.findNavController
|
||||
import androidx.viewpager2.adapter.FragmentStateAdapter
|
||||
import com.aurora.store.R
|
||||
import com.aurora.store.data.providers.AuthProvider
|
||||
@@ -84,6 +85,10 @@ class GamesContainerFragment : Fragment(R.layout.fragment_apps_games) {
|
||||
) { tab: TabLayout.Tab, position: Int ->
|
||||
tab.text = tabTitles[position]
|
||||
}.attach()
|
||||
|
||||
binding.searchFab.setOnClickListener {
|
||||
findNavController().navigate(R.id.searchSuggestionFragment)
|
||||
}
|
||||
}
|
||||
|
||||
override fun onDestroyView() {
|
||||
|
||||
Reference in New Issue
Block a user