app/src/main/java/net/nashlegend/sourcewall/view/common/SScrollView.java
(开头部分) 3KB这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。
package net.nashlegend.sourcewall.view.common;
import android.annotation.TargetApi;
import android.content.Context;
import android.os.Build;
import android.util.AttributeSet;
import android.view.MotionEvent;
import android.view.View;
import android.view.ViewConfiguration;
import android.widget.ScrollView;
/**
* Created by NashLegend on 2014/12/20 0020
*/
public class SScrollView extends ScrollView {
public SScrollView(Context context) {
super(context);
}
public SScrollView(Context context, AttributeSet attrs) {
super(context, attrs);
}
public SScrollView(Context context, AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
}
@TargetApi(Build.VERSION_CODES.LOLLIPOP)
public SScrollView(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) {
super(context, attrs, defStyleAttr, defStyleRes);
}
private float lastY = 0f;
private float currentY = 0f;
private int lastDirection = 0;
private int currentDirection = 0;
@Override
protected void onScrollChanged(int l, int t, int oldl, int oldt) {
super.onScrollChanged(l, t, oldl, oldt);
if (getScrollY() > headerHeight) {
float tmpCurrentY = getScrollY();
if (Math.abs(tmpCurrentY - lastY) > touchSlop) {
currentY = tmpCurrentY;
currentDirection = (int) (currentY - lastY);
if (lastDirection != currentDirection) {
if (currentDirection > 0) {
animateHide();
} else {
animateBackFooter();
}
lastDirection = currentDirection;
}
lastY = currentY;
}
} else {
animateBack();
}
}
后面还有 59 行代码,解锁后查看完整代码
24 小时内免费解锁 3 个项目,之后 1 积分/个。 规则说明
AI 解读
登录后可用,每次 10 积分,解读结果公开显示在下面。
还没有人解读过这个文件。
