Skip to content

Commit

Permalink
Revert "Set elevation 0 when creating TopBar"
Browse files Browse the repository at this point in the history
This reverts commit 05dacbd.
  • Loading branch information
guyca committed Jan 13, 2019
1 parent 27e59eb commit 135c6eb
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 23 deletions.
Original file line number Diff line number Diff line change
@@ -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;

Expand All @@ -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;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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();
}
}

0 comments on commit 135c6eb

Please sign in to comment.