Split the 'people' emoji spritesheet into multiple chunks.
The aim of this is to help performance by breaking up the single massive spritesheet into smaller ones. This will limit the amount of data that needs to be kept in memory to render emoji. (Hopefully) Fixes #8357pull/1/head
							parent
							
								
									e7c00a3066
								
							
						
					
					
						commit
						28081abe1c
					
				
											
												Binary file not shown.
											
										
									
								| Before Width: | Height: | Size: 5.1 MiB | 
											
												Binary file not shown.
											
										
									
								| After Width: | Height: | Size: 1.6 MiB | 
											
												Binary file not shown.
											
										
									
								| After Width: | Height: | Size: 1.6 MiB | 
											
												Binary file not shown.
											
										
									
								| After Width: | Height: | Size: 1.2 MiB | 
											
												Binary file not shown.
											
										
									
								| After Width: | Height: | Size: 692 KiB | 
											
												Binary file not shown.
											
										
									
								| After Width: | Height: | Size: 1019 B | 
| @ -0,0 +1,59 @@ | |||||||
|  | package org.thoughtcrime.securesms.components.emoji; | ||||||
|  | 
 | ||||||
|  | import android.support.annotation.AttrRes; | ||||||
|  | import android.support.annotation.NonNull; | ||||||
|  | import android.support.annotation.Nullable; | ||||||
|  | 
 | ||||||
|  | import com.annimon.stream.Stream; | ||||||
|  | 
 | ||||||
|  | import java.util.ArrayList; | ||||||
|  | import java.util.Arrays; | ||||||
|  | import java.util.LinkedList; | ||||||
|  | import java.util.List; | ||||||
|  | 
 | ||||||
|  | public class CompositeEmojiPageModel implements EmojiPageModel { | ||||||
|  |   @AttrRes  private final int         iconAttr; | ||||||
|  |   @NonNull  private final EmojiPageModel[] models; | ||||||
|  | 
 | ||||||
|  |   public CompositeEmojiPageModel(@AttrRes int iconAttr, @NonNull EmojiPageModel... models) { | ||||||
|  |     this.iconAttr = iconAttr; | ||||||
|  |     this.models   = models; | ||||||
|  |   } | ||||||
|  | 
 | ||||||
|  |   public int getIconAttr() { | ||||||
|  |     return iconAttr; | ||||||
|  |   } | ||||||
|  | 
 | ||||||
|  |   @Override | ||||||
|  |   public @NonNull List<String> getEmoji() { | ||||||
|  |     List<String> emojis = new LinkedList<>(); | ||||||
|  |     for (EmojiPageModel model : models) { | ||||||
|  |       emojis.addAll(model.getEmoji()); | ||||||
|  |     } | ||||||
|  |     return emojis; | ||||||
|  |   } | ||||||
|  | 
 | ||||||
|  |   @Override | ||||||
|  |   public @NonNull List<Emoji> getDisplayEmoji() { | ||||||
|  |     List<Emoji> emojis = new LinkedList<>(); | ||||||
|  |     for (EmojiPageModel model : models) { | ||||||
|  |       emojis.addAll(model.getDisplayEmoji()); | ||||||
|  |     } | ||||||
|  |     return emojis; | ||||||
|  |   } | ||||||
|  | 
 | ||||||
|  |   @Override | ||||||
|  |   public boolean hasSpriteMap() { | ||||||
|  |     return false; | ||||||
|  |   } | ||||||
|  | 
 | ||||||
|  |   @Override | ||||||
|  |   public @Nullable String getSprite() { | ||||||
|  |     return null; | ||||||
|  |   } | ||||||
|  | 
 | ||||||
|  |   @Override | ||||||
|  |   public boolean isDynamic() { | ||||||
|  |     return false; | ||||||
|  |   } | ||||||
|  | } | ||||||
											
												
													File diff suppressed because one or more lines are too long
												
											
										
									
								
					Loading…
					
					
				
		Reference in New Issue