forked from mirrors/Fedilab
Some fixes
This commit is contained in:
parent
7704e15e31
commit
f966874550
2 changed files with 8 additions and 10 deletions
|
@ -48,7 +48,6 @@ import android.os.Looper;
|
||||||
import android.text.Html;
|
import android.text.Html;
|
||||||
import android.text.SpannableString;
|
import android.text.SpannableString;
|
||||||
import android.text.TextUtils;
|
import android.text.TextUtils;
|
||||||
import android.util.Log;
|
|
||||||
import android.util.TypedValue;
|
import android.util.TypedValue;
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
import android.view.MotionEvent;
|
import android.view.MotionEvent;
|
||||||
|
@ -137,7 +136,9 @@ import app.fedilab.android.databinding.LayoutMediaBinding;
|
||||||
import app.fedilab.android.databinding.LayoutPollItemBinding;
|
import app.fedilab.android.databinding.LayoutPollItemBinding;
|
||||||
import app.fedilab.android.exception.DBException;
|
import app.fedilab.android.exception.DBException;
|
||||||
import app.fedilab.android.helper.CrossActionHelper;
|
import app.fedilab.android.helper.CrossActionHelper;
|
||||||
|
import app.fedilab.android.helper.GlideApp;
|
||||||
import app.fedilab.android.helper.GlideFocus;
|
import app.fedilab.android.helper.GlideFocus;
|
||||||
|
import app.fedilab.android.helper.GlideRequests;
|
||||||
import app.fedilab.android.helper.Helper;
|
import app.fedilab.android.helper.Helper;
|
||||||
import app.fedilab.android.helper.LongClickLinkMovementMethod;
|
import app.fedilab.android.helper.LongClickLinkMovementMethod;
|
||||||
import app.fedilab.android.helper.MastodonHelper;
|
import app.fedilab.android.helper.MastodonHelper;
|
||||||
|
@ -2099,9 +2100,9 @@ public class StatusAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder>
|
||||||
}
|
}
|
||||||
boolean expand_media = sharedpreferences.getBoolean(context.getString(R.string.SET_EXPAND_MEDIA), false);
|
boolean expand_media = sharedpreferences.getBoolean(context.getString(R.string.SET_EXPAND_MEDIA), false);
|
||||||
RequestBuilder<Drawable> requestBuilder;
|
RequestBuilder<Drawable> requestBuilder;
|
||||||
|
GlideRequests glideRequests = GlideApp.with(context);
|
||||||
if (!isSensitive || expand_media) {
|
if (!isSensitive || expand_media) {
|
||||||
requestBuilder = Glide.with(context)
|
requestBuilder = glideRequests.asDrawable();
|
||||||
.load(attachment.preview_url);
|
|
||||||
if (!fullAttachement) {
|
if (!fullAttachement) {
|
||||||
requestBuilder = requestBuilder.apply(new RequestOptions().transform(new GlideFocus(focusX, focusY)));
|
requestBuilder = requestBuilder.apply(new RequestOptions().transform(new GlideFocus(focusX, focusY)));
|
||||||
requestBuilder = requestBuilder.dontAnimate();
|
requestBuilder = requestBuilder.dontAnimate();
|
||||||
|
@ -2112,8 +2113,7 @@ public class StatusAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder>
|
||||||
requestBuilder = requestBuilder.fitCenter();
|
requestBuilder = requestBuilder.fitCenter();
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
requestBuilder = Glide.with(context)
|
requestBuilder = glideRequests.asDrawable()
|
||||||
.load(attachment.preview_url)
|
|
||||||
.dontAnimate()
|
.dontAnimate()
|
||||||
.apply(new RequestOptions().transform(new BlurTransformation(50, 3)));
|
.apply(new RequestOptions().transform(new BlurTransformation(50, 3)));
|
||||||
// .apply(new RequestOptions().transform(new CenterCrop(), new RoundedCorners((int) Helper.convertDpToPixel(3, context))))
|
// .apply(new RequestOptions().transform(new CenterCrop(), new RoundedCorners((int) Helper.convertDpToPixel(3, context))))
|
||||||
|
@ -2193,7 +2193,7 @@ public class StatusAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder>
|
||||||
} else {
|
} else {
|
||||||
layoutMediaBinding.viewHide.setImageResource(R.drawable.ic_baseline_visibility_off_24);
|
layoutMediaBinding.viewHide.setImageResource(R.drawable.ic_baseline_visibility_off_24);
|
||||||
}
|
}
|
||||||
requestBuilder.into(layoutMediaBinding.media);
|
requestBuilder.load(attachment.preview_url).into(layoutMediaBinding.media);
|
||||||
if (statusToDeal.sensitive) {
|
if (statusToDeal.sensitive) {
|
||||||
Helper.changeDrawableColor(context, layoutMediaBinding.viewHide, ThemeHelper.getAttColor(context, R.attr.colorError));
|
Helper.changeDrawableColor(context, layoutMediaBinding.viewHide, ThemeHelper.getAttColor(context, R.attr.colorError));
|
||||||
} else {
|
} else {
|
||||||
|
@ -2268,7 +2268,6 @@ public class StatusAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder>
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Log.v(Helper.TAG, position + " - getPreloadItems: " + attachments.size());
|
|
||||||
return attachments;
|
return attachments;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2287,8 +2286,7 @@ public class StatusAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder>
|
||||||
mediaH = attachment.meta.small.height;
|
mediaH = attachment.meta.small.height;
|
||||||
mediaW = attachment.meta.small.width;
|
mediaW = attachment.meta.small.width;
|
||||||
}
|
}
|
||||||
Log.v(Helper.TAG, "getPreloadRequestBuilder: " + attachment);
|
return prepareRequestBuilder(context, attachment, mediaW, mediaH, focusX, focusY, attachment.sensitive, timelineType == Timeline.TimeLineEnum.ART).load(attachment);
|
||||||
return prepareRequestBuilder(context, attachment, mediaW, mediaH, focusX, focusY, attachment.sensitive, timelineType == Timeline.TimeLineEnum.ART);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -88,7 +88,7 @@ public class FragmentMastodonTimeline extends Fragment implements StatusAdapter.
|
||||||
private StatusAdapter statusAdapter;
|
private StatusAdapter statusAdapter;
|
||||||
private Timeline.TimeLineEnum timelineType;
|
private Timeline.TimeLineEnum timelineType;
|
||||||
private List<Status> timelineStatuses;
|
private List<Status> timelineStatuses;
|
||||||
private static final int PRELOAD_AHEAD_ITEMS = 5;
|
private static final int PRELOAD_AHEAD_ITEMS = 10;
|
||||||
private ViewPreloadSizeProvider<Attachment> preloadSizeProvider;
|
private ViewPreloadSizeProvider<Attachment> preloadSizeProvider;
|
||||||
//Handle actions that can be done in other fragments
|
//Handle actions that can be done in other fragments
|
||||||
private final BroadcastReceiver receive_action = new BroadcastReceiver() {
|
private final BroadcastReceiver receive_action = new BroadcastReceiver() {
|
||||||
|
|
Loading…
Reference in a new issue