MCPcopy Index your code
hub / github.com/ckrgithub/CollapsingRefresh

github.com/ckrgithub/CollapsingRefresh @v1.0.1

Chat with this repo
repository ↗ · DeepWiki ↗ · release v1.0.1 ↗ · + Follow
732 symbols 1,545 edges 55 files 186 documented · 25%
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

CollapsingRefresh

AppBarLayout+ViewPager+RecyclerView的刷新功能。最低支持api 16,recyclerView:26.1.0。

效果演示

Demo

下载 APK

依赖

添加依赖:

    dependencies {
        implementation 'ckrjfrog.Refresh:CollapsingRefresh:1.0.2'//gradle plugin 3.0(包含)以上使用
        //compile 'ckrjfrog.Refresh:CollapsingRefresh:1.0.2'//gradle plugin 3.0一下使用
    }

功能及使用

1.布局引用

     <com.scwang.smartrefresh.SmartRefreshLayout
        xmlns:android="http://schemas.android.com/apk/res/android"
        xmlns:app="http://schemas.android.com/apk/res-auto"
        android:id="@+id/refreshLayout"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        app:srlDisableContentWhenLoading="false"
        app:srlDisableContentWhenRefresh="false"
        app:srlEnableAutoLoadmore="false"
        app:srlEnableHeaderTranslationContent="true"
        app:srlEnableLoadmore="true">

        <com.scwang.smartrefresh.header.ClassicsHeader
            android:id="@+id/classicsHeader"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            app:srlClassicsSpinnerStyle="Translate"/>

        <com.ckr.smoothappbarlayout.SmoothRecyclerView
            android:id="@+id/recyclerView"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:clipToPadding="false"
            android:paddingBottom="5dp"
            android:paddingLeft="5dp"
            android:paddingRight="5dp"
            android:paddingTop="0dp"/>

        <com.scwang.smartrefresh.footer.ClassicsFooter
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            app:srlClassicsSpinnerStyle="Translate"/>
    </com.scwang.smartrefresh.SmartRefreshLayout>

2.代码使用

  • 设置监听器
    appBarLayout.addOnOffsetChangedListener(this);
    recyclerView.setOnSmoothScrollListener(appBarLayout);
    smartRefreshLayout.setOnCollapsingListener(this);
  • 是否允许刷新
    @Override
    public void onOffsetChanged(AppBarLayout appBarLayout, int verticalOffset) {
        this.verticalOffset = verticalOffset;
        Logd(TAG, "onOffsetChanged: verticalOffset:" + this.verticalOffset);
        if (verticalOffset != 0) {
            boolean enableRefresh = smartRefreshLayout.isEnableRefresh();
            if (enableRefresh) {
                smartRefreshLayout.setEnableRefresh(false);
            }
        } else {
            smartRefreshLayout.setEnableRefresh(true);
        }
    }

感谢

SmartRefreshLayout

smooth-app-bar-layout

我的开源项目

PageRecyclerView:自定义RecyclerView实现翻页功能及无限轮播

FlexItemDecoration:recyclerView分割线的绘制

更新日志

  • 1.0.1-release
  • 修复:上拉刷新时拖动布局会闪烁的bug等一系列bug
  • 其他:重构代码完成
  • 依赖:ckrjfrog.Refresh:CollapsingRefresh:1.0.2

  • 1.0.1-beta

  • 实现AppBarLayout+ViewPager+RecyclerView的下拉刷新和上拉加载功能

License

Copyright 2018 ckrgithub

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

   http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

Extension points exported contracts — how you extend this code

OnOffsetListener (Interface)
Created by Administrator on 2018/3/14. [6 implementers]
behavior/src/main/java/com/ckr/behavior/listener/OnOffsetListener.java
OnStateChangedListener (Interface)
刷新状态改变监听器 Created by SCWANG on 2017/5/26. [5 implementers]
behavior/src/main/java/com/scwang/smartrefresh/listener/OnStateChangedListener.java
RefreshScrollBoundary (Interface)
滚动边界 Created by SCWANG on 2017/7/8. [4 implementers]
behavior/src/main/java/com/scwang/smartrefresh/api/RefreshScrollBoundary.java
RefreshHeader (Interface)
刷新头部 Created by SCWANG on 2017/5/26. [4 implementers]
behavior/src/main/java/com/scwang/smartrefresh/api/RefreshHeader.java
RefreshInternal (Interface)
刷新内部组件 Created by SCWANG on 2017/5/26. [4 implementers]
behavior/src/main/java/com/scwang/smartrefresh/api/RefreshInternal.java

Core symbols most depended-on inside this repo

Logd
called by 69
behavior/src/main/java/com/ckr/behavior/util/RefreshLog.java
getView
called by 32
behavior/src/main/java/com/scwang/smartrefresh/api/RefreshContent.java
Loge
called by 25
behavior/src/main/java/com/ckr/behavior/util/RefreshLog.java
getSpinnerStyle
called by 22
behavior/src/main/java/com/scwang/smartrefresh/api/RefreshInternal.java
getLayoutParams
called by 21
behavior/src/main/java/com/scwang/smartrefresh/api/RefreshContent.java
measure
called by 19
behavior/src/main/java/com/scwang/smartrefresh/api/RefreshContent.java
setColor
called by 16
behavior/src/main/java/com/scwang/smartrefresh/internal/ProgressDrawable.java
moveSpinnerInfinitely
called by 15
behavior/src/main/java/com/scwang/smartrefresh/SmartRefreshLayout.java

Shape

Method 662
Class 48
Interface 19
Enum 3

Languages

Java100%

Modules by API surface

behavior/src/main/java/com/scwang/smartrefresh/SmartRefreshLayout.java139 symbols
behavior/src/main/java/com/scwang/smartrefresh/impl/RefreshContentWrapper.java54 symbols
behavior/src/main/java/com/scwang/smartrefresh/api/RefreshLayout.java47 symbols
behavior/src/main/java/com/ckr/behavior/BaseBehavior.java33 symbols
behavior/src/main/java/com/scwang/smartrefresh/header/ClassicsHeader.java27 symbols
behavior/src/main/java/com/scwang/smartrefresh/footer/ClassicsFooter.java24 symbols
behavior/src/main/java/com/scwang/smartrefresh/api/RefreshKernel.java24 symbols
behavior/src/main/java/com/scwang/smartrefresh/internal/PathParser.java23 symbols
behavior/src/main/java/com/ckr/behavior/SmoothAppBarLayout.java23 symbols
behavior/src/main/java/com/scwang/smartrefresh/internal/PathsDrawable.java21 symbols
behavior/src/main/java/com/ckr/behavior/SmoothRecyclerView.java19 symbols
behavior/src/main/java/android/support/v4/view/PagerAdapterWrapper.java19 symbols

For agents

$ claude mcp add CollapsingRefresh \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact