#1458 Story thumbnail previews

This commit is contained in:
sictiru 2021-05-11 21:49:00 -07:00
parent d0179945b3
commit 103e92b14c
3 changed files with 11 additions and 7 deletions

View file

@ -41,7 +41,6 @@
android:layout_marginTop="1dp" android:layout_marginTop="1dp"
android:layout_marginBottom="1dp" android:layout_marginBottom="1dp"
android:layout_alignParentRight="true" android:layout_alignParentRight="true"
android:layout_centerVertical="true"
android:visibility="gone" /> android:visibility="gone" />
<ImageView <ImageView
@ -51,7 +50,6 @@
android:layout_marginTop="1dp" android:layout_marginTop="1dp"
android:layout_marginBottom="1dp" android:layout_marginBottom="1dp"
android:layout_toRightOf="@id/story_item_favicon_borderbar_2" android:layout_toRightOf="@id/story_item_favicon_borderbar_2"
android:layout_centerVertical="true"
android:visibility="gone" /> android:visibility="gone" />
<ImageView <ImageView

View file

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<resources> <resources>
<dimen name="thumbnails_small_size">50dp</dimen> <dimen name="thumbnails_small_size">54dp</dimen>
<dimen name="thumbnails_size">90dp</dimen> <dimen name="thumbnails_size">120dp</dimen>
<dimen name="extra_line_spacing">4dp</dimen> <dimen name="extra_line_spacing">4dp</dimen>
</resources> </resources>

View file

@ -557,14 +557,16 @@ public class StoryViewAdapter extends RecyclerView.Adapter<RecyclerView.ViewHold
// the view will display a stale, recycled thumb before the new one loads if the old is not cleared // the view will display a stale, recycled thumb before the new one loads if the old is not cleared
if (thumbnailStyle == ThumbnailStyle.LEFT_LARGE || thumbnailStyle == ThumbnailStyle.LEFT_SMALL) { if (thumbnailStyle == ThumbnailStyle.LEFT_LARGE || thumbnailStyle == ThumbnailStyle.LEFT_SMALL) {
int thumbSizeGuess = vh.thumbViewLeft.getMeasuredHeight(); int thumbSizeGuess = vh.thumbViewLeft.getMeasuredHeight();
boolean roundCorners = thumbnailStyle == ThumbnailStyle.LEFT_SMALL;
vh.thumbViewLeft.setImageDrawable(null); vh.thumbViewLeft.setImageDrawable(null);
vh.thumbLoader = FeedUtils.thumbnailLoader.displayImage(story.thumbnailUrl, vh.thumbViewLeft, 0, true, thumbSizeGuess, true); vh.thumbLoader = FeedUtils.thumbnailLoader.displayImage(story.thumbnailUrl, vh.thumbViewLeft, roundCorners, true, thumbSizeGuess, true);
vh.thumbViewRight.setVisibility(View.GONE); vh.thumbViewRight.setVisibility(View.GONE);
vh.thumbViewLeft.setVisibility(View.VISIBLE); vh.thumbViewLeft.setVisibility(View.VISIBLE);
} else if (thumbnailStyle == ThumbnailStyle.RIGHT_LARGE || thumbnailStyle == ThumbnailStyle.RIGHT_SMALL) { } else if (thumbnailStyle == ThumbnailStyle.RIGHT_LARGE || thumbnailStyle == ThumbnailStyle.RIGHT_SMALL) {
int thumbSizeGuess = vh.thumbViewRight.getMeasuredHeight(); int thumbSizeGuess = vh.thumbViewRight.getMeasuredHeight();
boolean roundCorners = thumbnailStyle == ThumbnailStyle.RIGHT_SMALL;
vh.thumbViewRight.setImageDrawable(null); vh.thumbViewRight.setImageDrawable(null);
vh.thumbLoader = FeedUtils.thumbnailLoader.displayImage(story.thumbnailUrl, vh.thumbViewRight, 0, true, thumbSizeGuess, true); vh.thumbLoader = FeedUtils.thumbnailLoader.displayImage(story.thumbnailUrl, vh.thumbViewRight, roundCorners, true, thumbSizeGuess, true);
vh.thumbViewLeft.setVisibility(View.GONE); vh.thumbViewLeft.setVisibility(View.GONE);
vh.thumbViewRight.setVisibility(View.VISIBLE); vh.thumbViewRight.setVisibility(View.VISIBLE);
} }
@ -598,7 +600,7 @@ public class StoryViewAdapter extends RecyclerView.Adapter<RecyclerView.ViewHold
// lists with mixed feeds get added info, but single feeds do not // lists with mixed feeds get added info, but single feeds do not
if (!singleFeed) { if (!singleFeed) {
FeedUtils.iconLoader.displayImage(story.extern_faviconUrl, vh.feedIconView, 0, false); FeedUtils.iconLoader.displayImage(story.extern_faviconUrl, vh.feedIconView, false, false);
vh.feedTitleView.setText(story.extern_feedTitle); vh.feedTitleView.setText(story.extern_feedTitle);
vh.feedIconView.setVisibility(View.VISIBLE); vh.feedIconView.setVisibility(View.VISIBLE);
vh.feedTitleView.setVisibility(View.VISIBLE); vh.feedTitleView.setVisibility(View.VISIBLE);
@ -699,6 +701,10 @@ public class StoryViewAdapter extends RecyclerView.Adapter<RecyclerView.ViewHold
params.height = sizeDp; params.height = sizeDp;
params.width = sizeDp; params.width = sizeDp;
} }
if (params != null && (thumbnailStyle == ThumbnailStyle.RIGHT_SMALL || thumbnailStyle == ThumbnailStyle.LEFT_SMALL)) {
params.addRule(RelativeLayout.CENTER_VERTICAL);
params.setMarginStart(UIUtils.dp2px(context, 8));
}
if (this.ignoreReadStatus || (! story.read)) { if (this.ignoreReadStatus || (! story.read)) {
vh.storyAuthor.setAlpha(1.0f); vh.storyAuthor.setAlpha(1.0f);