|
@@ -5,6 +5,7 @@ import android.graphics.Color;
|
5
|
5
|
import android.view.View;
|
6
|
6
|
|
7
|
7
|
import com.balysv.materialmenu.MaterialMenuDrawable;
|
|
8
|
+import com.reactnativenavigation.NavigationApplication;
|
8
|
9
|
import com.reactnativenavigation.params.TitleBarButtonParams;
|
9
|
10
|
import com.reactnativenavigation.params.TitleBarLeftButtonParams;
|
10
|
11
|
|
|
@@ -32,22 +33,36 @@ public class LeftButton extends MaterialMenuDrawable implements View.OnClickList
|
32
|
33
|
setInitialState();
|
33
|
34
|
}
|
34
|
35
|
|
35
|
|
- private void setInitialState() {
|
36
|
|
- if (params != null) {
|
37
|
|
- setIconState(params.iconState);
|
38
|
|
- } else {
|
39
|
|
- setVisible(false);
|
|
36
|
+ public void setIconState(TitleBarLeftButtonParams params) {
|
|
37
|
+ this.params = params;
|
|
38
|
+ if (params.color.hasColor()) {
|
|
39
|
+ setColor(params.color.getColor());
|
40
|
40
|
}
|
|
41
|
+ animateIconState(params.iconState);
|
41
|
42
|
}
|
42
|
43
|
|
43
|
44
|
@Override
|
44
|
45
|
public void onClick(View v) {
|
45
|
46
|
if (isBackButton()) {
|
46
|
47
|
titleBarBackButtonListener.onTitleBarBackPress();
|
|
48
|
+ } else {
|
|
49
|
+ sendClickEvent();
|
|
50
|
+ }
|
|
51
|
+ }
|
|
52
|
+
|
|
53
|
+ private void setInitialState() {
|
|
54
|
+ if (params != null) {
|
|
55
|
+ setIconState(params.iconState);
|
|
56
|
+ } else {
|
|
57
|
+ setVisible(false);
|
47
|
58
|
}
|
48
|
59
|
}
|
49
|
60
|
|
50
|
61
|
private boolean isBackButton() {
|
51
|
62
|
return getIconState() == IconState.ARROW;
|
52
|
63
|
}
|
|
64
|
+
|
|
65
|
+ private void sendClickEvent() {
|
|
66
|
+ NavigationApplication.instance.sendEvent(params.eventId, navigatorEventId);
|
|
67
|
+ }
|
53
|
68
|
}
|