mirror of
https://codeberg.org/Bazsalanszky/Infinity-For-Lemmy.git
synced 2025-01-30 19:34:45 +01:00
Initial support for gallery captions
This commit is contained in:
parent
70cbadfb3b
commit
b8e2d44638
@ -810,6 +810,24 @@ 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());
|
||||||
|
|
||||||
|
String previewCaption = preview.getPreviewCaption();
|
||||||
|
String previewCaptionUrl = preview.getPreviewCaptionUrl();
|
||||||
|
boolean previewCaptionIsEmpty = android.text.TextUtils.isEmpty(previewCaption);
|
||||||
|
boolean previewCaptionUrlIsEmpty = android.text.TextUtils.isEmpty(previewCaptionUrl);
|
||||||
|
if(!previewCaptionIsEmpty || !previewCaptionUrlIsEmpty){
|
||||||
|
((PostDetailGalleryViewHolder) holder).mCaptionConstraintLayout.setVisibility(View.VISIBLE);
|
||||||
|
}
|
||||||
|
if(!previewCaptionIsEmpty) {
|
||||||
|
((PostDetailGalleryViewHolder) holder).mCaption.setText(previewCaption);
|
||||||
|
((PostDetailGalleryViewHolder) holder).mCaption.setSelected(true);
|
||||||
|
}
|
||||||
|
if(!previewCaptionUrlIsEmpty)
|
||||||
|
{
|
||||||
|
String domain = Uri.parse(previewCaptionUrl).getHost();
|
||||||
|
domain = domain.startsWith("www.") ? domain.substring(4) : domain;
|
||||||
|
mPostDetailMarkwon.setMarkdown(((PostDetailGalleryViewHolder) holder).mCaptionUrl, String.format("[%s](%s)", domain, previewCaptionUrl));
|
||||||
|
}
|
||||||
|
|
||||||
loadImage((PostDetailGalleryViewHolder) holder, preview);
|
loadImage((PostDetailGalleryViewHolder) holder, preview);
|
||||||
} else {
|
} else {
|
||||||
((PostDetailGalleryViewHolder) holder).mNoPreviewPostTypeImageView.setVisibility(View.VISIBLE);
|
((PostDetailGalleryViewHolder) holder).mNoPreviewPostTypeImageView.setVisibility(View.VISIBLE);
|
||||||
@ -2296,6 +2314,12 @@ public class PostDetailRecyclerViewAdapter extends RecyclerView.Adapter<Recycler
|
|||||||
ImageView videoOrGifIndicatorImageView;
|
ImageView videoOrGifIndicatorImageView;
|
||||||
@BindView(R.id.image_view_item_post_detail_gallery)
|
@BindView(R.id.image_view_item_post_detail_gallery)
|
||||||
AspectRatioGifImageView mImageView;
|
AspectRatioGifImageView mImageView;
|
||||||
|
@BindView(R.id.caption_constraint_layout_item_post_detail_gallery)
|
||||||
|
ConstraintLayout mCaptionConstraintLayout;
|
||||||
|
@BindView(R.id.caption_text_view_item_post_detail_gallery)
|
||||||
|
TextView mCaption;
|
||||||
|
@BindView(R.id.caption_url_text_view_item_post_detail_gallery)
|
||||||
|
TextView mCaptionUrl;
|
||||||
@BindView(R.id.image_view_no_preview_link_item_post_detail_gallery)
|
@BindView(R.id.image_view_no_preview_link_item_post_detail_gallery)
|
||||||
ImageView mNoPreviewPostTypeImageView;
|
ImageView mNoPreviewPostTypeImageView;
|
||||||
@BindView(R.id.bottom_constraint_layout_item_post_detail_gallery)
|
@BindView(R.id.bottom_constraint_layout_item_post_detail_gallery)
|
||||||
|
@ -60,6 +60,7 @@ import ml.docilealligator.infinityforreddit.activities.ViewRedditGalleryActivity
|
|||||||
import ml.docilealligator.infinityforreddit.asynctasks.SaveBitmapImageToFile;
|
import ml.docilealligator.infinityforreddit.asynctasks.SaveBitmapImageToFile;
|
||||||
import ml.docilealligator.infinityforreddit.asynctasks.SaveGIFToFile;
|
import ml.docilealligator.infinityforreddit.asynctasks.SaveGIFToFile;
|
||||||
import ml.docilealligator.infinityforreddit.bottomsheetfragments.SetAsWallpaperBottomSheetFragment;
|
import ml.docilealligator.infinityforreddit.bottomsheetfragments.SetAsWallpaperBottomSheetFragment;
|
||||||
|
import ml.docilealligator.infinityforreddit.bottomsheetfragments.UrlMenuBottomSheetFragment;
|
||||||
import ml.docilealligator.infinityforreddit.post.Post;
|
import ml.docilealligator.infinityforreddit.post.Post;
|
||||||
import ml.docilealligator.infinityforreddit.services.DownloadMediaService;
|
import ml.docilealligator.infinityforreddit.services.DownloadMediaService;
|
||||||
|
|
||||||
@ -79,6 +80,14 @@ public class ViewRedditGalleryImageOrGifFragment extends Fragment {
|
|||||||
LinearLayout errorLinearLayout;
|
LinearLayout errorLinearLayout;
|
||||||
@BindView(R.id.bottom_navigation_view_reddit_gallery_image_or_gif_fragment)
|
@BindView(R.id.bottom_navigation_view_reddit_gallery_image_or_gif_fragment)
|
||||||
BottomAppBar bottomAppBar;
|
BottomAppBar bottomAppBar;
|
||||||
|
@BindView(R.id.caption_layout_view_reddit_gallery_image_or_gif_fragment)
|
||||||
|
LinearLayout captionLayout;
|
||||||
|
@BindView(R.id.caption_text_view_view_reddit_gallery_image_or_gif_fragment)
|
||||||
|
TextView captionTextView;
|
||||||
|
@BindView(R.id.caption_url_text_view_view_reddit_gallery_image_or_gif_fragment)
|
||||||
|
TextView captionUrlTextView;
|
||||||
|
@BindView(R.id.bottom_app_bar_menu_view_reddit_gallery_image_or_gif_fragment)
|
||||||
|
LinearLayout bottomAppBarMenu;
|
||||||
@BindView(R.id.title_text_view_view_reddit_gallery_image_or_gif_fragment)
|
@BindView(R.id.title_text_view_view_reddit_gallery_image_or_gif_fragment)
|
||||||
TextView titleTextView;
|
TextView titleTextView;
|
||||||
@BindView(R.id.download_image_view_view_reddit_gallery_image_or_gif_fragment)
|
@BindView(R.id.download_image_view_view_reddit_gallery_image_or_gif_fragment)
|
||||||
@ -96,6 +105,7 @@ public class ViewRedditGalleryImageOrGifFragment extends Fragment {
|
|||||||
private String subredditName;
|
private String subredditName;
|
||||||
private boolean isDownloading = false;
|
private boolean isDownloading = false;
|
||||||
private boolean isActionBarHidden = false;
|
private boolean isActionBarHidden = false;
|
||||||
|
private boolean isUseBottomCaption = false;
|
||||||
|
|
||||||
public ViewRedditGalleryImageOrGifFragment() {
|
public ViewRedditGalleryImageOrGifFragment() {
|
||||||
// Required empty public constructor
|
// Required empty public constructor
|
||||||
@ -182,7 +192,7 @@ public class ViewRedditGalleryImageOrGifFragment extends Fragment {
|
|||||||
| View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
|
| View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
|
||||||
| View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN);
|
| View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN);
|
||||||
isActionBarHidden = false;
|
isActionBarHidden = false;
|
||||||
if (activity.isUseBottomAppBar()) {
|
if (activity.isUseBottomAppBar() || isUseBottomCaption) {
|
||||||
bottomAppBar.setVisibility(View.VISIBLE);
|
bottomAppBar.setVisibility(View.VISIBLE);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@ -194,7 +204,7 @@ public class ViewRedditGalleryImageOrGifFragment extends Fragment {
|
|||||||
| View.SYSTEM_UI_FLAG_FULLSCREEN
|
| View.SYSTEM_UI_FLAG_FULLSCREEN
|
||||||
| View.SYSTEM_UI_FLAG_IMMERSIVE);
|
| View.SYSTEM_UI_FLAG_IMMERSIVE);
|
||||||
isActionBarHidden = true;
|
isActionBarHidden = true;
|
||||||
if (activity.isUseBottomAppBar()) {
|
if (activity.isUseBottomAppBar() || isUseBottomCaption) {
|
||||||
bottomAppBar.setVisibility(View.GONE);
|
bottomAppBar.setVisibility(View.GONE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -234,6 +244,44 @@ public class ViewRedditGalleryImageOrGifFragment extends Fragment {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
String caption = media.caption;
|
||||||
|
String captionUrl = media.captionUrl;
|
||||||
|
boolean captionIsEmpty = android.text.TextUtils.isEmpty(caption);
|
||||||
|
boolean captionUrlIsEmpty = android.text.TextUtils.isEmpty(captionUrl);
|
||||||
|
if(!captionIsEmpty || !captionUrlIsEmpty){
|
||||||
|
isUseBottomCaption = true;
|
||||||
|
|
||||||
|
if (!activity.isUseBottomAppBar()) {
|
||||||
|
bottomAppBar.setVisibility(View.VISIBLE);
|
||||||
|
bottomAppBarMenu.setVisibility(View.GONE);
|
||||||
|
//Add bottom margin so that caption doesn't disappear to the bottom in some screens with rounded corners
|
||||||
|
//I couldn't get binding expressions to work so I did it here
|
||||||
|
LinearLayout.LayoutParams layoutParams = (LinearLayout.LayoutParams)captionLayout.getLayoutParams();
|
||||||
|
layoutParams.setMargins(0, 0, 0, (int) (16 * getResources().getDisplayMetrics().density));
|
||||||
|
}
|
||||||
|
|
||||||
|
captionLayout.setVisibility(View.VISIBLE);
|
||||||
|
|
||||||
|
if(!captionIsEmpty) {
|
||||||
|
captionTextView.setVisibility(View.VISIBLE);
|
||||||
|
captionTextView.setText(caption);
|
||||||
|
}
|
||||||
|
if(!captionUrlIsEmpty)
|
||||||
|
{
|
||||||
|
captionUrlTextView.setOnLongClickListener(view -> {
|
||||||
|
UrlMenuBottomSheetFragment urlMenuBottomSheetFragment = new UrlMenuBottomSheetFragment();
|
||||||
|
Bundle bundle = new Bundle();
|
||||||
|
bundle.putString(UrlMenuBottomSheetFragment.EXTRA_URL, captionUrl);
|
||||||
|
urlMenuBottomSheetFragment.setArguments(bundle);
|
||||||
|
urlMenuBottomSheetFragment.show(activity.getSupportFragmentManager(), urlMenuBottomSheetFragment.getTag());
|
||||||
|
return true;
|
||||||
|
});
|
||||||
|
|
||||||
|
captionUrlTextView.setVisibility(View.VISIBLE);
|
||||||
|
captionUrlTextView.setText(captionUrl);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return rootView;
|
return rootView;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -98,7 +98,7 @@ public class FetchRemovedPost {
|
|||||||
previews.set(0, preview);
|
previews.set(0, preview);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
Post.Preview preview = new Post.Preview(result.getString("thumbnail"), 1, 1);
|
Post.Preview preview = new Post.Preview(result.getString("thumbnail"), 1, 1, "", "");
|
||||||
preview.setPreviewUrl(result.getString("thumbnail"));
|
preview.setPreviewUrl(result.getString("thumbnail"));
|
||||||
ArrayList<Post.Preview> newPreviews = new ArrayList<>();
|
ArrayList<Post.Preview> newPreviews = new ArrayList<>();
|
||||||
newPreviews.add(preview);
|
newPreviews.add(preview);
|
||||||
|
@ -209,7 +209,7 @@ public class ParsePost {
|
|||||||
String previewUrl = images.getJSONObject(JSONUtils.SOURCE_KEY).getString(JSONUtils.URL_KEY);
|
String previewUrl = images.getJSONObject(JSONUtils.SOURCE_KEY).getString(JSONUtils.URL_KEY);
|
||||||
int previewWidth = images.getJSONObject(JSONUtils.SOURCE_KEY).getInt(JSONUtils.WIDTH_KEY);
|
int previewWidth = images.getJSONObject(JSONUtils.SOURCE_KEY).getInt(JSONUtils.WIDTH_KEY);
|
||||||
int previewHeight = images.getJSONObject(JSONUtils.SOURCE_KEY).getInt(JSONUtils.HEIGHT_KEY);
|
int previewHeight = images.getJSONObject(JSONUtils.SOURCE_KEY).getInt(JSONUtils.HEIGHT_KEY);
|
||||||
previews.add(new Post.Preview(previewUrl, previewWidth, previewHeight));
|
previews.add(new Post.Preview(previewUrl, previewWidth, previewHeight, "", ""));
|
||||||
|
|
||||||
JSONArray thumbnailPreviews = images.getJSONArray(JSONUtils.RESOLUTIONS_KEY);
|
JSONArray thumbnailPreviews = images.getJSONArray(JSONUtils.RESOLUTIONS_KEY);
|
||||||
for (int i = 0; i < thumbnailPreviews.length(); i++) {
|
for (int i = 0; i < thumbnailPreviews.length(); i++) {
|
||||||
@ -218,7 +218,7 @@ public class ParsePost {
|
|||||||
int thumbnailPreviewWidth = thumbnailPreview.getInt(JSONUtils.WIDTH_KEY);
|
int thumbnailPreviewWidth = thumbnailPreview.getInt(JSONUtils.WIDTH_KEY);
|
||||||
int thumbnailPreviewHeight = thumbnailPreview.getInt(JSONUtils.HEIGHT_KEY);
|
int thumbnailPreviewHeight = thumbnailPreview.getInt(JSONUtils.HEIGHT_KEY);
|
||||||
|
|
||||||
previews.add(new Post.Preview(thumbnailPreviewUrl, thumbnailPreviewWidth, thumbnailPreviewHeight));
|
previews.add(new Post.Preview(thumbnailPreviewUrl, thumbnailPreviewWidth, thumbnailPreviewHeight, "", ""));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (data.has(JSONUtils.CROSSPOST_PARENT_LIST)) {
|
if (data.has(JSONUtils.CROSSPOST_PARENT_LIST)) {
|
||||||
@ -301,7 +301,7 @@ public class ParsePost {
|
|||||||
spoiler, nsfw, stickied, archived, locked, saved, isCrosspost);
|
spoiler, nsfw, stickied, archived, locked, saved, isCrosspost);
|
||||||
|
|
||||||
if (previews.isEmpty()) {
|
if (previews.isEmpty()) {
|
||||||
previews.add(new Post.Preview(url, 0, 0));
|
previews.add(new Post.Preview(url, 0, 0, "", ""));
|
||||||
}
|
}
|
||||||
post.setPreviews(previews);
|
post.setPreviews(previews);
|
||||||
} else {
|
} else {
|
||||||
@ -341,7 +341,7 @@ public class ParsePost {
|
|||||||
String previewUrl = images.getJSONObject(JSONUtils.SOURCE_KEY).getString(JSONUtils.URL_KEY);
|
String previewUrl = images.getJSONObject(JSONUtils.SOURCE_KEY).getString(JSONUtils.URL_KEY);
|
||||||
int previewWidth = images.getJSONObject(JSONUtils.SOURCE_KEY).getInt(JSONUtils.WIDTH_KEY);
|
int previewWidth = images.getJSONObject(JSONUtils.SOURCE_KEY).getInt(JSONUtils.WIDTH_KEY);
|
||||||
int previewHeight = images.getJSONObject(JSONUtils.SOURCE_KEY).getInt(JSONUtils.HEIGHT_KEY);
|
int previewHeight = images.getJSONObject(JSONUtils.SOURCE_KEY).getInt(JSONUtils.HEIGHT_KEY);
|
||||||
previews.add(new Post.Preview(previewUrl, previewWidth, previewHeight));
|
previews.add(new Post.Preview(previewUrl, previewWidth, previewHeight, "", ""));
|
||||||
|
|
||||||
JSONArray thumbnailPreviews = images.getJSONArray(JSONUtils.RESOLUTIONS_KEY);
|
JSONArray thumbnailPreviews = images.getJSONArray(JSONUtils.RESOLUTIONS_KEY);
|
||||||
for (int i = 0; i < thumbnailPreviews.length(); i++) {
|
for (int i = 0; i < thumbnailPreviews.length(); i++) {
|
||||||
@ -350,7 +350,7 @@ public class ParsePost {
|
|||||||
int thumbnailPreviewWidth = thumbnailPreview.getInt(JSONUtils.WIDTH_KEY);
|
int thumbnailPreviewWidth = thumbnailPreview.getInt(JSONUtils.WIDTH_KEY);
|
||||||
int thumbnailPreviewHeight = thumbnailPreview.getInt(JSONUtils.HEIGHT_KEY);
|
int thumbnailPreviewHeight = thumbnailPreview.getInt(JSONUtils.HEIGHT_KEY);
|
||||||
|
|
||||||
previews.add(new Post.Preview(thumbnailPreviewUrl, thumbnailPreviewWidth, thumbnailPreviewHeight));
|
previews.add(new Post.Preview(thumbnailPreviewUrl, thumbnailPreviewWidth, thumbnailPreviewHeight, "", ""));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -397,7 +397,7 @@ public class ParsePost {
|
|||||||
hidden, spoiler, nsfw, stickied, archived, locked, saved, isCrosspost);
|
hidden, spoiler, nsfw, stickied, archived, locked, saved, isCrosspost);
|
||||||
|
|
||||||
if (previews.isEmpty()) {
|
if (previews.isEmpty()) {
|
||||||
previews.add(new Post.Preview(url, 0, 0));
|
previews.add(new Post.Preview(url, 0, 0, "", ""));
|
||||||
}
|
}
|
||||||
post.setPreviews(previews);
|
post.setPreviews(previews);
|
||||||
} else if (url.endsWith("gif")){
|
} else if (url.endsWith("gif")){
|
||||||
@ -490,7 +490,7 @@ public class ParsePost {
|
|||||||
spoiler, nsfw, stickied, archived, locked, saved, isCrosspost);
|
spoiler, nsfw, stickied, archived, locked, saved, isCrosspost);
|
||||||
|
|
||||||
if (previews.isEmpty()) {
|
if (previews.isEmpty()) {
|
||||||
previews.add(new Post.Preview(url, 0, 0));
|
previews.add(new Post.Preview(url, 0, 0, "", ""));
|
||||||
}
|
}
|
||||||
post.setPreviews(previews);
|
post.setPreviews(previews);
|
||||||
} else if (url.endsWith("mp4")) {
|
} else if (url.endsWith("mp4")) {
|
||||||
@ -559,11 +559,24 @@ public class ParsePost {
|
|||||||
galleryItemUrl = sourceObject.getString(JSONUtils.MP4_KEY);
|
galleryItemUrl = sourceObject.getString(JSONUtils.MP4_KEY);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
JSONObject galleryItem = galleryIdsArray.getJSONObject(i);
|
||||||
|
String galleryItemCaption = "";
|
||||||
|
String galleryItemCaptionUrl = "";
|
||||||
|
if(galleryItem.has(JSONUtils.CAPTION_KEY)){
|
||||||
|
galleryItemCaption = galleryItem.getString(JSONUtils.CAPTION_KEY).trim();
|
||||||
|
}
|
||||||
|
|
||||||
|
if(galleryItem.has(JSONUtils.CAPTION_URL_KEY)){
|
||||||
|
galleryItemCaptionUrl = galleryItem.getString(JSONUtils.CAPTION_URL_KEY).trim();
|
||||||
|
}
|
||||||
|
|
||||||
if ((previews.isEmpty()) && mimeType.contains("jpg") || mimeType.contains("png")) {
|
if ((previews.isEmpty()) && mimeType.contains("jpg") || mimeType.contains("png")) {
|
||||||
previews.add(new Post.Preview(galleryItemUrl, singleGalleryObject.getJSONObject(JSONUtils.S_KEY).getInt(JSONUtils.X_KEY),
|
previews.add(new Post.Preview(galleryItemUrl, singleGalleryObject.getJSONObject(JSONUtils.S_KEY).getInt(JSONUtils.X_KEY),
|
||||||
singleGalleryObject.getJSONObject(JSONUtils.S_KEY).getInt(JSONUtils.Y_KEY)));
|
singleGalleryObject.getJSONObject(JSONUtils.S_KEY).getInt(JSONUtils.Y_KEY), galleryItemCaption, galleryItemCaptionUrl));
|
||||||
}
|
}
|
||||||
gallery.add(new Post.Gallery(mimeType, galleryItemUrl, subredditName + "-" + galleryId + "." + mimeType.substring(mimeType.lastIndexOf("/") + 1)));
|
|
||||||
|
gallery.add(new Post.Gallery(mimeType, galleryItemUrl, subredditName + "-" + galleryId + "." + mimeType.substring(mimeType.lastIndexOf("/") + 1), galleryItemCaption, galleryItemCaptionUrl));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!gallery.isEmpty()) {
|
if (!gallery.isEmpty()) {
|
||||||
|
@ -582,8 +582,10 @@ public class Post implements Parcelable {
|
|||||||
public String url;
|
public String url;
|
||||||
public String fileName;
|
public String fileName;
|
||||||
public int mediaType;
|
public int mediaType;
|
||||||
|
public String caption;
|
||||||
|
public String captionUrl;
|
||||||
|
|
||||||
public Gallery(String mimeType, String url, String fileName) {
|
public Gallery(String mimeType, String url, String fileName, String caption, String captionUrl) {
|
||||||
this.mimeType = mimeType;
|
this.mimeType = mimeType;
|
||||||
this.url = url;
|
this.url = url;
|
||||||
this.fileName = fileName;
|
this.fileName = fileName;
|
||||||
@ -594,6 +596,8 @@ public class Post implements Parcelable {
|
|||||||
} else {
|
} else {
|
||||||
mediaType = TYPE_VIDEO;
|
mediaType = TYPE_VIDEO;
|
||||||
}
|
}
|
||||||
|
this.caption = caption;
|
||||||
|
this.captionUrl = captionUrl;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected Gallery(Parcel in) {
|
protected Gallery(Parcel in) {
|
||||||
@ -601,6 +605,8 @@ public class Post implements Parcelable {
|
|||||||
url = in.readString();
|
url = in.readString();
|
||||||
fileName = in.readString();
|
fileName = in.readString();
|
||||||
mediaType = in.readInt();
|
mediaType = in.readInt();
|
||||||
|
caption = in.readString();
|
||||||
|
captionUrl = in.readString();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static final Creator<Gallery> CREATOR = new Creator<Gallery>() {
|
public static final Creator<Gallery> CREATOR = new Creator<Gallery>() {
|
||||||
@ -626,6 +632,8 @@ public class Post implements Parcelable {
|
|||||||
parcel.writeString(url);
|
parcel.writeString(url);
|
||||||
parcel.writeString(fileName);
|
parcel.writeString(fileName);
|
||||||
parcel.writeInt(mediaType);
|
parcel.writeInt(mediaType);
|
||||||
|
parcel.writeString(caption);
|
||||||
|
parcel.writeString(captionUrl);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -633,17 +641,23 @@ public class Post implements Parcelable {
|
|||||||
private String previewUrl;
|
private String previewUrl;
|
||||||
private int previewWidth;
|
private int previewWidth;
|
||||||
private int previewHeight;
|
private int previewHeight;
|
||||||
|
private String previewCaption;
|
||||||
|
private String previewCaptionUrl;
|
||||||
|
|
||||||
public Preview(String previewUrl, int previewWidth, int previewHeight) {
|
public Preview(String previewUrl, int previewWidth, int previewHeight, String previewCaption, String previewCaptionUrl) {
|
||||||
this.previewUrl = previewUrl;
|
this.previewUrl = previewUrl;
|
||||||
this.previewWidth = previewWidth;
|
this.previewWidth = previewWidth;
|
||||||
this.previewHeight = previewHeight;
|
this.previewHeight = previewHeight;
|
||||||
|
this.previewCaption = previewCaption;
|
||||||
|
this.previewCaptionUrl = previewCaptionUrl;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected Preview(Parcel in) {
|
protected Preview(Parcel in) {
|
||||||
previewUrl = in.readString();
|
previewUrl = in.readString();
|
||||||
previewWidth = in.readInt();
|
previewWidth = in.readInt();
|
||||||
previewHeight = in.readInt();
|
previewHeight = in.readInt();
|
||||||
|
previewCaption = in.readString();
|
||||||
|
previewCaptionUrl = in.readString();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static final Creator<Preview> CREATOR = new Creator<Preview>() {
|
public static final Creator<Preview> CREATOR = new Creator<Preview>() {
|
||||||
@ -682,6 +696,18 @@ public class Post implements Parcelable {
|
|||||||
this.previewHeight = previewHeight;
|
this.previewHeight = previewHeight;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getPreviewCaption() {
|
||||||
|
return previewCaption;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPreviewCaption(String previewCaption) { this.previewCaption = previewCaption; }
|
||||||
|
|
||||||
|
public String getPreviewCaptionUrl() {
|
||||||
|
return previewCaptionUrl;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPreviewCaptionUrl(String previewCaptionUrl) { this.previewCaptionUrl = previewCaptionUrl; }
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int describeContents() {
|
public int describeContents() {
|
||||||
return 0;
|
return 0;
|
||||||
@ -692,6 +718,8 @@ public class Post implements Parcelable {
|
|||||||
parcel.writeString(previewUrl);
|
parcel.writeString(previewUrl);
|
||||||
parcel.writeInt(previewWidth);
|
parcel.writeInt(previewWidth);
|
||||||
parcel.writeInt(previewHeight);
|
parcel.writeInt(previewHeight);
|
||||||
|
parcel.writeString(previewCaption);
|
||||||
|
parcel.writeString(previewCaptionUrl);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -171,4 +171,6 @@ public class JSONUtils {
|
|||||||
public static final String DISPLAY_STRING_KEY = "display_string";
|
public static final String DISPLAY_STRING_KEY = "display_string";
|
||||||
public static final String RESULTS_KEY = "results";
|
public static final String RESULTS_KEY = "results";
|
||||||
public static final String CONTENT_MD_KEY = "content_md";
|
public static final String CONTENT_MD_KEY = "content_md";
|
||||||
|
public static final String CAPTION_KEY = "caption";
|
||||||
|
public static final String CAPTION_URL_KEY = "outbound_url";
|
||||||
}
|
}
|
||||||
|
@ -50,6 +50,48 @@
|
|||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:orientation="vertical">
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:id="@+id/caption_layout_view_reddit_gallery_image_or_gif_fragment"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:gravity="center_vertical"
|
||||||
|
android:orientation="vertical"
|
||||||
|
android:visibility="gone">
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/caption_text_view_view_reddit_gallery_image_or_gif_fragment"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="0dp"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:fontFamily="?attr/content_font_family"
|
||||||
|
android:gravity="center_vertical"
|
||||||
|
android:textColor="#FFFFFF"
|
||||||
|
android:textSize="?attr/content_font_default"
|
||||||
|
android:visibility="gone" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/caption_url_text_view_view_reddit_gallery_image_or_gif_fragment"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="0dp"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:autoLink="web"
|
||||||
|
android:ellipsize="end"
|
||||||
|
android:fontFamily="?attr/content_font_family"
|
||||||
|
android:gravity="center_vertical"
|
||||||
|
android:nestedScrollingEnabled="false"
|
||||||
|
android:textColor="#FFFFFF"
|
||||||
|
android:textColorLink="#FFFFFF"
|
||||||
|
android:textSize="?attr/content_font_default"
|
||||||
|
android:textStyle="bold"
|
||||||
|
android:visibility="gone" />
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:id="@+id/bottom_app_bar_menu_view_reddit_gallery_image_or_gif_fragment"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content">
|
android:layout_height="wrap_content">
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
@ -91,6 +133,7 @@
|
|||||||
android:padding="16dp"
|
android:padding="16dp"
|
||||||
android:src="@drawable/ic_wallpaper_white_24dp"
|
android:src="@drawable/ic_wallpaper_white_24dp"
|
||||||
android:background="?attr/selectableItemBackgroundBorderless" />
|
android:background="?attr/selectableItemBackgroundBorderless" />
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
|
@ -267,6 +267,60 @@
|
|||||||
android:src="@drawable/ic_link"
|
android:src="@drawable/ic_link"
|
||||||
android:visibility="gone" />
|
android:visibility="gone" />
|
||||||
|
|
||||||
|
<androidx.constraintlayout.widget.ConstraintLayout
|
||||||
|
android:id="@+id/caption_constraint_layout_item_post_detail_gallery"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:background="?attr/colorBackgroundFloating"
|
||||||
|
android:visibility="gone">
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/caption_text_view_item_post_detail_gallery"
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:ellipsize="marquee"
|
||||||
|
android:fontFamily="?attr/content_font_family"
|
||||||
|
android:gravity="start"
|
||||||
|
android:marqueeRepeatLimit="marquee_forever"
|
||||||
|
android:paddingLeft="8dp"
|
||||||
|
android:paddingRight="8dp"
|
||||||
|
android:singleLine="true"
|
||||||
|
android:scrollHorizontally="true"
|
||||||
|
android:focusable="true"
|
||||||
|
android:focusableInTouchMode="true"
|
||||||
|
android:textColor="?attr/primaryTextColor"
|
||||||
|
android:textSize="?attr/content_font_default"
|
||||||
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
|
app:layout_constraintEnd_toStartOf="@id/guideline4"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toTopOf="parent" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/caption_url_text_view_item_post_detail_gallery"
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:ellipsize="end"
|
||||||
|
android:fontFamily="?attr/content_font_family"
|
||||||
|
android:gravity="end"
|
||||||
|
android:maxLines="1"
|
||||||
|
android:paddingEnd="8dp"
|
||||||
|
android:scrollHorizontally="false"
|
||||||
|
android:textColor="?attr/primaryTextColor"
|
||||||
|
android:textSize="?attr/content_font_default"
|
||||||
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintStart_toEndOf="@id/guideline4"
|
||||||
|
app:layout_constraintTop_toTopOf="parent" />
|
||||||
|
|
||||||
|
<androidx.constraintlayout.widget.Guideline
|
||||||
|
android:id="@+id/guideline4"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:orientation="vertical"
|
||||||
|
app:layout_constraintGuide_percent="0.50" />
|
||||||
|
|
||||||
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||||
|
|
||||||
<androidx.constraintlayout.widget.ConstraintLayout
|
<androidx.constraintlayout.widget.ConstraintLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user