Skip to content

fix(crash): show snack bar in nested scroll view#16597

Open
alperozturk96 wants to merge 7 commits intomasterfrom
fix/show-snack-bar-in-nested-scroll-view
Open

fix(crash): show snack bar in nested scroll view#16597
alperozturk96 wants to merge 7 commits intomasterfrom
fix/show-snack-bar-in-nested-scroll-view

Conversation

@alperozturk96
Copy link
Collaborator

@alperozturk96 alperozturk96 commented Feb 26, 2026

Issue

Calling showSnackBar function with view from NestedScrollView causing crash e.g. FileDetailSharingFragment.java‎

Exception java.lang.IllegalStateException: ScrollView can host only one direct child
 at androidx.core.widget.NestedScrollView.addView ([NestedScrollView.java:540](http://nestedscrollview.java:540/))
 at [com.google.android](http://com.google.android/).material.snackbar.BaseTransientBottomBar$SnackbarBaseLayout.addToTargetParent ([BaseTransientBottomBar.java:1313](http://basetransientbottombar.java:1313/))
 at [com.google.android](http://com.google.android/).material.snackbar.BaseTransientBottomBar.showView ([BaseTransientBottomBar.java:775](http://basetransientbottombar.java:775/))
 at [com.google.android](http://com.google.android/).material.snackbar.BaseTransientBottomBar$1.handleMessage ([BaseTransientBottomBar.java:254](http://basetransientbottombar.java:254/))
 at android.os.Handler.dispatchMessage ([Handler.java:106](http://handler.java:106/))
 at android.os.Looper.loopOnce ([Looper.java:273](http://looper.java:273/))
 at android.os.Looper.loop ([Looper.java:363](http://looper.java:363/))
 at [android.app](http://android.app/).ActivityThread.main ([ActivityThread.java:10060](http://activitythread.java:10060/))
 at java.lang.reflect.Method.invoke
 at [com.android](http://com.android/).internal.os.RuntimeInit$MethodAndArgsCaller.run ([RuntimeInit.java:632](http://runtimeinit.java:632/))
 at [com.android](http://com.android/).internal.os.ZygoteInit.main ([ZygoteInit.java:975](http://zygoteinit.java:975/))

Changes

Simplifies DisplayUtils functions
Calls fragment instead of view so that snack bar can be shown from activity
Shows snackbar always in main thread
Adds null check before trying to show snackbar
Adds tests

Test

Screen.Recording.2026-02-26.at.12.23.48.mov

@alperozturk96
Copy link
Collaborator Author

/backport to stable-3.36

Signed-off-by: alperozturk96 <alper_ozturk@proton.me>
Signed-off-by: alperozturk96 <alper_ozturk@proton.me>
Signed-off-by: alperozturk96 <alper_ozturk@proton.me>
@alperozturk96 alperozturk96 force-pushed the fix/show-snack-bar-in-nested-scroll-view branch from 58cdde4 to 551c170 Compare February 26, 2026 11:26
Signed-off-by: alperozturk96 <alper_ozturk@proton.me>
Signed-off-by: alperozturk96 <alper_ozturk@proton.me>
Signed-off-by: alperozturk96 <alper_ozturk@proton.me>
Signed-off-by: alperozturk96 <alper_ozturk@proton.me>
@github-actions
Copy link

blue-Light-Screenshot test failed, but no output was generated. Maybe a preliminary stage failed.

@github-actions
Copy link

Codacy

SpotBugs

CategoryBaseNew
Bad practice4242
Correctness7575
Dodgy code253252
Experimental11
Internationalization77
Malicious code vulnerability22
Multithreaded correctness3434
Performance4343
Security1818
Total475474

@github-actions
Copy link

APK file: https://www.kaminsky.me/nc-dev/android-artifacts/16597.apk

qrcode

To test this change/fix you can simply download above APK file and install and test it in parallel to your existing Nextcloud app.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant