Skip to content

Commit c9bf09d

Browse files
committed
finish v1.2.2
1 parent c4685a6 commit c9bf09d

12 files changed

Lines changed: 78 additions & 35 deletions

File tree

README-cn.md

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ LoadSir的使用,只需要简单的三步
5555
### 添加依赖
5656

5757
```groovy
58-
compile 'com.kingja.loadsir:loadsir:1.2.0'
58+
compile 'com.kingja.loadsir:loadsir:1.2.2'
5959
```
6060

6161
### 第一步:配置
@@ -230,11 +230,7 @@ placeholder效果状态页类似[ShimmerRecyclerView](https://github.com/sharish
230230
* :point_right: [常见问题](docs/FAQ-cn.md)
231231
* 📌 [更新日志](docs/changelog.md)
232232
* [最佳实践](docs/BestPractice-cn.md)
233-
<<<<<<< HEAD
234233
* [下个版本开发计划](docs/NextVersion.md)
235-
=======
236-
* [Next Version](docs/NextVersion.md)
237-
>>>>>>> v1.2.2-pre
238234

239235
## 代码混淆
240236

README.md

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ LoadSir only needs 3 steps to finish its task: **Config** -> **Register** -> **D
5252
### Download
5353

5454
```groovy
55-
compile 'com.kingja.loadsir:loadsir:1.2.0'
55+
compile 'com.kingja.loadsir:loadsir:1.2.2'
5656
```
5757

5858
### Step 1: Config
@@ -230,11 +230,7 @@ amazing. :ghost:
230230
* :point_right: [FAQ](docs/FAQ.md)
231231
* 📌 [Versions](docs/changelog.md)
232232
* [Best Practice](docs/BestPractice.md)
233-
<<<<<<< HEAD
234-
* [What Next Version Will Include?](docs/NextVersion.md)
235-
=======
236233
* [What Will Next Version Include?](docs/NextVersion.md)
237-
>>>>>>> v1.2.2-pre
238234

239235
## ProGuard
240236

app/build.gradle

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ dependencies {
3333
})
3434
testCompile 'junit:junit:4.12'
3535
compile project(':loadsir')
36+
// compile 'com.kingja.loadsir:loadsir:1.2.2'
3637
debugCompile 'com.squareup.leakcanary:leakcanary-android:1.5.4'
3738
releaseCompile 'com.squareup.leakcanary:leakcanary-android-no-op:1.5.4'
3839
/*ButterKnife*/

app/src/main/AndroidManifest.xml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,7 @@
1818

1919
<category android:name="android.intent.category.LAUNCHER"/>
2020
</intent-filter>
21-
<<<<<<< HEAD
22-
=======
2321

24-
>>>>>>> v1.2.2-pre
2522
</activity>
2623
<activity android:name=".target.NormalActivity"/>
2724
<activity android:name=".target.ConvertorActivity"/>

app/src/main/java/sample/kingja/loadsir/PostUtil.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
1414
*/
1515
public class PostUtil {
16-
public static final int DELAY_TIME = 1000;
16+
private static final int DELAY_TIME = 1000;
1717

1818
public static void postCallbackDelayed(final LoadService loadService, final Class<? extends Callback> clazz) {
1919
postCallbackDelayed(loadService, clazz, DELAY_TIME);

app/src/main/java/sample/kingja/loadsir/target/AnimateActivity.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ public void run() {
5858
}).start();
5959
}
6060
});
61-
PostUtil.postCallbackDelayed(loadService,EmptyCallback.class, 2500);
61+
PostUtil.postCallbackDelayed(loadService, EmptyCallback.class, 2500);
6262
}
6363

6464
}

app/src/main/res/layout/layout_empty.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,12 @@
1515
android:id="@+id/tv_empty"
1616
android:layout_width="wrap_content"
1717
android:layout_height="wrap_content"
18-
android:text="fine, no data."
18+
android:text="@string/fine_no_data"
1919
android:textColor="#333333"
2020
android:textSize="18sp"/>
2121

2222
<TextView
2323
android:layout_width="wrap_content"
2424
android:layout_height="wrap_content"
25-
android:text="click me to retry!"/>
25+
android:text="@string/click_me_to_retry"/>
2626
</LinearLayout>

