Fixes 'capture more' on Settings home page
This change excludes the contents of 'main_content_scrollable_container' from scroll capture search. Explanation: The inner-most child is selected whenever nested scrolling views are found. This is incorrect for Settings because the inner RecyclerView isn't actually scrollable (that is, the contents of it are not scrolled within it, the RecyclerView itself is scrolled by the outer ScrollView instead). View.canScrollVertically is unfortunately incorrect for RecyclerView in this case as well. This change excludes all children of the main ScrollView from the search. This ensures the outer ScrollView is chosen and this corrects the 'capture more' screenshot functionality on the Settings home page. Bug: 399810823 Test: manual; Open settings, screenshot, capture more Flag: com.android.settings.flags.extended_screenshots_exclude_nested_scrollables Change-Id: I3363d70b3649e2a34e541c45ab387d59547b8588
This commit is contained in:
@@ -80,3 +80,13 @@ flag {
|
||||
purpose: PURPOSE_BUGFIX
|
||||
}
|
||||
}
|
||||
|
||||
flag {
|
||||
name: "extended_screenshots_exclude_nested_scrollables"
|
||||
namespace: "systemui"
|
||||
description: "Sets a flag on the main scrollable container to exclude any nested scrollable views as potential targets for extended screenshots."
|
||||
bug: "399810823"
|
||||
metadata {
|
||||
purpose: PURPOSE_BUGFIX
|
||||
}
|
||||
}
|
||||
|
@@ -775,6 +775,16 @@ public class SettingsHomepageActivity extends FragmentActivity implements
|
||||
// Prevent inner RecyclerView gets focus and invokes scrolling.
|
||||
view.setFocusableInTouchMode(true);
|
||||
view.requestFocus();
|
||||
|
||||
if (Flags.extendedScreenshotsExcludeNestedScrollables()) {
|
||||
// Force scroll capture to select the NestedScrollView, instead of the non-scrollable
|
||||
// RecyclerView which is contained inside it with no height constraint.
|
||||
final View scrollableContainer = findViewById(R.id.main_content_scrollable_container);
|
||||
if (scrollableContainer != null) {
|
||||
scrollableContainer.setScrollCaptureHint(
|
||||
View.SCROLL_CAPTURE_HINT_EXCLUDE_DESCENDANTS);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void updateHomepageAppBar() {
|
||||
|
Reference in New Issue
Block a user