Skip to content

Commit

Permalink
finish v1.2.2
Browse files Browse the repository at this point in the history
  • Loading branch information
KingJA committed Sep 28, 2017
1 parent c4685a6 commit c9bf09d
Show file tree
Hide file tree
Showing 12 changed files with 78 additions and 35 deletions.
6 changes: 1 addition & 5 deletions README-cn.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ LoadSir的使用,只需要简单的三步
### 添加依赖

```groovy
compile 'com.kingja.loadsir:loadsir:1.2.0'
compile 'com.kingja.loadsir:loadsir:1.2.2'
```

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

## 代码混淆

Expand Down
6 changes: 1 addition & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ LoadSir only needs 3 steps to finish its task: **Config** -> **Register** -> **D
### Download

```groovy
compile 'com.kingja.loadsir:loadsir:1.2.0'
compile 'com.kingja.loadsir:loadsir:1.2.2'
```

### Step 1: Config
Expand Down Expand Up @@ -230,11 +230,7 @@ amazing. :ghost:
* :point_right: [FAQ](docs/FAQ.md)
* 📌 [Versions](docs/changelog.md)
* [Best Practice](docs/BestPractice.md)
<<<<<<< HEAD
* [What Next Version Will Include?](docs/NextVersion.md)
=======
* [What Will Next Version Include?](docs/NextVersion.md)
>>>>>>> v1.2.2-pre

## ProGuard

Expand Down
1 change: 1 addition & 0 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ dependencies {
})
testCompile 'junit:junit:4.12'
compile project(':loadsir')
// compile 'com.kingja.loadsir:loadsir:1.2.2'
debugCompile 'com.squareup.leakcanary:leakcanary-android:1.5.4'
releaseCompile 'com.squareup.leakcanary:leakcanary-android-no-op:1.5.4'
/*ButterKnife*/
Expand Down
3 changes: 0 additions & 3 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,7 @@

<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
<<<<<<< HEAD
=======

>>>>>>> v1.2.2-pre
</activity>
<activity android:name=".target.NormalActivity"/>
<activity android:name=".target.ConvertorActivity"/>
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/java/sample/kingja/loadsir/PostUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
* Email:kingjavip@gmail.com
*/
public class PostUtil {
public static final int DELAY_TIME = 1000;
private static final int DELAY_TIME = 1000;

public static void postCallbackDelayed(final LoadService loadService, final Class<? extends Callback> clazz) {
postCallbackDelayed(loadService, clazz, DELAY_TIME);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ public void run() {
}).start();
}
});
PostUtil.postCallbackDelayed(loadService,EmptyCallback.class, 2500);
PostUtil.postCallbackDelayed(loadService, EmptyCallback.class, 2500);
}

}
4 changes: 2 additions & 2 deletions app/src/main/res/layout/layout_empty.xml
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,12 @@
android:id="@+id/tv_empty"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="fine, no data."
android:text="@string/fine_no_data"
android:textColor="#333333"
android:textSize="18sp"/>

<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="click me to retry!"/>
android:text="@string/click_me_to_retry"/>
</LinearLayout>
2 changes: 2 additions & 0 deletions app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,6 @@
<string name="loadsir">LoadSir</string>
<string name="success">Success</string>
<string name="keep_title_bar">keep title bar</string>
<string name="fine_no_data">fine, no data.</string>
<string name="click_me_to_retry">click me to retry!</string>
</resources>
31 changes: 28 additions & 3 deletions docs/FAQ-cn.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,34 @@ in Fragment
}
```

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

});
return loadService.getTitleLoadLayout(getContext(), rootView, titleBarView);
}
```



Expand Down
30 changes: 27 additions & 3 deletions docs/FAQ.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,12 +60,36 @@ public class BufferKnifeActivity extends AppCompatActivity {
}
```

### #2 How to add Toolbar or TitleView in custom Callback?
Because there are so many styles of TitleView, LoadSir didn't support this feature. You can register the View below the
TitleView instead. So that LayoutLoad will not include the TitleView.
### #2 How to keep the toolbar in Fragment?
```java
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle
savedInstanceState) {
ViewGroup rootView = (ViewGroup) inflater.inflate(R.layout.title_title_bar, container, false);
unBinder = ButterKnife.bind(this, rootView);
RelativeLayout titleBarView = (RelativeLayout) rootView.findViewById(R.id.rl_titleBar);
LinearLayout contentView = (LinearLayout) rootView.findViewById(R.id.ll_content);
rootView.removeView(contentView);
LoadSir loadSir = new LoadSir.Builder()
.addCallback(new EmptyCallback())
.addCallback(new LoadingCallback())
.setDefaultCallback(LoadingCallback.class)
.build();
loadService = loadSir.register(contentView, new Callback.OnReloadListener() {
@Override
public void onReload(View v) {
loadService.showSuccess();
}

});
return loadService.getTitleLoadLayout(getContext(), rootView, titleBarView);
}
```

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


### #3 `setDefaultCallback(...)` vs `addCallback(...)`
What's the purpose of a `DefaultCallback`?

Expand Down
12 changes: 2 additions & 10 deletions docs/NextVersion.md
Original file line number Diff line number Diff line change
@@ -1,17 +1,9 @@
The Next Version
---

What Will Next Version Include?(1.2.2)
What Will Next Version Include?(1.2.X)

- [x] change minSdkVersion 16 to 14 [issues #8](https://github.com/KingJA/LoadSir/issues/8)
- [x] modify callback dynamically [issues #11](https://github.com/KingJA/LoadSir/issues/11) [issues #7](https://github.com/KingJA/LoadSir/issues/7)
- [x] add TitleBar sample [issues #12](https://github.com/KingJA/LoadSir/issues/12)
- [x] add API in Callback [issues #10](https://github.com/KingJA/LoadSir/issues/10)
* protected abstract int onCreateView()
* public void onDetach()
* public void onAttach(Context context, View view)
- [x] make LoadLayout public
- [ ] others, you can tell me
- [ ] you tell me



Expand Down
14 changes: 12 additions & 2 deletions docs/changelog.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,18 @@
Changelog
---

**v1.2.2**
- [x] change minSdkVersion 16 to 14 [issues #8](https://github.com/KingJA/LoadSir/issues/8)
- [x] modify callback dynamically [issues #11](https://github.com/KingJA/LoadSir/issues/11) [issues #7](https://github.com/KingJA/LoadSir/issues/7)
- [x] add TitleBar sample [issues #12](https://github.com/KingJA/LoadSir/issues/12)
- [x] add API in Callback [issues #10](https://github.com/KingJA/LoadSir/issues/10)
* protected abstract int onCreateView()
* public void onDetach()
* public void onAttach(Context context, View view)
- [x] make LoadLayout public

**v1.2.0**
- Improve API naming notations.
- [x] Improve API naming notations.

**v1.1.1**
- Initial release .
- [x] Initial release .

0 comments on commit c9bf09d

Please sign in to comment.