-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
182 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
package bttv; | ||
|
||
import java.util.ArrayList; | ||
import java.util.List; | ||
|
||
import bttv.emote.Emote; | ||
import bttv.emote.Emotes; | ||
import tv.twitch.android.shared.emotes.models.EmoteSet; | ||
import tv.twitch.android.shared.emotes.models.EmoteModelAssetType; | ||
import tv.twitch.android.shared.emotes.models.EmotePickerEmoteModel; | ||
|
||
public class Autocomplete { | ||
|
||
public static void addOurEmotes(List<EmoteSet> list) { | ||
for (EmoteSet set : list) { | ||
if (set.getSetId().equals("bttv_emote_set_id")) { | ||
return; | ||
} | ||
} | ||
int channelId = Data.currentBroadcasterId; | ||
if (list.isEmpty()) { | ||
return; | ||
} | ||
ArrayList<String> codes = Emotes.getAllEmotes(channelId); | ||
List<EmotePickerEmoteModel.Generic> generics = new ArrayList<>(codes.size()); | ||
|
||
for (String code : codes) { | ||
Emote e = Emotes.getEmote(channelId, code); | ||
if (e == null) | ||
continue; // should not happen | ||
generics.add(new EmotePickerEmoteModel.Generic("BTTV-" + e.id, e.code, EmoteModelAssetType.STATIC)); | ||
} | ||
EmoteSet set = new EmoteSet.GenericEmoteSet("bttv_emote_set_id", generics); | ||
list.add(set); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
package bttv.api; | ||
|
||
import android.util.Log; | ||
|
||
import java.util.List; | ||
|
||
import tv.twitch.android.shared.emotes.models.EmoteSet; | ||
|
||
public class Autocomplete { | ||
final static String TAG = "LBTTVAutocomplete"; | ||
|
||
public static void addOurEmotes(List<EmoteSet> list) { | ||
try { | ||
bttv.Autocomplete.addOurEmotes(list); | ||
} catch (Throwable e) { | ||
Log.e(TAG, "addOurEmotes: failed", e); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
26 changes: 26 additions & 0 deletions
26
mod/twitch/src/main/java/tv/twitch/android/shared/emotes/models/EmoteSet.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
package tv.twitch.android.shared.emotes.models; | ||
|
||
import java.util.List; | ||
|
||
public abstract class EmoteSet { | ||
public abstract List<EmotePickerEmoteModel> getEmotes(); | ||
public abstract java.lang.String getSetId(); | ||
|
||
|
||
public static final class GenericEmoteSet extends EmoteSet { | ||
|
||
public GenericEmoteSet(String str, List<EmotePickerEmoteModel.Generic> list) { | ||
throw new IllegalStateException("EmoteSet.GenericEmoteSet constructor called"); | ||
} | ||
|
||
@Override | ||
public List<EmotePickerEmoteModel> getEmotes() { | ||
throw new IllegalStateException("EmoteSet.GenericEmoteSet getEmotes() called"); | ||
} | ||
|
||
@Override | ||
public String getSetId() { | ||
throw new IllegalStateException("EmoteSet.GenericEmoteSet getSetId() called"); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters