~captainepoch/husky-devel

This thread contains a patchset. You're looking at the original emails, but you may wish to use the patch review UI. Review patch
3 3

[PATCH husky 1/2] entity/Emoji: match MastoAPI docs on custom emoji reacts

Details
Message ID
<20220609134505.8864-1-helene@helene.moe>
DKIM signature
pass
Download raw message
Patch: +2 -0
From: Hélène <pleroma-dev@helene.moe>

Signed-off-by: Hélène <pleroma-dev@helene.moe>
---
 husky/app/src/main/java/com/keylesspalace/tusky/entity/Emoji.kt | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/husky/app/src/main/java/com/keylesspalace/tusky/entity/Emoji.kt b/husky/app/src/main/java/com/keylesspalace/tusky/entity/Emoji.kt
index 029b392..23472d4 100644
--- a/husky/app/src/main/java/com/keylesspalace/tusky/entity/Emoji.kt
+++ b/husky/app/src/main/java/com/keylesspalace/tusky/entity/Emoji.kt
@@ -32,5 +32,7 @@ data class EmojiReaction(
        val name: String,
        val count: Int,
        val me: Boolean,
        val url: String?,
        @SerializedName("static_url") val staticUrl: String,
        val accounts: List<Account>? // only for emoji_reactions_by
)
-- 
2.36.1

[PATCH husky 2/2] EmojiReactionsAdapter: implement custom emoji reactions on messages

Details
Message ID
<20220609134505.8864-2-helene@helene.moe>
In-Reply-To
<20220609134505.8864-1-helene@helene.moe> (view parent)
DKIM signature
pass
Download raw message
Patch: +38 -7
From: Hélène <pleroma-dev@helene.moe>

Signed-off-by: Hélène <pleroma-dev@helene.moe>
---
 .../tusky/adapter/EmojiReactionsAdapter.java  | 41 ++++++++++++++++---
 .../tusky/util/CustomEmojiHelper.kt           |  4 +-
 2 files changed, 38 insertions(+), 7 deletions(-)

diff --git a/husky/app/src/main/java/com/keylesspalace/tusky/adapter/EmojiReactionsAdapter.java b/husky/app/src/main/java/com/keylesspalace/tusky/adapter/EmojiReactionsAdapter.java
index c8491ad..81e884c 100644
--- a/husky/app/src/main/java/com/keylesspalace/tusky/adapter/EmojiReactionsAdapter.java
+++ b/husky/app/src/main/java/com/keylesspalace/tusky/adapter/EmojiReactionsAdapter.java
@@ -4,11 +4,14 @@ import android.content.ClipData;
import android.content.ClipboardManager;
import android.content.Context;
import android.graphics.drawable.Drawable;
import android.text.SpannableStringBuilder;
import android.text.Spanned;
import android.text.method.LinkMovementMethod;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
import android.widget.TextView.BufferType;
import android.widget.Toast;
import android.util.Log;

@@ -16,15 +19,22 @@ import androidx.annotation.Nullable;
import androidx.emoji.widget.EmojiAppCompatButton;
import androidx.recyclerview.widget.RecyclerView;

import com.bumptech.glide.Glide;
import com.bumptech.glide.load.engine.DiskCacheStrategy;
import com.github.penfeizhou.animation.glide.AnimationDecoderOption;
import com.keylesspalace.tusky.R;
import com.keylesspalace.tusky.entity.Status;
import com.keylesspalace.tusky.entity.EmojiReaction;
import com.keylesspalace.tusky.interfaces.StatusActionListener;
import com.keylesspalace.tusky.util.CardViewMode;
import com.keylesspalace.tusky.util.CustomEmojiHelper;
import com.keylesspalace.tusky.util.LinkHelper;
import com.keylesspalace.tusky.util.MIME;
import com.keylesspalace.tusky.util.StatusDisplayOptions;
import com.keylesspalace.tusky.util.SmallEmojiSpan;
import com.keylesspalace.tusky.viewdata.StatusViewData;

