public PullRefreshLayout(Context context, AttributeSet attrs) {
super(context, attrs);
TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.refresh_PullRefreshLayout);
final int colorsId = a.getResourceId(R.styleable.refresh_PullRefreshLayout_refreshColors, 0);
final int colorId = a.getResourceId(R.styleable.refresh_PullRefreshLayout_refreshColor, 0);
a.recycle();
mDecelerateInterpolator = new DecelerateInterpolator(DECELERATE_INTERPOLATION_FACTOR);
mTouchSlop = ViewConfiguration.get(context).getScaledTouchSlop();
int defaultDuration = getResources().getInteger(android.R.integer.config_mediumAnimTime);
mDurationToStartPosition = defaultDuration;
mDurationToCorrectPosition = defaultDuration;
mSpinnerFinalOffset = mTotalDragDistance = dp2px(DRAG_MAX_DISTANCE);
mRefreshView = new ImageView(context);
if (colorsId > 0) {
mColorSchemeColors = context.getResources().getIntArray(colorsId);
} else {
mColorSchemeColors = new int[]{Color.rgb(0xC9, 0x34, 0x37), Color.rgb(0x37, 0x5B, 0xF1), Color.rgb(0xF7, 0xD2, 0x3E), Color.rgb(0x34, 0xA3, 0x50)};
}
if (colorId > 0) {
mColorSchemeColors = new int[]{ContextCompat.getColor(context, colorId)};
}
setDefaultRefreshStyle();
mRefreshView.setVisibility(View.GONE);
setWillNotDraw(false);
ViewCompat.setChildrenDrawingOrderEnabled(this, true);
}
PullRefreshLayout.java 文件源码
java
阅读 28
收藏 0
点赞 0
评论 0
项目:Android-PullRefresh
作者:
评论列表
文章目录