@Test public void testResultKeyWithModifiers() throws Exception { MirageRequest request = new MirageRequest(); request.uri(Uri.parse("http: request.provider(new UriProvider(request)); request.addProcessor(new BitmapProcessor() { @Override public String getId() { return "eeek"; } @Override public Bitmap process(Bitmap in) { return null; } }); request.addProcessor(new BitmapProcessor() { @Override public String getId() { return "rrrrr"; } @Override public Bitmap process(Bitmap in) { return null; } }); SimpleKeyMaker keyMaker = new SimpleKeyMaker(); Assert.assertEquals("d53c8b77", keyMaker.getResultKey(request)); }
@Override public String getResultKey(MirageRequest request) { StringBuilder b = new StringBuilder(); b.append(request.provider().id().hashCode()); if (request.isInSampleSizeDynamic()) { b.append("_size"); b.append(request.getResizeTargetDimen()); b.append("-under"); b.append(request.isResizeSampleUndershoot()); } else if (request.options() != null) { b.append("_"); b.append(request.options().inSampleSize); } List<BitmapProcessor> processors = request.getProcessors(); if (processors != null) { for (int i=0; i<processors.size(); i++) { b.append("_"); b.append(processors.get(i).getId()); } } return Integer.toHexString(b.toString().hashCode()); }
SimpleKeyMaker implements KeyMaker { @Override public String getResultKey(MirageRequest request) { StringBuilder b = new StringBuilder(); b.append(request.provider().id().hashCode()); if (request.isInSampleSizeDynamic()) { b.append("_size"); b.append(request.getResizeTargetDimen()); b.append("-under"); b.append(request.isResizeSampleUndershoot()); } else if (request.options() != null) { b.append("_"); b.append(request.options().inSampleSize); } List<BitmapProcessor> processors = request.getProcessors(); if (processors != null) { for (int i=0; i<processors.size(); i++) { b.append("_"); b.append(processors.get(i).getId()); } } return Integer.toHexString(b.toString().hashCode()); } }
SimpleKeyMaker implements KeyMaker { @Override public String getResultKey(MirageRequest request) { StringBuilder b = new StringBuilder(); b.append(request.provider().id().hashCode()); if (request.isInSampleSizeDynamic()) { b.append("_size"); b.append(request.getResizeTargetDimen()); b.append("-under"); b.append(request.isResizeSampleUndershoot()); } else if (request.options() != null) { b.append("_"); b.append(request.options().inSampleSize); } List<BitmapProcessor> processors = request.getProcessors(); if (processors != null) { for (int i=0; i<processors.size(); i++) { b.append("_"); b.append(processors.get(i).getId()); } } return Integer.toHexString(b.toString().hashCode()); }  }
SimpleKeyMaker implements KeyMaker { @Override public String getResultKey(MirageRequest request) { StringBuilder b = new StringBuilder(); b.append(request.provider().id().hashCode()); if (request.isInSampleSizeDynamic()) { b.append("_size"); b.append(request.getResizeTargetDimen()); b.append("-under"); b.append(request.isResizeSampleUndershoot()); } else if (request.options() != null) { b.append("_"); b.append(request.options().inSampleSize); } List<BitmapProcessor> processors = request.getProcessors(); if (processors != null) { for (int i=0; i<processors.size(); i++) { b.append("_"); b.append(processors.get(i).getId()); } } return Integer.toHexString(b.toString().hashCode()); }  @Override String getSourceKey(MirageRequest request); @Override String getResultKey(MirageRequest request); }
SimpleKeyMaker implements KeyMaker { @Override public String getResultKey(MirageRequest request) { StringBuilder b = new StringBuilder(); b.append(request.provider().id().hashCode()); if (request.isInSampleSizeDynamic()) { b.append("_size"); b.append(request.getResizeTargetDimen()); b.append("-under"); b.append(request.isResizeSampleUndershoot()); } else if (request.options() != null) { b.append("_"); b.append(request.options().inSampleSize); } List<BitmapProcessor> processors = request.getProcessors(); if (processors != null) { for (int i=0; i<processors.size(); i++) { b.append("_"); b.append(processors.get(i).getId()); } } return Integer.toHexString(b.toString().hashCode()); }  @Override String getSourceKey(MirageRequest request); @Override String getResultKey(MirageRequest request);  }