DrawerBackgroundView { public synchronized void addBlurredLayer() { View blurredLayer = LayoutInflater.from(drawerLayoutWithBlurredBackground.getContext()). inflate(R.layout.blurred_background_for_drawer, drawerLayoutWithBlurredBackground, false); addViewAsNextToLast(blurredLayer); blurBackground = (ImageView) blurredLayer.findViewById(R.id.drawerBlurBackground); orginalBackground = (ImageView) blurredLayer.findViewById(R.id.drawerBlurBackgroundBackground); } DrawerBackgroundView(DrawerLayoutWithBlurredBackground drawerLayoutWithBlurredBackground); synchronized void addBlurredLayer(); synchronized void setImageBitmap(Bitmap blurredImage); synchronized void reset(); synchronized void setAlpha(float alphaLevel); void disableBlurredLayers(); void enableBlurredLayers(); static final float NOT_TRANSPARENT_ALPHA_LEVEL; }
@Test public void shouldAddBlurredLayerAtTheTopOfDrawerLayout() { int childsCount = 4; given(drawerLayoutWithBlurredBackground.getChildCount()).willReturn(childsCount); int lastViewIndexBeforeDrawer = childsCount - 1; drawerBackgroundView.addBlurredLayer(); verify(drawerLayoutWithBlurredBackground ).addView((View) any(), eq(lastViewIndexBeforeDrawer)); }