fix the emoji selection dialog

This commit is contained in:
Conny Duck 2018-06-25 16:23:43 +02:00
commit 970551adee
11 changed files with 100 additions and 93 deletions

View file

@ -117,7 +117,7 @@ public class EmojiPreference extends DialogPreference {
// Switch to downloading style
download.setVisibility(View.GONE);
caption.setVisibility(View.GONE);
caption.setVisibility(View.INVISIBLE);
progressBar.setVisibility(View.VISIBLE);
cancel.setVisibility(View.VISIBLE);
@ -248,7 +248,6 @@ public class EmojiPreference extends DialogPreference {
.setNegativeButton(R.string.later, null)
.setPositiveButton(R.string.restart, ((dialog, which) -> {
// Restart the app
// TODO: I'm not sure if this is a good solution but it seems to work
// From https://stackoverflow.com/a/17166729/5070653
Intent launchIntent = new Intent(context, MainActivity.class);
PendingIntent mPendingIntent = PendingIntent.getActivity(

View file

@ -32,33 +32,30 @@ public class EmojiCompatFont {
private static final String DIRECTORY = "emoji";
// These are the items which are also present in the JSON files
private final String name, display, url, src;
private final String name, display, url;
// The thumbnail image and the caption are provided as resource ids
private final int img, caption;
private AsyncTask fontDownloader;
// The system font gets some special behavior...
public static final EmojiCompatFont SYSTEM_DEFAULT =
private static final EmojiCompatFont SYSTEM_DEFAULT =
new EmojiCompatFont("system-default",
"System Default",
R.string.caption_systememoji,
R.drawable.ic_emoji_24dp,
"",
R.drawable.ic_emoji_34dp,
"");
private static final EmojiCompatFont BLOBMOJI =
new EmojiCompatFont("Blobmoji",
"Blobmoji",
R.string.caption_blobmoji,
R.drawable.ic_blobmoji,
"https://tuskyapp.github.io/hosted/emoji/BlobmojiCompat.ttf",
"https://github.com/c1710/blobmoji"
"https://tuskyapp.github.io/hosted/emoji/BlobmojiCompat.ttf"
);
private static final EmojiCompatFont TWEMOJI =
new EmojiCompatFont("Twemoji",
"Twemoji",
R.string.caption_twemoji,
R.drawable.ic_twemoji,
"https://tuskyapp.github.io/hosted/emoji/TwemojiCompat.ttf",
"https://github.com/twitter/twemoji"
"https://tuskyapp.github.io/hosted/emoji/TwemojiCompat.ttf"
);
/**
@ -67,19 +64,16 @@ public class EmojiCompatFont {
*/
public static final EmojiCompatFont[] FONTS = {SYSTEM_DEFAULT, BLOBMOJI, TWEMOJI};
private EmojiCompatFont(String name,
String display,
int caption,
int img,
String url,
String src) {
String url) {
this.name = name;
this.display = display;
this.caption = caption;
this.img = img;
this.url = url;
this.src = src;
}
/**
@ -117,10 +111,6 @@ public class EmojiCompatFont {
return url;
}
public String getSrc() {
return src;
}
public Drawable getThumb(Context context) {
return context.getResources().getDrawable(img);
}