admin
2022-01-07 60e97a582feba0526c64d823fcf74e1cb97fd4c1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
package com.demo.app.ui.subview;
 
import android.content.Context;
import android.util.AttributeSet;
 
 
import com.demo.app.R;
 
import androidx.swiperefreshlayout.widget.SwipeRefreshLayout;
 
public class MyRefreshLayout extends SwipeRefreshLayout {
 
 
    /**
     * 按下时的y坐标
     */
    private float mYDown;
    private float mXDown;
    /**
     * 抬起时的y坐标, 与mYDown一起用于滑动到底部时判断是上拉还是下拉
     */
    private float mLastY;
    private float mLastX;
    private boolean mIsVpDragger;
 
    /**
     * @param context
     */
    public MyRefreshLayout(Context context) {
        this(context, null);
    }
 
    public MyRefreshLayout(Context context, AttributeSet attrs) {
        super(context, attrs);
        setColorSchemeColors(getResources().getColor(R.color.refresh_color));
    }
 
 
    @Override
    protected void onLayout(boolean changed, int left, int top, int right, int bottom) {
        super.onLayout(changed, left, top
                , right, bottom);
    }
}