@Test public void isAdapterHasNotReadyImageAndIsNotWorkingThenReadImageFromStorage() { blurredBackgroundAdapter.imageUtils = imageUtils; blurredBackgroundAdapter.state = BlurredBackgroundAdapter.BlurredBackgroundAdapterState.READY; blurredBackgroundAdapter.resetBlurringListener(listenerMock); verify(imageUtils, times(1)).createBitmapFromFile(any(String.class)); }
public synchronized void resetBlurringListener(BlurringImageListener listener) { if (state == BlurredBackgroundAdapterState.WORKING) { blurringImageListener = listener; } else if (state == BlurredBackgroundAdapterState.READY && listener != null && blurredImage != null) { listener.onBlurringFinish(blurredImage); } else if (state != BlurredBackgroundAdapterState.RESETTED && listener != null) { Log.w(TAG, "Something was wrong. There isn't any ready blurred background" + " Thus I try to restore some from internal storage."); leaveCurrentBlurredImage(); blurredImage = imageUtils.createBitmapFromFile(internalFilesDirPath + FoggerConfig.BLURRED_SCREENSHOT_FILE_NAME); listener.onBlurringFinish(blurredImage); } }
BlurredBackgroundAdapter { public synchronized void resetBlurringListener(BlurringImageListener listener) { if (state == BlurredBackgroundAdapterState.WORKING) { blurringImageListener = listener; } else if (state == BlurredBackgroundAdapterState.READY && listener != null && blurredImage != null) { listener.onBlurringFinish(blurredImage); } else if (state != BlurredBackgroundAdapterState.RESETTED && listener != null) { Log.w(TAG, "Something was wrong. There isn't any ready blurred background" + " Thus I try to restore some from internal storage."); leaveCurrentBlurredImage(); blurredImage = imageUtils.createBitmapFromFile(internalFilesDirPath + FoggerConfig.BLURRED_SCREENSHOT_FILE_NAME); listener.onBlurringFinish(blurredImage); } } }
BlurredBackgroundAdapter { public synchronized void resetBlurringListener(BlurringImageListener listener) { if (state == BlurredBackgroundAdapterState.WORKING) { blurringImageListener = listener; } else if (state == BlurredBackgroundAdapterState.READY && listener != null && blurredImage != null) { listener.onBlurringFinish(blurredImage); } else if (state != BlurredBackgroundAdapterState.RESETTED && listener != null) { Log.w(TAG, "Something was wrong. There isn't any ready blurred background" + " Thus I try to restore some from internal storage."); leaveCurrentBlurredImage(); blurredImage = imageUtils.createBitmapFromFile(internalFilesDirPath + FoggerConfig.BLURRED_SCREENSHOT_FILE_NAME); listener.onBlurringFinish(blurredImage); } } private  BlurredBackgroundAdapter(); }
BlurredBackgroundAdapter { public synchronized void resetBlurringListener(BlurringImageListener listener) { if (state == BlurredBackgroundAdapterState.WORKING) { blurringImageListener = listener; } else if (state == BlurredBackgroundAdapterState.READY && listener != null && blurredImage != null) { listener.onBlurringFinish(blurredImage); } else if (state != BlurredBackgroundAdapterState.RESETTED && listener != null) { Log.w(TAG, "Something was wrong. There isn't any ready blurred background" + " Thus I try to restore some from internal storage."); leaveCurrentBlurredImage(); blurredImage = imageUtils.createBitmapFromFile(internalFilesDirPath + FoggerConfig.BLURRED_SCREENSHOT_FILE_NAME); listener.onBlurringFinish(blurredImage); } } private  BlurredBackgroundAdapter(); static synchronized BlurredBackgroundAdapter getInstance(Application application); synchronized void prepareBlurredBackgroundForActivity(Activity activity); synchronized void prepareBlurredBackgroundForView(Context context, View viewToBlur); synchronized void reset(); synchronized void resetBlurringListener(BlurringImageListener listener); }
BlurredBackgroundAdapter { public synchronized void resetBlurringListener(BlurringImageListener listener) { if (state == BlurredBackgroundAdapterState.WORKING) { blurringImageListener = listener; } else if (state == BlurredBackgroundAdapterState.READY && listener != null && blurredImage != null) { listener.onBlurringFinish(blurredImage); } else if (state != BlurredBackgroundAdapterState.RESETTED && listener != null) { Log.w(TAG, "Something was wrong. There isn't any ready blurred background" + " Thus I try to restore some from internal storage."); leaveCurrentBlurredImage(); blurredImage = imageUtils.createBitmapFromFile(internalFilesDirPath + FoggerConfig.BLURRED_SCREENSHOT_FILE_NAME); listener.onBlurringFinish(blurredImage); } } private  BlurredBackgroundAdapter(); static synchronized BlurredBackgroundAdapter getInstance(Application application); synchronized void prepareBlurredBackgroundForActivity(Activity activity); synchronized void prepareBlurredBackgroundForView(Context context, View viewToBlur); synchronized void reset(); synchronized void resetBlurringListener(BlurringImageListener listener);  }