mirror of
https://codeberg.org/Bazsalanszky/Infinity-For-Lemmy.git
synced 2024-12-28 11:58:23 +01:00
Merge pull request #522 from scria1000/gallery-captions-feature
Initial support for gallery captions
This commit is contained in:
commit
e2964893da
@ -1,8 +1,15 @@
|
||||
package ml.docilealligator.infinityforreddit.activities;
|
||||
|
||||
import static androidx.appcompat.app.AppCompatDelegate.MODE_NIGHT_AUTO_BATTERY;
|
||||
import static androidx.appcompat.app.AppCompatDelegate.MODE_NIGHT_FOLLOW_SYSTEM;
|
||||
import static androidx.appcompat.app.AppCompatDelegate.MODE_NIGHT_NO;
|
||||
import static androidx.appcompat.app.AppCompatDelegate.MODE_NIGHT_YES;
|
||||
|
||||
import android.content.SharedPreferences;
|
||||
import android.content.res.Configuration;
|
||||
import android.graphics.drawable.ColorDrawable;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.os.Handler;
|
||||
import android.text.Html;
|
||||
@ -13,6 +20,7 @@ import android.widget.Toast;
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.appcompat.app.ActionBar;
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
import androidx.appcompat.app.AppCompatDelegate;
|
||||
import androidx.fragment.app.Fragment;
|
||||
import androidx.fragment.app.FragmentManager;
|
||||
import androidx.fragment.app.FragmentStatePagerAdapter;
|
||||
@ -32,6 +40,7 @@ import ml.docilealligator.infinityforreddit.Infinity;
|
||||
import ml.docilealligator.infinityforreddit.R;
|
||||
import ml.docilealligator.infinityforreddit.SetAsWallpaperCallback;
|
||||
import ml.docilealligator.infinityforreddit.WallpaperSetter;
|
||||
import ml.docilealligator.infinityforreddit.customtheme.CustomThemeWrapper;
|
||||
import ml.docilealligator.infinityforreddit.customviews.ViewPagerBugFixed;
|
||||
import ml.docilealligator.infinityforreddit.font.ContentFontFamily;
|
||||
import ml.docilealligator.infinityforreddit.font.ContentFontStyle;
|
||||
@ -53,15 +62,15 @@ public class ViewRedditGalleryActivity extends AppCompatActivity implements SetA
|
||||
HaulerView haulerView;
|
||||
@BindView(R.id.view_pager_view_reddit_gallery_activity)
|
||||
ViewPagerBugFixed viewPager;
|
||||
private SectionsPagerAdapter sectionsPagerAdapter;
|
||||
private ArrayList<Post.Gallery> gallery;
|
||||
private String subredditName;
|
||||
private boolean useBottomAppBar;
|
||||
@Inject
|
||||
@Named("default")
|
||||
SharedPreferences sharedPreferences;
|
||||
@Inject
|
||||
Executor executor;
|
||||
private SectionsPagerAdapter sectionsPagerAdapter;
|
||||
private ArrayList<Post.Gallery> gallery;
|
||||
private String subredditName;
|
||||
private boolean useBottomAppBar;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
@ -69,7 +78,37 @@ public class ViewRedditGalleryActivity extends AppCompatActivity implements SetA
|
||||
|
||||
((Infinity) getApplication()).getAppComponent().inject(this);
|
||||
|
||||
boolean systemDefault = Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q;
|
||||
int systemThemeType = Integer.parseInt(sharedPreferences.getString(SharedPreferencesUtils.THEME_KEY, "2"));
|
||||
switch (systemThemeType) {
|
||||
case 0:
|
||||
AppCompatDelegate.setDefaultNightMode(MODE_NIGHT_NO);
|
||||
getTheme().applyStyle(R.style.Theme_Normal, true);
|
||||
break;
|
||||
case 1:
|
||||
AppCompatDelegate.setDefaultNightMode(MODE_NIGHT_YES);
|
||||
if (sharedPreferences.getBoolean(SharedPreferencesUtils.AMOLED_DARK_KEY, false)) {
|
||||
getTheme().applyStyle(R.style.Theme_Normal_AmoledDark, true);
|
||||
} else {
|
||||
getTheme().applyStyle(R.style.Theme_Normal_NormalDark, true);
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
if (systemDefault) {
|
||||
AppCompatDelegate.setDefaultNightMode(MODE_NIGHT_FOLLOW_SYSTEM);
|
||||
} else {
|
||||
AppCompatDelegate.setDefaultNightMode(MODE_NIGHT_AUTO_BATTERY);
|
||||
}
|
||||
if ((getResources().getConfiguration().uiMode & Configuration.UI_MODE_NIGHT_MASK) == Configuration.UI_MODE_NIGHT_NO) {
|
||||
getTheme().applyStyle(R.style.Theme_Normal, true);
|
||||
} else {
|
||||
if (sharedPreferences.getBoolean(SharedPreferencesUtils.AMOLED_DARK_KEY, false)) {
|
||||
getTheme().applyStyle(R.style.Theme_Normal_AmoledDark, true);
|
||||
} else {
|
||||
getTheme().applyStyle(R.style.Theme_Normal_NormalDark, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
getTheme().applyStyle(FontStyle.valueOf(sharedPreferences
|
||||
.getString(SharedPreferencesUtils.FONT_SIZE_KEY, FontStyle.Normal.name())).getResId(), true);
|
||||
|
@ -131,7 +131,6 @@ public class PostDetailRecyclerViewAdapter extends RecyclerView.Adapter<Recycler
|
||||
private static final int VIEW_TYPE_POST_DETAIL_NO_PREVIEW_LINK = 6;
|
||||
private static final int VIEW_TYPE_POST_DETAIL_GALLERY = 7;
|
||||
private static final int VIEW_TYPE_POST_DETAIL_TEXT_TYPE = 8;
|
||||
|
||||
private AppCompatActivity mActivity;
|
||||
private ViewPostDetailFragment mFragment;
|
||||
private Executor mExecutor;
|
||||
@ -202,6 +201,7 @@ public class PostDetailRecyclerViewAdapter extends RecyclerView.Adapter<Recycler
|
||||
private int mDownvotedColor;
|
||||
private int mVoteAndReplyUnavailableVoteButtonColor;
|
||||
private int mPostIconAndInfoColor;
|
||||
private int mCommentColor;
|
||||
|
||||
private Drawable mCommentIcon;
|
||||
private float mScale;
|
||||
@ -380,6 +380,7 @@ public class PostDetailRecyclerViewAdapter extends RecyclerView.Adapter<Recycler
|
||||
mDownvotedColor = customThemeWrapper.getDownvoted();
|
||||
mVoteAndReplyUnavailableVoteButtonColor = customThemeWrapper.getVoteAndReplyUnavailableButtonColor();
|
||||
mPostIconAndInfoColor = customThemeWrapper.getPostIconAndInfoColor();
|
||||
mCommentColor = customThemeWrapper.getCommentColor();
|
||||
|
||||
mCommentIcon = activity.getDrawable(R.drawable.ic_comment_grey_24dp);
|
||||
if (mCommentIcon != null) {
|
||||
@ -768,6 +769,8 @@ public class PostDetailRecyclerViewAdapter extends RecyclerView.Adapter<Recycler
|
||||
.setRatio((float) preview.getPreviewHeight() / preview.getPreviewWidth());
|
||||
|
||||
loadImage((PostDetailGalleryViewHolder) holder, preview);
|
||||
|
||||
loadCaptionPreview((PostDetailGalleryViewHolder) holder, preview);
|
||||
} else {
|
||||
((PostDetailGalleryViewHolder) holder).mNoPreviewPostTypeImageView.setVisibility(View.VISIBLE);
|
||||
}
|
||||
@ -794,6 +797,29 @@ public class PostDetailRecyclerViewAdapter extends RecyclerView.Adapter<Recycler
|
||||
}
|
||||
}
|
||||
|
||||
private void loadCaptionPreview(PostDetailBaseViewHolder holder, Post.Preview preview) {
|
||||
if (holder instanceof PostDetailGalleryViewHolder) {
|
||||
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.setBackgroundColor(mCardViewColor & 0x0D000000); // Make 10% darker than CardViewColor
|
||||
((PostDetailGalleryViewHolder) holder).mCaptionConstraintLayout.setVisibility(View.VISIBLE);
|
||||
}
|
||||
if (!previewCaptionIsEmpty) {
|
||||
((PostDetailGalleryViewHolder) holder).mCaption.setTextColor(mCommentColor);
|
||||
((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));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Nullable
|
||||
private Post.Preview getSuitablePreview(ArrayList<Post.Preview> previews) {
|
||||
Post.Preview preview;
|
||||
@ -1485,6 +1511,7 @@ public class PostDetailRecyclerViewAdapter extends RecyclerView.Adapter<Recycler
|
||||
}
|
||||
|
||||
class PostDetailVideoAutoplayViewHolder extends PostDetailBaseViewHolder implements ToroPlayer {
|
||||
public FetchGfycatOrRedgifsVideoLinks fetchGfycatOrRedgifsVideoLinks;
|
||||
@BindView(R.id.icon_gif_image_view_item_post_detail_video_autoplay)
|
||||
AspectRatioGifImageView mIconGifImageView;
|
||||
@BindView(R.id.subreddit_text_view_item_post_detail_video_autoplay)
|
||||
@ -1541,12 +1568,10 @@ public class PostDetailRecyclerViewAdapter extends RecyclerView.Adapter<Recycler
|
||||
ImageView mSaveButton;
|
||||
@BindView(R.id.share_button_item_post_detail_video_autoplay)
|
||||
ImageView mShareButton;
|
||||
|
||||
@Nullable
|
||||
ExoPlayerViewHelper helper;
|
||||
private Uri mediaUri;
|
||||
private float volume;
|
||||
public FetchGfycatOrRedgifsVideoLinks fetchGfycatOrRedgifsVideoLinks;
|
||||
|
||||
public PostDetailVideoAutoplayViewHolder(@NonNull View itemView) {
|
||||
super(itemView);
|
||||
@ -2153,7 +2178,7 @@ public class PostDetailRecyclerViewAdapter extends RecyclerView.Adapter<Recycler
|
||||
intent.putExtra(ViewImageOrGifActivity.EXTRA_POST_TITLE_KEY, mPost.getTitle());
|
||||
intent.putExtra(ViewImageOrGifActivity.EXTRA_SUBREDDIT_OR_USERNAME_KEY, mPost.getSubredditName());
|
||||
mActivity.startActivity(intent);
|
||||
} else if (mPost.getPostType() == Post.GIF_TYPE){
|
||||
} else if (mPost.getPostType() == Post.GIF_TYPE) {
|
||||
Intent intent = new Intent(mActivity, ViewImageOrGifActivity.class);
|
||||
intent.putExtra(ViewImageOrGifActivity.EXTRA_FILE_NAME_KEY, mPost.getSubredditName()
|
||||
+ "-" + mPost.getId() + ".gif");
|
||||
@ -2221,6 +2246,12 @@ public class PostDetailRecyclerViewAdapter extends RecyclerView.Adapter<Recycler
|
||||
ImageView videoOrGifIndicatorImageView;
|
||||
@BindView(R.id.image_view_item_post_detail_gallery)
|
||||
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)
|
||||
ImageView mNoPreviewPostTypeImageView;
|
||||
@BindView(R.id.bottom_constraint_layout_item_post_detail_gallery)
|
||||
|
@ -73,8 +73,10 @@ import ml.docilealligator.infinityforreddit.SaveMemoryCenterInisdeDownsampleStra
|
||||
import ml.docilealligator.infinityforreddit.R;
|
||||
import ml.docilealligator.infinityforreddit.SaveThing;
|
||||
import ml.docilealligator.infinityforreddit.VoteThing;
|
||||
import ml.docilealligator.infinityforreddit.activities.BaseActivity;
|
||||
import ml.docilealligator.infinityforreddit.activities.FilteredPostsActivity;
|
||||
import ml.docilealligator.infinityforreddit.activities.LinkResolverActivity;
|
||||
import ml.docilealligator.infinityforreddit.activities.SearchResultActivity;
|
||||
import ml.docilealligator.infinityforreddit.activities.ViewImageOrGifActivity;
|
||||
import ml.docilealligator.infinityforreddit.activities.ViewPostDetailActivity;
|
||||
import ml.docilealligator.infinityforreddit.activities.ViewRedditGalleryActivity;
|
||||
|
@ -10,6 +10,8 @@ import android.net.Uri;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.os.Handler;
|
||||
import android.text.TextUtils;
|
||||
import android.text.util.Linkify;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.Menu;
|
||||
import android.view.MenuInflater;
|
||||
@ -52,6 +54,7 @@ import javax.inject.Inject;
|
||||
|
||||
import butterknife.BindView;
|
||||
import butterknife.ButterKnife;
|
||||
import me.saket.bettermovementmethod.BetterLinkMovementMethod;
|
||||
import ml.docilealligator.infinityforreddit.BuildConfig;
|
||||
import ml.docilealligator.infinityforreddit.Infinity;
|
||||
import ml.docilealligator.infinityforreddit.R;
|
||||
@ -59,9 +62,12 @@ import ml.docilealligator.infinityforreddit.SetAsWallpaperCallback;
|
||||
import ml.docilealligator.infinityforreddit.activities.ViewRedditGalleryActivity;
|
||||
import ml.docilealligator.infinityforreddit.asynctasks.SaveBitmapImageToFile;
|
||||
import ml.docilealligator.infinityforreddit.asynctasks.SaveGIFToFile;
|
||||
import ml.docilealligator.infinityforreddit.bottomsheetfragments.CopyTextBottomSheetFragment;
|
||||
import ml.docilealligator.infinityforreddit.bottomsheetfragments.SetAsWallpaperBottomSheetFragment;
|
||||
import ml.docilealligator.infinityforreddit.bottomsheetfragments.UrlMenuBottomSheetFragment;
|
||||
import ml.docilealligator.infinityforreddit.post.Post;
|
||||
import ml.docilealligator.infinityforreddit.services.DownloadMediaService;
|
||||
import ml.docilealligator.infinityforreddit.utils.Utils;
|
||||
|
||||
public class ViewRedditGalleryImageOrGifFragment extends Fragment {
|
||||
|
||||
@ -79,6 +85,14 @@ public class ViewRedditGalleryImageOrGifFragment extends Fragment {
|
||||
LinearLayout errorLinearLayout;
|
||||
@BindView(R.id.bottom_navigation_view_reddit_gallery_image_or_gif_fragment)
|
||||
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)
|
||||
TextView titleTextView;
|
||||
@BindView(R.id.download_image_view_view_reddit_gallery_image_or_gif_fragment)
|
||||
@ -96,6 +110,7 @@ public class ViewRedditGalleryImageOrGifFragment extends Fragment {
|
||||
private String subredditName;
|
||||
private boolean isDownloading = false;
|
||||
private boolean isActionBarHidden = false;
|
||||
private boolean isUseBottomCaption = false;
|
||||
|
||||
public ViewRedditGalleryImageOrGifFragment() {
|
||||
// Required empty public constructor
|
||||
@ -182,24 +197,16 @@ public class ViewRedditGalleryImageOrGifFragment extends Fragment {
|
||||
| View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
|
||||
| View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN);
|
||||
isActionBarHidden = false;
|
||||
if (activity.isUseBottomAppBar()) {
|
||||
if (activity.isUseBottomAppBar() || isUseBottomCaption) {
|
||||
bottomAppBar.setVisibility(View.VISIBLE);
|
||||
}
|
||||
} else {
|
||||
activity.getWindow().getDecorView().setSystemUiVisibility(
|
||||
View.SYSTEM_UI_FLAG_LAYOUT_STABLE
|
||||
| View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
|
||||
| View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
|
||||
| View.SYSTEM_UI_FLAG_HIDE_NAVIGATION
|
||||
| View.SYSTEM_UI_FLAG_FULLSCREEN
|
||||
| View.SYSTEM_UI_FLAG_IMMERSIVE);
|
||||
isActionBarHidden = true;
|
||||
if (activity.isUseBottomAppBar()) {
|
||||
bottomAppBar.setVisibility(View.GONE);
|
||||
}
|
||||
hideAppBar();
|
||||
}
|
||||
});
|
||||
|
||||
captionLayout.setOnClickListener(view -> hideAppBar());
|
||||
|
||||
errorLinearLayout.setOnClickListener(view -> {
|
||||
progressBar.setVisibility(View.VISIBLE);
|
||||
errorLinearLayout.setVisibility(View.GONE);
|
||||
@ -234,9 +241,81 @@ public class ViewRedditGalleryImageOrGifFragment extends Fragment {
|
||||
});
|
||||
}
|
||||
|
||||
String caption = media.caption;
|
||||
String captionUrl = media.captionUrl;
|
||||
boolean captionIsEmpty = TextUtils.isEmpty(caption);
|
||||
boolean captionUrlIsEmpty = TextUtils.isEmpty(captionUrl);
|
||||
if (!captionIsEmpty || !captionUrlIsEmpty) {
|
||||
isUseBottomCaption = true;
|
||||
|
||||
if (!activity.isUseBottomAppBar()) {
|
||||
bottomAppBar.setVisibility(View.VISIBLE);
|
||||
bottomAppBarMenu.setVisibility(View.GONE);
|
||||
|
||||
captionLayout.setPadding(0, captionLayout.getPaddingTop(), 0, (int) Utils.convertDpToPixel(16, activity));
|
||||
}
|
||||
|
||||
captionLayout.setVisibility(View.VISIBLE);
|
||||
|
||||
if (!captionIsEmpty) {
|
||||
captionTextView.setVisibility(View.VISIBLE);
|
||||
captionTextView.setText(caption);
|
||||
captionTextView.setOnClickListener(view -> hideAppBar());
|
||||
captionTextView.setOnLongClickListener(view -> {
|
||||
if (activity != null
|
||||
&& !activity.isDestroyed()
|
||||
&& !activity.isFinishing()
|
||||
&& captionTextView.getSelectionStart() == -1
|
||||
&& captionTextView.getSelectionEnd() == -1) {
|
||||
Bundle bundle = new Bundle();
|
||||
bundle.putString(CopyTextBottomSheetFragment.EXTRA_RAW_TEXT, caption);
|
||||
CopyTextBottomSheetFragment copyTextBottomSheetFragment = new CopyTextBottomSheetFragment();
|
||||
copyTextBottomSheetFragment.setArguments(bundle);
|
||||
copyTextBottomSheetFragment.show(activity.getSupportFragmentManager(), copyTextBottomSheetFragment.getTag());
|
||||
}
|
||||
return true;
|
||||
});
|
||||
}
|
||||
if (!captionUrlIsEmpty) {
|
||||
String scheme = Uri.parse(captionUrl).getScheme();
|
||||
String urlWithoutScheme = "";
|
||||
if(!TextUtils.isEmpty(scheme)){
|
||||
urlWithoutScheme = captionUrl.substring(scheme.length() + 3);
|
||||
}
|
||||
|
||||
captionUrlTextView.setText(TextUtils.isEmpty(urlWithoutScheme) ? captionUrl : urlWithoutScheme);
|
||||
|
||||
BetterLinkMovementMethod.linkify(Linkify.WEB_URLS, captionUrlTextView).setOnLinkLongClickListener((textView, url) -> {
|
||||
if (activity != null && !activity.isDestroyed() && !activity.isFinishing()) {
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
return rootView;
|
||||
}
|
||||
|
||||
private void hideAppBar() {
|
||||
activity.getWindow().getDecorView().setSystemUiVisibility(
|
||||
View.SYSTEM_UI_FLAG_LAYOUT_STABLE
|
||||
| View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
|
||||
| View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
|
||||
| View.SYSTEM_UI_FLAG_HIDE_NAVIGATION
|
||||
| View.SYSTEM_UI_FLAG_FULLSCREEN
|
||||
| View.SYSTEM_UI_FLAG_IMMERSIVE);
|
||||
isActionBarHidden = true;
|
||||
if (activity.isUseBottomAppBar() || isUseBottomCaption) {
|
||||
bottomAppBar.setVisibility(View.GONE);
|
||||
}
|
||||
}
|
||||
|
||||
private void loadImage() {
|
||||
imageView.showImage(Uri.parse(media.url));
|
||||
}
|
||||
@ -296,7 +375,7 @@ public class ViewRedditGalleryImageOrGifFragment extends Fragment {
|
||||
|
||||
Intent intent = new Intent(activity, DownloadMediaService.class);
|
||||
intent.putExtra(DownloadMediaService.EXTRA_URL, media.url);
|
||||
intent.putExtra(DownloadMediaService.EXTRA_MEDIA_TYPE, media.mediaType == Post.Gallery.TYPE_GIF ? DownloadMediaService.EXTRA_MEDIA_TYPE_GIF: DownloadMediaService.EXTRA_MEDIA_TYPE_IMAGE);
|
||||
intent.putExtra(DownloadMediaService.EXTRA_MEDIA_TYPE, media.mediaType == Post.Gallery.TYPE_GIF ? DownloadMediaService.EXTRA_MEDIA_TYPE_GIF : DownloadMediaService.EXTRA_MEDIA_TYPE_IMAGE);
|
||||
intent.putExtra(DownloadMediaService.EXTRA_FILE_NAME, media.fileName);
|
||||
intent.putExtra(DownloadMediaService.EXTRA_SUBREDDIT_NAME, subredditName);
|
||||
ContextCompat.startForegroundService(activity, intent);
|
||||
|
@ -98,7 +98,7 @@ public class FetchRemovedPost {
|
||||
previews.set(0, preview);
|
||||
}
|
||||
} 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"));
|
||||
ArrayList<Post.Preview> newPreviews = new ArrayList<>();
|
||||
newPreviews.add(preview);
|
||||
|
@ -209,7 +209,7 @@ public class ParsePost {
|
||||
String previewUrl = images.getJSONObject(JSONUtils.SOURCE_KEY).getString(JSONUtils.URL_KEY);
|
||||
int previewWidth = images.getJSONObject(JSONUtils.SOURCE_KEY).getInt(JSONUtils.WIDTH_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);
|
||||
for (int i = 0; i < thumbnailPreviews.length(); i++) {
|
||||
@ -218,7 +218,7 @@ public class ParsePost {
|
||||
int thumbnailPreviewWidth = thumbnailPreview.getInt(JSONUtils.WIDTH_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)) {
|
||||
@ -301,7 +301,7 @@ public class ParsePost {
|
||||
spoiler, nsfw, stickied, archived, locked, saved, isCrosspost);
|
||||
|
||||
if (previews.isEmpty()) {
|
||||
previews.add(new Post.Preview(url, 0, 0));
|
||||
previews.add(new Post.Preview(url, 0, 0, "", ""));
|
||||
}
|
||||
post.setPreviews(previews);
|
||||
} else {
|
||||
@ -341,7 +341,7 @@ public class ParsePost {
|
||||
String previewUrl = images.getJSONObject(JSONUtils.SOURCE_KEY).getString(JSONUtils.URL_KEY);
|
||||
int previewWidth = images.getJSONObject(JSONUtils.SOURCE_KEY).getInt(JSONUtils.WIDTH_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);
|
||||
for (int i = 0; i < thumbnailPreviews.length(); i++) {
|
||||
@ -350,7 +350,7 @@ public class ParsePost {
|
||||
int thumbnailPreviewWidth = thumbnailPreview.getInt(JSONUtils.WIDTH_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);
|
||||
|
||||
if (previews.isEmpty()) {
|
||||
previews.add(new Post.Preview(url, 0, 0));
|
||||
previews.add(new Post.Preview(url, 0, 0, "", ""));
|
||||
}
|
||||
post.setPreviews(previews);
|
||||
} else if (url.endsWith("gif")){
|
||||
@ -490,7 +490,7 @@ public class ParsePost {
|
||||
spoiler, nsfw, stickied, archived, locked, saved, isCrosspost);
|
||||
|
||||
if (previews.isEmpty()) {
|
||||
previews.add(new Post.Preview(url, 0, 0));
|
||||
previews.add(new Post.Preview(url, 0, 0, "", ""));
|
||||
}
|
||||
post.setPreviews(previews);
|
||||
} else if (url.endsWith("mp4")) {
|
||||
@ -559,11 +559,24 @@ public class ParsePost {
|
||||
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")) {
|
||||
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()) {
|
||||
|
@ -582,8 +582,10 @@ public class Post implements Parcelable {
|
||||
public String url;
|
||||
public String fileName;
|
||||
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.url = url;
|
||||
this.fileName = fileName;
|
||||
@ -594,6 +596,8 @@ public class Post implements Parcelable {
|
||||
} else {
|
||||
mediaType = TYPE_VIDEO;
|
||||
}
|
||||
this.caption = caption;
|
||||
this.captionUrl = captionUrl;
|
||||
}
|
||||
|
||||
protected Gallery(Parcel in) {
|
||||
@ -601,6 +605,8 @@ public class Post implements Parcelable {
|
||||
url = in.readString();
|
||||
fileName = in.readString();
|
||||
mediaType = in.readInt();
|
||||
caption = in.readString();
|
||||
captionUrl = in.readString();
|
||||
}
|
||||
|
||||
public static final Creator<Gallery> CREATOR = new Creator<Gallery>() {
|
||||
@ -626,6 +632,8 @@ public class Post implements Parcelable {
|
||||
parcel.writeString(url);
|
||||
parcel.writeString(fileName);
|
||||
parcel.writeInt(mediaType);
|
||||
parcel.writeString(caption);
|
||||
parcel.writeString(captionUrl);
|
||||
}
|
||||
}
|
||||
|
||||
@ -633,17 +641,23 @@ public class Post implements Parcelable {
|
||||
private String previewUrl;
|
||||
private int previewWidth;
|
||||
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.previewWidth = previewWidth;
|
||||
this.previewHeight = previewHeight;
|
||||
this.previewCaption = previewCaption;
|
||||
this.previewCaptionUrl = previewCaptionUrl;
|
||||
}
|
||||
|
||||
protected Preview(Parcel in) {
|
||||
previewUrl = in.readString();
|
||||
previewWidth = in.readInt();
|
||||
previewHeight = in.readInt();
|
||||
previewCaption = in.readString();
|
||||
previewCaptionUrl = in.readString();
|
||||
}
|
||||
|
||||
public static final Creator<Preview> CREATOR = new Creator<Preview>() {
|
||||
@ -682,6 +696,18 @@ public class Post implements Parcelable {
|
||||
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
|
||||
public int describeContents() {
|
||||
return 0;
|
||||
@ -692,6 +718,8 @@ public class Post implements Parcelable {
|
||||
parcel.writeString(previewUrl);
|
||||
parcel.writeInt(previewWidth);
|
||||
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 RESULTS_KEY = "results";
|
||||
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";
|
||||
}
|
||||
|
@ -1,7 +1,7 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.coordinatorlayout.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:id="@+id/constraintLayout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
@ -29,68 +29,110 @@
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:drawableTop="@drawable/ic_error_outline_white_24dp"
|
||||
android:layout_gravity="center"
|
||||
android:drawableTop="@drawable/ic_error_outline_white_24dp"
|
||||
android:fontFamily="?attr/font_family"
|
||||
android:gravity="center"
|
||||
android:textColor="@android:color/white"
|
||||
android:text="@string/error_loading_image_tap_to_retry"
|
||||
android:textSize="?attr/font_default"
|
||||
android:fontFamily="?attr/font_family" />
|
||||
android:textColor="@android:color/white"
|
||||
android:textSize="?attr/font_default" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<com.google.android.material.bottomappbar.BottomAppBar
|
||||
android:id="@+id/bottom_navigation_view_reddit_gallery_image_or_gif_fragment"
|
||||
style="@style/Widget.MaterialComponents.BottomAppBar"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="bottom"
|
||||
android:backgroundTint="#80000000"
|
||||
android:visibility="gone"
|
||||
style="@style/Widget.MaterialComponents.BottomAppBar">
|
||||
android:visibility="gone">
|
||||
|
||||
<LinearLayout
|
||||
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="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center_vertical"
|
||||
android:orientation="vertical"
|
||||
android:paddingTop="8dp"
|
||||
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="wrap_content"
|
||||
android:ellipsize="end"
|
||||
android:fontFamily="?attr/content_font_family"
|
||||
android:maxLength="180"
|
||||
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:ellipsize="end"
|
||||
android:fontFamily="?attr/content_font_family"
|
||||
android:maxLength="180"
|
||||
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">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/title_text_view_view_reddit_gallery_image_or_gif_fragment"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:layout_weight="1"
|
||||
android:ellipsize="end"
|
||||
android:fontFamily="?attr/font_family"
|
||||
android:gravity="center_vertical"
|
||||
android:maxLines="1"
|
||||
android:paddingTop="8dp"
|
||||
android:paddingBottom="8dp"
|
||||
android:textColor="#FFFFFF"
|
||||
android:textSize="?attr/font_20"
|
||||
android:fontFamily="?attr/font_family"
|
||||
android:maxLines="1"
|
||||
android:ellipsize="end" />
|
||||
android:textSize="?attr/font_20" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/download_image_view_view_reddit_gallery_image_or_gif_fragment"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="?attr/selectableItemBackgroundBorderless"
|
||||
android:padding="16dp"
|
||||
android:src="@drawable/ic_file_download_toolbar_white_24dp"
|
||||
android:background="?attr/selectableItemBackgroundBorderless" />
|
||||
android:src="@drawable/ic_file_download_toolbar_white_24dp" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/share_image_view_view_reddit_gallery_image_or_gif_fragment"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="?attr/selectableItemBackgroundBorderless"
|
||||
android:padding="16dp"
|
||||
android:src="@drawable/ic_share_toolbar_white_24dp"
|
||||
android:background="?attr/selectableItemBackgroundBorderless" />
|
||||
android:src="@drawable/ic_share_toolbar_white_24dp" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/wallpaper_image_view_view_reddit_gallery_image_or_gif_fragment"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginEnd="16dp"
|
||||
android:background="?attr/selectableItemBackgroundBorderless"
|
||||
android:padding="16dp"
|
||||
android:src="@drawable/ic_wallpaper_white_24dp"
|
||||
android:background="?attr/selectableItemBackgroundBorderless" />
|
||||
android:src="@drawable/ic_wallpaper_white_24dp" />
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
|
@ -1,11 +1,11 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:orientation="vertical"
|
||||
android:background="?attr/cardViewBackgroundColor">
|
||||
android:background="?attr/cardViewBackgroundColor"
|
||||
android:orientation="vertical">
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:id="@+id/constraint_layout_item_post_detail_gallery"
|
||||
@ -27,13 +27,13 @@
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="16dp"
|
||||
android:layout_marginEnd="8dp"
|
||||
android:textSize="?attr/font_default"
|
||||
android:fontFamily="?attr/font_family"
|
||||
app:layout_constraintStart_toEndOf="@+id/icon_gif_image_view_item_post_detail_gallery"
|
||||
android:textSize="?attr/font_default"
|
||||
app:layout_constrainedWidth="true"
|
||||
app:layout_constraintEnd_toStartOf="@id/guideline"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintHorizontal_bias="0"
|
||||
app:layout_constrainedWidth="true" />
|
||||
app:layout_constraintStart_toEndOf="@+id/icon_gif_image_view_item_post_detail_gallery"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/user_text_view_item_post_detail_gallery"
|
||||
@ -41,14 +41,14 @@
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="16dp"
|
||||
android:layout_marginEnd="8dp"
|
||||
android:textSize="?attr/font_default"
|
||||
android:fontFamily="?attr/font_family"
|
||||
android:textSize="?attr/font_default"
|
||||
app:layout_constrainedWidth="true"
|
||||
app:layout_constraintBottom_toTopOf="@+id/author_flair_text_view_item_post_detail_gallery"
|
||||
app:layout_constraintStart_toEndOf="@+id/icon_gif_image_view_item_post_detail_gallery"
|
||||
app:layout_constraintEnd_toStartOf="@id/guideline"
|
||||
app:layout_constraintTop_toBottomOf="@+id/subreddit_text_view_item_post_detail_gallery"
|
||||
app:layout_constraintHorizontal_bias="0"
|
||||
app:layout_constrainedWidth="true" />
|
||||
app:layout_constraintStart_toEndOf="@+id/icon_gif_image_view_item_post_detail_gallery"
|
||||
app:layout_constraintTop_toBottomOf="@+id/subreddit_text_view_item_post_detail_gallery" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/author_flair_text_view_item_post_detail_gallery"
|
||||
@ -56,28 +56,28 @@
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="16dp"
|
||||
android:layout_marginEnd="8dp"
|
||||
android:textSize="?attr/font_12"
|
||||
android:fontFamily="?attr/font_family"
|
||||
android:textSize="?attr/font_12"
|
||||
android:visibility="gone"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintStart_toEndOf="@+id/icon_gif_image_view_item_post_detail_gallery"
|
||||
app:layout_constraintEnd_toStartOf="@id/guideline"
|
||||
app:layout_constraintTop_toBottomOf="@+id/user_text_view_item_post_detail_gallery"
|
||||
app:layout_constraintHorizontal_bias="0"
|
||||
app:layout_constrainedWidth="true"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toStartOf="@id/guideline"
|
||||
app:layout_constraintHorizontal_bias="0"
|
||||
app:layout_constraintStart_toEndOf="@+id/icon_gif_image_view_item_post_detail_gallery"
|
||||
app:layout_constraintTop_toBottomOf="@+id/user_text_view_item_post_detail_gallery"
|
||||
tools:visibility="visible" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/post_time_text_view_item_post_detail_gallery"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:fontFamily="?attr/font_family"
|
||||
android:gravity="end"
|
||||
android:textSize="?attr/font_default"
|
||||
android:fontFamily="?attr/font_family"
|
||||
app:layout_constraintHorizontal_bias="1"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintStart_toEndOf="@id/guideline"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintHorizontal_bias="1"
|
||||
app:layout_constraintStart_toEndOf="@id/guideline"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<androidx.constraintlayout.widget.Guideline
|
||||
@ -93,15 +93,15 @@
|
||||
android:id="@+id/title_text_view_item_post_detail_gallery"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:enabled="true"
|
||||
android:focusable="true"
|
||||
android:fontFamily="?attr/title_font_family"
|
||||
android:longClickable="true"
|
||||
android:paddingStart="16dp"
|
||||
android:paddingEnd="16dp"
|
||||
android:textColor="?attr/primaryTextColor"
|
||||
android:textSize="?attr/title_font_18"
|
||||
android:fontFamily="?attr/title_font_family"
|
||||
android:textIsSelectable="true"
|
||||
android:enabled="true"
|
||||
android:focusable="true"
|
||||
android:longClickable="true" />
|
||||
android:textSize="?attr/title_font_18" />
|
||||
|
||||
<com.nex3z.flowlayout.FlowLayout
|
||||
android:layout_width="match_parent"
|
||||
@ -116,10 +116,10 @@
|
||||
android:id="@+id/type_text_view_item_post_detail_gallery"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:fontFamily="?attr/font_family"
|
||||
android:padding="4dp"
|
||||
android:text="@string/gallery"
|
||||
android:textSize="?attr/font_12"
|
||||
android:fontFamily="?attr/font_family"
|
||||
app:lib_setRadius="6dp"
|
||||
app:lib_setRoundedView="true"
|
||||
app:lib_setShape="rectangle" />
|
||||
@ -129,10 +129,10 @@
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:text="@string/spoiler"
|
||||
android:textSize="?attr/font_12"
|
||||
android:fontFamily="?attr/font_family"
|
||||
android:padding="4dp"
|
||||
android:text="@string/spoiler"
|
||||
android:textSize="?attr/font_12"
|
||||
android:visibility="gone"
|
||||
app:lib_setRadius="6dp"
|
||||
app:lib_setRoundedView="true"
|
||||
@ -142,10 +142,10 @@
|
||||
android:id="@+id/nsfw_text_view_item_post_detail_gallery"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:fontFamily="?attr/font_family"
|
||||
android:padding="4dp"
|
||||
android:text="@string/nsfw"
|
||||
android:textSize="?attr/font_12"
|
||||
android:fontFamily="?attr/font_family"
|
||||
android:visibility="gone"
|
||||
app:lib_setRadius="6dp"
|
||||
app:lib_setRoundedView="true"
|
||||
@ -156,9 +156,9 @@
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:fontFamily="?attr/font_family"
|
||||
android:padding="4dp"
|
||||
android:textSize="?attr/font_12"
|
||||
android:fontFamily="?attr/font_family"
|
||||
android:visibility="gone"
|
||||
app:lib_setRadius="6dp"
|
||||
app:lib_setRoundedView="true"
|
||||
@ -168,8 +168,8 @@
|
||||
android:id="@+id/upvote_ratio_text_view_item_post_detail_gallery"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textSize="?attr/font_12"
|
||||
android:fontFamily="?attr/font_family" />
|
||||
android:fontFamily="?attr/font_family"
|
||||
android:textSize="?attr/font_12" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/archived_image_view_item_post_detail_gallery"
|
||||
@ -196,8 +196,8 @@
|
||||
android:id="@+id/awards_text_view_item_post_detail_gallery"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textSize="?attr/font_12"
|
||||
android:fontFamily="?attr/font_family"
|
||||
android:textSize="?attr/font_12"
|
||||
android:visibility="gone" />
|
||||
|
||||
</com.nex3z.flowlayout.FlowLayout>
|
||||
@ -223,10 +223,10 @@
|
||||
android:id="@+id/video_or_gif_indicator_image_view_item_post_detail"
|
||||
android:layout_width="36dp"
|
||||
android:layout_height="36dp"
|
||||
android:layout_margin="16dp"
|
||||
android:layout_gravity="start"
|
||||
android:scaleType="center"
|
||||
android:layout_margin="16dp"
|
||||
android:background="@drawable/play_button_round_background"
|
||||
android:scaleType="center"
|
||||
android:src="@drawable/ic_gallery_24dp" />
|
||||
|
||||
</FrameLayout>
|
||||
@ -247,12 +247,12 @@
|
||||
android:id="@+id/load_image_error_text_view_item_post_detail_gallery"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:drawableTop="@drawable/ic_error_outline_black_24dp"
|
||||
android:layout_centerInParent="true"
|
||||
android:drawableTop="@drawable/ic_error_outline_black_24dp"
|
||||
android:fontFamily="?attr/font_family"
|
||||
android:gravity="center"
|
||||
android:text="@string/error_loading_image_tap_to_retry"
|
||||
android:textSize="?attr/font_default"
|
||||
android:fontFamily="?attr/font_family"
|
||||
android:visibility="gone" />
|
||||
|
||||
</RelativeLayout>
|
||||
@ -268,89 +268,145 @@
|
||||
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:id="@+id/bottom_constraint_layout_item_post_detail_gallery">
|
||||
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:focusable="true"
|
||||
android:focusableInTouchMode="true"
|
||||
android:fontFamily="?attr/content_font_family"
|
||||
android:gravity="start"
|
||||
android:marqueeRepeatLimit="marquee_forever"
|
||||
android:paddingHorizontal="8dp"
|
||||
android:scrollHorizontally="true"
|
||||
android:singleLine="true"
|
||||
android:textColor="?attr/primaryTextColor"
|
||||
android:textSize="?attr/content_font_default"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toStartOf="@id/caption_url_text_view_item_post_detail_gallery"
|
||||
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="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:ellipsize="end"
|
||||
android:fontFamily="?attr/content_font_family"
|
||||
android:gravity="end"
|
||||
android:isScrollContainer="false"
|
||||
android:maxLines="1"
|
||||
android:paddingEnd="8dp"
|
||||
android:scrollHorizontally="false"
|
||||
android:textColor="?attr/primaryTextColor"
|
||||
android:textSize="?attr/content_font_default"
|
||||
app:layout_constrainedWidth="true"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintHorizontal_bias="1"
|
||||
app:layout_constraintLeft_toRightOf="@id/guideline4"
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<androidx.constraintlayout.widget.Guideline
|
||||
android:id="@+id/guideline4"
|
||||
android:layout_width="1dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
app:layout_constraintGuide_percent="0.50" />
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:id="@+id/bottom_constraint_layout_item_post_detail_gallery"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/plus_button_item_post_detail_gallery"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:padding="12dp"
|
||||
android:src="@drawable/ic_arrow_upward_grey_24dp"
|
||||
android:background="?actionBarItemBackground"
|
||||
android:clickable="true"
|
||||
android:focusable="true"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
android:padding="12dp"
|
||||
android:src="@drawable/ic_arrow_upward_grey_24dp"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent" />
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/score_text_view_item_post_detail_gallery"
|
||||
android:layout_width="64dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:fontFamily="?attr/font_family"
|
||||
android:gravity="center"
|
||||
android:textSize="?attr/font_12"
|
||||
android:textStyle="bold"
|
||||
android:fontFamily="?attr/font_family"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintStart_toEndOf="@id/plus_button_item_post_detail_gallery" />
|
||||
app:layout_constraintStart_toEndOf="@id/plus_button_item_post_detail_gallery"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/minus_button_item_post_detail_gallery"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:padding="12dp"
|
||||
android:src="@drawable/ic_arrow_downward_grey_24dp"
|
||||
android:background="?actionBarItemBackground"
|
||||
android:clickable="true"
|
||||
android:focusable="true"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
android:padding="12dp"
|
||||
android:src="@drawable/ic_arrow_downward_grey_24dp"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintStart_toEndOf="@id/score_text_view_item_post_detail_gallery" />
|
||||
app:layout_constraintStart_toEndOf="@id/score_text_view_item_post_detail_gallery"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/comments_count_item_post_detail_gallery"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:padding="12dp"
|
||||
android:gravity="center_vertical"
|
||||
android:textSize="?attr/font_12"
|
||||
android:textStyle="bold"
|
||||
android:fontFamily="?attr/font_family"
|
||||
android:drawableStart="@drawable/ic_comment_grey_24dp"
|
||||
android:drawablePadding="12dp"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
android:fontFamily="?attr/font_family"
|
||||
android:gravity="center_vertical"
|
||||
android:padding="12dp"
|
||||
android:textSize="?attr/font_12"
|
||||
android:textStyle="bold"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintStart_toEndOf="@id/minus_button_item_post_detail_gallery" />
|
||||
app:layout_constraintStart_toEndOf="@id/minus_button_item_post_detail_gallery"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/save_button_item_post_detail_gallery"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:padding="12dp"
|
||||
android:background="?actionBarItemBackground"
|
||||
android:clickable="true"
|
||||
android:focusable="true"
|
||||
app:layout_constraintHorizontal_bias="1"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
android:padding="12dp"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toStartOf="@id/share_button_item_post_detail_gallery"
|
||||
app:layout_constraintHorizontal_bias="1"
|
||||
app:layout_constraintStart_toEndOf="@id/comments_count_item_post_detail_gallery"
|
||||
app:layout_constraintEnd_toStartOf="@id/share_button_item_post_detail_gallery" />
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/share_button_item_post_detail_gallery"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:padding="12dp"
|
||||
android:src="@drawable/ic_share_grey_24dp"
|
||||
android:background="?actionBarItemBackground"
|
||||
android:clickable="true"
|
||||
android:focusable="true"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
android:padding="12dp"
|
||||
android:src="@drawable/ic_share_grey_24dp"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent" />
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user