add missing APIs related to scrolling

This commit is contained in:
Julian Winkler
2023-11-11 11:45:01 +01:00
parent 4bf4887244
commit 1a039e5e51
4 changed files with 35 additions and 3 deletions

View File

@@ -1291,6 +1291,7 @@ public class View extends Object {
}
public void addOnLayoutChangeListener(OnLayoutChangeListener listener) {}
public void removeOnLayoutChangeListener(OnLayoutChangeListener listener) {}
public boolean isSelected() {return false;}
@@ -1560,4 +1561,12 @@ public class View extends Object {
protected int computeHorizontalScrollExtent() {
return getWidth();
}
protected int computeVerticalScrollRange() {
return getHeight();
}
protected int computeVerticalScrollExtent() {
return getHeight();
}
}

View File

@@ -315,6 +315,16 @@ public class ViewGroup extends View implements ViewParent, ViewManager {
return false;
}
@Override
public boolean onNestedPreFling(View target, float velocityX, float velocityY) {
return false;
}
@Override
public boolean onNestedFling(View target, float velocityX, float velocityY, boolean consumed) {
return false;
}
public static class LayoutParams {
public static final int FILL_PARENT = -1;
public static final int MATCH_PARENT = -1;

View File

@@ -8,4 +8,8 @@ public interface ViewParent {
public void requestDisallowInterceptTouchEvent(boolean disallowIntercept);
public abstract boolean onStartNestedScroll(View child, View target, int nestedScrollAxes);
public boolean onNestedPreFling(View target, float velocityX, float velocityY);
public boolean onNestedFling(View target, float velocityX, float velocityY, boolean consumed);
}

View File

@@ -2,12 +2,21 @@ package android.view.animation;
public class DecelerateInterpolator implements Interpolator{
public DecelerateInterpolator(float value) {}
private float factor = 1.0f;
public DecelerateInterpolator(float value) {
factor = value;
}
@Override
public float getInterpolation(float input) {
// TODO Auto-generated method stub
throw new UnsupportedOperationException("Unimplemented method 'getInterpolation'");
float result;
if (factor == 1.0f) {
result = 1.0f - (1.0f - input) * (1.0f - input);
} else {
result = 1.0f - (float)Math.pow((1.0f - input), 2 * factor);
}
return result;
}
}