(Context ctx, String code, int channelId)
| 78 | } |
| 79 | |
| 80 | public static Emote getEmote(Context ctx, String code, int channelId) { |
| 81 | boolean bttvEnabled = ResUtil.getBooleanFromSettings(Settings.BTTVEmotesEnabled); |
| 82 | boolean gifEnabled = !ResUtil.selectedDropdownFromSettingsIs(Settings.GifRenderMode, Res.strings.bttv_settings_gif_render_mode_disabled); |
| 83 | boolean ffzEnabled = ResUtil.getBooleanFromSettings(Settings.FFZEmotesEnabled); |
| 84 | boolean stvEnabled = ResUtil.getBooleanFromSettings(Settings.SevenTVEmotesEnabled); |
| 85 | |
| 86 | ArrayList<Map<String, Emote>> globals = new ArrayList<>(Arrays.asList(globalEmotesFFZ, globalEmotesBTTV, globalEmotes7TV)); |
| 87 | ArrayList<Map<Integer, Set<String>>> channels = new ArrayList<>(Arrays.asList(channelEmotesFFZ, channelEmotesBTTV, channelEmotes7TV)); |
| 88 | ArrayList<Boolean> enabled = new ArrayList<>(Arrays.asList(ffzEnabled, bttvEnabled, stvEnabled)); |
| 89 | |
| 90 | for (int i = 0; i < globals.size(); i++) { |
| 91 | boolean isEnabled = enabled.get(i); |
| 92 | if (!isEnabled) { |
| 93 | continue; |
| 94 | } |
| 95 | |
| 96 | Map<String, Emote> global = globals.get(i); |
| 97 | |
| 98 | Emote emote = global.get(code); |
| 99 | if (emote != null && (!emote.imageType.equals("gif") || gifEnabled)) { |
| 100 | return emote; |
| 101 | } |
| 102 | |
| 103 | Map<Integer, Set<String>> channel = channels.get(i); |
| 104 | Set<String> set = channel.get(channelId); |
| 105 | if (set != null && set.contains(code)) { |
| 106 | Map<Integer, Emote > channelEmoteMap = codeEmoteMap.get(code); |
| 107 | if (channelEmoteMap != null) { |
| 108 | emote = channelEmoteMap.get(channelId); |
| 109 | if (emote != null && (!emote.imageType.equals("gif") || gifEnabled)) { |
| 110 | return emote; |
| 111 | } |
| 112 | } |
| 113 | } |
| 114 | } |
| 115 | |
| 116 | return null; |
| 117 | } |
| 118 | |
| 119 | public static Emote getEmote(int channelId, String code) { |
| 120 | Map<Integer, Emote> channelEmoteMap = codeEmoteMap.get(code); |
no test coverage detected