How do their APIs compare?
How do their APIs compare?
About bingoogolapple/bgarefreshlayout-android · 2 messages · last activity 8/13/2026
These two libraries operate at completely different layers and their "APIs" aren't really comparable in scope — one is a small UI widget library, the other is a full media-playback framework — but here's a concrete breakdown of how each exposes its functionality.
bingoogolapple/bgarefreshlayout-android: a single ViewGroup + delegate callback
The whole API surface centers on BGARefreshLayout, a custom ViewGroup you drop into XML:
- Delegate pattern: You implement
BGARefreshLayout.BGARefreshLayoutDelegatewith two callback methods —onBGARefreshLayoutBeginRefreshing(...)(void) andonBGARefreshLayoutBeginLoadingMore(...)(returnsbooleanto indicate whether loading-more should actually start) [library/src/main/java/cn/bingoogolapple/refreshlayout/BGARefreshLayout.java:L883-L890]. You register it viasetDelegate(delegate)[library/src/main/java/cn/bingoogolapple/refreshlayout/BGARefreshLayout.java:L843-L849], or declaratively via a Data Binding@BindingAdapter("bga_refresh_delegate")inBGARefreshLayoutAdapter[library/src/main/java/cn/bingoogolapple/refreshlayout/adapters/BGARefreshLayoutAdapter.java:L27-L34]. - Imperative control methods:
beginLoadingMore(),endRefreshing(),endLoadingMore(),isLoadingMore(),getCurrentRefreshStatus()[library/src/main/java/cn/bingoogolapple/refreshlayout/BGARefreshLayout.java:L774-L782, L862-L874]. A separateBGARefreshScaleDelegate.onRefreshScaleChanged(scale, moveYDistance)lets you hook into the pull progress directly [library/src/main/java/cn/bingoogolapple/refreshlayout/BGARefreshLayout.java:L892-L899]. - State model: a simple enum
RefreshStatus { IDLE, PULL_DOWN, RELEASE_REFRESH, REFRESHING }[library/src/main/java/cn/bingoogolapple/refreshlayout/BGARefreshLayout.java:L901-L903]. - Extensibility via abstract class: to build a custom refresh visual, you extend
BGARefreshViewHolderand implement lifecycle hooks likehandleScale,changeToIdle/PullDown/ReleaseRefresh/Refreshing,onEndRefreshing, as seen in concrete implementations likeBGAStickinessRefreshViewHolder[library/src/main/java/cn/bingoogolapple/refreshlayout/BGAStickinessRefreshViewHolder.java:L29-L118] and the corresponding low-level animated viewBGAMeiTuanRefreshView(changeToIdle,changeToRefreshing,handleScale, etc.) [library/src/main/java/cn/bingoogolapple/refreshlayout/BGAMeiTuanRefreshView.java:L31-L125]. - Internally it also patches
AbsListView's scroll listener via reflection to detect "scrolled to bottom" for auto-loading-more, without requiring users to subclassListView[library/src/main/java/cn/bingoogolapple/refreshlayout/BGARefreshLayout.java:L290-L316].
This is a small, synchronous, callback-based UI API — a handful of classes, no async task graph, no lifecycle beyond the Android View lifecycle.
google/exoplayer: layered, component-based media framework
ExoPlayer's public API is vastly larger and organized very differently — the retrieved chunks here happen to be from extensions (ffmpeg, av1, cast, media2) rather than the core Player/ExoPlayer interfaces, but they illustrate the pattern well:
- Extension modules as pluggable components: e.g.
FfmpegLibrary.getCodecName(mimeType)maps MIME types to native FFmpeg decoder names (aac,mp3,ac3,opus, etc.) [extensions/ffmpeg/src/main/java/com/google/android/exoplayer2/
Want to ask your own question?
Open chat for bingoogolapple/bgarefreshlayout-androidPublic Q&A. Generated by RepoPilot from the actual source of bingoogolapple/bgarefreshlayout-android. AI answers can be incomplete or stale — verify before relying on them.