|
@@ -8,6 +8,7 @@ import android.view.Menu;
|
8
|
8
|
import android.view.MenuInflater;
|
9
|
9
|
|
10
|
10
|
import com.reactnativenavigation.R;
|
|
11
|
+import com.reactnativenavigation.animation.HideOnScrollAnimator;
|
11
|
12
|
import com.reactnativenavigation.core.Button;
|
12
|
13
|
|
13
|
14
|
import java.util.List;
|
|
@@ -17,10 +18,12 @@ public class TitleBar extends Toolbar {
|
17
|
18
|
private Menu menu;
|
18
|
19
|
private ActionMenuView actionMenuView;
|
19
|
20
|
private boolean hideOnScroll = false;
|
|
21
|
+ private HideOnScrollAnimator hideOnScrollAnimator;
|
20
|
22
|
|
21
|
23
|
public TitleBar(Context context) {
|
22
|
24
|
super(context);
|
23
|
25
|
createMenu();
|
|
26
|
+
|
24
|
27
|
}
|
25
|
28
|
|
26
|
29
|
private void createMenu() {
|
|
@@ -49,7 +52,14 @@ public class TitleBar extends Toolbar {
|
49
|
52
|
|
50
|
53
|
public void onScrollChanged(ScrollDirectionListener.Direction direction) {
|
51
|
54
|
if (hideOnScroll) {
|
52
|
|
- //TODO animate hide/show
|
|
55
|
+ if (hideOnScrollAnimator == null) {
|
|
56
|
+ createScrollAnimator();
|
|
57
|
+ }
|
|
58
|
+ hideOnScrollAnimator.onScrollChanged(direction);
|
53
|
59
|
}
|
54
|
60
|
}
|
|
61
|
+
|
|
62
|
+ private void createScrollAnimator() {
|
|
63
|
+ hideOnScrollAnimator = new HideOnScrollAnimator(this, HideOnScrollAnimator.HideDirection.Up, getHeight());
|
|
64
|
+ }
|
55
|
65
|
}
|