app/src/main/res/values/strings.xml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,6 @@
1212
<string name="loadsir">LoadSir</string>
1313
<string name="success">Success</string>
1414
<string name="keep_title_bar">keep title bar</string>
15+
<string name="fine_no_data">fine, no data.</string>
16+
<string name="click_me_to_retry">click me to retry!</string>
1517
</resources>

docs/FAQ-cn.md

Lines changed: 28 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -60,9 +60,34 @@ in Fragment
6060
}
6161
```
6262

63-
### #2 如何在自定义状态页上添加标题栏以模仿原布局的标题栏
64-
由于标题栏的样式多种多样,为了降低耦合没有对该需求提供扩展,如果有这方面需求的同学可以利用View注册的方式,对标题栏以下
65-
的布局进行注册,这样就保留了标题栏,如果大家有更好的思路请告诉我,或发起pull request。
63+
### #2 如果保留原布局的标题栏(toolbar,或者titileView)?
64+
在Activity,只要注册toolbar,或者titileView以下的布局View即可,这样LoadSir就会保留标题栏。
65+
在Fragment,情况稍微复杂点,请看模板代码:
66+
```java
67+
@Nullable
68+
@Override
69+
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle
70+
savedInstanceState) {
71+
ViewGroup rootView = (ViewGroup) inflater.inflate(R.layout.title_title_bar, container, false);
72+
unBinder = ButterKnife.bind(this, rootView);
73+
RelativeLayout titleBarView = (RelativeLayout) rootView.findViewById(R.id.rl_titleBar);
74+
LinearLayout contentView = (LinearLayout) rootView.findViewById(R.id.ll_content);
75+
rootView.removeView(contentView);
76+
LoadSir loadSir = new LoadSir.Builder()
77+
.addCallback(new EmptyCallback())
78+
.addCallback(new LoadingCallback())
79+
.setDefaultCallback(LoadingCallback.class)
80+
.build();
81+
loadService = loadSir.register(contentView, new Callback.OnReloadListener() {
82+
@Override
83+
public void onReload(View v) {
84+
loadService.showSuccess();
85+
}
86+
87+
});
88+
return loadService.getTitleLoadLayout(getContext(), rootView, titleBarView);
89+
}
90+
```
6691

6792

6893

docs/FAQ.md

Lines changed: 27 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -60,12 +60,36 @@ public class BufferKnifeActivity extends AppCompatActivity {
6060
}
6161
```
6262

63-
### #2 How to add Toolbar or TitleView in custom Callback?
64-
Because there are so many styles of TitleView, LoadSir didn't support this feature. You can register the View below the
65-
TitleView instead. So that LayoutLoad will not include the TitleView.
63+
### #2 How to keep the toolbar in Fragment?
64+
```java
65+
@Nullable
66+
@Override
67+
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle
68+
savedInstanceState) {
69+
ViewGroup rootView = (ViewGroup) inflater.inflate(R.layout.title_title_bar, container, false);
70+
unBinder = ButterKnife.bind(this, rootView);
71+
RelativeLayout titleBarView = (RelativeLayout) rootView.findViewById(R.id.rl_titleBar);
72+
LinearLayout contentView = (LinearLayout) rootView.findViewById(R.id.ll_content);
73+
rootView.removeView(contentView);
74+
LoadSir loadSir = new LoadSir.Builder()
75+
.addCallback(new EmptyCallback())
76+
.addCallback(new LoadingCallback())
77+
.setDefaultCallback(LoadingCallback.class)
78+
.build();
79+
loadService = loadSir.register(contentView, new Callback.OnReloadListener() {
80+
@Override
81+
public void onReload(View v) {
82+
loadService.showSuccess();
83+
}
84+
85+
});
86+
return loadService.getTitleLoadLayout(getContext(), rootView, titleBarView);
87+
}
88+
```
6689

6790
If you have a better idea, please let me know. I'm very interested to improve LoadSir in any way. Thanks for your help.
6891

92+
6993
### #3 `setDefaultCallback(...)` vs `addCallback(...)`
7094
What's the purpose of a `DefaultCallback`?
7195

0 commit comments

Comments
 (0)