DrawerBackgroundView { public synchronized void setAlpha(float alphaLevel) { lastAlphaLevel = alphaLevel; Log.d(TAG, "Add to alpha queue[" + alphaLevel + "] "); blockingQueue.add(alphaLevel); if (isBackgroundSet && isReadyToImmidiatelySetAlpha) { Log.d(TAG, "Set alpha[" + alphaLevel + "] \tfor background with background source: " + blurBackground.getDrawable()); blurBackground.setAlpha(alphaLevel); } } 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 shouldAddAlphaValueToQueueWhenBackgroundIsNotReadyToSetAlphaDirectly() { float initAlphaLevel = drawerBackgroundView.blurBackground.getAlpha(); drawerBackgroundView.setAlpha(0.43f); assertThat(drawerBackgroundView.blurBackground.getAlpha()).isEqualTo(initAlphaLevel); }