gt:                 thumbKey += "@" + thumbFilter;
context: /*
   * This is the source code of Telegram for Android v. 1.3.x.
   * It is licensed under GNU GPL v. 2 or later.
   * You should have received a copy of the license in this archive (see LICENSE).
   *
   * Copyright Nikolai Kudashov, 2013-2016.
   */
  
  package org.telegram.messenger;
  import org.decisiongram.R;
  
  import android.graphics.Bitmap;
  import android.graphics.BitmapShader;
  import android.graphics.Canvas;
  import android.graphics.ColorFilter;
  import android.graphics.Matrix;
  import android.graphics.Paint;
  import android.graphics.PorterDuff;
  import android.graphics.PorterDuffColorFilter;
  import android.graphics.Rect;
  import android.graphics.RectF;
  import android.graphics.Shader;
  import android.graphics.drawable.BitmapDrawable;
  import android.graphics.drawable.Drawable;
  import android.view.View;
  
  import org.telegram.tgnet.TLObject;
  import org.telegram.tgnet.TLRPC;
  import org.telegram.ui.Components.AnimatedFileDrawable;
  
  public class ImageReceiver implements NotificationCenter.NotificationCenterDelegate {
  
      public interface ImageReceiverDelegate {
          void didSetImage(ImageReceiver imageReceiver, boolean set, boolean thumb);
      }
  
      private class SetImageBackup {
          public TLObject fileLocation;
          public String httpUrl;
          public String filter;
          public Drawable thumb;
          public TLRPC.FileLocation thumbLocation;
          public String thumbFilter;
          public int size;
          public boolean cacheOnly;
          public String ext;
      }
  
      private View parentView;
      private Integer tag;
      private Integer thumbTag;
      private MessageObject parentMessageObject;
      private boolean canceledLoading;
  
      private SetImageBackup setImageBackup;
  
      private TLObject currentImageLocation;
      private String currentKey;
      private String currentThumbKey;
      private String currentHttpUrl;
      private String currentFilter;
      private String currentThumbFilter;
      private String currentExt;
      private TLRPC.FileLocation currentThumbLocation;
      private int currentSize;
      private boolean currentCacheOnly;
      private Drawable currentImage;
      private Drawable currentThumb;
      private Drawable staticThumb;
      private boolean allowStartAnimation = true;
  
      private boolean needsQualityThumb;
      private boolean shouldGenerateQualityThumb;
      private boolean invalidateAll;
  
      private int imageX, imageY, imageW, imageH;
      private Rect drawRegion = new Rect();
      private boolean isVisible = true;
      private boolean isAspectFit;
      private boolean forcePreview;
      private int roundRadius;
      private BitmapShader bitmapShader;
      private Paint roundPaint;
      private RectF roundRect;
      private RectF bitmapRect;
      private Matrix shaderMatrix;
      private float overrideAlpha = 1.0f;
      private boolean isPressed;
      private int orientation;
      private boolean centerRotation;
      private ImageReceiverDelegate delegate;
      private float currentAlpha;
      private long lastUpdateAlphaTime;
      private byte crossfadeAlpha = 1;
      private boolean crossfadeWithThumb;
      private ColorFilter colorFilter;
  
      public ImageReceiver() {
  
      }
  
      public ImageReceiver(View view) {
          parentView = view;
      }
  
      public void cancelLoadImage() {
          ImageLoader.getInstance().cancelLoadingForImageReceiver(this, 0);
          canceledLoading = true;
      }
  
      public void setImage(TLObject path, String filter, Drawable thumb, String ext, boolean cacheOnly) {
          setImage(path, null, filter, thumb, null, null, 0, ext, cacheOnly);
      }
  
      public void setImage(TLObject path, String filter, Drawable thumb, int size, String ext, boolean cacheOnly) {
          setImage(path, null, filter, thumb, null, null, size, ext, cacheOnly);
      }
  
      public void setImage(String httpUrl, String filter, Drawable thumb, String ext, int size) {
          setImage(null, httpUrl, filter, thumb, null, null, size, ext, true);
      }
  
      public void setImage(TLObject fileLocation, String filter, TLRPC.FileLocation thumbLocation, String thumbFilter, String ext, boolean cacheOnly) {
          setImage(fileLocation, null, filter, null, thumbLocation, thumbFilter, 0, ext, cacheOnly);
      }
  
      public void setImage(TLObject fileLocation, String filter, TLRPC.FileLocation thumbLocation, String thumbFilter, int size, String ext, boolean cacheOnly) {
          setImage(fileLocation, null, filter, null, thumbLocation, thumbFilter, size, ext, cacheOnly);
      }
  
      public void setImage(TLObject fileLocation, String httpUrl, String filter, Drawable thumb, TLRPC.FileLocation thumbLocation, String thumbFilter, int size, String ext, boolean cacheOnly) {
          if (setImageBackup != null) {
              setImageBackup.fileLocation = null;
              setImageBackup.httpUrl = null;
              setImageBackup.thumbLocation = null;
              setImageBackup.thumb = null;
          }
  
          if ((fileLocation == null && httpUrl == null && thumbLocation == null)
                  || (fileLocation != null && !(fileLocation instanceof TLRPC.TL_fileLocation)
                  && !(fileLocation instanceof TLRPC.TL_fileEncryptedLocation)
                  && !(fileLocation instanceof TLRPC.TL_document)
                  && !(fileLocation instanceof TLRPC.TL_documentEncrypted))) {
              recycleBitmap(null, false);
              recycleBitmap(null, true);
              currentKey = null;
              currentExt = ext;
              currentThumbKey = null;
              currentThumbFilter = null;
              currentImageLocation = null;
              currentHttpUrl = null;
              currentFilter = null;
              currentCacheOnly = false;
              staticThumb = thumb;
              currentAlpha = 1;
              currentThumbLocation = null;
              currentSize = 0;
              currentImage = null;
              bitmapShader = null;
              ImageLoader.getInstance().cancelLoadingForImageReceiver(this, 0);
              if (parentView != null) {
                  if (invalidateAll) {
                      parentView.invalidate();
                  } else {
                      parentView.invalidate(imageX, imageY, imageX + imageW, imageY + imageH);
                  }
              }
              if (delegate != null) {
                  delegate.didSetImage(this, currentImage != null || currentThumb != null || staticThumb != null, currentImage == null);
              }
              return;
          }
  
          if (!(thumbLocation instanceof TLRPC.TL_fileLocation)) {
              thumbLocation = null;
          }
  
          String key = null;
          if (fileLocation != null) {
              if (fileLocation instanceof TLRPC.FileLocation) {
                  TLRPC.FileLocation location = (TLRPC.FileLocation) fileLocation;
                  key = location.volume_id + "_" + location.local_id;
              } else {
                  TLRPC.Document location = (TLRPC.Document) fileLocation;
                  if (location.dc_id != 0) {
                      key = location.dc_id + "_" + location.id;
                  } else {
                      fileLocation = null;
                  }
              }
          } else if (httpUrl != null) {
              key = Utilities.MD5(httpUrl);
          }
          if (key != null) {
              if (filter != null) {
                  key += "@" + filter;
              }
          }
  
          if (currentKey != null && key != null && currentKey.equals(key)) {
              if (delegate != null) {
                  delegate.didSetImage(this, currentImage != null || currentThumb != null || staticThumb != null, currentImage == null);
              }
              if (!canceledLoading && !forcePreview) {
                  return;
              }
          }
  
          String thumbKey = null;
          if (thumbLocation != null) {
              thumbKey = thumbLocation.volume_id + "_" + thumbLocation.local_id;
              if (thumbFilter != null) {
  