
org.robolectric.shadows.ShadowAbsListView Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of shadows-framework Show documentation
Show all versions of shadows-framework Show documentation
An alternative Android testing framework.
The newest version!
package org.robolectric.shadows;
import android.widget.AbsListView;
import org.robolectric.annotation.Implementation;
import org.robolectric.annotation.Implements;
@Implements(AbsListView.class)
public class ShadowAbsListView extends ShadowAdapterView {
private AbsListView.OnScrollListener onScrollListener;
private int smoothScrolledPosition;
private int lastSmoothScrollByDistance;
private int lastSmoothScrollByDuration;
@Implementation
protected void setOnScrollListener(AbsListView.OnScrollListener l) {
onScrollListener = l;
}
@Implementation
protected void smoothScrollToPosition(int position) {
smoothScrolledPosition = position;
}
@Implementation
protected void smoothScrollBy(int distance, int duration) {
this.lastSmoothScrollByDistance = distance;
this.lastSmoothScrollByDuration = duration;
}
/**
* Robolectric accessor for the onScrollListener
*
* @return AbsListView.OnScrollListener
*/
public AbsListView.OnScrollListener getOnScrollListener() {
return onScrollListener;
}
/**
* Robolectric accessor for the last smoothScrolledPosition
*
* @return int position
*/
public int getSmoothScrolledPosition() {
return smoothScrolledPosition;
}
/**
* Robolectric accessor for the last smoothScrollBy distance
*
* @return int distance
*/
public int getLastSmoothScrollByDistance() {
return lastSmoothScrollByDistance;
}
/**
* Robolectric accessor for the last smoothScrollBy duration
*
* @return int duration
*/
public int getLastSmoothScrollByDuration() {
return lastSmoothScrollByDuration;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy