Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow disabling initialAwakenScrollBars temporarily #7245

Open
wants to merge 1 commit into
base: google
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Expand Up @@ -48,6 +48,7 @@
import org.robolectric.annotation.Implements;
import org.robolectric.annotation.LooperMode;
import org.robolectric.annotation.RealObject;
import org.robolectric.annotation.ReflectorObject;
import org.robolectric.annotation.Resetter;
import org.robolectric.shadow.api.Shadow;
import org.robolectric.util.ReflectionHelpers;
Expand All @@ -62,6 +63,7 @@
public class ShadowView {

@RealObject protected View realView;
@ReflectorObject protected _View_ viewReflector;
private static final List<View.OnClickListener> globalClickListeners =
new CopyOnWriteArrayList<>();
private static final List<View.OnLongClickListener> globalLongClickListeners =
Expand Down Expand Up @@ -665,6 +667,17 @@ protected void clearAnimation() {
}
}

@Implementation
protected boolean initialAwakenScrollBars() {
// Temporarily allow disabling initial awaken of scroll bars to aid in migration of tests to
// default to window's being marked visible, this will be removed once migration is complete.
if (Boolean.getBoolean("robolectric.disableInitialAwakenScrollBars")) {
return false;
} else {
return viewReflector.initialAwakenScrollBars();
}
}

private class AnimationRunner implements Runnable {
private final Animation animation;
private long startTime, startOffset, elapsedTime;
Expand Down Expand Up @@ -830,6 +843,9 @@ void removeOnAttachStateChangeListener(

@Direct
int getSourceLayoutResId();

@Direct
boolean initialAwakenScrollBars();
}

public void callOnAttachedToWindow() {
Expand Down