import java.lang.ref.WeakReference;
import java.text.DateFormat;
import java.util.List;
import java.util.Date;
@@ -51,12 +61,33 @@ public class EmojiReactionsAdapter extends RecyclerView.Adapter<SingleViewHolder
    @Override
    public void onBindViewHolder(SingleViewHolder holder, int position) {
        EmojiReaction reaction = reactions.get(position);
        String str = reaction.getName() + " " + reaction.getCount();
        
        // no custom emoji yet!
        SpannableStringBuilder builder = new SpannableStringBuilder(
                reaction.getName() + " " + reaction.getCount());

        EmojiAppCompatButton btn = (EmojiAppCompatButton)holder.itemView;
        
        btn.setText(str);

        var url = reaction.getUrl();
        if (url != null) {
            var animate = true;
            var span = new SmallEmojiSpan(new WeakReference<View>(btn));

            builder.setSpan(span, 0, reaction.getName().length(),
                    Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);

            var glideRequest = Glide.with(btn).load(url)
                    .set(AnimationDecoderOption.DISABLE_ANIMATION_GIF_DECODER, !animate)
                    .set(AnimationDecoderOption.DISABLE_ANIMATION_WEBP_DECODER, !animate)
                    .set(AnimationDecoderOption.DISABLE_ANIMATION_APNG_DECODER, !animate);
            var mimetype = CustomEmojiHelper.getMimeType(url);
            if(mimetype == MIME.SVG) {
                glideRequest = glideRequest
                        .diskCacheStrategy(DiskCacheStrategy.AUTOMATIC)
                        .override(512, 512);
            }
            glideRequest.into(span.getTarget(animate));
        }

        btn.setText(builder, BufferType.SPANNABLE);
        btn.setActivated(reaction.getMe());
        btn.setOnClickListener(v -> {
            listener.onEmojiReactMenu(v, reaction, statusId);
diff --git a/husky/app/src/main/java/com/keylesspalace/tusky/util/CustomEmojiHelper.kt b/husky/app/src/main/java/com/keylesspalace/tusky/util/CustomEmojiHelper.kt
index df5ccc6..a6b7ede 100644
--- a/husky/app/src/main/java/com/keylesspalace/tusky/util/CustomEmojiHelper.kt
+++ b/husky/app/src/main/java/com/keylesspalace/tusky/util/CustomEmojiHelper.kt
@@ -210,7 +210,7 @@ class SmallEmojiSpan(viewWeakReference: WeakReference<View>) : EmojiSpan(viewWea
 *
 * @return MIME - The Mimetype.
 */
private fun getMimeType(url: String?): MIME {
public fun getMimeType(url: String?): MIME {
    var type: String? = null
    val extension = MimeTypeMap.getFileExtensionFromUrl(url)
    if(extension != null) {
@@ -219,7 +219,7 @@ private fun getMimeType(url: String?): MIME {
    return MIME.getMime(type)
}

private enum class MIME(private val mimetype: String) {
public enum class MIME(private val mimetype: String) {

    NONE(""),
    SVG("image/svg+xml");
-- 
2.36.1

[husky/patches/stable.yml] build failed

builds.sr.ht <builds@sr.ht>
Details
Message ID
<CKLL3H9SOL2J.1RNMC4WN512Y0@cirno>
In-Reply-To
<20220609134505.8864-2-helene@helene.moe> (view parent)
DKIM signature
missing
Download raw message
husky/patches/stable.yml: FAILED in 12m47s

[entity/Emoji: match MastoAPI docs on custom emoji reacts][0] from [][1]

[0]: https://lists.sr.ht/~captainepoch/husky-devel/patches/32861
[1]: helene@helene.moe

✗ #777337 FAILED husky/patches/stable.yml https://builds.sr.ht/~captainepoch/job/777337

Re: [PATCH husky 2/2] EmojiReactionsAdapter: implement custom emoji reactions on messages

Details
Message ID
<20220617151538.stmgm4fhcq7l6lnh@MacBook-Pro-de-Adolfo.local>
In-Reply-To
<20220609134505.8864-2-helene@helene.moe> (view parent)
DKIM signature
pass
Download raw message
Since there's a v2 of this patchset, I marked it as superseded.

Thank you for both patchsets.

Cheers!
Reply to thread Export thread (mbox)