|  |  | @ -15,6 +15,7 @@ import org.thoughtcrime.securesms.database.Address | 
			
		
	
		
		
			
				
					
					|  |  |  | import org.thoughtcrime.securesms.loki.JazzIdenticonDrawable |  |  |  | import org.thoughtcrime.securesms.loki.JazzIdenticonDrawable | 
			
		
	
		
		
			
				
					
					|  |  |  | import org.thoughtcrime.securesms.mms.GlideRequests |  |  |  | import org.thoughtcrime.securesms.mms.GlideRequests | 
			
		
	
		
		
			
				
					
					|  |  |  | import org.thoughtcrime.securesms.recipients.Recipient |  |  |  | import org.thoughtcrime.securesms.recipients.Recipient | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | import org.thoughtcrime.securesms.util.TextSecurePreferences | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  | // TODO: Look into a better way of handling different sizes. Maybe an enum (with associated values) encapsulating the different modes? |  |  |  | // TODO: Look into a better way of handling different sizes. Maybe an enum (with associated values) encapsulating the different modes? | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
	
		
		
			
				
					|  |  | @ -60,12 +61,15 @@ class ProfilePictureView : RelativeLayout { | 
			
		
	
		
		
			
				
					
					|  |  |  |         fun setProfilePictureIfNeeded(imageView: ImageView, hexEncodedPublicKey: String, @DimenRes sizeID: Int) { |  |  |  |         fun setProfilePictureIfNeeded(imageView: ImageView, hexEncodedPublicKey: String, @DimenRes sizeID: Int) { | 
			
		
	
		
		
			
				
					
					|  |  |  |             glide.clear(imageView) |  |  |  |             glide.clear(imageView) | 
			
		
	
		
		
			
				
					
					|  |  |  |             if (hexEncodedPublicKey.isNotEmpty()) { |  |  |  |             if (hexEncodedPublicKey.isNotEmpty()) { | 
			
		
	
		
		
			
				
					
					|  |  |  |                 val signalProfilePicture = Recipient.from(context, Address.fromSerialized(hexEncodedPublicKey), false).contactPhoto |  |  |  |                 val recipient = Recipient.from(context, Address.fromSerialized(hexEncodedPublicKey), false); | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                 val signalProfilePicture = recipient.contactPhoto | 
			
		
	
		
		
			
				
					
					|  |  |  |                 if (signalProfilePicture != null && (signalProfilePicture as? ProfileContactPhoto)?.avatarObject != "0" && (signalProfilePicture as? ProfileContactPhoto)?.avatarObject != "") { |  |  |  |                 if (signalProfilePicture != null && (signalProfilePicture as? ProfileContactPhoto)?.avatarObject != "0" && (signalProfilePicture as? ProfileContactPhoto)?.avatarObject != "") { | 
			
		
	
		
		
			
				
					
					|  |  |  |                     glide.load(signalProfilePicture).diskCacheStrategy(DiskCacheStrategy.ALL).circleCrop().into(imageView) |  |  |  |                     glide.load(signalProfilePicture).diskCacheStrategy(DiskCacheStrategy.ALL).circleCrop().into(imageView) | 
			
		
	
		
		
			
				
					
					|  |  |  |                 } else { |  |  |  |                 } else { | 
			
		
	
		
		
			
				
					
					|  |  |  |                     val size = resources.getDimensionPixelSize(sizeID) |  |  |  |                     val size = resources.getDimensionPixelSize(sizeID) | 
			
		
	
		
		
			
				
					
					|  |  |  |                     val jazzIcon = JazzIdenticonDrawable(size, size, hexEncodedPublicKey) |  |  |  |                     val primaryAddress = TextSecurePreferences.getMasterHexEncodedPublicKey(context) | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                     val profileAddress = if (recipient.isLocalNumber && primaryAddress != null) primaryAddress else hexEncodedPublicKey | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                     val jazzIcon = JazzIdenticonDrawable(size, size, profileAddress) | 
			
		
	
		
		
			
				
					
					|  |  |  |                     glide.load(jazzIcon).diskCacheStrategy(DiskCacheStrategy.ALL).circleCrop().into(imageView) |  |  |  |                     glide.load(jazzIcon).diskCacheStrategy(DiskCacheStrategy.ALL).circleCrop().into(imageView) | 
			
		
	
		
		
			
				
					
					|  |  |  |                 } |  |  |  |                 } | 
			
		
	
		
		
			
				
					
					|  |  |  |             } else { |  |  |  |             } else { | 
			
		
	
	
		
		
			
				
					|  |  | 
 |