diff --git a/lib/android/app/src/main/java/com/reactnativenavigation/viewcontrollers/topbar/TopBarController.java b/lib/android/app/src/main/java/com/reactnativenavigation/viewcontrollers/topbar/TopBarController.java index 8a640d17d6c..b1fda5a1594 100644 --- a/lib/android/app/src/main/java/com/reactnativenavigation/viewcontrollers/topbar/TopBarController.java +++ b/lib/android/app/src/main/java/com/reactnativenavigation/viewcontrollers/topbar/TopBarController.java @@ -1,7 +1,6 @@ package com.reactnativenavigation.viewcontrollers.topbar; import android.content.Context; -import android.os.Build; import android.support.v4.view.ViewPager; import android.view.View; @@ -11,14 +10,12 @@ public class TopBarController { - private static final int INITIAL_ELEVATION = 0; private TopBar topBar; public View createView(Context context, StackLayout stackLayout) { if (topBar == null) { topBar = createTopBar(context, stackLayout); topBar.setId(CompatUtils.generateViewId()); - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) topBar.setElevation(INITIAL_ELEVATION); } return topBar; } diff --git a/lib/android/app/src/test/java/com/reactnativenavigation/viewcontrollers/TopBarControllerTest.java b/lib/android/app/src/test/java/com/reactnativenavigation/viewcontrollers/TopBarControllerTest.java index 39c7d9059f8..07f1cd1568d 100644 --- a/lib/android/app/src/test/java/com/reactnativenavigation/viewcontrollers/TopBarControllerTest.java +++ b/lib/android/app/src/test/java/com/reactnativenavigation/viewcontrollers/TopBarControllerTest.java @@ -2,6 +2,7 @@ import android.app.Activity; import android.content.Context; +import android.support.annotation.NonNull; import com.reactnativenavigation.BaseTest; import com.reactnativenavigation.viewcontrollers.topbar.TopBarController; @@ -19,38 +20,31 @@ public class TopBarControllerTest extends BaseTest { private TopBarController uut; - private TitleBar titleBar; - private TopBar topBar; - private Activity activity; @Override public void beforeEach() { - activity = newActivity(); + uut = new TopBarController(); + } + + @Test + public void clear() { + final TitleBar[] titleBar = new TitleBar[1]; uut = new TopBarController() { + @NonNull @Override protected TopBar createTopBar(Context context, StackLayout stackLayout) { - topBar = spy(new TopBar(context, stackLayout) { + return new TopBar(context, stackLayout) { @Override protected TitleBar createTitleBar(Context context) { - titleBar = spy(super.createTitleBar(context)); - return titleBar; + titleBar[0] = spy(super.createTitleBar(context)); + return titleBar[0]; } - }); - return topBar; + }; } }; - } - - @Test - public void createView_setElevationToCancelDefaultElevationAnimationWhichMightConflictWithElevationValueFromDefaultOptions() { - uut.createView(activity, Mockito.mock(StackLayout.class)); - verify(topBar).setElevation(0); - } - - @Test - public void clear() { + Activity activity = newActivity(); uut.createView(activity, Mockito.mock(StackLayout.class)); uut.clear(); - verify(titleBar, times(1)).clear(); + verify(titleBar[0], times(1)).clear(); } }