File tree Expand file tree Collapse file tree
java/loopeer/com/appbarlayout_spring_extension Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11package loopeer .com .appbarlayout_spring_extension ;
22
33import android .os .Bundle ;
4- import android .support .design .widget .AppBarLayout ;
5- import android .support .design .widget .CoordinatorLayout ;
64import android .support .design .widget .FloatingActionButton ;
75import android .support .design .widget .Snackbar ;
8- import android .support .design .widget .AppBarLayoutSpringBehavior ;
96import android .support .v7 .app .AppCompatActivity ;
107import android .support .v7 .widget .Toolbar ;
118import android .view .View ;
129
13- import com .github .mmin18 .widget .RealtimeBlurView ;
14-
1510public class SpringAppBarLayoutActivity extends AppCompatActivity {
1611
1712 @ Override
@@ -30,17 +25,5 @@ public void onClick(View view) {
3025 .setAction ("Action" , null ).show ();
3126 }
3227 });
33-
34- final RealtimeBlurView realtimeBlurView = (RealtimeBlurView ) findViewById (R .id .real_time_blur_view );
35-
36- AppBarLayout appBarLayout = (AppBarLayout ) findViewById (R .id .app_bar );
37- AppBarLayoutSpringBehavior springBehavior = (AppBarLayoutSpringBehavior ) ((CoordinatorLayout .LayoutParams ) appBarLayout .getLayoutParams ()).getBehavior ();
38- springBehavior .setSpringOffsetCallback (new AppBarLayoutSpringBehavior .SpringOffsetCallback () {
39- @ Override
40- public void springCallback (int offset ) {
41- int radius = 20 * (240 - offset > 0 ? 240 - offset : 0 ) / 240 ;
42- realtimeBlurView .setBlurRadius (radius );
43- }
44- });
4528 }
4629}
Original file line number Diff line number Diff line change 3030 android : scaleType =" centerCrop"
3131 android : src =" @mipmap/img_test" />
3232
33- <com .github.mmin18.widget.RealtimeBlurView
34- android : id =" @+id/real_time_blur_view"
35- android : layout_width =" match_parent"
36- android : layout_height =" match_parent"
37- app : realtimeBlurRadius =" 20dp"
38- app : realtimeOverlayColor =" @android:color/transparent" />
39-
4033 <android .support.v7.widget.Toolbar
4134 android : id =" @+id/toolbar"
4235 android : layout_width =" match_parent"
You can’t perform that action at this time.
0 commit comments