Skip to content

Commit

Permalink
feat: パフォーマンス改善
Browse files Browse the repository at this point in the history
  • Loading branch information
pantasystem committed Jun 26, 2023
1 parent c773f35 commit 5b0d082
Show file tree
Hide file tree
Showing 3 changed files with 63 additions and 37 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -83,13 +83,20 @@ object ReactionViewHelper {

if (emoji != null) {
//Log.d("ReactionViewHelper", "カスタム絵文字を発見した: ${emoji}")
GlideApp.with(reactionImageView.context)
.load(emoji.cachePath)
.error(
GlideApp.with(reactionImageView.context)
.load(emoji.url ?: emoji.uri)
)
.into(reactionImageView)
if (emoji.cachePath == null) {
GlideApp.with(reactionImageView.context)
.load(emoji.url ?: emoji.uri)
.into(reactionImageView)
} else {
GlideApp.with(reactionImageView.context)
.load(emoji.cachePath)
.error(
GlideApp.with(reactionImageView.context)
.load(emoji.url ?: emoji.uri)
)
.into(reactionImageView)
}

reactionImageView.setMemoVisibility(View.VISIBLE)
reactionStringView.setMemoVisibility(View.GONE)
return
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,17 +57,26 @@ object NoteReactionViewHelper {
)


GlideApp.with(reactionImageTypeView.context)
.load(emoji.cachePath)
.error(
GlideApp.with(reactionImageTypeView.context)
.load(emoji.url ?: emoji.uri)
.override(imageViewWidthPx.toInt(), imageViewHeightPx.toInt())
.addListener(SaveImageAspectRequestListener(emoji, context))
)
.override(imageViewWidthPx.toInt(), imageViewHeightPx.toInt())
.addListener(SaveImageAspectRequestListener(emoji, context))
.into(reactionImageTypeView)
if (emoji.cachePath == null) {
GlideApp.with(reactionImageTypeView.context)
.load(emoji.url ?: emoji.uri)
.override(imageViewWidthPx.toInt(), imageViewHeightPx.toInt())
.addListener(SaveImageAspectRequestListener(emoji, context))
.into(reactionImageTypeView)
} else {
GlideApp.with(reactionImageTypeView.context)
.load(emoji.cachePath)
.error(
GlideApp.with(reactionImageTypeView.context)
.load(emoji.url ?: emoji.uri)
.override(imageViewWidthPx.toInt(), imageViewHeightPx.toInt())
.addListener(SaveImageAspectRequestListener(emoji, context))
)
.override(imageViewWidthPx.toInt(), imageViewHeightPx.toInt())
.addListener(SaveImageAspectRequestListener(emoji, context))
.into(reactionImageTypeView)
}

}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,28 +75,38 @@ class EmojiListItemsAdapter(
)
)
}
GlideApp.with(binding.reactionImagePreview.context)
.load(item.emoji.cachePath)
// FIXME: webpの場合うまく表示できなくなる
// .centerCrop()
.addListener(
SaveImageAspectRequestListener(
item.emoji,
binding.root.context
if (item.emoji.cachePath == null) {
GlideApp.with(binding.reactionImagePreview.context)
.load(item.emoji.url ?: item.emoji.uri)
.addListener(
SaveImageAspectRequestListener(
item.emoji,
binding.root.context
)
)
)
.error(
GlideApp.with(binding.reactionImagePreview.context)
.load(item.emoji.url ?: item.emoji.uri)
.addListener(
SaveImageAspectRequestListener(
item.emoji,
binding.root.context
)
.into(binding.reactionImagePreview)
} else {
GlideApp.with(binding.reactionImagePreview.context)
.load(item.emoji.cachePath)
.addListener(
SaveImageAspectRequestListener(
item.emoji,
binding.root.context
)
)
)
.error(
GlideApp.with(binding.reactionImagePreview.context)
.load(item.emoji.url ?: item.emoji.uri)
.addListener(
SaveImageAspectRequestListener(
item.emoji,
binding.root.context
)
)
)
.into(binding.reactionImagePreview)

.into(binding.reactionImagePreview)
}

binding.reactionStringPreview.setMemoVisibility(View.GONE)
binding.reactionImagePreview.setMemoVisibility(View.VISIBLE)
Expand Down

0 comments on commit 5b0d082

Please sign in to comment.