@Test public void nullBitmapOptionsIfNoResizingOrPurgeable() { final Request noResize = new Request.Builder(URI_1).build(); final BitmapFactory.Options noResizeOptions = createBitmapOptions(noResize); assertThat(noResizeOptions).isNull(); }
static BitmapFactory.Options createBitmapOptions(Request data) { final boolean justBounds = data.hasSize(); final boolean hasConfig = data.config != null; BitmapFactory.Options options = null; if (justBounds || hasConfig || data.purgeable) { options = new BitmapFactory.Options(); options.inJustDecodeBounds = justBounds; options.inInputShareable = data.purgeable; options.inPurgeable = data.purgeable; if (hasConfig) { options.inPreferredConfig = data.config; } } return options; }
RequestHandler { static BitmapFactory.Options createBitmapOptions(Request data) { final boolean justBounds = data.hasSize(); final boolean hasConfig = data.config != null; BitmapFactory.Options options = null; if (justBounds || hasConfig || data.purgeable) { options = new BitmapFactory.Options(); options.inJustDecodeBounds = justBounds; options.inInputShareable = data.purgeable; options.inPurgeable = data.purgeable; if (hasConfig) { options.inPreferredConfig = data.config; } } return options; } }
RequestHandler { static BitmapFactory.Options createBitmapOptions(Request data) { final boolean justBounds = data.hasSize(); final boolean hasConfig = data.config != null; BitmapFactory.Options options = null; if (justBounds || hasConfig || data.purgeable) { options = new BitmapFactory.Options(); options.inJustDecodeBounds = justBounds; options.inInputShareable = data.purgeable; options.inPurgeable = data.purgeable; if (hasConfig) { options.inPreferredConfig = data.config; } } return options; }  }
RequestHandler { static BitmapFactory.Options createBitmapOptions(Request data) { final boolean justBounds = data.hasSize(); final boolean hasConfig = data.config != null; BitmapFactory.Options options = null; if (justBounds || hasConfig || data.purgeable) { options = new BitmapFactory.Options(); options.inJustDecodeBounds = justBounds; options.inInputShareable = data.purgeable; options.inPurgeable = data.purgeable; if (hasConfig) { options.inPreferredConfig = data.config; } } return options; }  abstract boolean canHandleRequest(Request data); @Nullable abstract Result load(Request request, int networkPolicy); }
RequestHandler { static BitmapFactory.Options createBitmapOptions(Request data) { final boolean justBounds = data.hasSize(); final boolean hasConfig = data.config != null; BitmapFactory.Options options = null; if (justBounds || hasConfig || data.purgeable) { options = new BitmapFactory.Options(); options.inJustDecodeBounds = justBounds; options.inInputShareable = data.purgeable; options.inPurgeable = data.purgeable; if (hasConfig) { options.inPreferredConfig = data.config; } } return options; }  abstract boolean canHandleRequest(Request data); @Nullable abstract Result load(Request request, int networkPolicy);  }