Class SmartRefreshLayout
-
- All Implemented Interfaces:
-
ai.nexconn.chatui.widget.pullrefresh.api.RefreshLayout,android.graphics.drawable.Drawable.Callback,android.view.KeyEvent.Callback,android.view.ViewManager,android.view.ViewParent,android.view.accessibility.AccessibilityEventSource,androidx.core.view.NestedScrollingParent
public class SmartRefreshLayout extends ViewGroup implements RefreshLayout, NestedScrollingParent
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected classSmartRefreshLayout.FlingRunnableprotected classSmartRefreshLayout.BounceRunnablepublic classSmartRefreshLayout.LayoutParamspublic classSmartRefreshLayout.RefreshKernelImplCore refresh layout interface. Opens APIs for complex Headers or Footers.
-
Field Summary
-
Constructor Summary
Constructors Constructor Description SmartRefreshLayout(Context context)SmartRefreshLayout(Context context, AttributeSet attrs)
-
Method Summary
Modifier and Type Method Description voidonFinishInflate()Override onFinishInflate for smart-specific features: 1. voidonAttachedToWindow()Override onAttachedToWindow for smart-specific features: 1. voidonMeasure(int widthMeasureSpec, int heightMeasureSpec)Measure Header, Footer, and Content. voidonLayout(boolean changed, int l, int t, int r, int b)Layout Header, Footer, and Content. voidonDetachedFromWindow()Override onDetachedFromWindow for smart-specific features: 1. booleandrawChild(Canvas canvas, View child, long drawingTime)Override drawChild for smart-specific features: 1. voidcomputeScroll()Override computeScroll for smart-specific features: 1. booleandispatchTouchEvent(MotionEvent e)Event dispatch (gesture core): 1. voidrequestDisallowInterceptTouchEvent(boolean disallowIntercept)This code is from Google's official SwipeRefreshLayout, mainly to let older ListView scroll down smoothly by selectively blocking requestDisallowInterceptTouchEvent. booleanstartFlingIfNeed(float flingVelocity)Start fling mode when necessary. booleaninterceptAnimatorByAction(int action)When animation is playing, touch the screen to interrupt animation and switch to drag state. voidnotifyStateChanged(RefreshState state)Set and notify state change (setState). voidsetStateDirectLoading(boolean triggerLoadMoreEvent)Directly set state to Loading. voidsetStateLoading(boolean notify)Set state to Loading. voidsetStateRefreshing(boolean notify)Set state to Refreshing. voidsetViceState(RefreshState state)Set the vice state. booleanisEnableTranslationContent(boolean enable, @Nullable() RefreshComponent internal)Determine whether content should be translated when pulling down booleanisEnableRefreshOrLoadMore(boolean enable)Whether the layout can actually refresh or load (distinct from over-scroll drag / pure scroll mode). ValueAnimatoranimSpinner(int endSpinner, int startDelay, Interpolator interpolator, int duration)Execute rebound animation. voidanimSpinnerBounce(float velocity)Over-scroll bounce animation. voidoverSpinner()Gesture drag ended, start executing rebound animation. voidmoveSpinnerInfinitely(float spinner)Viscous (sticky) spinner translation. ViewGroup.LayoutParamsgenerateLayoutParams(AttributeSet attrs)intgetNestedScrollAxes()booleanonStartNestedScroll(@NonNull() View child, @NonNull() View target, int nestedScrollAxes)voidonNestedScrollAccepted(@NonNull() View child, @NonNull() View target, int axes)voidonNestedPreScroll(@NonNull() View target, int dx, int dy, @NonNull() Array<int> consumed)voidonNestedScroll(@NonNull() View target, int dxConsumed, int dyConsumed, int dxUnconsumed, int dyUnconsumed)booleanonNestedPreFling(@NonNull() View target, float velocityX, float velocityY)booleanonNestedFling(@NonNull() View target, float velocityX, float velocityY, boolean consumed)voidonStopNestedScroll(@NonNull() View target)voidsetNestedScrollingEnabled(boolean enabled)booleanisNestedScrollingEnabled()RefreshLayoutsetHeaderHeight(float heightDp)Set the Header's height. RefreshLayoutsetHeaderHeightPx(int height)Set the Header height RefreshLayoutsetFooterHeight(float heightDp)Set the Footer's height. RefreshLayoutsetFooterHeightPx(int height)Set the Footer height RefreshLayoutsetHeaderInsetStart(float insetDp)Set the Header's start offset (see srlHeaderInsetStart in the RepastPracticeActivity XML in demo-app for the practical application). RefreshLayoutsetHeaderInsetStartPx(int insetPx)Set the Header's start offset (see srlHeaderInsetStart in the RepastPracticeActivity XML in demo-app for the practical application). RefreshLayoutsetFooterInsetStart(float insetDp)Set the Footer's start offset. RefreshLayoutsetFooterInsetStartPx(int insetPx)Set the Footer's start offset. RefreshLayoutsetDragRate(float rate)Set the damping effect. RefreshLayoutsetHeaderMaxDragRate(float rate)Set the ratio of the maximum height to drag header. RefreshLayoutsetFooterMaxDragRate(float rate)Set the ratio of the maximum height to drag footer. RefreshLayoutsetHeaderTriggerRate(float rate)Set the ratio at which the refresh is triggered. RefreshLayoutsetFooterTriggerRate(float rate)Set the ratio at which the load more is triggered. RefreshLayoutsetReboundInterpolator(@NonNull() Interpolator interpolator)Set the rebound interpolator. RefreshLayoutsetReboundDuration(int duration)Set the duration of the rebound animation. RefreshLayoutsetEnableLoadMore(boolean enabled)Set whether to enable pull-up loading more (enabled by default). RefreshLayoutsetEnableRefresh(boolean enabled)Whether to enable pull-down refresh (enabled by default). RefreshLayoutsetEnableHeaderTranslationContent(boolean enabled)Whether to enable pull-down refresh (enabled by default). RefreshLayoutsetEnableFooterTranslationContent(boolean enabled)Set whether to pull up the content while pulling up the footer. RefreshLayoutsetEnableAutoLoadMore(boolean enabled)Sets whether to listen for the list to trigger a load event when scrolling to the bottom (default true). RefreshLayoutsetEnableOverScrollBounce(boolean enabled)Set whether to enable the over-scroll bounce function. RefreshLayoutsetEnablePureScrollMode(boolean enabled)Set whether to enable pure scroll mode. RefreshLayoutsetEnableScrollContentWhenLoaded(boolean enabled)Set whether to scroll the content to display new data after loading more complete. RefreshLayoutsetEnableScrollContentWhenRefreshed(boolean enabled)Set whether to scroll the content to display new data after the refresh is complete. RefreshLayoutsetEnableLoadMoreWhenContentNotFull(boolean enabled)Set whether to pull up and load more when the content is not full of one page. RefreshLayoutsetEnableOverScrollDrag(boolean enabled)Set whether to enable over-scroll drag (imitation iPhone effect). RefreshLayoutsetEnableFooterFollowWhenNoMoreData(boolean enabled)Set whether Footer follows the content after there is no more data. RefreshLayoutsetEnableClipHeaderWhenFixedBehind(boolean enabled)Set whether to clip header when the Header is in the FixedBehind state. RefreshLayoutsetEnableClipFooterWhenFixedBehind(boolean enabled)Set whether to clip footer when the Footer is in the FixedBehind state. RefreshLayoutsetEnableNestedScroll(boolean enabled)Setting whether nesting scrolling is enabled (default off + smart on). RefreshLayoutsetFixedHeaderViewId(int id)Set the View ID fixed below the Header, which stays stationary when Footer scrolls. RefreshLayoutsetFixedFooterViewId(int id)Set the View ID fixed above the Footer, which stays stationary when Header scrolls. RefreshLayoutsetHeaderTranslationViewId(int id)Set the View ID that should scroll along with the Header. RefreshLayoutsetFooterTranslationViewId(int id)Set the View ID that should scroll along with the Footer. RefreshLayoutsetDisableContentWhenRefresh(boolean disable)Set whether to disable content interaction during refresh. RefreshLayoutsetDisableContentWhenLoading(boolean disable)Set whether to disable content interaction during loading. RefreshLayoutsetRefreshHeader(@NonNull() RefreshHeader header)Set the header of RefreshLayout. RefreshLayoutsetRefreshHeader(@NonNull() RefreshHeader header, int width, int height)Set the header of RefreshLayout. RefreshLayoutsetRefreshFooter(@NonNull() RefreshFooter footer)Set the footer of RefreshLayout. RefreshLayoutsetRefreshFooter(@NonNull() RefreshFooter footer, int width, int height)Set the footer of RefreshLayout. RefreshLayoutsetRefreshContent(@NonNull() View content)Set the content of RefreshLayout (Suitable for non-XML pages, not suitable for replacing empty layouts). RefreshLayoutsetRefreshContent(@NonNull() View content, int width, int height)Set the content of RefreshLayout (Suitable for non-XML pages, not suitable for replacing empty layouts). RefreshFootergetRefreshFooter()Get the current Footer of RefreshLayout. RefreshHeadergetRefreshHeader()Get the current Header of RefreshLayout. RefreshStategetState()Get the current state of RefreshLayout. ViewGroupgetLayout()Get the ViewGroup of RefreshLayout. RefreshLayoutsetOnRefreshListener(OnRefreshListener listener)Set refresh listener separately. RefreshLayoutsetOnLoadMoreListener(OnLoadMoreListener listener)Set load more listener separately. RefreshLayoutsetOnRefreshLoadMoreListener(OnRefreshLoadMoreListener listener)Set refresh and load listeners at the same time. RefreshLayoutsetOnMultiListener(OnMultiListener listener)Set up a multi-function listener. RefreshLayoutsetPrimaryColors(@ColorInt() Array<int> primaryColors)Set theme color int (primaryColor and accentColor). RefreshLayoutsetPrimaryColorsId(@ColorRes() Array<int> primaryColorId)Set theme color id (primaryColor and accentColor). RefreshLayoutsetScrollBoundaryDecider(ScrollBoundaryDecider boundary)Set the scroll boundary Decider, Can customize when you can refresh. RefreshLayoutsetNoMoreData(boolean noMoreData)Restore the original state after finishLoadMoreWithNoMoreData. RefreshLayoutresetNoMoreData()Restore the original state after finishLoadMoreWithNoMoreData. RefreshLayoutfinishRefresh()Finish refresh. RefreshLayoutfinishLoadMore()Finish load more. RefreshLayoutfinishRefresh(int delayed)Finish refresh. RefreshLayoutfinishRefresh(boolean success)Finish refresh. RefreshLayoutfinishRefresh(int delayed, boolean success, Boolean noMoreData)Finish refresh. RefreshLayoutfinishRefreshWithNoMoreData()Finish refresh and mark no more data. RefreshLayoutfinishLoadMore(int delayed)Finish load more. RefreshLayoutfinishLoadMore(boolean success)Finish load more. RefreshLayoutfinishLoadMore(int delayed, boolean success, boolean noMoreData)Finish load more. RefreshLayoutfinishLoadMoreWithNoMoreData()Finish load more and mark no more data. RefreshLayoutcloseHeaderOrFooter()Close the Header or Footer. booleanautoRefresh()Display refresh animation and trigger refresh event. booleanautoRefresh(int delayed)Display refresh animation and trigger refresh event with delayed start. booleanautoRefreshAnimationOnly()Display refresh animation without triggering events. booleanautoRefresh(int delayed, int duration, float dragRate, boolean animationOnly)Display refresh animation with multifunction options. booleanautoLoadMore()Display load more animation and trigger load more event. booleanautoLoadMore(int delayed)Display load more animation and trigger load more event with delayed start. booleanautoLoadMoreAnimationOnly()Display load more animation without triggering events. booleanautoLoadMore(int delayed, int duration, float dragRate, boolean animationOnly)Display load more animation with multifunction options. static voidsetDefaultRefreshHeaderCreator(@NonNull() DefaultRefreshHeaderCreator creator)Set the default Header creator. static voidsetDefaultRefreshFooterCreator(@NonNull() DefaultRefreshFooterCreator creator)Set the default Footer creator. static voidsetDefaultRefreshInitializer(@NonNull() DefaultRefreshInitializer initializer)Set the default Refresh initializer. booleanisRefreshing()Whether currently refreshing booleanisLoading()Whether currently loading booleanperformClick()-
Methods inherited from class android.view.ViewGroup
addChildrenForAccessibility, addExtraDataToAccessibilityNodeInfo, addFocusables, addKeyboardNavigationClusters, addStatesFromChildren, addTouchables, addView, addViewInLayout, attachLayoutAnimationParameters, attachViewToParent, bringChildToFront, canAnimate, checkLayoutParams, childDrawableStateChanged, childHasTransientStateChanged, cleanupLayoutState, clearChildFocus, clearDisappearingChildren, clearFocus, debug, detachAllViewsFromParent, detachViewFromParent, detachViewsFromParent, dispatchApplyWindowInsets, dispatchCapturedPointerEvent, dispatchConfigurationChanged, dispatchCreateViewTranslationRequest, dispatchDisplayHint, dispatchDragEvent, dispatchDraw, dispatchDrawableHotspotChanged, dispatchFinishTemporaryDetach, dispatchFreezeSelfOnly, dispatchGenericFocusedEvent, dispatchGenericPointerEvent, dispatchHoverEvent, dispatchKeyEvent, dispatchKeyEventPreIme, dispatchKeyShortcutEvent, dispatchPointerCaptureChanged, dispatchProvideAutofillStructure, dispatchProvideStructure, dispatchRestoreInstanceState, dispatchSaveInstanceState, dispatchScrollCaptureSearch, dispatchSetActivated, dispatchSetPressed, dispatchSetSelected, dispatchStartTemporaryDetach, dispatchSystemUiVisibilityChanged, dispatchThawSelfOnly, dispatchTrackballEvent, dispatchUnhandledMove, dispatchVisibilityChanged, dispatchWindowFocusChanged, dispatchWindowInsetsAnimationEnd, dispatchWindowInsetsAnimationPrepare, dispatchWindowInsetsAnimationProgress, dispatchWindowInsetsAnimationStart, dispatchWindowSystemUiVisiblityChanged, dispatchWindowVisibilityChanged, drawableStateChanged, endViewTransition, findFocus, findOnBackInvokedDispatcherForChild, findViewsWithText, focusSearch, focusableViewAvailable, gatherTransparentRegion, generateDefaultLayoutParams, getAccessibilityClassName, getChildAt, getChildCount, getChildDrawingOrder, getChildMeasureSpec, getChildStaticTransformation, getChildVisibleRect, getClipChildren, getClipToPadding, getDescendantFocusability, getFocusedChild, getLayoutAnimation, getLayoutAnimationListener, getLayoutMode, getLayoutTransition, getOverlay, getPersistentDrawingCache, getTouchscreenBlocksFocus, hasFocus, hasTransientState, indexOfChild, invalidateChild, invalidateChildInParent, isAlwaysDrawnWithCacheEnabled, isAnimationCacheEnabled, isChildrenDrawingOrderEnabled, isChildrenDrawnWithCacheEnabled, isLayoutSuppressed, isMotionEventSplittingEnabled, isTransitionGroup, jumpDrawablesToCurrentState, layout, measureChild, measureChildWithMargins, measureChildren, notifySubtreeAccessibilityStateChanged, offsetDescendantRectToMyCoords, offsetRectIntoDescendantCoords, onCreateDrawableState, onDescendantInvalidated, onInterceptHoverEvent, onInterceptTouchEvent, onNestedPrePerformAccessibilityAction, onRequestFocusInDescendants, onRequestSendAccessibilityEvent, onResolvePointerIcon, onViewAdded, onViewRemoved, propagateRequestedFrameRate, recomputeViewAttributes, removeAllViews, removeAllViewsInLayout, removeDetachedView, removeView, removeViewAt, removeViewInLayout, removeViews, removeViewsInLayout, requestChildFocus, requestChildRectangleOnScreen, requestFocus, requestSendAccessibilityEvent, requestTransparentRegion, restoreDefaultFocus, scheduleLayoutAnimation, setAddStatesFromChildren, setAlwaysDrawnWithCacheEnabled, setAnimationCacheEnabled, setChildrenDrawingCacheEnabled, setChildrenDrawingOrderEnabled, setChildrenDrawnWithCacheEnabled, setClipChildren, setClipToPadding, setDescendantFocusability, setLayoutAnimation, setLayoutAnimationListener, setLayoutMode, setLayoutTransition, setMotionEventSplittingEnabled, setOnHierarchyChangeListener, setPersistentDrawingCache, setRequestedFrameRate, setStaticTransformationsEnabled, setTouchscreenBlocksFocus, setTransitionGroup, setWindowInsetsAnimationCallback, shouldDelayChildPressedState, showContextMenuForChild, startActionModeForChild, startLayoutAnimation, startViewTransition, suppressLayout, updateViewLayout -
Methods inherited from class android.view.View
addOnAttachStateChangeListener, addOnLayoutChangeListener, addOnUnhandledKeyEventListener, animate, announceForAccessibility, autofill, awakenScrollBars, bringToFront, buildDrawingCache, buildLayer, callOnClick, canResolveLayoutDirection, canResolveTextAlignment, canResolveTextDirection, canScrollHorizontally, canScrollVertically, cancelDragAndDrop, cancelLongPress, cancelPendingInputEvents, checkInputConnectionProxy, clearAnimation, clearPendingCredentialRequest, clearViewTranslationCallback, combineMeasuredStates, computeHorizontalScrollExtent, computeHorizontalScrollOffset, computeHorizontalScrollRange, computeSystemWindowInsets, computeVerticalScrollExtent, computeVerticalScrollOffset, computeVerticalScrollRange, createAccessibilityNodeInfo, createContextMenu, destroyDrawingCache, dispatchGenericMotionEvent, dispatchNestedFling, dispatchNestedPreFling, dispatchNestedPrePerformAccessibilityAction, dispatchNestedPreScroll, dispatchNestedScroll, dispatchPopulateAccessibilityEvent, draw, drawableHotspotChanged, findOnBackInvokedDispatcher, findViewById, findViewWithTag, fitSystemWindows, forceHasOverlappingRendering, forceLayout, generateDisplayHash, generateViewId, getAccessibilityDelegate, getAccessibilityLiveRegion, getAccessibilityNodeProvider, getAccessibilityPaneTitle, getAccessibilityTraversalAfter, getAccessibilityTraversalBefore, getAllowedHandwritingDelegatePackageName, getAllowedHandwritingDelegatorPackageName, getAlpha, getAnimation, getAnimationMatrix, getApplicationWindowToken, getAttributeResolutionStack, getAttributeSourceResourceMap, getAutofillHints, getAutofillId, getAutofillType, getAutofillValue, getBackground, getBackgroundTintBlendMode, getBackgroundTintList, getBackgroundTintMode, getBaseline, getBottom, getBottomFadingEdgeStrength, getBottomPaddingOffset, getCameraDistance, getClipBounds, getClipBounds, getClipToOutline, getContentCaptureSession, getContentDescription, getContentSensitivity, getContext, getContextMenuInfo, getDefaultFocusHighlightEnabled, getDefaultSize, getDisplay, getDrawableState, getDrawingCache, getDrawingCacheBackgroundColor, getDrawingCacheQuality, getDrawingRect, getDrawingTime, getElevation, getExplicitStyle, getFilterTouchesWhenObscured, getFitsSystemWindows, getFocusable, getFocusables, getFocusedRect, getForeground, getForegroundGravity, getForegroundTintBlendMode, getForegroundTintList, getForegroundTintMode, getFrameContentVelocity, getGlobalVisibleRect, getHandler, getHandwritingBoundsOffsetBottom, getHandwritingBoundsOffsetLeft, getHandwritingBoundsOffsetRight, getHandwritingBoundsOffsetTop, getHandwritingDelegateFlags, getHandwritingDelegatorCallback, getHasOverlappingRendering, getHeight, getHitRect, getHorizontalFadingEdgeLength, getHorizontalScrollbarHeight, getHorizontalScrollbarThumbDrawable, getHorizontalScrollbarTrackDrawable, getId, getImportantForAccessibility, getImportantForAutofill, getImportantForContentCapture, getKeepScreenOn, getKeyDispatcherState, getLabelFor, getLayerType, getLayoutDirection, getLayoutParams, getLeft, getLeftFadingEdgeStrength, getLeftPaddingOffset, getLocalVisibleRect, getLocationInSurface, getLocationInWindow, getLocationOnScreen, getMatrix, getMeasuredHeight, getMeasuredHeightAndState, getMeasuredState, getMeasuredWidth, getMeasuredWidthAndState, getMinimumHeight, getMinimumWidth, getNextClusterForwardId, getNextFocusDownId, getNextFocusForwardId, getNextFocusLeftId, getNextFocusRightId, getNextFocusUpId, getOnFocusChangeListener, getOutlineAmbientShadowColor, getOutlineProvider, getOutlineSpotShadowColor, getOverScrollMode, getOverlay, getPaddingBottom, getPaddingEnd, getPaddingLeft, getPaddingRight, getPaddingStart, getPaddingTop, getParent, getParentForAccessibility, getPendingCredentialCallback, getPendingCredentialRequest, getPivotX, getPivotY, getPointerIcon, getPreferKeepClearRects, getReceiveContentMimeTypes, getRequestedFrameRate, getResources, getRevealOnFocusHint, getRight, getRightFadingEdgeStrength, getRightPaddingOffset, getRootSurfaceControl, getRootView, getRootWindowInsets, getRotation, getRotationX, getRotationY, getScaleX, getScaleY, getScrollBarDefaultDelayBeforeFade, getScrollBarFadeDuration, getScrollBarSize, getScrollBarStyle, getScrollCaptureHint, getScrollIndicators, getScrollX, getScrollY, getSolidColor, getSourceLayoutResId, getStateDescription, getStateListAnimator, getSuggestedMinimumHeight, getSuggestedMinimumWidth, getSupplementalDescription, getSystemGestureExclusionRects, getSystemUiVisibility, getTag, getTextAlignment, getTextDirection, getTooltipText, getTop, getTopFadingEdgeStrength, getTopPaddingOffset, getTouchDelegate, getTouchables, getTransitionAlpha, getTransitionName, getTranslationX, getTranslationY, getTranslationZ, getUniqueDrawingId, getVerticalFadingEdgeLength, getVerticalScrollbarPosition, getVerticalScrollbarThumbDrawable, getVerticalScrollbarTrackDrawable, getVerticalScrollbarWidth, getViewTranslationResponse, getViewTreeObserver, getVisibility, getWidth, getWindowAttachCount, getWindowId, getWindowInsetsController, getWindowSystemUiVisibility, getWindowToken, getWindowVisibility, getWindowVisibleDisplayFrame, getX, getY, getZ, hasExplicitFocusable, hasFocusable, hasNestedScrollingParent, hasOnClickListeners, hasOnLongClickListeners, hasOverlappingRendering, hasPointerCapture, hasWindowFocus, inflate, invalidate, invalidateDrawable, invalidateOutline, isAccessibilityDataSensitive, isAccessibilityFocused, isAccessibilityHeading, isActivated, isAttachedToWindow, isAutoHandwritingEnabled, isClickable, isContentSensitive, isContextClickable, isCredential, isDirty, isDrawingCacheEnabled, isDuplicateParentStateEnabled, isEnabled, isFocusable, isFocusableInTouchMode, isFocused, isFocusedByDefault, isForceDarkAllowed, isHandwritingDelegate, isHapticFeedbackEnabled, isHardwareAccelerated, isHorizontalFadingEdgeEnabled, isHorizontalScrollBarEnabled, isHovered, isImportantForAccessibility, isImportantForAutofill, isImportantForContentCapture, isInEditMode, isInLayout, isInTouchMode, isKeyboardNavigationCluster, isLaidOut, isLayoutDirectionResolved, isLayoutRequested, isLongClickable, isOpaque, isPaddingOffsetRequired, isPaddingRelative, isPivotSet, isPreferKeepClear, isPressed, isSaveEnabled, isSaveFromParentEnabled, isScreenReaderFocusable, isScrollContainer, isScrollbarFadingEnabled, isSelected, isShowingLayoutBounds, isShown, isSoundEffectsEnabled, isTemporarilyDetached, isTextAlignmentResolved, isTextDirectionResolved, isVerticalFadingEdgeEnabled, isVerticalScrollBarEnabled, isVisibleToUserForAutofill, keyboardNavigationClusterSearch, measure, mergeDrawableStates, offsetLeftAndRight, offsetTopAndBottom, onAnimationEnd, onAnimationStart, onApplyWindowInsets, onCancelPendingInputEvents, onCapturedPointerEvent, onCheckIsTextEditor, onConfigurationChanged, onCreateContextMenu, onCreateInputConnection, onCreateViewTranslationRequest, onCreateVirtualViewTranslationRequests, onDisplayHint, onDragEvent, onDraw, onDrawForeground, onDrawScrollBars, onFilterTouchEventForSecurity, onFinishTemporaryDetach, onFocusChanged, onGenericMotionEvent, onHoverChanged, onHoverEvent, onInitializeAccessibilityEvent, onInitializeAccessibilityNodeInfo, onKeyDown, onKeyLongPress, onKeyMultiple, onKeyPreIme, onKeyShortcut, onKeyUp, onOverScrolled, onPointerCaptureChange, onPopulateAccessibilityEvent, onProvideAutofillStructure, onProvideAutofillVirtualStructure, onProvideContentCaptureStructure, onProvideStructure, onProvideVirtualStructure, onReceiveContent, onRestoreInstanceState, onRtlPropertiesChanged, onSaveInstanceState, onScreenStateChanged, onScrollCaptureSearch, onScrollChanged, onSetAlpha, onSizeChanged, onStartTemporaryDetach, onTouchEvent, onTrackballEvent, onViewTranslationResponse, onVirtualViewTranslationResponses, onVisibilityAggregated, onVisibilityChanged, onWindowFocusChanged, onWindowSystemUiVisibilityChanged, onWindowVisibilityChanged, overScrollBy, performAccessibilityAction, performContextClick, performHapticFeedback, performLongClick, performReceiveContent, playSoundEffect, post, postDelayed, postInvalidate, postInvalidateDelayed, postInvalidateOnAnimation, postOnAnimation, postOnAnimationDelayed, refreshDrawableState, releasePointerCapture, removeCallbacks, removeOnAttachStateChangeListener, removeOnLayoutChangeListener, removeOnUnhandledKeyEventListener, reportAppJankStats, requestApplyInsets, requestFitSystemWindows, requestFocusFromTouch, requestLayout, requestPointerCapture, requestRectangleOnScreen, requestUnbufferedDispatch, requireViewById, resetPivot, resolveSize, resolveSizeAndState, restoreHierarchyState, saveAttributeDataForStyleable, saveHierarchyState, scheduleDrawable, scrollBy, scrollTo, sendAccessibilityEvent, sendAccessibilityEventUnchecked, setAccessibilityDataSensitive, setAccessibilityDelegate, setAccessibilityHeading, setAccessibilityLiveRegion, setAccessibilityPaneTitle, setAccessibilityTraversalAfter, setAccessibilityTraversalBefore, setActivated, setAllowClickWhenDisabled, setAllowedHandwritingDelegatePackage, setAllowedHandwritingDelegatorPackage, setAlpha, setAnimation, setAnimationMatrix, setAutoHandwritingEnabled, setAutofillHints, setAutofillId, setBackground, setBackgroundColor, setBackgroundDrawable, setBackgroundResource, setBackgroundTintBlendMode, setBackgroundTintList, setBackgroundTintMode, setBottom, setCameraDistance, setClickable, setClipBounds, setClipToOutline, setContentCaptureSession, setContentDescription, setContentSensitivity, setContextClickable, setDefaultFocusHighlightEnabled, setDrawingCacheBackgroundColor, setDrawingCacheEnabled, setDrawingCacheQuality, setDuplicateParentStateEnabled, setElevation, setEnabled, setFadingEdgeLength, setFilterTouchesWhenObscured, setFitsSystemWindows, setFocusable, setFocusableInTouchMode, setFocusedByDefault, setForceDarkAllowed, setForeground, setForegroundGravity, setForegroundTintBlendMode, setForegroundTintList, setForegroundTintMode, setFrameContentVelocity, setHandwritingBoundsOffsets, setHandwritingDelegateFlags, setHandwritingDelegatorCallback, setHapticFeedbackEnabled, setHasTransientState, setHorizontalFadingEdgeEnabled, setHorizontalScrollBarEnabled, setHorizontalScrollbarThumbDrawable, setHorizontalScrollbarTrackDrawable, setHovered, setId, setImportantForAccessibility, setImportantForAutofill, setImportantForContentCapture, setIsCredential, setIsHandwritingDelegate, setKeepScreenOn, setKeyboardNavigationCluster, setLabelFor, setLayerPaint, setLayerType, setLayoutDirection, setLayoutParams, setLeft, setLeftTopRightBottom, setLongClickable, setMeasuredDimension, setMinimumHeight, setMinimumWidth, setNextClusterForwardId, setNextFocusDownId, setNextFocusForwardId, setNextFocusLeftId, setNextFocusRightId, setNextFocusUpId, setOnApplyWindowInsetsListener, setOnCapturedPointerListener, setOnClickListener, setOnContextClickListener, setOnCreateContextMenuListener, setOnDragListener, setOnFocusChangeListener, setOnGenericMotionListener, setOnHoverListener, setOnKeyListener, setOnLongClickListener, setOnReceiveContentListener, setOnScrollChangeListener, setOnSystemUiVisibilityChangeListener, setOnTouchListener, setOutlineAmbientShadowColor, setOutlineProvider, setOutlineSpotShadowColor, setOverScrollMode, setPadding, setPaddingRelative, setPendingCredentialRequest, setPivotX, setPivotY, setPointerIcon, setPreferKeepClear, setPreferKeepClearRects, setPressed, setRenderEffect, setRevealOnFocusHint, setRight, setRotation, setRotationX, setRotationY, setSaveEnabled, setSaveFromParentEnabled, setScaleX, setScaleY, setScreenReaderFocusable, setScrollBarDefaultDelayBeforeFade, setScrollBarFadeDuration, setScrollBarSize, setScrollBarStyle, setScrollCaptureCallback, setScrollCaptureHint, setScrollContainer, setScrollIndicators, setScrollX, setScrollY, setScrollbarFadingEnabled, setSelected, setSoundEffectsEnabled, setStateDescription, setStateListAnimator, setSupplementalDescription, setSystemGestureExclusionRects, setSystemUiVisibility, setTag, setTextAlignment, setTextDirection, setTooltipText, setTop, setTouchDelegate, setTransitionAlpha, setTransitionName, setTransitionVisibility, setTranslationX, setTranslationY, setTranslationZ, setVerticalFadingEdgeEnabled, setVerticalScrollBarEnabled, setVerticalScrollbarPosition, setVerticalScrollbarThumbDrawable, setVerticalScrollbarTrackDrawable, setViewTranslationCallback, setVisibility, setWillNotCacheDrawing, setWillNotDraw, setX, setY, setZ, showContextMenu, startActionMode, startAnimation, startDrag, startDragAndDrop, startNestedScroll, stopNestedScroll, toString, transformMatrixToGlobal, transformMatrixToLocal, unscheduleDrawable, updateDragShadow, verifyDrawable, willNotCacheDrawing, willNotDraw -
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
-
Method Detail
-
onFinishInflate
void onFinishInflate()
Override onFinishInflate for smart-specific features: 1. Auto-detect Content, Header, Footer defined in XML.
-
onAttachedToWindow
void onAttachedToWindow()
Override onAttachedToWindow for smart-specific features: 1. Add default or globally configured Header and Footer (only when absent). 2. Show a TextView hint when Content is empty. 3. Smart-enable NestedScrollingEnabled. 4. Initialize theme colors and adjust Header/Footer/Content display order.
-
onMeasure
void onMeasure(int widthMeasureSpec, int heightMeasureSpec)
Measure Header, Footer, and Content. 1. The measurement code appears complex because Header/Footer have four spinner styles SpinnerStyle, each with its own measurement method. 2. Provides preview measurement for XML editing (isInEditMode). 3. Resets the horizontal touch position cache mLastTouchX to the screen center.
- Parameters:
widthMeasureSpec- Horizontal measure specheightMeasureSpec- Vertical measure spec
-
onLayout
void onLayout(boolean changed, int l, int t, int r, int b)
Layout Header, Footer, and Content. The layout code is relatively simple because complex calculations have already been done during measurement; layout just follows the results.
- Parameters:
changed- Whether the layout has changedl- Leftt- Topr- Rightb- Bottom
-
onDetachedFromWindow
void onDetachedFromWindow()
Override onDetachedFromWindow for smart-specific features: 1. Restore original state. 2. Clear animation data (prevent memory leaks).
-
drawChild
boolean drawChild(Canvas canvas, View child, long drawingTime)
Override drawChild for smart-specific features: 1. Draw background for Header and Footer (only when background is set). 2. Clip Header/Footer in FixedBehind style (when mEnableClipHeaderWhenFixedBehind=true).
- Parameters:
canvas- Drawing canvaschild- Child view to drawdrawingTime- Drawing time
-
computeScroll
void computeScroll()
Override computeScroll for smart-specific features: 1. Over-scroll bounce. 2. Boundary collision.
-
dispatchTouchEvent
boolean dispatchTouchEvent(MotionEvent e)
Event dispatch (gesture core): 1. Multi-touch support. 2. Seamless content scrolling.
- Parameters:
e- Touch event
-
requestDisallowInterceptTouchEvent
void requestDisallowInterceptTouchEvent(boolean disallowIntercept)
This code is from Google's official SwipeRefreshLayout, mainly to let older ListView scroll down smoothly by selectively blocking requestDisallowInterceptTouchEvent. Most third-party refresh libraries retain this code
-
startFlingIfNeed
boolean startFlingIfNeed(float flingVelocity)
Start fling mode when necessary.
- Parameters:
flingVelocity- Velocity- Returns:
true if nested scrolling fling can be intercepted
-
interceptAnimatorByAction
boolean interceptAnimatorByAction(int action)
When animation is playing, touch the screen to interrupt animation and switch to drag state.
- Parameters:
action- MotionEvent- Returns:
Whether the animation was successfully interrupted
-
notifyStateChanged
void notifyStateChanged(RefreshState state)
Set and notify state change (setState).
- Parameters:
state- State
-
setStateDirectLoading
void setStateDirectLoading(boolean triggerLoadMoreEvent)
Directly set state to Loading.
- Parameters:
triggerLoadMoreEvent- Whether to trigger the load more callback
-
setStateLoading
void setStateLoading(boolean notify)
Set state to Loading.
- Parameters:
notify- Whether to trigger notification event
-
setStateRefreshing
void setStateRefreshing(boolean notify)
Set state to Refreshing.
- Parameters:
notify- Whether to trigger notification event
-
setViceState
void setViceState(RefreshState state)
Set the vice state.
- Parameters:
state- State
-
isEnableTranslationContent
boolean isEnableTranslationContent(boolean enable, @Nullable() RefreshComponent internal)
Determine whether content should be translated when pulling down
- Parameters:
enable- mEnableHeaderTranslationContent or mEnableFooterTranslationContentinternal- mRefreshHeader or mRefreshFooter- Returns:
enable
-
isEnableRefreshOrLoadMore
boolean isEnableRefreshOrLoadMore(boolean enable)
Whether the layout can actually refresh or load (distinct from over-scroll drag / pure scroll mode). Directly affects Header/Footer visibility.
- Parameters:
enable- mEnableRefresh or mEnableLoadMore- Returns:
enable
-
animSpinner
ValueAnimator animSpinner(int endSpinner, int startDelay, Interpolator interpolator, int duration)
Execute rebound animation.
- Parameters:
endSpinner- Target valuestartDelay- Start delayinterpolator- Interpolatorduration- Duration- Returns:
ValueAnimator or null
-
animSpinnerBounce
void animSpinnerBounce(float velocity)
Over-scroll bounce animation.
- Parameters:
velocity- Velocity
-
overSpinner
void overSpinner()
Gesture drag ended, start executing rebound animation.
-
moveSpinnerInfinitely
void moveSpinnerInfinitely(float spinner)
Viscous (sticky) spinner translation.
- Parameters:
spinner- Offset
-
generateLayoutParams
ViewGroup.LayoutParams generateLayoutParams(AttributeSet attrs)
-
getNestedScrollAxes
int getNestedScrollAxes()
-
onStartNestedScroll
boolean onStartNestedScroll(@NonNull() View child, @NonNull() View target, int nestedScrollAxes)
-
onNestedScrollAccepted
void onNestedScrollAccepted(@NonNull() View child, @NonNull() View target, int axes)
-
onNestedPreScroll
void onNestedPreScroll(@NonNull() View target, int dx, int dy, @NonNull() Array<int> consumed)
-
onNestedScroll
void onNestedScroll(@NonNull() View target, int dxConsumed, int dyConsumed, int dxUnconsumed, int dyUnconsumed)
-
onNestedPreFling
boolean onNestedPreFling(@NonNull() View target, float velocityX, float velocityY)
-
onNestedFling
boolean onNestedFling(@NonNull() View target, float velocityX, float velocityY, boolean consumed)
-
onStopNestedScroll
void onStopNestedScroll(@NonNull() View target)
-
setNestedScrollingEnabled
void setNestedScrollingEnabled(boolean enabled)
-
isNestedScrollingEnabled
boolean isNestedScrollingEnabled()
-
setHeaderHeight
RefreshLayout setHeaderHeight(float heightDp)
Set the Header's height.
- Parameters:
heightDp- Density-independent Pixels Density-independent pixels (use px2dp for pixel conversion)- Returns:
RefreshLayout
-
setHeaderHeightPx
RefreshLayout setHeaderHeightPx(int height)
Set the Header height
- Parameters:
height- Pixels- Returns:
RefreshLayout
-
setFooterHeight
RefreshLayout setFooterHeight(float heightDp)
Set the Footer's height.
- Parameters:
heightDp- Density-independent Pixels Density-independent pixels (use px2dp for pixel conversion)- Returns:
RefreshLayout
-
setFooterHeightPx
RefreshLayout setFooterHeightPx(int height)
Set the Footer height
- Parameters:
height- Pixels- Returns:
RefreshLayout
-
setHeaderInsetStart
RefreshLayout setHeaderInsetStart(float insetDp)
Set the Header's start offset (see srlHeaderInsetStart in the RepastPracticeActivity XML in demo-app for the practical application).
- Parameters:
insetDp- Density-independent Pixels Density-independent pixels (use px2dp for pixel conversion)- Returns:
RefreshLayout
-
setHeaderInsetStartPx
RefreshLayout setHeaderInsetStartPx(int insetPx)
Set the Header's start offset (see srlHeaderInsetStart in the RepastPracticeActivity XML in demo-app for the practical application).
- Parameters:
insetPx- Pixels- Returns:
RefreshLayout
-
setFooterInsetStart
RefreshLayout setFooterInsetStart(float insetDp)
Set the Footer's start offset.
- Parameters:
insetDp- Density-independent Pixels Density-independent pixels (use px2dp for pixel conversion)- Returns:
RefreshLayout
-
setFooterInsetStartPx
RefreshLayout setFooterInsetStartPx(int insetPx)
Set the Footer's start offset.
- Parameters:
insetPx- Pixels- Returns:
RefreshLayout
-
setDragRate
RefreshLayout setDragRate(float rate)
Set the damping effect. Ratio of displayed drag height to actual drag height (default 0.5).
- Parameters:
rate- ratio = (The drag height of the view)/(The actual drag height of the finger) Ratio = view drag height / finger drag height- Returns:
RefreshLayout
-
setHeaderMaxDragRate
RefreshLayout setHeaderMaxDragRate(float rate)
Set the ratio of the maximum height to drag header.
- Parameters:
rate- ratio = (the maximum height to drag header)/(the height of header) Ratio = max pull-down height / Header height- Returns:
RefreshLayout
-
setFooterMaxDragRate
RefreshLayout setFooterMaxDragRate(float rate)
Set the ratio of the maximum height to drag footer.
- Parameters:
rate- ratio = (the maximum height to drag footer)/(the height of footer) Ratio = max pull-up height / Footer height- Returns:
RefreshLayout
-
setHeaderTriggerRate
RefreshLayout setHeaderTriggerRate(float rate)
Set the ratio at which the refresh is triggered.
- Parameters:
rate- Ratio of trigger refresh distance to HeaderHeight- Returns:
RefreshLayout
-
setFooterTriggerRate
RefreshLayout setFooterTriggerRate(float rate)
Set the ratio at which the load more is triggered.
- Parameters:
rate- Ratio of trigger load distance to FooterHeight- Returns:
RefreshLayout
-
setReboundInterpolator
RefreshLayout setReboundInterpolator(@NonNull() Interpolator interpolator)
Set the rebound interpolator.
- Parameters:
interpolator- Animation interpolator- Returns:
RefreshLayout
-
setReboundDuration
RefreshLayout setReboundDuration(int duration)
Set the duration of the rebound animation.
- Parameters:
duration- Duration- Returns:
RefreshLayout
-
setEnableLoadMore
RefreshLayout setEnableLoadMore(boolean enabled)
Set whether to enable pull-up loading more (enabled by default).
- Parameters:
enabled- Whether to enable- Returns:
RefreshLayout
-
setEnableRefresh
RefreshLayout setEnableRefresh(boolean enabled)
Whether to enable pull-down refresh (enabled by default).
- Parameters:
enabled- Whether to enable- Returns:
SmartRefreshLayout
-
setEnableHeaderTranslationContent
RefreshLayout setEnableHeaderTranslationContent(boolean enabled)
Whether to enable pull-down refresh (enabled by default).
- Parameters:
enabled- Whether to enable- Returns:
RefreshLayout
-
setEnableFooterTranslationContent
RefreshLayout setEnableFooterTranslationContent(boolean enabled)
Set whether to pull up the content while pulling up the footer.
- Parameters:
enabled- Whether to enable- Returns:
RefreshLayout
-
setEnableAutoLoadMore
RefreshLayout setEnableAutoLoadMore(boolean enabled)
Sets whether to listen for the list to trigger a load event when scrolling to the bottom (default true).
- Parameters:
enabled- Whether to enable- Returns:
RefreshLayout
-
setEnableOverScrollBounce
RefreshLayout setEnableOverScrollBounce(boolean enabled)
Set whether to enable the over-scroll bounce function.
- Parameters:
enabled- Whether to enable- Returns:
RefreshLayout
-
setEnablePureScrollMode
RefreshLayout setEnablePureScrollMode(boolean enabled)
Set whether to enable pure scroll mode.
- Parameters:
enabled- Whether to enable- Returns:
RefreshLayout
-
setEnableScrollContentWhenLoaded
RefreshLayout setEnableScrollContentWhenLoaded(boolean enabled)
Set whether to scroll the content to display new data after loading more complete. Whether to scroll content to show new data after load more.
- Parameters:
enabled- Whether to enable- Returns:
RefreshLayout
-
setEnableScrollContentWhenRefreshed
RefreshLayout setEnableScrollContentWhenRefreshed(boolean enabled)
Set whether to scroll the content to display new data after the refresh is complete. Whether to scroll content to show new data after refresh
- Parameters:
enabled- Whether to enable- Returns:
RefreshLayout
-
setEnableLoadMoreWhenContentNotFull
RefreshLayout setEnableLoadMoreWhenContentNotFull(boolean enabled)
Set whether to pull up and load more when the content is not full of one page. Whether to allow pull-up load more when content is less than one page.
- Parameters:
enabled- Whether to enable- Returns:
RefreshLayout
-
setEnableOverScrollDrag
RefreshLayout setEnableOverScrollDrag(boolean enabled)
Set whether to enable over-scroll drag (imitation iPhone effect).
- Parameters:
enabled- Whether to enable- Returns:
RefreshLayout
-
setEnableFooterFollowWhenNoMoreData
RefreshLayout setEnableFooterFollowWhenNoMoreData(boolean enabled)
Set whether Footer follows the content after there is no more data.
- Parameters:
enabled- Whether to enable- Returns:
RefreshLayout
-
setEnableClipHeaderWhenFixedBehind
RefreshLayout setEnableClipHeaderWhenFixedBehind(boolean enabled)
Set whether to clip header when the Header is in the FixedBehind state.
- Parameters:
enabled- Whether to enable- Returns:
RefreshLayout
-
setEnableClipFooterWhenFixedBehind
RefreshLayout setEnableClipFooterWhenFixedBehind(boolean enabled)
Set whether to clip footer when the Footer is in the FixedBehind state.
- Parameters:
enabled- Whether to enable- Returns:
RefreshLayout
-
setEnableNestedScroll
RefreshLayout setEnableNestedScroll(boolean enabled)
Setting whether nesting scrolling is enabled (default off + smart on). Set whether to enable nested scrolling (default off, smart auto-enable).
- Parameters:
enabled- Whether to enable- Returns:
RefreshLayout
-
setFixedHeaderViewId
RefreshLayout setFixedHeaderViewId(int id)
Set the View ID fixed below the Header, which stays stationary when Footer scrolls.
- Parameters:
id- View ID fixed at header- Returns:
RefreshLayout
-
setFixedFooterViewId
RefreshLayout setFixedFooterViewId(int id)
Set the View ID fixed above the Footer, which stays stationary when Header scrolls.
- Parameters:
id- View ID fixed at footer- Returns:
RefreshLayout
-
setHeaderTranslationViewId
RefreshLayout setHeaderTranslationViewId(int id)
Set the View ID that should scroll along with the Header. Defaults to the entire Content view.
- Parameters:
id- View ID fixed at header- Returns:
RefreshLayout
-
setFooterTranslationViewId
RefreshLayout setFooterTranslationViewId(int id)
Set the View ID that should scroll along with the Footer. Defaults to the entire Content view.
- Parameters:
id- View ID fixed at header- Returns:
RefreshLayout
-
setDisableContentWhenRefresh
RefreshLayout setDisableContentWhenRefresh(boolean disable)
Set whether to disable content interaction during refresh.
- Parameters:
disable- Whether to disable- Returns:
RefreshLayout
-
setDisableContentWhenLoading
RefreshLayout setDisableContentWhenLoading(boolean disable)
Set whether to disable content interaction during loading.
- Parameters:
disable- Whether to disable- Returns:
RefreshLayout
-
setRefreshHeader
RefreshLayout setRefreshHeader(@NonNull() RefreshHeader header)
Set the header of RefreshLayout.
- Parameters:
header- RefreshHeader refresh header- Returns:
RefreshLayout
-
setRefreshHeader
RefreshLayout setRefreshHeader(@NonNull() RefreshHeader header, int width, int height)
Set the header of RefreshLayout.
- Parameters:
header- RefreshHeader refresh headerwidth- the width in px, can use MATCH_PARENT and WRAP_CONTENT.height- the height in px, can use MATCH_PARENT and WRAP_CONTENT.- Returns:
RefreshLayout
-
setRefreshFooter
RefreshLayout setRefreshFooter(@NonNull() RefreshFooter footer)
Set the footer of RefreshLayout.
- Parameters:
footer- RefreshFooter refresh footer- Returns:
RefreshLayout
-
setRefreshFooter
RefreshLayout setRefreshFooter(@NonNull() RefreshFooter footer, int width, int height)
Set the footer of RefreshLayout.
- Parameters:
footer- RefreshFooter refresh footerwidth- the width in px, can use MATCH_PARENT and WRAP_CONTENT.height- the height in px, can use MATCH_PARENT and WRAP_CONTENT.- Returns:
RefreshLayout
-
setRefreshContent
RefreshLayout setRefreshContent(@NonNull() View content)
Set the content of RefreshLayout (Suitable for non-XML pages, not suitable for replacing empty layouts).
- Parameters:
content- View content view- Returns:
RefreshLayout
-
setRefreshContent
RefreshLayout setRefreshContent(@NonNull() View content, int width, int height)
Set the content of RefreshLayout (Suitable for non-XML pages, not suitable for replacing empty layouts).
- Parameters:
content- View content viewwidth- the width in px, can use MATCH_PARENT and WRAP_CONTENT.height- the height in px, can use MATCH_PARENT and WRAP_CONTENT.- Returns:
RefreshLayout
-
getRefreshFooter
@Nullable() RefreshFooter getRefreshFooter()
Get the current Footer of RefreshLayout.
- Returns:
RefreshLayout
-
getRefreshHeader
@Nullable() RefreshHeader getRefreshHeader()
Get the current Header of RefreshLayout.
- Returns:
RefreshLayout
-
getState
@NonNull() RefreshState getState()
Get the current state of RefreshLayout.
- Returns:
RefreshLayout
-
getLayout
@NonNull() ViewGroup getLayout()
Get the ViewGroup of RefreshLayout.
- Returns:
ViewGroup
-
setOnRefreshListener
RefreshLayout setOnRefreshListener(OnRefreshListener listener)
Set refresh listener separately.
- Parameters:
listener- OnRefreshListener refresh listener- Returns:
RefreshLayout
-
setOnLoadMoreListener
RefreshLayout setOnLoadMoreListener(OnLoadMoreListener listener)
Set load more listener separately.
- Parameters:
listener- OnLoadMoreListener load more listener- Returns:
RefreshLayout
-
setOnRefreshLoadMoreListener
RefreshLayout setOnRefreshLoadMoreListener(OnRefreshLoadMoreListener listener)
Set refresh and load listeners at the same time.
- Parameters:
listener- OnRefreshLoadMoreListener refresh and load more listener- Returns:
RefreshLayout
-
setOnMultiListener
RefreshLayout setOnMultiListener(OnMultiListener listener)
Set up a multi-function listener. Recommended: SimpleBoundaryDecider.
- Parameters:
listener- OnMultiListener multi-purpose listener- Returns:
RefreshLayout
-
setPrimaryColors
RefreshLayout setPrimaryColors(@ColorInt() Array<int> primaryColors)
Set theme color int (primaryColor and accentColor).
- Parameters:
primaryColors- ColorInt theme colors- Returns:
RefreshLayout
-
setPrimaryColorsId
RefreshLayout setPrimaryColorsId(@ColorRes() Array<int> primaryColorId)
Set theme color id (primaryColor and accentColor).
- Parameters:
primaryColorId- ColorRes theme color resource IDs- Returns:
RefreshLayout
-
setScrollBoundaryDecider
RefreshLayout setScrollBoundaryDecider(ScrollBoundaryDecider boundary)
Set the scroll boundary Decider, Can customize when you can refresh. Recommended .
- Parameters:
boundary- ScrollBoundaryDecider scroll boundary decider- Returns:
RefreshLayout
-
setNoMoreData
RefreshLayout setNoMoreData(boolean noMoreData)
Restore the original state after finishLoadMoreWithNoMoreData.
- Parameters:
noMoreData- Whether there is more data- Returns:
RefreshLayout
-
resetNoMoreData
RefreshLayout resetNoMoreData()
Restore the original state after finishLoadMoreWithNoMoreData.
- Returns:
RefreshLayout
-
finishRefresh
RefreshLayout finishRefresh()
Finish refresh.
- Returns:
RefreshLayout
-
finishLoadMore
RefreshLayout finishLoadMore()
Finish load more.
- Returns:
RefreshLayout
-
finishRefresh
RefreshLayout finishRefresh(int delayed)
Finish refresh.
- Parameters:
delayed- Start delay- Returns:
RefreshLayout
-
finishRefresh
RefreshLayout finishRefresh(boolean success)
Finish refresh.
- Parameters:
success- Whether data was refreshed successfully (affects last update time)- Returns:
RefreshLayout
-
finishRefresh
RefreshLayout finishRefresh(int delayed, boolean success, Boolean noMoreData)
Finish refresh.
- Parameters:
delayed- Start delaysuccess- Whether data was refreshed successfully (affects last update time)- Returns:
RefreshLayout
-
finishRefreshWithNoMoreData
RefreshLayout finishRefreshWithNoMoreData()
Finish refresh and mark no more data.
- Returns:
RefreshLayout
-
finishLoadMore
RefreshLayout finishLoadMore(int delayed)
Finish load more.
- Parameters:
delayed- Start delay- Returns:
RefreshLayout
-
finishLoadMore
RefreshLayout finishLoadMore(boolean success)
Finish load more.
- Parameters:
success- Whether data was successful- Returns:
RefreshLayout
-
finishLoadMore
RefreshLayout finishLoadMore(int delayed, boolean success, boolean noMoreData)
Finish load more.
- Parameters:
delayed- Start delaysuccess- Whether data was successfulnoMoreData- Whether there is more data- Returns:
RefreshLayout
-
finishLoadMoreWithNoMoreData
RefreshLayout finishLoadMoreWithNoMoreData()
Finish load more and mark no more data.
- Returns:
RefreshLayout
-
closeHeaderOrFooter
RefreshLayout closeHeaderOrFooter()
Close the Header or Footer. Note: this cannot replace finishRefresh and finishLoadMore. 1. closeHeaderOrFooter can close header/footer at any time in any state. 2. finishRefresh and finishLoadMore can only close during refresh or load respectively.
- Returns:
RefreshLayout
-
autoRefresh
boolean autoRefresh()
Display refresh animation and trigger refresh event.
- Returns:
true or false, Status non-compliance will fail. true if successful (fails if state is non-compliant)
-
autoRefresh
boolean autoRefresh(int delayed)
Display refresh animation and trigger refresh event with delayed start.
- Parameters:
delayed- Start delay- Returns:
true or false, Status non-compliance will fail. true if successful (fails if state is non-compliant)
-
autoRefreshAnimationOnly
boolean autoRefreshAnimationOnly()
Display refresh animation without triggering events.
- Returns:
true or false, Status non-compliance will fail. true if successful (fails if state is non-compliant)
-
autoRefresh
boolean autoRefresh(int delayed, int duration, float dragRate, boolean animationOnly)
Display refresh animation with multifunction options.
- Parameters:
delayed- Start delayduration- Drag animation durationdragRate- Drag height ratioanimationOnly- Animation only- Returns:
true or false, Status non-compliance will fail. true if successful (fails if state is non-compliant)
-
autoLoadMore
boolean autoLoadMore()
Display load more animation and trigger load more event.
- Returns:
true or false, Status non-compliance will fail. true if successful (fails if state is non-compliant)
-
autoLoadMore
boolean autoLoadMore(int delayed)
Display load more animation and trigger load more event with delayed start.
- Parameters:
delayed- Start delay- Returns:
true or false, Status non-compliance will fail. true if successful (fails if state is non-compliant)
-
autoLoadMoreAnimationOnly
boolean autoLoadMoreAnimationOnly()
Display load more animation without triggering events.
- Returns:
true or false, Status non-compliance will fail. true if successful (fails if state is non-compliant)
-
autoLoadMore
boolean autoLoadMore(int delayed, int duration, float dragRate, boolean animationOnly)
Display load more animation with multifunction options.
- Parameters:
delayed- Start delayduration- Drag animation durationdragRate- Drag height ratio- Returns:
true or false, Status non-compliance will fail. true if successful (fails if state is non-compliant)
-
setDefaultRefreshHeaderCreator
static void setDefaultRefreshHeaderCreator(@NonNull() DefaultRefreshHeaderCreator creator)
Set the default Header creator.
- Parameters:
creator- Header creator
-
setDefaultRefreshFooterCreator
static void setDefaultRefreshFooterCreator(@NonNull() DefaultRefreshFooterCreator creator)
Set the default Footer creator.
- Parameters:
creator- Footer creator
-
setDefaultRefreshInitializer
static void setDefaultRefreshInitializer(@NonNull() DefaultRefreshInitializer initializer)
Set the default Refresh initializer.
- Parameters:
initializer- Global initializer
-
isRefreshing
boolean isRefreshing()
Whether currently refreshing
- Returns:
Whether currently refreshing
-
isLoading
boolean isLoading()
Whether currently loading
- Returns:
Whether currently loading
-
performClick
boolean performClick()
-
-
-
-