mirror of
https://codeberg.org/Bazsalanszky/Infinity-For-Lemmy.git
synced 2024-12-28 11:58:23 +01:00
Version 5.1.9-beta1. Fix low resolution post previews when showing them for the first time in PostDetailRecyclerViewAdapter.
This commit is contained in:
parent
141abc654a
commit
53755d4381
@ -6,8 +6,8 @@ android {
|
|||||||
applicationId "ml.docilealligator.infinityforreddit"
|
applicationId "ml.docilealligator.infinityforreddit"
|
||||||
minSdkVersion 21
|
minSdkVersion 21
|
||||||
targetSdkVersion 30
|
targetSdkVersion 30
|
||||||
versionCode 93
|
versionCode 94
|
||||||
versionName "5.1.8"
|
versionName "5.1.9-beta1"
|
||||||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
||||||
javaCompileOptions {
|
javaCompileOptions {
|
||||||
annotationProcessorOptions {
|
annotationProcessorOptions {
|
||||||
|
@ -187,7 +187,7 @@ public class MessageRecyclerViewAdapter extends PagedListAdapter<Message, Recycl
|
|||||||
((DataViewHolder) holder).subjectTextView.setText(subject);
|
((DataViewHolder) holder).subjectTextView.setText(subject);
|
||||||
mMarkwon.setMarkdown(((DataViewHolder) holder).contentCustomMarkwonView, displayedMessage.getBody());
|
mMarkwon.setMarkdown(((DataViewHolder) holder).contentCustomMarkwonView, displayedMessage.getBody());
|
||||||
|
|
||||||
((DataViewHolder) holder).itemView.setOnClickListener(view -> {
|
holder.itemView.setOnClickListener(view -> {
|
||||||
if (mMessageType == FetchMessage.MESSAGE_TYPE_INBOX
|
if (mMessageType == FetchMessage.MESSAGE_TYPE_INBOX
|
||||||
&& message.getContext() != null && !message.getContext().equals("")) {
|
&& message.getContext() != null && !message.getContext().equals("")) {
|
||||||
Uri uri = Uri.parse(message.getContext());
|
Uri uri = Uri.parse(message.getContext());
|
||||||
@ -202,7 +202,7 @@ public class MessageRecyclerViewAdapter extends PagedListAdapter<Message, Recycl
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (displayedMessage.isNew()) {
|
if (displayedMessage.isNew()) {
|
||||||
((DataViewHolder) holder).itemView.setBackgroundColor(mMessageBackgroundColor);
|
holder.itemView.setBackgroundColor(mMessageBackgroundColor);
|
||||||
message.setNew(false);
|
message.setNew(false);
|
||||||
|
|
||||||
ReadMessage.readMessage(mOauthRetrofit, mAccessToken, message.getFullname(),
|
ReadMessage.readMessage(mOauthRetrofit, mAccessToken, message.getFullname(),
|
||||||
@ -214,7 +214,7 @@ public class MessageRecyclerViewAdapter extends PagedListAdapter<Message, Recycl
|
|||||||
@Override
|
@Override
|
||||||
public void readFailed() {
|
public void readFailed() {
|
||||||
message.setNew(true);
|
message.setNew(true);
|
||||||
((DataViewHolder) holder).itemView.setBackgroundColor(mUnreadMessageBackgroundColor);
|
holder.itemView.setBackgroundColor(mUnreadMessageBackgroundColor);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -228,7 +228,7 @@ public class MessageRecyclerViewAdapter extends PagedListAdapter<Message, Recycl
|
|||||||
|
|
||||||
((DataViewHolder) holder).contentCustomMarkwonView.setOnClickListener(view -> {
|
((DataViewHolder) holder).contentCustomMarkwonView.setOnClickListener(view -> {
|
||||||
if (((DataViewHolder) holder).contentCustomMarkwonView.getSelectionStart() == -1 && ((DataViewHolder) holder).contentCustomMarkwonView.getSelectionEnd() == -1) {
|
if (((DataViewHolder) holder).contentCustomMarkwonView.getSelectionStart() == -1 && ((DataViewHolder) holder).contentCustomMarkwonView.getSelectionEnd() == -1) {
|
||||||
((DataViewHolder) holder).itemView.performClick();
|
holder.itemView.performClick();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -19,6 +19,7 @@ import android.text.util.Linkify;
|
|||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
|
import android.view.ViewTreeObserver;
|
||||||
import android.widget.ImageView;
|
import android.widget.ImageView;
|
||||||
import android.widget.ProgressBar;
|
import android.widget.ProgressBar;
|
||||||
import android.widget.RelativeLayout;
|
import android.widget.RelativeLayout;
|
||||||
@ -717,7 +718,13 @@ public class PostDetailRecyclerViewAdapter extends RecyclerView.Adapter<Recycler
|
|||||||
Post.Preview preview = getSuitablePreview(mPost.getPreviews());
|
Post.Preview preview = getSuitablePreview(mPost.getPreviews());
|
||||||
if (preview != null) {
|
if (preview != null) {
|
||||||
((PostDetailVideoAndGifPreviewHolder) holder).mImageView.setRatio((float) preview.getPreviewHeight() / (float) preview.getPreviewWidth());
|
((PostDetailVideoAndGifPreviewHolder) holder).mImageView.setRatio((float) preview.getPreviewHeight() / (float) preview.getPreviewWidth());
|
||||||
loadImage((PostDetailVideoAndGifPreviewHolder) holder, preview);
|
((PostDetailVideoAndGifPreviewHolder) holder).mImageView.getViewTreeObserver().addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() {
|
||||||
|
@Override
|
||||||
|
public void onGlobalLayout() {
|
||||||
|
((PostDetailVideoAndGifPreviewHolder) holder).mImageView.getViewTreeObserver().removeOnGlobalLayoutListener(this);
|
||||||
|
loadImage((PostDetailVideoAndGifPreviewHolder) holder, preview);
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
} else if (holder instanceof PostDetailImageAndGifAutoplayViewHolder) {
|
} else if (holder instanceof PostDetailImageAndGifAutoplayViewHolder) {
|
||||||
if (!mHidePostType) {
|
if (!mHidePostType) {
|
||||||
@ -737,7 +744,13 @@ public class PostDetailRecyclerViewAdapter extends RecyclerView.Adapter<Recycler
|
|||||||
} else {
|
} else {
|
||||||
((PostDetailImageAndGifAutoplayViewHolder) holder).mImageView.setRatio((float) preview.getPreviewHeight() / (float) preview.getPreviewWidth());
|
((PostDetailImageAndGifAutoplayViewHolder) holder).mImageView.setRatio((float) preview.getPreviewHeight() / (float) preview.getPreviewWidth());
|
||||||
}
|
}
|
||||||
loadImage((PostDetailImageAndGifAutoplayViewHolder) holder, preview);
|
((PostDetailImageAndGifAutoplayViewHolder) holder).mImageView.getViewTreeObserver().addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() {
|
||||||
|
@Override
|
||||||
|
public void onGlobalLayout() {
|
||||||
|
((PostDetailImageAndGifAutoplayViewHolder) holder).mImageView.getViewTreeObserver().removeOnGlobalLayoutListener(this);
|
||||||
|
loadImage((PostDetailImageAndGifAutoplayViewHolder) holder, preview);
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
} else if (holder instanceof PostDetailLinkViewHolder) {
|
} else if (holder instanceof PostDetailLinkViewHolder) {
|
||||||
String domain = Uri.parse(mPost.getUrl()).getHost();
|
String domain = Uri.parse(mPost.getUrl()).getHost();
|
||||||
@ -745,7 +758,13 @@ public class PostDetailRecyclerViewAdapter extends RecyclerView.Adapter<Recycler
|
|||||||
Post.Preview preview = getSuitablePreview(mPost.getPreviews());
|
Post.Preview preview = getSuitablePreview(mPost.getPreviews());
|
||||||
if (preview != null) {
|
if (preview != null) {
|
||||||
((PostDetailLinkViewHolder) holder).mImageView.setRatio((float) preview.getPreviewHeight() / (float) preview.getPreviewWidth());
|
((PostDetailLinkViewHolder) holder).mImageView.setRatio((float) preview.getPreviewHeight() / (float) preview.getPreviewWidth());
|
||||||
loadImage((PostDetailLinkViewHolder) holder, preview);
|
((PostDetailLinkViewHolder) holder).mImageView.getViewTreeObserver().addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() {
|
||||||
|
@Override
|
||||||
|
public void onGlobalLayout() {
|
||||||
|
((PostDetailLinkViewHolder) holder).mImageView.getViewTreeObserver().removeOnGlobalLayoutListener(this);
|
||||||
|
loadImage((PostDetailLinkViewHolder) holder, preview);
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
} else if (holder instanceof PostDetailNoPreviewViewHolder) {
|
} else if (holder instanceof PostDetailNoPreviewViewHolder) {
|
||||||
@ -812,7 +831,13 @@ public class PostDetailRecyclerViewAdapter extends RecyclerView.Adapter<Recycler
|
|||||||
((PostDetailGalleryViewHolder) holder).mImageView
|
((PostDetailGalleryViewHolder) holder).mImageView
|
||||||
.setRatio((float) preview.getPreviewHeight() / preview.getPreviewWidth());
|
.setRatio((float) preview.getPreviewHeight() / preview.getPreviewWidth());
|
||||||
|
|
||||||
loadImage((PostDetailGalleryViewHolder) holder, preview);
|
((PostDetailGalleryViewHolder) holder).mImageView.getViewTreeObserver().addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() {
|
||||||
|
@Override
|
||||||
|
public void onGlobalLayout() {
|
||||||
|
((PostDetailGalleryViewHolder) holder).mImageView.getViewTreeObserver().removeOnGlobalLayoutListener(this);
|
||||||
|
loadImage((PostDetailGalleryViewHolder) holder, preview);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
loadCaptionPreview((PostDetailGalleryViewHolder) holder, preview);
|
loadCaptionPreview((PostDetailGalleryViewHolder) holder, preview);
|
||||||
} else {
|
} else {
|
||||||
|
Loading…
Reference in New Issue
Block a user