finds.dev← search

// the find

hehonghui/android_my_pull_refresh_view

★ 276 · Java · updated Mar 2017

android下拉刷新实现原理【阐述基本原理,不建议使用】

A 2014 Android pull-to-refresh implementation built on LinearLayout that hides header/footer via padding and reveals them on overscroll. The author explicitly warns in the README not to use it in production — it exists to explain the underlying mechanism, not to be shipped. For that narrow purpose, it does the job.

The padding-based hide/reveal trick is clearly explained and easy to follow in the source. The generic base class `PullRefreshBase<T>` with `isTop()`/`isShowFooterView()` overrides is a reasonable teaching pattern for how ListView-era pull-to-refresh worked. The code is short enough to read in one sitting.

Abandoned in 2017 and targets pre-RecyclerView Android — ListView-based pull-to-refresh is a solved, obsolete problem. The `isTop()` check using `getChildAt(0)` and `getFirstVisiblePosition()` breaks on edge cases like empty lists or views with headers. There are two nearly-identical parallel implementations (`scroller/` and `swipe/`) with no explanation of the difference. No Gradle build files — this is an Eclipse ADT project, which stopped being supported a decade ago.

View on GitHub →

// want more like this?

We dig through GitHub every week and send a few repos picked for what you actually care about — each with an honest take like this one.

Get finds in your inbox → Search again →