Search in sources :

Example 6 with ButtonOptions

use of com.reactnativenavigation.options.ButtonOptions in project react-native-navigation by wix.

the class TitleBarButtonControllerTest method beforeEach.

@Override
public void beforeEach() {
    Activity activity = newActivity();
    titleBar = new ButtonBar(activity);
    ButtonOptions button = createComponentButton();
    uut = new ButtonController(activity, new ButtonPresenter(activity, button, new IconResolver(activity, ImageLoaderMock.mock())), button, new TitleBarButtonCreatorMock(), Mockito.mock(ButtonController.OnClickListener.class));
}
Also used : ButtonOptions(com.reactnativenavigation.options.ButtonOptions) ButtonController(com.reactnativenavigation.viewcontrollers.stack.topbar.button.ButtonController) ButtonBar(com.reactnativenavigation.views.stack.topbar.titlebar.ButtonBar) ButtonPresenter(com.reactnativenavigation.viewcontrollers.stack.topbar.button.ButtonPresenter) IconResolver(com.reactnativenavigation.viewcontrollers.stack.topbar.button.IconResolver) Activity(android.app.Activity) TitleBarButtonCreatorMock(com.reactnativenavigation.mocks.TitleBarButtonCreatorMock)

Example 7 with ButtonOptions

use of com.reactnativenavigation.options.ButtonOptions in project react-native-navigation by wix.

the class TopBarButtonControllerTest method beforeEach.

@Override
public void beforeEach() {
    button = new ButtonOptions();
    final Activity activity = newActivity();
    TitleBarButtonCreatorMock buttonCreatorMock = new TitleBarButtonCreatorMock();
    stackController = spy(TestUtils.newStackController(activity).build());
    stackController.getView().layout(0, 0, 1080, 1920);
    stackController.getTopBar().layout(0, 0, 1080, 200);
    getTitleBar().layout(0, 0, 1080, 200);
    optionsPresenter = spy(new ButtonPresenter(activity, button, new IconResolverFake(activity, ImageLoaderMock.mock())));
    uut = new ButtonController(activity, optionsPresenter, button, buttonCreatorMock, (buttonId) -> {
    });
    stackController.ensureViewIsCreated();
}
Also used : IconResolverFake(com.reactnativenavigation.fakes.IconResolverFake) ArgumentMatchers.any(org.mockito.ArgumentMatchers.any) Text(com.reactnativenavigation.options.params.Text) Java6Assertions.assertThat(org.assertj.core.api.Java6Assertions.assertThat) ArgumentMatchers.eq(org.mockito.ArgumentMatchers.eq) Colour(com.reactnativenavigation.options.params.Colour) ButtonBar(com.reactnativenavigation.views.stack.topbar.titlebar.ButtonBar) Mockito.spy(org.mockito.Mockito.spy) MenuItem(android.view.MenuItem) TitleBarButtonCreatorMock(com.reactnativenavigation.mocks.TitleBarButtonCreatorMock) NullText(com.reactnativenavigation.options.params.NullText) ArgumentMatchers.anyInt(org.mockito.ArgumentMatchers.anyInt) Bool(com.reactnativenavigation.options.params.Bool) ButtonOptions(com.reactnativenavigation.options.ButtonOptions) BaseTest(com.reactnativenavigation.BaseTest) ButtonPresenter(com.reactnativenavigation.viewcontrollers.stack.topbar.button.ButtonPresenter) Number(com.reactnativenavigation.options.params.Number) ButtonController(com.reactnativenavigation.viewcontrollers.stack.topbar.button.ButtonController) Test(org.junit.Test) Mockito.times(org.mockito.Mockito.times) Mockito.verify(org.mockito.Mockito.verify) Color(android.graphics.Color) IconResolverFake(com.reactnativenavigation.fakes.IconResolverFake) ThemeColour(com.reactnativenavigation.options.params.ThemeColour) TestUtils(com.reactnativenavigation.TestUtils) Activity(android.app.Activity) ImageLoaderMock(com.reactnativenavigation.mocks.ImageLoaderMock) ButtonOptions(com.reactnativenavigation.options.ButtonOptions) ButtonController(com.reactnativenavigation.viewcontrollers.stack.topbar.button.ButtonController) ButtonPresenter(com.reactnativenavigation.viewcontrollers.stack.topbar.button.ButtonPresenter) Activity(android.app.Activity) TitleBarButtonCreatorMock(com.reactnativenavigation.mocks.TitleBarButtonCreatorMock)

