Search in sources :

Example 1 with BottomTabs

use of com.reactnativenavigation.views.bottomtabs.BottomTabs in project react-native-navigation by wix.

the class BottomTabPresenterTest method createBottomTabs.

private void createBottomTabs(Options tab1Options, Options tab2Options, Options tab3Options) {
    childRegistry = new ChildControllersRegistry();
    bottomTabs = Mockito.mock(BottomTabs.class);
    child1 = spy(new SimpleViewController(activity, childRegistry, "child1", tab1Options));
    child2 = spy(new SimpleViewController(activity, childRegistry, "child2", tab2Options));
    child3 = spy(new SimpleViewController(activity, childRegistry, "child2", tab3Options));
    tabs = Arrays.asList(child1, child2, child3);
    uut = new BottomTabPresenter(activity, tabs, ImageLoaderMock.mock(), new TypefaceLoaderMock(), new Options());
    uut.bindView(bottomTabs);
    uut.setDefaultOptions(new Options());
}
Also used : BottomTabs(com.reactnativenavigation.views.bottomtabs.BottomTabs) Options(com.reactnativenavigation.options.Options) ChildControllersRegistry(com.reactnativenavigation.viewcontrollers.child.ChildControllersRegistry) SimpleViewController(com.reactnativenavigation.mocks.SimpleViewController) TypefaceLoaderMock(com.reactnativenavigation.mocks.TypefaceLoaderMock)

Example 2 with BottomTabs

use of com.reactnativenavigation.views.bottomtabs.BottomTabs in project react-native-navigation by wix.

the class BottomTabPresenter method mergeDotIndicator.

private void mergeDotIndicator(int index, DotIndicatorOptions dotIndicator) {
    if (bottomTabs == null)
        return;
    AHNotification.Builder builder = new AHNotification.Builder();
    if (dotIndicator.color.hasValue())
        builder.setBackgroundColor(dotIndicator.color.get());
    builder.setSize(dotIndicator.visible.isFalse() ? 0 : dotIndicator.size.get(defaultDotIndicatorSize));
    if (dotIndicator.animate.hasValue())
        builder.animate(dotIndicator.animate.get());
    AHNotification notification = builder.build();
    if (notification.hasValue())
        bottomTabs.perform(bottomTabs -> bottomTabs.setNotification(notification, index));
}
Also used : Typeface(android.graphics.Typeface) ViewController(com.reactnativenavigation.viewcontrollers.viewcontroller.ViewController) Context(android.content.Context) BottomTabOptions(com.reactnativenavigation.options.BottomTabOptions) ImageLoadingListenerAdapter(com.reactnativenavigation.utils.ImageLoadingListenerAdapter) ImageLoader(com.reactnativenavigation.utils.ImageLoader) LateInit(com.reactnativenavigation.utils.LateInit) CollectionUtils.forEach(com.reactnativenavigation.utils.CollectionUtils.forEach) NonNull(androidx.annotation.NonNull) BottomTabs(com.reactnativenavigation.views.bottomtabs.BottomTabs) Drawable(android.graphics.drawable.Drawable) DotIndicatorOptions(com.reactnativenavigation.options.DotIndicatorOptions) ThemeColour(com.reactnativenavigation.options.params.ThemeColour) List(java.util.List) AHNotification(com.aurelhubert.ahbottomnavigation.notification.AHNotification) UiUtils.dpToPx(com.reactnativenavigation.utils.UiUtils.dpToPx) Options(com.reactnativenavigation.options.Options) TypefaceLoader(com.reactnativenavigation.options.parsers.TypefaceLoader) AHTextView(com.aurelhubert.ahbottomnavigation.AHTextView) AHNotification(com.aurelhubert.ahbottomnavigation.notification.AHNotification)

Aggregations

Options (com.reactnativenavigation.options.Options)2 BottomTabs (com.reactnativenavigation.views.bottomtabs.BottomTabs)2 Context (android.content.Context)1 Typeface (android.graphics.Typeface)1 Drawable (android.graphics.drawable.Drawable)1 NonNull (androidx.annotation.NonNull)1 AHTextView (com.aurelhubert.ahbottomnavigation.AHTextView)1 AHNotification (com.aurelhubert.ahbottomnavigation.notification.AHNotification)1 SimpleViewController (com.reactnativenavigation.mocks.SimpleViewController)1 TypefaceLoaderMock (com.reactnativenavigation.mocks.TypefaceLoaderMock)1 BottomTabOptions (com.reactnativenavigation.options.BottomTabOptions)1 DotIndicatorOptions (com.reactnativenavigation.options.DotIndicatorOptions)1 ThemeColour (com.reactnativenavigation.options.params.ThemeColour)1 TypefaceLoader (com.reactnativenavigation.options.parsers.TypefaceLoader)1 CollectionUtils.forEach (com.reactnativenavigation.utils.CollectionUtils.forEach)1 ImageLoader (com.reactnativenavigation.utils.ImageLoader)1 ImageLoadingListenerAdapter (com.reactnativenavigation.utils.ImageLoadingListenerAdapter)1 LateInit (com.reactnativenavigation.utils.LateInit)1 UiUtils.dpToPx (com.reactnativenavigation.utils.UiUtils.dpToPx)1 ChildControllersRegistry (com.reactnativenavigation.viewcontrollers.child.ChildControllersRegistry)1