Skip to content

Commit f63893e

Browse files
authored
Update README.md
1 parent 34d8c64 commit f63893e

1 file changed

Lines changed: 63 additions & 0 deletions

File tree

README.md

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,64 @@
11
# appbarlayout-spring-extension
2+
One library contains one behavior help appbarlayout to scrll spring. In the sample have add the realtimeblur test and add tablayout with TabScrimHelper(animate color with CollapsingToolbarLayout).Because of some methods in the Behavior of AppBarLayout not open to the out package. So I set the package name same to the support design.
3+
4+
Screenshot
5+
====
6+
First is with spring. Second with blur and TabScrimHelper
7+
![](/screenshot/appbar_spring.gif)
8+
![](/screenshot/appbar_spring_with_blur_tab.gif)
9+
10+
Installation
11+
====
12+
```groovy
13+
dependencies {
14+
compile 'com.todou.com:appbarspring:1.0.1'
15+
}
16+
```
17+
Usages
18+
====
19+
```xml
20+
<android.support.design.widget.AppBarLayout
21+
...
22+
app:layout_behavior="@string/appbar_spring_behavior"
23+
...>
24+
...
25+
</android.support.design.widget.AppBarLayout>
26+
```
27+
if you want add blur with the spring.You can add this by the [RealtimeBlurView](https://github.com/mmin18/RealtimeBlurView):
28+
```java
29+
final RealtimeBlurView realtimeBlurView = (RealtimeBlurView) findViewById(R.id.real_time_blur_view);
30+
AppBarLayout appBarLayout = (AppBarLayout) findViewById(R.id.app_bar);
31+
AppBarLayoutSpringBehavior springBehavior = (AppBarLayoutSpringBehavior) ((CoordinatorLayout.LayoutParams) appBarLayout.getLayoutParams()).getBehavior();
32+
springBehavior.setSpringOffsetCallback(new AppBarLayoutSpringBehavior.SpringOffsetCallback() {
33+
@Override
34+
public void springCallback(int offset) {
35+
int radius = 20 * (240 - offset > 0 ? 240 - offset : 0) / 240;
36+
realtimeBlurView.setBlurRadius(radius);
37+
}
38+
});
39+
```
40+
With the tablayout you can add **TabScrimHelper** to let TabLayout animate color with the CollapsingToolbarLayout:
41+
```java
42+
TabScrimHelper tabScrimHelper = new TabScrimHelper(tabLayout, collapsingToolbarLayout);
43+
appBarLayout.addOnOffsetChangedListener(tabScrimHelper);
44+
```
45+
46+
Thanks for [RealtimeBlurView](https://github.com/mmin18/RealtimeBlurView)
47+
48+
License
49+
====
50+
<pre>
51+
Copyright 2016 ToDou
52+
53+
Licensed under the Apache License, Version 2.0 (the "License");
54+
you may not use this file except in compliance with the License.
55+
You may obtain a copy of the License at
56+
57+
http://www.apache.org/licenses/LICENSE-2.0
58+
59+
Unless required by applicable law or agreed to in writing, software
60+
distributed under the License is distributed on an "AS IS" BASIS,
61+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
62+
See the License for the specific language governing permissions and
63+
limitations under the License.
64+
</pre>

0 commit comments

Comments
 (0)