|
@@ -1,7 +1,10 @@
|
1
|
1
|
package com.reactnativenavigation.views;
|
2
|
2
|
|
|
3
|
+import android.animation.Animator;
|
|
4
|
+import android.animation.AnimatorListenerAdapter;
|
3
|
5
|
import android.content.Context;
|
4
|
6
|
import android.graphics.drawable.Drawable;
|
|
7
|
+import android.support.annotation.Nullable;
|
5
|
8
|
import android.support.v7.widget.ActionMenuView;
|
6
|
9
|
import android.support.v7.widget.Toolbar;
|
7
|
10
|
import android.view.Menu;
|
|
@@ -141,17 +144,25 @@ public class TitleBar extends Toolbar {
|
141
|
144
|
}
|
142
|
145
|
|
143
|
146
|
public void hide() {
|
|
147
|
+ hide(null);
|
|
148
|
+ }
|
|
149
|
+
|
|
150
|
+ public void hide(@Nullable final Runnable onHidden) {
|
144
|
151
|
animate()
|
145
|
152
|
.alpha(0)
|
146
|
153
|
.setDuration(200)
|
147
|
|
- .setInterpolator(new AccelerateInterpolator());
|
|
154
|
+ .setInterpolator(new AccelerateInterpolator())
|
|
155
|
+ .setListener(new AnimatorListenerAdapter() {
|
|
156
|
+ @Override
|
|
157
|
+ public void onAnimationEnd(Animator animation) {
|
|
158
|
+ if (onHidden != null) {
|
|
159
|
+ onHidden.run();
|
|
160
|
+ }
|
|
161
|
+ }
|
|
162
|
+ });
|
148
|
163
|
}
|
149
|
164
|
|
150
|
165
|
public void show() {
|
151
|
|
- if (getAlpha() == 1) {
|
152
|
|
- return;
|
153
|
|
- }
|
154
|
|
-
|
155
|
166
|
setAlpha(0);
|
156
|
167
|
animate()
|
157
|
168
|
.alpha(1)
|