File tree 3 files changed +27
-14
lines changed
java/com/dylanc/loadinghelper/sample
3 files changed +27
-14
lines changed Original file line number Diff line number Diff line change 39
39
*/
40
40
public class ToolbarAdapter extends LoadingHelper .Adapter <ToolbarAdapter .ViewHolder > {
41
41
42
- private String title ;
43
- private NavIconType type ;
42
+ private final String title ;
43
+ private final NavIconType type ;
44
44
private int menuId ;
45
45
private Function1 <? super MenuItem , Boolean > onMenuItemClick ;
46
46
Original file line number Diff line number Diff line change 1
1
package com .dylanc .loadinghelper .sample .animation ;
2
2
3
- import android .animation .Animator ;
4
- import android .animation .AnimatorListenerAdapter ;
5
3
import android .view .View ;
6
4
7
5
import com .dylanc .loadinghelper .LoadingHelper ;
13
11
*/
14
12
public class FadeAnimation implements LoadingHelper .Animation {
15
13
14
+ private static final long DEFAULT_DURATION = 500 ;
15
+ private final long duration ;
16
+
17
+ public FadeAnimation () {
18
+ this (DEFAULT_DURATION );
19
+ }
20
+
21
+ public FadeAnimation (long duration ) {
22
+ this .duration = duration ;
23
+ }
24
+
16
25
@ Override
17
26
public void onStartShowAnimation (@ NotNull View view , @ NotNull Object viewType ) {
18
27
view .setAlpha (0 );
19
- view .animate ().alpha (1 ).setDuration (500 ). setListener ( null );
28
+ view .animate ().alpha (1 ).setDuration (duration );
20
29
}
21
30
22
31
@ Override
23
32
public void onStartHideAnimation (@ NotNull View view , @ NotNull Object viewType ) {
24
- view .animate ().alpha (0f ).setDuration (500 ).setListener (new AnimatorListenerAdapter () {
25
- @ Override
26
- public void onAnimationEnd (Animator animation ) {
27
- view .setAlpha (1 );
28
- view .setVisibility (View .GONE );
29
- }
33
+ view .setAlpha (1 );
34
+ view .animate ().alpha (0 ).setDuration (duration ).withEndAction (() -> {
35
+ view .setAlpha (1 );
36
+ view .setVisibility (View .GONE );
30
37
});
31
38
}
32
39
}
Original file line number Diff line number Diff line change 5
5
android : orientation =" vertical" >
6
6
7
7
<ScrollView
8
- android : id =" @+id/content_parent"
9
8
android : layout_width =" match_parent"
10
9
android : layout_height =" 0dp"
11
- android : layout_weight =" 1" />
10
+ android : layout_weight =" 1" >
11
+
12
+ <LinearLayout
13
+ android : id =" @+id/content_parent"
14
+ android : layout_width =" match_parent"
15
+ android : layout_height =" wrap_content"
16
+ android : orientation =" vertical" />
17
+ </ScrollView >
12
18
13
19
<LinearLayout
14
20
android : layout_width =" match_parent"
15
21
android : layout_height =" 48dp"
16
- android : elevation =" 4dp"
17
22
android : background =" @android:color/white"
23
+ android : elevation =" 4dp"
18
24
android : orientation =" horizontal" >
19
25
20
26
<EditText
You can’t perform that action at this time.
0 commit comments