From 8c425c44e527760c1f8d596e1cd8627f5bb70ad5 Mon Sep 17 00:00:00 2001 From: Conny Duck Date: Mon, 25 Jun 2018 16:23:43 +0200 Subject: [PATCH] fix the emoji selection dialog --- .../keylesspalace/tusky/EmojiPreference.java | 3 +- .../tusky/util/EmojiCompatFont.java | 22 +--- .../main/res/drawable-night/ic_emoji_34dp.xml | 9 ++ app/src/main/res/drawable/ic_blobmoji.xml | 4 +- app/src/main/res/drawable/ic_emoji_34dp.xml | 9 ++ app/src/main/res/drawable/ic_twemoji.xml | 4 +- app/src/main/res/layout/activity_license.xml | 1 + .../main/res/layout/dialog_emojicompat.xml | 22 ++-- app/src/main/res/layout/item_emoji_pref.xml | 109 +++++++++--------- app/src/main/res/values-de/strings.xml | 2 +- app/src/main/res/values/strings.xml | 2 +- 11 files changed, 97 insertions(+), 90 deletions(-) create mode 100644 app/src/main/res/drawable-night/ic_emoji_34dp.xml create mode 100644 app/src/main/res/drawable/ic_emoji_34dp.xml diff --git a/app/src/main/java/com/keylesspalace/tusky/EmojiPreference.java b/app/src/main/java/com/keylesspalace/tusky/EmojiPreference.java index 0a682ec6..fb1943da 100644 --- a/app/src/main/java/com/keylesspalace/tusky/EmojiPreference.java +++ b/app/src/main/java/com/keylesspalace/tusky/EmojiPreference.java @@ -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( diff --git a/app/src/main/java/com/keylesspalace/tusky/util/EmojiCompatFont.java b/app/src/main/java/com/keylesspalace/tusky/util/EmojiCompatFont.java index f00f787e..0f2e8db4 100644 --- a/app/src/main/java/com/keylesspalace/tusky/util/EmojiCompatFont.java +++ b/app/src/main/java/com/keylesspalace/tusky/util/EmojiCompatFont.java @@ -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); } diff --git a/app/src/main/res/drawable-night/ic_emoji_34dp.xml b/app/src/main/res/drawable-night/ic_emoji_34dp.xml new file mode 100644 index 00000000..cf11e0a9 --- /dev/null +++ b/app/src/main/res/drawable-night/ic_emoji_34dp.xml @@ -0,0 +1,9 @@ + + + \ No newline at end of file diff --git a/app/src/main/res/drawable/ic_blobmoji.xml b/app/src/main/res/drawable/ic_blobmoji.xml index 2d475710..be3332ce 100644 --- a/app/src/main/res/drawable/ic_blobmoji.xml +++ b/app/src/main/res/drawable/ic_blobmoji.xml @@ -1,5 +1,5 @@ - + + + \ No newline at end of file diff --git a/app/src/main/res/drawable/ic_twemoji.xml b/app/src/main/res/drawable/ic_twemoji.xml index 0888d26f..70c4b513 100644 --- a/app/src/main/res/drawable/ic_twemoji.xml +++ b/app/src/main/res/drawable/ic_twemoji.xml @@ -1,5 +1,5 @@ - + diff --git a/app/src/main/res/layout/activity_license.xml b/app/src/main/res/layout/activity_license.xml index 964348c5..2ebdfcbc 100644 --- a/app/src/main/res/layout/activity_license.xml +++ b/app/src/main/res/layout/activity_license.xml @@ -158,6 +158,7 @@ android:layout_marginStart="12dp" android:layout_marginTop="12dp" license:license="@string/license_cc_by_4" + license:link="https://github.com/c1710/blobmoji" license:name="Blobmoji" /> + android:paddingTop="16dp"> + + layout="@layout/item_emoji_pref" /> + - + android:textColor="?android:attr/textColorSecondary" + app:layout_constraintTop_toBottomOf="@+id/emoji_font_list" /> \ No newline at end of file diff --git a/app/src/main/res/layout/item_emoji_pref.xml b/app/src/main/res/layout/item_emoji_pref.xml index 2b33d94d..8c4bbd28 100644 --- a/app/src/main/res/layout/item_emoji_pref.xml +++ b/app/src/main/res/layout/item_emoji_pref.xml @@ -1,54 +1,56 @@ - + android:paddingBottom="8dp" + android:paddingTop="8dp"> + app:srcCompat="@drawable/ic_emoji_24dp" /> + app:layout_constraintBottom_toTopOf="@+id/emojicompat_caption" + app:layout_constraintStart_toEndOf="@+id/emojicompat_thumb" + app:layout_constraintTop_toTopOf="parent" + tools:text="@string/system_default" /> + android:textSize="12sp" + app:layout_constraintBottom_toBottomOf="parent" + app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintHorizontal_bias="0" + app:layout_constraintStart_toStartOf="@id/emojicompat_name" + app:layout_constraintTop_toBottomOf="@id/emojicompat_name" + app:layout_constraintVertical_chainStyle="packed" + tools:text="@string/caption_blobmoji" /> + app:layout_constraintTop_toBottomOf="@id/emojicompat_name" /> + app:srcCompat="@drawable/ic_file_download_black_24dp" /> - + app:srcCompat="@drawable/ic_cancel_black_24dp" /> - - - - + app:layout_constraintTop_toTopOf="parent" /> - \ No newline at end of file + \ No newline at end of file diff --git a/app/src/main/res/values-de/strings.xml b/app/src/main/res/values-de/strings.xml index 09938ad6..89d4bef8 100644 --- a/app/src/main/res/values-de/strings.xml +++ b/app/src/main/res/values-de/strings.xml @@ -280,7 +280,7 @@ Später Neustarten Die Standard-Emojis deines Geräts - Ein Emoji–Set, das auf den "Blob"–Emojis aus Android 4.4–7.1 basiert + Die Blob–Emojis aus Android 4.4–7.1 Die Standard-Emojis von Mastodon Download fehlgeschlagen. diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 2ee388bf..e0694fc4 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -325,7 +325,7 @@ Later Restart Your device\'s default emoji set - An emoji set based on the Blob emojis known from Android 4.4–7.1 + The Blob emojis known from Android 4.4–7.1 Mastodon\'s standard emoji set Download failed