Skip to content

Commit

Permalink
Merge pull request #1445 from Infomaniak/fix/scrollbar-conflict-with-…
Browse files Browse the repository at this point in the history
…gallery-swipe-refresh

Fix conflict between SwipeRefresh and FastScroller in gallery
  • Loading branch information
FabianDevel authored Oct 2, 2024
2 parents f4fc68e + 5bf298c commit ec08a1b
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 22 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ import com.infomaniak.drive.ui.fileList.multiSelect.MultiSelectFragment
import com.infomaniak.drive.utils.AccountUtils
import com.infomaniak.drive.utils.Utils
import com.infomaniak.drive.utils.getAdjustedColumnNumber
import com.infomaniak.drive.utils.observeAndDisplayNetworkAvailability
import com.infomaniak.drive.views.NoItemsLayoutView
import com.infomaniak.lib.core.utils.Utils.createRefreshTimer
import com.infomaniak.lib.core.utils.setPagination
Expand Down Expand Up @@ -119,6 +120,12 @@ class GalleryFragment : MultiSelectFragment(MATOMO_CATEGORY), NoItemsLayoutView.
configGalleryLayoutManager()

noGalleryLayout.iNoItemsLayoutView = this@GalleryFragment

observeAndDisplayNetworkAvailability(
mainViewModel = mainViewModel,
noNetworkBinding = noNetworkInclude,
noNetworkBindingDirectParent = root,
)
}

mainViewModel.observeDownloadOffline(requireContext()).observe(viewLifecycleOwner) { workInfoList ->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ import com.infomaniak.drive.databinding.MultiSelectLayoutBinding
import com.infomaniak.drive.ui.MainActivity
import com.infomaniak.drive.ui.MainViewModel
import com.infomaniak.drive.ui.fileList.multiSelect.GalleryMultiSelectActionsBottomSheetDialog
import com.infomaniak.drive.utils.observeAndDisplayNetworkAvailability
import com.infomaniak.lib.core.utils.safeBinding
import com.infomaniak.lib.core.utils.toPx

Expand Down Expand Up @@ -79,12 +78,6 @@ class MenuGalleryFragment : Fragment() {
}

adjustFastScrollBarScrollRange(galleryFragment)

observeAndDisplayNetworkAvailability(
mainViewModel = mainViewModel,
noNetworkBinding = noNetworkInclude,
noNetworkBindingDirectParent = galleryContentLinearLayout,
)
}

private fun MultiSelectLayoutBinding.setMultiSelectClickListeners(galleryFragment: GalleryFragment) = with(galleryFragment) {
Expand Down
4 changes: 4 additions & 0 deletions app/src/main/res/layout/fragment_gallery.xml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,10 @@
android:orientation="vertical"
tools:context=".ui.menu.GalleryFragment">

<include
android:id="@+id/noNetworkInclude"
layout="@layout/layout_no_network_small" />

<com.infomaniak.drive.ui.menu.RecyclerViewFastScroller
android:id="@+id/galleryFastScroller"
android:layout_width="match_parent"
Expand Down
19 changes: 4 additions & 15 deletions app/src/main/res/layout/fragment_menu_gallery.xml
Original file line number Diff line number Diff line change
Expand Up @@ -59,23 +59,12 @@
android:layout_height="match_parent"
app:layout_behavior="@string/appbar_scrolling_view_behavior">

<LinearLayout
android:id="@+id/galleryContentLinearLayout"
<androidx.fragment.app.FragmentContainerView
android:id="@+id/galleryFragmentView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
android:nestedScrollingEnabled="true"
tools:layout="@layout/fragment_gallery" />

<include
android:id="@+id/noNetworkInclude"
layout="@layout/layout_no_network_small" />

<androidx.fragment.app.FragmentContainerView
android:id="@+id/galleryFragmentView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:nestedScrollingEnabled="true"
tools:layout="@layout/fragment_gallery" />

</LinearLayout>
</androidx.swiperefreshlayout.widget.SwipeRefreshLayout>
</androidx.coordinatorlayout.widget.CoordinatorLayout>

0 comments on commit ec08a1b

Please sign in to comment.