Skip to content

Commit cf7d808

Browse files
Merge remote-tracking branch 'origin/master'
2 parents 8b9f530 + f53940f commit cf7d808

File tree

3 files changed

+13
-57
lines changed

3 files changed

+13
-57
lines changed

README.md

Lines changed: 6 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ English | [中文](README_ZH_CN.md)
44

55
[![](https://www.jitpack.io/v/DylanCaiCoding/LoadingHelper.svg)](https://www.jitpack.io/#DylanCaiCoding/LoadingHelper) [![](https://img.shields.io/badge/License-Apache--2.0-blue.svg)](https://github.com/DylanCaiCoding/LoadingHelper/blob/master/LICENSE)
66

7-
`LoadingHelper` is a highly expandable Android library for showing loading status view on the low-coupling way, it is implemented with a Kotlin code of more than 200 lines without comment statement . it not only **shows different view like loading, content, error, empty or customized view** when loading network data, but also **manages title bar.**
7+
`LoadingHelper` is a highly expandable Android library for showing loading status view on the low-coupling way, it is implemented with a Kotlin code of less than 300 lines without comment statement . it not only **shows different view like loading, content, error, empty or customized view** when loading network data, but also **manages title bar.**
88

99
## Feature
1010

@@ -15,7 +15,6 @@ English | [中文](README_ZH_CN.md)
1515
- Support for set reload event.
1616
- Support for update views anytime.
1717
- Support for use with most third-party libraries.
18-
- Support for preprocessing the content view.
1918

2019
## Demo
2120

@@ -48,7 +47,7 @@ Add dependencies in your module `build.gradle` :
4847

4948
```
5049
dependencies {
51-
implementation 'com.github.DylanCaiCoding:LoadingHelper:2.2.0'
50+
implementation 'com.github.DylanCaiCoding:LoadingHelper:2.3.0'
5251
}
5352
```
5453

@@ -129,9 +128,7 @@ If you want to add an ordinary title bar above the content.
129128
Similar to the previous usage, create a class extends `LoadingHelper.Adapter<VH extends ViewHolder>` and set header.
130129

131130
```java
132-
loadingHelper.register(ViewType.TITLE, new TitleAdapter("title"));
133-
loadingHelper.register(VIEW_TYPE_SEARCH, new SearchHeaderAdapter(onSearchListener));
134-
loadingHelper.setDecorHeader(ViewType.TITLE, VIEW_TYPE_SEARCH);
131+
loadingHelper.setDecorHeader(new TitleAdapter("title"), new SearchHeaderAdapter(onSearchListener));
135132
```
136133

137134
If you want to add an special title bar with linkage effect.
@@ -160,29 +157,10 @@ Then set it up.
160157
loadingHelper.setDecorAdapter(new ScrollDecorAdapter());
161158
```
162159

163-
#### Preprocessing the content view
160+
## Author's other libraries
164161

165-
Create a adapter extends `LoadingHelper.ContentAdapter<VH extends ViewHolder>`.
166-
167-
```java
168-
public class CommonContentAdapter extends LoadingHelper.ContentAdapter<LoadingHelper.ViewHolder> {
169-
@Override
170-
public LoadingHelper.ViewHolder onCreateViewHolder(@NonNull View contentView) {
171-
return new LoadingHelper.ViewHolder(contentView);
172-
}
173-
174-
@Override
175-
public void onBindViewHolder(@NonNull LoadingHelper.ViewHolder holder) {
176-
View contentView = holder.getRootView();
177-
}
178-
}
179-
```
180-
181-
Create a `LoadingHelper` with the `ContentAdapter`.
182-
183-
```java
184-
LoadingHelper loadingHelper = new LoadingHelper(this, new CommonContentAdapter());
185-
```
162+
- [LoadingHelper](https://github.com/DylanCaiCoding/LoadingHelper), a highly expandable Android library for decoupling the code of toolbar or loading status view.
163+
- [ViewBindingKTX](https://github.com/DylanCaiCoding/ViewBindingKTX), the most comprehensive utils of ViewBinding.
186164

187165
## Thanks
188166

README_ZH_CN.md

Lines changed: 6 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
[![](https://www.jitpack.io/v/DylanCaiCoding/LoadingHelper.svg)](https://www.jitpack.io/#DylanCaiCoding/LoadingHelper) [![License](https://img.shields.io/badge/License-Apache--2.0-blue.svg)](https://github.com/DylanCaiCoding/LoadingHelper/blob/master/LICENSE)
66

7-
`LoadingHelper` 是一个深度解耦加载界面和标题栏的工具,只用了一个 Kotlin 文件实现,不算上注释只有 200 多行代码。不仅能在请求网络数据时**显示加载中、加载成功、加载失败、无数据的视图或自定义视图**,还可以**对标题栏进行管理**
7+
`LoadingHelper` 是一个深度解耦加载界面和标题栏的工具,只用了一个 Kotlin 文件实现,不算上注释少于 300 行代码。不仅能在请求网络数据时**显示加载中、加载成功、加载失败、无数据的视图或自定义视图**,还可以**对标题栏进行管理**
88

99
详细的标题栏用法可以查看这篇文章[《史上耦合度最低的添加标题栏方式》](https://juejin.im/post/5ef01e22e51d4573eb40dab1)
1010

@@ -15,7 +15,6 @@
1515
- 可设置重新请求数据的事件
1616
- 可动态更新视图样式
1717
- 可结合绝大部分第三方控件使用
18-
- 可对内容进行预处理
1918

2019
## 示例
2120

@@ -53,7 +52,7 @@ allprojects {
5352

5453
```
5554
dependencies {
56-
implementation 'com.github.DylanCaiCoding:LoadingHelper:2.2.0'
55+
implementation 'com.github.DylanCaiCoding:LoadingHelper:2.3.0'
5756
}
5857
```
5958

@@ -124,9 +123,7 @@ errorAdapter.notifyDataSetChanged();
124123
和前面的用法类似,先创建一个继承 `LoadingHelper.Adapter<VH extends ViewHolder>` 的标题栏适配器,然后就能在内容的上方添加标题栏了,可以添加多个头部。
125124

126125
```java
127-
loadingHelper.register(ViewType.TITLE, new TitleAdapter("标题名"));
128-
loadingHelper.register(VIEW_TYPE_SEARCH, new SearchHeaderAdapter(onSearchListener));
129-
loadingHelper.setDecorHeader(ViewType.TITLE, VIEW_TYPE_SEARCH);
126+
loadingHelper.setDecorHeader(new TitleAdapter("标题名"), new SearchHeaderAdapter(onSearchListener));
130127
```
131128

132129
如果是**特殊的标题栏**,比如有联动效果,就不能直接使用上面的方式了。这时我们要给内容增加个装饰的容器。
@@ -202,29 +199,10 @@ loadingHelper.setDecorAdapter(new ScrollDecorAdapter());
202199

203200
上述的两种使用方式都是可以进行多次设置,不过每次设置会把上一次设置的样式给替换掉。
204201

205-
#### 预处理内容视图
202+
## 作者其它的库
206203

207-
创建一个适配器继承 `LoadingHelper.ContentAdapter<VH extends ViewHolder>`。如果想要使用 Activity 对象,可以在构造方法传入或者通过 contentView 获得。
208-
209-
```java
210-
public class CommonContentAdapter extends LoadingHelper.ContentAdapter<LoadingHelper.ViewHolder> {
211-
@Override
212-
public LoadingHelper.ViewHolder onCreateViewHolder(@NonNull View contentView) {
213-
return new LoadingHelper.ViewHolder(contentView);
214-
}
215-
216-
@Override
217-
public void onBindViewHolder(@NonNull LoadingHelper.ViewHolder holder) {
218-
View contentView = holder.getRootView();
219-
}
220-
}
221-
```
222-
223-
在创建 `LoadingHelper` 对象时传入 `ContentAdapter` 对象,就会立即对内容视图进行处理。
224-
225-
```java
226-
loadingHelper= new LoadingHelper(this, new CommonContentAdapter());
227-
```
204+
- [ViewBindingKTX](https://github.com/DylanCaiCoding/ViewBindingKTX) —— 最全面的 ViewBinding 工具
205+
- [ActivityResultLauncher](https://github.com/DylanCaiCoding/ActivityResultLauncher) —— 完美替代 `startActivityForResult()`
228206

229207
## 感谢
230208

build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11

22
buildscript {
3-
ext.kotlin_version = '1.4.32'
3+
ext.kotlin_version = '1.5.20'
44
repositories {
55
google()
66
jcenter()

0 commit comments

Comments
 (0)