|
@@ -15,26 +15,29 @@ import com.reactnativenavigation.params.TitleBarLeftButtonParams;
|
15
|
15
|
import java.util.List;
|
16
|
16
|
|
17
|
17
|
public class ContextualMenu extends TitleBar implements LeftButtonOnClickListener, ContextualMenuButton.ContextualButtonClickListener {
|
|
18
|
+ private ContextualMenuParams params;
|
18
|
19
|
private Callback onButtonClicked;
|
19
|
20
|
private final String navigatorEventId;
|
20
|
21
|
|
21
|
|
- public ContextualMenu(Context context, ContextualMenuParams params, StyleParams.Color contextualMenuBackgroundColor, Callback onButtonClicked) {
|
|
22
|
+ public ContextualMenu(Context context, ContextualMenuParams params, StyleParams styleParams, Callback onButtonClicked) {
|
22
|
23
|
super(context);
|
|
24
|
+ this.params = params;
|
23
|
25
|
this.onButtonClicked = onButtonClicked;
|
24
|
26
|
navigatorEventId = params.navigationParams.navigatorEventId;
|
25
|
|
- setStyle(contextualMenuBackgroundColor);
|
26
|
|
- setButtons(params.buttons, params.leftButton);
|
|
27
|
+ setStyle(styleParams);
|
|
28
|
+ setButtons();
|
27
|
29
|
}
|
28
|
30
|
|
29
|
|
- public void setStyle(StyleParams.Color contextualMenuBackgroundColor) {
|
30
|
|
- if (contextualMenuBackgroundColor.hasColor()) {
|
31
|
|
- setBackgroundColor(contextualMenuBackgroundColor.getColor());
|
|
31
|
+ public void setStyle(StyleParams styleParams) {
|
|
32
|
+ params.setButtonsColor(styleParams.contextualMenuButtonsColor);
|
|
33
|
+ if (styleParams.contextualMenuBackgroundColor.hasColor()) {
|
|
34
|
+ setBackgroundColor(styleParams.contextualMenuBackgroundColor.getColor());
|
32
|
35
|
}
|
33
|
36
|
}
|
34
|
37
|
|
35
|
|
- public void setButtons(List<ContextualMenuButtonParams> buttons, TitleBarLeftButtonParams leftButton) {
|
36
|
|
- addButtonsToContextualMenu(buttons, getMenu());
|
37
|
|
- setBackButton(leftButton);
|
|
38
|
+ public void setButtons() {
|
|
39
|
+ addButtonsToContextualMenu(params.buttons, getMenu());
|
|
40
|
+ setBackButton(params.leftButton);
|
38
|
41
|
}
|
39
|
42
|
|
40
|
43
|
private void setBackButton(TitleBarLeftButtonParams leftButton) {
|