Browse Source

Revert "Set elevation 0 when creating TopBar"

This reverts commit 05dacbd072.
Guy Carmeli 6 years ago
parent
commit
135c6eb7b2

+ 0
- 3
lib/android/app/src/main/java/com/reactnativenavigation/viewcontrollers/topbar/TopBarController.java View File

@@ -1,7 +1,6 @@
1 1
 package com.reactnativenavigation.viewcontrollers.topbar;
2 2
 
3 3
 import android.content.Context;
4
-import android.os.Build;
5 4
 import android.support.v4.view.ViewPager;
6 5
 import android.view.View;
7 6
 
@@ -11,14 +10,12 @@ import com.reactnativenavigation.views.topbar.TopBar;
11 10
 
12 11
 
13 12
 public class TopBarController {
14
-    private static final int INITIAL_ELEVATION = 0;
15 13
     private TopBar topBar;
16 14
 
17 15
     public View createView(Context context, StackLayout stackLayout) {
18 16
         if (topBar == null) {
19 17
             topBar = createTopBar(context, stackLayout);
20 18
             topBar.setId(CompatUtils.generateViewId());
21
-            if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) topBar.setElevation(INITIAL_ELEVATION);
22 19
         }
23 20
         return topBar;
24 21
     }

+ 14
- 20
lib/android/app/src/test/java/com/reactnativenavigation/viewcontrollers/TopBarControllerTest.java View File

@@ -2,6 +2,7 @@ package com.reactnativenavigation.viewcontrollers;
2 2
 
3 3
 import android.app.Activity;
4 4
 import android.content.Context;
5
+import android.support.annotation.NonNull;
5 6
 
6 7
 import com.reactnativenavigation.BaseTest;
7 8
 import com.reactnativenavigation.viewcontrollers.topbar.TopBarController;
@@ -19,38 +20,31 @@ import static org.mockito.Mockito.verify;
19 20
 public class TopBarControllerTest extends BaseTest {
20 21
 
21 22
     private TopBarController uut;
22
-    private TitleBar titleBar;
23
-    private TopBar topBar;
24
-    private Activity activity;
25 23
 
26 24
     @Override
27 25
     public void beforeEach() {
28
-        activity = newActivity();
26
+        uut = new TopBarController();
27
+    }
28
+
29
+    @Test
30
+    public void clear() {
31
+        final TitleBar[] titleBar = new TitleBar[1];
29 32
         uut = new TopBarController() {
33
+            @NonNull
30 34
             @Override
31 35
             protected TopBar createTopBar(Context context, StackLayout stackLayout) {
32
-                topBar = spy(new TopBar(context, stackLayout) {
36
+                return new TopBar(context, stackLayout) {
33 37
                     @Override
34 38
                     protected TitleBar createTitleBar(Context context) {
35
-                        titleBar = spy(super.createTitleBar(context));
36
-                        return titleBar;
39
+                        titleBar[0] = spy(super.createTitleBar(context));
40
+                        return titleBar[0];
37 41
                     }
38
-                });
39
-                return topBar;
42
+                };
40 43
             }
41 44
         };
42
-    }
43
-
44
-    @Test
45
-    public void createView_setElevationToCancelDefaultElevationAnimationWhichMightConflictWithElevationValueFromDefaultOptions() {
46
-        uut.createView(activity, Mockito.mock(StackLayout.class));
47
-        verify(topBar).setElevation(0);
48
-    }
49
-
50
-    @Test
51
-    public void clear() {
45
+        Activity activity = newActivity();
52 46
         uut.createView(activity, Mockito.mock(StackLayout.class));
53 47
         uut.clear();
54
-        verify(titleBar, times(1)).clear();
48
+        verify(titleBar[0], times(1)).clear();
55 49
     }
56 50
 }