Example 8 with ButtonOptions

use of com.reactnativenavigation.options.ButtonOptions in project react-native-navigation by wix.

the class NavigationIconResolverTest method iconButton.

private ButtonOptions iconButton() {
    ButtonOptions button = new ButtonOptions();
    button.id = "iconBtnId";
    button.icon = new Text(ICON_URI);
    button.color = new ThemeColour(new Colour(Color.RED));
    return button;
}
Also used : ButtonOptions(com.reactnativenavigation.options.ButtonOptions) Text(com.reactnativenavigation.options.params.Text) ThemeColour(com.reactnativenavigation.options.params.ThemeColour) Colour(com.reactnativenavigation.options.params.Colour) ThemeColour(com.reactnativenavigation.options.params.ThemeColour)

Example 9 with ButtonOptions

use of com.reactnativenavigation.options.ButtonOptions in project react-native-navigation by wix.

the class TitleBarHelper method textualButton.

public static ButtonOptions textualButton(String text) {
    ButtonOptions button = new ButtonOptions();
    button.id = text + CompatUtils.generateViewId();
    button.text = new Text(text);
    return button;
}
Also used : ButtonOptions(com.reactnativenavigation.options.ButtonOptions) Text(com.reactnativenavigation.options.params.Text)

Example 10 with ButtonOptions

use of com.reactnativenavigation.options.ButtonOptions in project react-native-navigation by wix.

the class TitleBarHelper method reactViewButton.

public static ButtonOptions reactViewButton(String name) {
    ButtonOptions button = new ButtonOptions();
    button.id = name + CompatUtils.generateViewId();
    button.component = new ComponentOptions();
    button.component.name = new Text("com.example" + name + CompatUtils.generateViewId());
    button.component.componentId = new Text(name + CompatUtils.generateViewId());
    return button;
}
Also used : ButtonOptions(com.reactnativenavigation.options.ButtonOptions) ComponentOptions(com.reactnativenavigation.options.ComponentOptions) Text(com.reactnativenavigation.options.params.Text)

Aggregations

ButtonOptions (com.reactnativenavigation.options.ButtonOptions)10 Text (com.reactnativenavigation.options.params.Text)7 Colour (com.reactnativenavigation.options.params.Colour)3 ThemeColour (com.reactnativenavigation.options.params.ThemeColour)3 Activity (android.app.Activity)2 TitleBarButtonCreatorMock (com.reactnativenavigation.mocks.TitleBarButtonCreatorMock)2 Number (com.reactnativenavigation.options.params.Number)2 ButtonController (com.reactnativenavigation.viewcontrollers.stack.topbar.button.ButtonController)2 ButtonPresenter (com.reactnativenavigation.viewcontrollers.stack.topbar.button.ButtonPresenter)2 ButtonBar (com.reactnativenavigation.views.stack.topbar.titlebar.ButtonBar)2 Color (android.graphics.Color)1 MenuItem (android.view.MenuItem)1 BaseTest (com.reactnativenavigation.BaseTest)1 TestUtils (com.reactnativenavigation.TestUtils)1 IconResolverFake (com.reactnativenavigation.fakes.IconResolverFake)1 ImageLoaderMock (com.reactnativenavigation.mocks.ImageLoaderMock)1 ComponentOptions (com.reactnativenavigation.options.ComponentOptions)1 Bool (com.reactnativenavigation.options.params.Bool)1 NullText (com.reactnativenavigation.options.params.NullText)1 IconResolver (com.reactnativenavigation.viewcontrollers.stack.topbar.button.IconResolver)1