aboutsummaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authorAlex Ning <chineseperson5@gmail.com>2020-05-07 06:05:33 +0000
committerAlex Ning <chineseperson5@gmail.com>2020-05-07 06:05:33 +0000
commite439b840957030cdce7b310b595cfa9add844422 (patch)
treeb247873e90f1671cdceefb3a054c328ffe90d30e /app
parenteefc8e869d74721ffd41bd7295ae88228a7cca1e (diff)
downloadinfinity-for-reddit-e439b840957030cdce7b310b595cfa9add844422.tar
infinity-for-reddit-e439b840957030cdce7b310b595cfa9add844422.tar.gz
infinity-for-reddit-e439b840957030cdce7b310b595cfa9add844422.tar.bz2
infinity-for-reddit-e439b840957030cdce7b310b595cfa9add844422.tar.lz
infinity-for-reddit-e439b840957030cdce7b310b595cfa9add844422.tar.xz
infinity-for-reddit-e439b840957030cdce7b310b595cfa9add844422.tar.zst
infinity-for-reddit-e439b840957030cdce7b310b595cfa9add844422.zip
Video autoplay in ViewPostDetailActivity. Optimize CommentAndPostRecyclerViewAdapter.
Diffstat (limited to 'app')
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/Activity/ViewPostDetailActivity.java42
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/Adapter/CommentAndPostRecyclerViewAdapter.java1536
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/Adapter/PostRecyclerViewAdapter.java296
-rw-r--r--app/src/main/res/layout/activity_view_post_detail.xml2
-rw-r--r--app/src/main/res/layout/item_post.xml361
-rw-r--r--app/src/main/res/layout/item_post_compact.xml8
-rw-r--r--app/src/main/res/layout/item_post_detail_image_and_gif_autoplay.xml317
-rw-r--r--app/src/main/res/layout/item_post_detail_link.xml327
-rw-r--r--app/src/main/res/layout/item_post_detail_no_preview_link.xml305
-rw-r--r--app/src/main/res/layout/item_post_detail_text.xml288
-rw-r--r--app/src/main/res/layout/item_post_detail_video_and_gif_preview.xml (renamed from app/src/main/res/layout/item_post_detail.xml)110
-rw-r--r--app/src/main/res/layout/item_post_detail_video_autoplay.xml294
-rw-r--r--app/src/main/res/layout/item_post_image_and_gif_autoplay.xml (renamed from app/src/main/res/layout/item_post_image_and_gif_autoplay_type.xml)76
-rw-r--r--app/src/main/res/layout/item_post_link.xml (renamed from app/src/main/res/layout/item_post_link_type.xml)78
-rw-r--r--app/src/main/res/layout/item_post_no_preview_link.xml (renamed from app/src/main/res/layout/item_post_no_preview_link_type.xml)4
-rw-r--r--app/src/main/res/layout/item_post_text.xml (renamed from app/src/main/res/layout/item_post_text_type.xml)4
-rw-r--r--app/src/main/res/layout/item_post_video_and_gif_preview.xml (renamed from app/src/main/res/layout/item_post_video_and_gif_preview_type.xml)76
-rw-r--r--app/src/main/res/layout/item_post_video_type_autoplay.xml6
18 files changed, 3011 insertions, 1119 deletions
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/ViewPostDetailActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/ViewPostDetailActivity.java
index f3e4d0aa..764ede0d 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/ViewPostDetailActivity.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/ViewPostDetailActivity.java
@@ -52,11 +52,15 @@ import javax.inject.Named;
import butterknife.BindView;
import butterknife.ButterKnife;
+import im.ene.toro.exoplayer.ExoCreator;
+import im.ene.toro.media.PlaybackInfo;
+import im.ene.toro.media.VolumeInfo;
import ml.docilealligator.infinityforreddit.Adapter.CommentAndPostRecyclerViewAdapter;
import ml.docilealligator.infinityforreddit.AsyncTask.GetCurrentAccountAsyncTask;
import ml.docilealligator.infinityforreddit.AsyncTask.SwitchAccountAsyncTask;
import ml.docilealligator.infinityforreddit.CommentData;
import ml.docilealligator.infinityforreddit.CustomTheme.CustomThemeWrapper;
+import ml.docilealligator.infinityforreddit.CustomView.CustomToroContainer;
import ml.docilealligator.infinityforreddit.DeleteThing;
import ml.docilealligator.infinityforreddit.Event.ChangeNSFWBlurEvent;
import ml.docilealligator.infinityforreddit.Event.ChangeSpoilerBlurEvent;
@@ -64,13 +68,13 @@ import ml.docilealligator.infinityforreddit.Event.PostUpdateEventToDetailActivit
import ml.docilealligator.infinityforreddit.Event.PostUpdateEventToPostList;
import ml.docilealligator.infinityforreddit.Event.SwitchAccountEvent;
import ml.docilealligator.infinityforreddit.FetchComment;
-import ml.docilealligator.infinityforreddit.Post.FetchPost;
import ml.docilealligator.infinityforreddit.Flair;
import ml.docilealligator.infinityforreddit.Fragment.FlairBottomSheetFragment;
import ml.docilealligator.infinityforreddit.Fragment.PostCommentSortTypeBottomSheetFragment;
-import ml.docilealligator.infinityforreddit.Post.HidePost;
import ml.docilealligator.infinityforreddit.Infinity;
import ml.docilealligator.infinityforreddit.ParseComment;
+import ml.docilealligator.infinityforreddit.Post.FetchPost;
+import ml.docilealligator.infinityforreddit.Post.HidePost;
import ml.docilealligator.infinityforreddit.Post.ParsePost;
import ml.docilealligator.infinityforreddit.Post.Post;
import ml.docilealligator.infinityforreddit.R;
@@ -87,6 +91,8 @@ import retrofit2.Callback;
import retrofit2.Response;
import retrofit2.Retrofit;
+import static im.ene.toro.media.PlaybackInfo.INDEX_UNSET;
+import static im.ene.toro.media.PlaybackInfo.TIME_UNSET;
import static ml.docilealligator.infinityforreddit.Activity.CommentActivity.RETURN_EXTRA_COMMENT_DATA_KEY;
import static ml.docilealligator.infinityforreddit.Activity.CommentActivity.WRITE_COMMENT_REQUEST_CODE;
@@ -140,7 +146,7 @@ public class ViewPostDetailActivity extends BaseActivity implements FlairBottomS
@BindView(R.id.swipe_refresh_layout_view_post_detail_activity)
SwipeRefreshLayout mSwipeRefreshLayout;
@BindView(R.id.recycler_view_view_post_detail)
- RecyclerView mRecyclerView;
+ CustomToroContainer mRecyclerView;
@BindView(R.id.fetch_post_info_linear_layout_view_post_detail_activity)
LinearLayout mFetchPostInfoLinearLayout;
@BindView(R.id.fetch_post_info_image_view_view_post_detail_activity)
@@ -165,16 +171,14 @@ public class ViewPostDetailActivity extends BaseActivity implements FlairBottomS
SharedPreferences mSortTypeSharedPreferences;
@Inject
CustomThemeWrapper mCustomThemeWrapper;
+ @Inject
+ ExoCreator mExoCreator;
private RequestManager mGlide;
private Locale mLocale;
private Menu mMenu;
private int orientation;
private int postListPosition = -1;
private String mSingleCommentId;
- private boolean mNeedBlurNsfw;
- private boolean mNeedBlurSpoiler;
- private boolean mVoteButtonsOnTheRight;
- private boolean mShowElapsedTime;
private boolean showToast = false;
private boolean isSortingComments = false;
private boolean mVolumeKeysNavigateComments;
@@ -182,10 +186,6 @@ public class ViewPostDetailActivity extends BaseActivity implements FlairBottomS
private boolean mLockFab;
private boolean mSwipeUpToHideFab;
private boolean mExpandChildren;
- private boolean mCommentToolbarHidden;
- private boolean mCommentToolbarHideOnClick;
- private boolean mShowCommentDivider;
- private boolean mShowAbsoluteNumberOfVotes;
private LinearLayoutManager mLinearLayoutManager;
private CommentAndPostRecyclerViewAdapter mAdapter;
private RecyclerView.SmoothScroller mSmoothScroller;
@@ -242,18 +242,10 @@ public class ViewPostDetailActivity extends BaseActivity implements FlairBottomS
mToolbar.setTitle("");
setSupportActionBar(mToolbar);
- mNeedBlurNsfw = mSharedPreferences.getBoolean(SharedPreferencesUtils.BLUR_NSFW_KEY, true);
- mNeedBlurSpoiler = mSharedPreferences.getBoolean(SharedPreferencesUtils.BLUR_SPOILER_KEY, false);
- mVoteButtonsOnTheRight = mSharedPreferences.getBoolean(SharedPreferencesUtils.VOTE_BUTTONS_ON_THE_RIGHT_KEY, false);
- mShowElapsedTime = mSharedPreferences.getBoolean(SharedPreferencesUtils.SHOW_ELAPSED_TIME_KEY, false);
mVolumeKeysNavigateComments = mSharedPreferences.getBoolean(SharedPreferencesUtils.VOLUME_KEYS_NAVIGATE_COMMENTS, false);
mLockFab = mSharedPreferences.getBoolean(SharedPreferencesUtils.LOCK_JUMP_TO_NEXT_TOP_LEVEL_COMMENT_BUTTON, false);
mSwipeUpToHideFab = mSharedPreferences.getBoolean(SharedPreferencesUtils.SWIPE_UP_TO_HIDE_JUMP_TO_NEXT_TOP_LEVEL_COMMENT_BUTTON, false);
mExpandChildren = !mSharedPreferences.getBoolean(SharedPreferencesUtils.SHOW_TOP_LEVEL_COMMENTS_FIRST, false);
- mCommentToolbarHidden = mSharedPreferences.getBoolean(SharedPreferencesUtils.COMMENT_TOOLBAR_HIDDEN, false);
- mCommentToolbarHideOnClick= mSharedPreferences.getBoolean(SharedPreferencesUtils.COMMENT_TOOLBAR_HIDE_ON_CLICK, true);
- mShowCommentDivider = mSharedPreferences.getBoolean(SharedPreferencesUtils.SHOW_COMMENT_DIVIDER, false);
- mShowAbsoluteNumberOfVotes = mSharedPreferences.getBoolean(SharedPreferencesUtils.SHOW_ABSOLUTE_NUMBER_OF_VOTES, true);
mGlide = Glide.with(this);
mLocale = getResources().getConfiguration().locale;
@@ -511,8 +503,7 @@ public class ViewPostDetailActivity extends BaseActivity implements FlairBottomS
mAdapter = new CommentAndPostRecyclerViewAdapter(ViewPostDetailActivity.this,
mCustomThemeWrapper, mRetrofit, mOauthRetrofit, mRedditDataRoomDatabase, mGlide,
mAccessToken, mAccountName, mPost, mLocale, mSingleCommentId, isSingleCommentThreadMode,
- mNeedBlurNsfw, mNeedBlurSpoiler, mVoteButtonsOnTheRight, mShowElapsedTime, mExpandChildren,
- mCommentToolbarHidden, mCommentToolbarHideOnClick, mShowCommentDivider,mShowAbsoluteNumberOfVotes,
+ mSharedPreferences, mExoCreator,
new CommentAndPostRecyclerViewAdapter.CommentRecyclerViewAdapterCallback() {
@Override
public void updatePost(Post post) {
@@ -552,6 +543,12 @@ public class ViewPostDetailActivity extends BaseActivity implements FlairBottomS
}
}
+ mRecyclerView.setCacheManager(mAdapter);
+ mRecyclerView.setPlayerInitializer(order -> {
+ VolumeInfo volumeInfo = new VolumeInfo(true, 0f);
+ return new PlaybackInfo(INDEX_UNSET, TIME_UNSET, volumeInfo);
+ });
+
fab.setOnClickListener(view -> scrollToNextParentComment());
}
@@ -644,8 +641,7 @@ public class ViewPostDetailActivity extends BaseActivity implements FlairBottomS
mAdapter = new CommentAndPostRecyclerViewAdapter(ViewPostDetailActivity.this,
mCustomThemeWrapper, mRetrofit, mOauthRetrofit, mRedditDataRoomDatabase, mGlide,
mAccessToken, mAccountName, mPost, mLocale, mSingleCommentId, isSingleCommentThreadMode,
- mNeedBlurNsfw, mNeedBlurSpoiler, mVoteButtonsOnTheRight, mShowElapsedTime, mExpandChildren,
- mCommentToolbarHidden, mCommentToolbarHideOnClick, mShowCommentDivider, mShowAbsoluteNumberOfVotes,
+ mSharedPreferences, mExoCreator,
new CommentAndPostRecyclerViewAdapter.CommentRecyclerViewAdapterCallback() {
@Override
public void updatePost(Post post) {
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/Adapter/CommentAndPostRecyclerViewAdapter.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Adapter/CommentAndPostRecyclerViewAdapter.java
index eb2ba7ae..14d6686b 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/Adapter/CommentAndPostRecyclerViewAdapter.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Adapter/CommentAndPostRecyclerViewAdapter.java
@@ -1,6 +1,7 @@
package ml.docilealligator.infinityforreddit.Adapter;
import android.content.Intent;
+import android.content.SharedPreferences;
import android.content.res.ColorStateList;
import android.graphics.ColorFilter;
import android.graphics.PorterDuff;
@@ -39,6 +40,12 @@ import com.bumptech.glide.load.engine.GlideException;
import com.bumptech.glide.request.RequestListener;
import com.bumptech.glide.request.RequestOptions;
import com.bumptech.glide.request.target.Target;
+import com.google.android.exoplayer2.metadata.Metadata;
+import com.google.android.exoplayer2.source.TrackGroupArray;
+import com.google.android.exoplayer2.text.Cue;
+import com.google.android.exoplayer2.trackselection.TrackSelectionArray;
+import com.google.android.exoplayer2.ui.AspectRatioFrameLayout;
+import com.google.android.exoplayer2.ui.PlayerView;
import com.libRG.CustomTextView;
import com.lsjwzh.widget.materialloadingprogressbar.CircleProgressBar;
import com.santalu.aspectratioimageview.AspectRatioImageView;
@@ -46,10 +53,19 @@ import com.santalu.aspectratioimageview.AspectRatioImageView;
import org.commonmark.ext.gfm.tables.TableBlock;
import java.util.ArrayList;
+import java.util.List;
import java.util.Locale;
import butterknife.BindView;
import butterknife.ButterKnife;
+import im.ene.toro.CacheManager;
+import im.ene.toro.ToroPlayer;
+import im.ene.toro.ToroUtil;
+import im.ene.toro.exoplayer.ExoCreator;
+import im.ene.toro.exoplayer.ExoPlayerViewHelper;
+import im.ene.toro.exoplayer.Playable;
+import im.ene.toro.media.PlaybackInfo;
+import im.ene.toro.widget.Container;
import io.noties.markwon.AbstractMarkwonPlugin;
import io.noties.markwon.Markwon;
import io.noties.markwon.MarkwonConfiguration;
@@ -88,22 +104,28 @@ import ml.docilealligator.infinityforreddit.RedditDataRoomDatabase;
import ml.docilealligator.infinityforreddit.SaveThing;
import ml.docilealligator.infinityforreddit.Utils.GlideImageGetter;
import ml.docilealligator.infinityforreddit.Utils.RedditUtils;
+import ml.docilealligator.infinityforreddit.Utils.SharedPreferencesUtils;
import ml.docilealligator.infinityforreddit.Utils.Utils;
import ml.docilealligator.infinityforreddit.VoteThing;
import retrofit2.Retrofit;
import static ml.docilealligator.infinityforreddit.Activity.CommentActivity.WRITE_COMMENT_REQUEST_CODE;
-public class CommentAndPostRecyclerViewAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> {
- private static final int VIEW_TYPE_POST_DETAIL = 0;
- private static final int VIEW_TYPE_FIRST_LOADING = 1;
- private static final int VIEW_TYPE_FIRST_LOADING_FAILED = 2;
- private static final int VIEW_TYPE_NO_COMMENT_PLACEHOLDER = 3;
- private static final int VIEW_TYPE_COMMENT = 4;
- private static final int VIEW_TYPE_LOAD_MORE_CHILD_COMMENTS = 5;
- private static final int VIEW_TYPE_IS_LOADING_MORE_COMMENTS = 6;
- private static final int VIEW_TYPE_LOAD_MORE_COMMENTS_FAILED = 7;
- private static final int VIEW_TYPE_VIEW_ALL_COMMENTS = 8;
+public class CommentAndPostRecyclerViewAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> implements CacheManager {
+ private static final int VIEW_TYPE_POST_DETAIL_VIDEO_AUTOPLAY = 1;
+ private static final int VIEW_TYPE_POST_DETAIL_VIDEO_AND_GIF_PREVIEW = 2;
+ private static final int VIEW_TYPE_POST_DETAIL_IMAGE_AND_GIF_AUTOPLAY = 3;
+ private static final int VIEW_TYPE_POST_DETAIL_LINK = 4;
+ private static final int VIEW_TYPE_POST_DETAIL_NO_PREVIEW_LINK = 5;
+ private static final int VIEW_TYPE_POST_DETAIL_TEXT_TYPE = 6;
+ private static final int VIEW_TYPE_FIRST_LOADING = 7;
+ private static final int VIEW_TYPE_FIRST_LOADING_FAILED = 8;
+ private static final int VIEW_TYPE_NO_COMMENT_PLACEHOLDER = 9;
+ private static final int VIEW_TYPE_COMMENT = 10;
+ private static final int VIEW_TYPE_LOAD_MORE_CHILD_COMMENTS = 11;
+ private static final int VIEW_TYPE_IS_LOADING_MORE_COMMENTS = 12;
+ private static final int VIEW_TYPE_LOAD_MORE_COMMENTS_FAILED = 13;
+ private static final int VIEW_TYPE_VIEW_ALL_COMMENTS = 14;
private AppCompatActivity mActivity;
private Retrofit mRetrofit;
@@ -121,7 +143,7 @@ public class CommentAndPostRecyclerViewAdapter extends RecyclerView.Adapter<Recy
private Locale mLocale;
private String mSingleCommentId;
private boolean mIsSingleCommentThreadMode;
- private boolean mNeedBlurNSFW;
+ private boolean mNeedBlurNsfw;
private boolean mNeedBlurSpoiler;
private boolean mVoteButtonsOnTheRight;
private boolean mShowElapsedTime;
@@ -130,6 +152,7 @@ public class CommentAndPostRecyclerViewAdapter extends RecyclerView.Adapter<Recy
private boolean mCommentToolbarHideOnClick;
private boolean mShowCommentDivider;
private boolean mShowAbsoluteNumberOfVotes;
+ private boolean mAutoplay = false;
private CommentRecyclerViewAdapterCallback mCommentRecyclerViewAdapterCallback;
private boolean isInitiallyLoading;
private boolean isInitiallyLoadingFailed;
@@ -182,16 +205,14 @@ public class CommentAndPostRecyclerViewAdapter extends RecyclerView.Adapter<Recy
private float mScale;
private ShareLinkBottomSheetFragment mShareLinkBottomSheetFragment;
private CopyTextBottomSheetFragment mCopyTextBottomSheetFragment;
+ private ExoCreator mExoCreator;
public CommentAndPostRecyclerViewAdapter(AppCompatActivity activity, CustomThemeWrapper customThemeWrapper,
Retrofit retrofit, Retrofit oauthRetrofit,
RedditDataRoomDatabase redditDataRoomDatabase, RequestManager glide,
String accessToken, String accountName, Post post, Locale locale,
String singleCommentId, boolean isSingleCommentThreadMode,
- boolean needBlurNSFW, boolean needBlurSpoiler, boolean voteButtonsOnTheRight,
- boolean showElapsedTime, boolean expandChildren, boolean commentToolbarHidden,
- boolean commentToolbarHideOnClick, boolean showCommentDivider,
- boolean showAbsoluteNumberOfVotes,
+ SharedPreferences mSharedPreferences, ExoCreator exoCreator,
CommentRecyclerViewAdapterCallback commentRecyclerViewAdapterCallback) {
mActivity = activity;
mRetrofit = retrofit;
@@ -277,15 +298,24 @@ public class CommentAndPostRecyclerViewAdapter extends RecyclerView.Adapter<Recy
mLocale = locale;
mSingleCommentId = singleCommentId;
mIsSingleCommentThreadMode = isSingleCommentThreadMode;
- mNeedBlurNSFW = needBlurNSFW;
- mNeedBlurSpoiler = needBlurSpoiler;
- mVoteButtonsOnTheRight = voteButtonsOnTheRight;
- mShowElapsedTime = showElapsedTime;
- mExpandChildren = expandChildren;
- mCommentToolbarHidden = commentToolbarHidden;
- mCommentToolbarHideOnClick = commentToolbarHideOnClick;
- mShowCommentDivider = showCommentDivider;
- mShowAbsoluteNumberOfVotes = showAbsoluteNumberOfVotes;
+
+ mNeedBlurNsfw = mSharedPreferences.getBoolean(SharedPreferencesUtils.BLUR_NSFW_KEY, true);
+ mNeedBlurSpoiler = mSharedPreferences.getBoolean(SharedPreferencesUtils.BLUR_SPOILER_KEY, false);
+ mVoteButtonsOnTheRight = mSharedPreferences.getBoolean(SharedPreferencesUtils.VOTE_BUTTONS_ON_THE_RIGHT_KEY, false);
+ mShowElapsedTime = mSharedPreferences.getBoolean(SharedPreferencesUtils.SHOW_ELAPSED_TIME_KEY, false);
+ mExpandChildren = !mSharedPreferences.getBoolean(SharedPreferencesUtils.SHOW_TOP_LEVEL_COMMENTS_FIRST, false);
+ mCommentToolbarHidden = mSharedPreferences.getBoolean(SharedPreferencesUtils.COMMENT_TOOLBAR_HIDDEN, false);
+ mCommentToolbarHideOnClick= mSharedPreferences.getBoolean(SharedPreferencesUtils.COMMENT_TOOLBAR_HIDE_ON_CLICK, true);
+ mShowCommentDivider = mSharedPreferences.getBoolean(SharedPreferencesUtils.SHOW_COMMENT_DIVIDER, false);
+ mShowAbsoluteNumberOfVotes = mSharedPreferences.getBoolean(SharedPreferencesUtils.SHOW_ABSOLUTE_NUMBER_OF_VOTES, true);
+
+ String autoplayString = mSharedPreferences.getString(SharedPreferencesUtils.VIDEO_AUTOPLAY, SharedPreferencesUtils.VIDEO_AUTOPLAY_VALUE_NEVER);
+ if (autoplayString.equals(SharedPreferencesUtils.VIDEO_AUTOPLAY_VALUE_ALWAYS_ON)) {
+ mAutoplay = true;
+ } else if (autoplayString.equals(SharedPreferencesUtils.VIDEO_AUTOPLAY_VALUE_ON_WIFI)) {
+ mAutoplay = Utils.isConnectedToWifi(activity);
+ }
+
mCommentRecyclerViewAdapterCallback = commentRecyclerViewAdapterCallback;
isInitiallyLoading = true;
isInitiallyLoadingFailed = false;
@@ -341,12 +371,35 @@ public class CommentAndPostRecyclerViewAdapter extends RecyclerView.Adapter<Recy
mShareLinkBottomSheetFragment = new ShareLinkBottomSheetFragment();
mCopyTextBottomSheetFragment = new CopyTextBottomSheetFragment();
+ mExoCreator = exoCreator;
}
@Override
public int getItemViewType(int position) {
if (position == 0) {
- return VIEW_TYPE_POST_DETAIL;
+ switch (mPost.getPostType()) {
+ case Post.VIDEO_TYPE:
+ if (mAutoplay) {
+ return VIEW_TYPE_POST_DETAIL_VIDEO_AUTOPLAY;
+ } else {
+ return VIEW_TYPE_POST_DETAIL_VIDEO_AND_GIF_PREVIEW;
+ }
+ case Post.GIF_TYPE:
+ if (mAutoplay) {
+ return VIEW_TYPE_POST_DETAIL_IMAGE_AND_GIF_AUTOPLAY;
+ } else {
+ return VIEW_TYPE_POST_DETAIL_VIDEO_AND_GIF_PREVIEW;
+ }
+ case Post.IMAGE_TYPE:
+ return VIEW_TYPE_POST_DETAIL_IMAGE_AND_GIF_AUTOPLAY;
+ case Post.LINK_TYPE:
+ return VIEW_TYPE_POST_DETAIL_LINK;
+ case Post.NO_PREVIEW_LINK_TYPE:
+ return VIEW_TYPE_POST_DETAIL_NO_PREVIEW_LINK;
+ default:
+ return VIEW_TYPE_POST_DETAIL_TEXT_TYPE;
+
+ }
}
if (mVisibleComments.size() == 0) {
@@ -402,8 +455,18 @@ public class CommentAndPostRecyclerViewAdapter extends RecyclerView.Adapter<Recy
@Override
public RecyclerView.ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
switch (viewType) {
- case VIEW_TYPE_POST_DETAIL:
- return new PostDetailViewHolder(LayoutInflater.from(parent.getContext()).inflate(R.layout.item_post_detail, parent, false));
+ case VIEW_TYPE_POST_DETAIL_VIDEO_AUTOPLAY:
+ return new PostDetailVideoAutoplayViewHolder(LayoutInflater.from(parent.getContext()).inflate(R.layout.item_post_detail_video_autoplay, parent, false));
+ case VIEW_TYPE_POST_DETAIL_VIDEO_AND_GIF_PREVIEW:
+ return new PostDetailVideoAndGifPreviewHolder(LayoutInflater.from(parent.getContext()).inflate(R.layout.item_post_detail_video_and_gif_preview, parent, false));
+ case VIEW_TYPE_POST_DETAIL_IMAGE_AND_GIF_AUTOPLAY:
+ return new PostDetailImageAndGifAutoplayViewHolder(LayoutInflater.from(parent.getContext()).inflate(R.layout.item_post_detail_image_and_gif_autoplay, parent, false));
+ case VIEW_TYPE_POST_DETAIL_LINK:
+ return new PostDetailLinkViewHolder(LayoutInflater.from(parent.getContext()).inflate(R.layout.item_post_detail_link, parent, false));
+ case VIEW_TYPE_POST_DETAIL_NO_PREVIEW_LINK:
+ return new PostDetailNoPreviewLinkViewHolder(LayoutInflater.from(parent.getContext()).inflate(R.layout.item_post_detail_no_preview_link, parent, false));
+ case VIEW_TYPE_POST_DETAIL_TEXT_TYPE:
+ return new PostDetailTextViewHolder(LayoutInflater.from(parent.getContext()).inflate(R.layout.item_post_detail_text, parent, false));
case VIEW_TYPE_FIRST_LOADING:
return new LoadCommentsViewHolder(LayoutInflater.from(parent.getContext()).inflate(R.layout.item_load_comments, parent, false));
case VIEW_TYPE_FIRST_LOADING_FAILED:
@@ -425,8 +488,8 @@ public class CommentAndPostRecyclerViewAdapter extends RecyclerView.Adapter<Recy
@Override
public void onBindViewHolder(@NonNull RecyclerView.ViewHolder holder, int position) {
- if (holder instanceof PostDetailViewHolder) {
- ((PostDetailViewHolder) holder).mTitleTextView.setText(mPost.getTitle());
+ if (holder instanceof PostDetailBaseViewHolder) {
+ ((PostDetailBaseViewHolder) holder).mTitleTextView.setText(mPost.getTitle());
if (mPost.getSubredditNamePrefixed().startsWith("u/")) {
if (mPost.getAuthorIconUrl() == null) {
String authorName = mPost.getAuthor().equals("[deleted]") ? mPost.getSubredditNamePrefixed().substring(2) : mPost.getAuthor();
@@ -435,13 +498,13 @@ public class CommentAndPostRecyclerViewAdapter extends RecyclerView.Adapter<Recy
if (iconImageUrl == null || iconImageUrl.equals("")) {
mGlide.load(R.drawable.subreddit_default_icon)
.apply(RequestOptions.bitmapTransform(new RoundedCornersTransformation(72, 0)))
- .into(((PostDetailViewHolder) holder).mIconGifImageView);
+ .into(((PostDetailBaseViewHolder) holder).mIconGifImageView);
} else {
mGlide.load(iconImageUrl)
.apply(RequestOptions.bitmapTransform(new RoundedCornersTransformation(72, 0)))
.error(mGlide.load(R.drawable.subreddit_default_icon)
.apply(RequestOptions.bitmapTransform(new RoundedCornersTransformation(72, 0))))
- .into(((PostDetailViewHolder) holder).mIconGifImageView);
+ .into(((PostDetailBaseViewHolder) holder).mIconGifImageView);
}
if (holder.getAdapterPosition() >= 0) {
@@ -454,11 +517,11 @@ public class CommentAndPostRecyclerViewAdapter extends RecyclerView.Adapter<Recy
.apply(RequestOptions.bitmapTransform(new RoundedCornersTransformation(72, 0)))
.error(mGlide.load(R.drawable.subreddit_default_icon)
.apply(RequestOptions.bitmapTransform(new RoundedCornersTransformation(72, 0))))
- .into(((PostDetailViewHolder) holder).mIconGifImageView);
+ .into(((PostDetailBaseViewHolder) holder).mIconGifImageView);
} else {
mGlide.load(R.drawable.subreddit_default_icon)
.apply(RequestOptions.bitmapTransform(new RoundedCornersTransformation(72, 0)))
- .into(((PostDetailViewHolder) holder).mIconGifImageView);
+ .into(((PostDetailBaseViewHolder) holder).mIconGifImageView);
}
} else {
if (mPost.getSubredditIconUrl() == null) {
@@ -468,13 +531,13 @@ public class CommentAndPostRecyclerViewAdapter extends RecyclerView.Adapter<Recy
if (iconImageUrl == null || iconImageUrl.equals("")) {
mGlide.load(R.drawable.subreddit_default_icon)
.apply(RequestOptions.bitmapTransform(new RoundedCornersTransformation(72, 0)))
- .into(((PostDetailViewHolder) holder).mIconGifImageView);
+ .into(((PostDetailBaseViewHolder) holder).mIconGifImageView);
} else {
mGlide.load(iconImageUrl)
.apply(RequestOptions.bitmapTransform(new RoundedCornersTransformation(72, 0)))
.error(mGlide.load(R.drawable.subreddit_default_icon)
.apply(RequestOptions.bitmapTransform(new RoundedCornersTransformation(72, 0))))
- .into(((PostDetailViewHolder) holder).mIconGifImageView);
+ .into(((PostDetailBaseViewHolder) holder).mIconGifImageView);
}
mPost.setSubredditIconUrl(iconImageUrl);
@@ -484,338 +547,177 @@ public class CommentAndPostRecyclerViewAdapter extends RecyclerView.Adapter<Recy
.apply(RequestOptions.bitmapTransform(new RoundedCornersTransformation(72, 0)))
.error(mGlide.load(R.drawable.subreddit_default_icon)
.apply(RequestOptions.bitmapTransform(new RoundedCornersTransformation(72, 0))))
- .into(((PostDetailViewHolder) holder).mIconGifImageView);
+ .into(((PostDetailBaseViewHolder) holder).mIconGifImageView);
} else {
mGlide.load(R.drawable.subreddit_default_icon)
.apply(RequestOptions.bitmapTransform(new RoundedCornersTransformation(72, 0)))
- .into(((PostDetailViewHolder) holder).mIconGifImageView);
+ .into(((PostDetailBaseViewHolder) holder).mIconGifImageView);
}
}
if (mPost.getAuthorFlairHTML() != null && !mPost.getAuthorFlairHTML().equals("")) {
- ((PostDetailViewHolder) holder).mAuthorFlairTextView.setVisibility(View.VISIBLE);
- Utils.setHTMLWithImageToTextView(((PostDetailViewHolder) holder).mAuthorFlairTextView, mPost.getAuthorFlairHTML());
- ((PostDetailViewHolder) holder).mAuthorFlairTextView.setOnClickListener(view -> ((PostDetailViewHolder) holder).mUserTextView.performClick());
+ ((PostDetailBaseViewHolder) holder).mAuthorFlairTextView.setVisibility(View.VISIBLE);
+ Utils.setHTMLWithImageToTextView(((PostDetailBaseViewHolder) holder).mAuthorFlairTextView, mPost.getAuthorFlairHTML());
} else if (mPost.getAuthorFlair() != null && !mPost.getAuthorFlair().equals("")) {
- ((PostDetailViewHolder) holder).mAuthorFlairTextView.setVisibility(View.VISIBLE);
- ((PostDetailViewHolder) holder).mAuthorFlairTextView.setText(mPost.getAuthorFlair());
+ ((PostDetailBaseViewHolder) holder).mAuthorFlairTextView.setVisibility(View.VISIBLE);
+ ((PostDetailBaseViewHolder) holder).mAuthorFlairTextView.setText(mPost.getAuthorFlair());
}
switch (mPost.getVoteType()) {
case 1:
//Upvote
- ((PostDetailViewHolder) holder).mUpvoteButton.setColorFilter(mUpvotedColor, PorterDuff.Mode.SRC_IN);
- ((PostDetailViewHolder) holder).mScoreTextView.setTextColor(mUpvotedColor);
+ ((PostDetailBaseViewHolder) holder).mUpvoteButton.setColorFilter(mUpvotedColor, PorterDuff.Mode.SRC_IN);
+ ((PostDetailBaseViewHolder) holder).mScoreTextView.setTextColor(mUpvotedColor);
break;
case -1:
//Downvote
- ((PostDetailViewHolder) holder).mDownvoteButton.setColorFilter(mDownvotedColor, PorterDuff.Mode.SRC_IN);
- ((PostDetailViewHolder) holder).mScoreTextView.setTextColor(mDownvotedColor);
+ ((PostDetailBaseViewHolder) holder).mDownvoteButton.setColorFilter(mDownvotedColor, PorterDuff.Mode.SRC_IN);
+ ((PostDetailBaseViewHolder) holder).mScoreTextView.setTextColor(mDownvotedColor);
break;
case 0:
- ((PostDetailViewHolder) holder).mUpvoteButton.setColorFilter(mPostIconAndInfoColor, android.graphics.PorterDuff.Mode.SRC_IN);
- ((PostDetailViewHolder) holder).mDownvoteButton.setColorFilter(mPostIconAndInfoColor, android.graphics.PorterDuff.Mode.SRC_IN);
- ((PostDetailViewHolder) holder).mScoreTextView.setTextColor(mPostIconAndInfoColor);
- }
-
- if (mPost.getPostType() != Post.TEXT_TYPE && mPost.getPostType() != Post.NO_PREVIEW_LINK_TYPE) {
- ((PostDetailViewHolder) holder).mRelativeLayout.setVisibility(View.VISIBLE);
- ((PostDetailViewHolder) holder).mImageView.setVisibility(View.VISIBLE);
- ((PostDetailViewHolder) holder).mImageView.setRatio((float) mPost.getPreviewHeight() / (float) mPost.getPreviewWidth());
- loadImage((PostDetailViewHolder) holder);
- } else {
- ((PostDetailViewHolder) holder).mRelativeLayout.setVisibility(View.GONE);
- ((PostDetailViewHolder) holder).mImageView.setVisibility(View.GONE);
+ ((PostDetailBaseViewHolder) holder).mUpvoteButton.setColorFilter(mPostIconAndInfoColor, android.graphics.PorterDuff.Mode.SRC_IN);
+ ((PostDetailBaseViewHolder) holder).mDownvoteButton.setColorFilter(mPostIconAndInfoColor, android.graphics.PorterDuff.Mode.SRC_IN);
+ ((PostDetailBaseViewHolder) holder).mScoreTextView.setTextColor(mPostIconAndInfoColor);
}
if (mPost.isArchived()) {
- ((PostDetailViewHolder) holder).mUpvoteButton
+ ((PostDetailBaseViewHolder) holder).mUpvoteButton
.setColorFilter(mVoteAndReplyUnavailableVoteButtonColor, android.graphics.PorterDuff.Mode.SRC_IN);
- ((PostDetailViewHolder) holder).mDownvoteButton
+ ((PostDetailBaseViewHolder) holder).mDownvoteButton
.setColorFilter(mVoteAndReplyUnavailableVoteButtonColor, android.graphics.PorterDuff.Mode.SRC_IN);
}
if (mPost.isCrosspost()) {
- ((PostDetailViewHolder) holder).mCrosspostImageView.setOnClickListener(view -> {
- Intent crosspostIntent = new Intent(mActivity, ViewPostDetailActivity.class);
- crosspostIntent.putExtra(ViewPostDetailActivity.EXTRA_POST_ID, mPost.getCrosspostParentId());
- mActivity.startActivity(crosspostIntent);
- });
- ((PostDetailViewHolder) holder).mCrosspostImageView.setVisibility(View.VISIBLE);
+ ((PostDetailBaseViewHolder) holder).mCrosspostImageView.setVisibility(View.VISIBLE);
}
- ((PostDetailViewHolder) holder).mSubredditTextView.setText(mPost.getSubredditNamePrefixed());
- ((PostDetailViewHolder) holder).mUserTextView.setText(mPost.getAuthorNamePrefixed());
+ ((PostDetailBaseViewHolder) holder).mSubredditTextView.setText(mPost.getSubredditNamePrefixed());
+ ((PostDetailBaseViewHolder) holder).mUserTextView.setText(mPost.getAuthorNamePrefixed());
if (mShowElapsedTime) {
- ((PostDetailViewHolder) holder).mPostTimeTextView.setText(
+ ((PostDetailBaseViewHolder) holder).mPostTimeTextView.setText(
Utils.getElapsedTime(mActivity, mPost.getPostTimeMillis()));
} else {
- ((PostDetailViewHolder) holder).mPostTimeTextView.setText(mPost.getPostTime());
+ ((PostDetailBaseViewHolder) holder).mPostTimeTextView.setText(mPost.getPostTime());
}
if (mPost.isArchived()) {
- ((PostDetailViewHolder) holder).mArchivedImageView.setVisibility(View.VISIBLE);
+ ((PostDetailBaseViewHolder) holder).mArchivedImageView.setVisibility(View.VISIBLE);
}
if (mPost.isLocked()) {
- ((PostDetailViewHolder) holder).mLockedImageView.setVisibility(View.VISIBLE);
+ ((PostDetailBaseViewHolder) holder).mLockedImageView.setVisibility(View.VISIBLE);
}
if (mPost.isSpoiler()) {
- ((PostDetailViewHolder) holder).mSpoilerTextView.setVisibility(View.VISIBLE);
+ ((PostDetailBaseViewHolder) holder).mSpoilerTextView.setVisibility(View.VISIBLE);
}
if (mPost.getFlair() != null && !mPost.getFlair().equals("")) {
- ((PostDetailViewHolder) holder).mFlairTextView.setVisibility(View.VISIBLE);
+ ((PostDetailBaseViewHolder) holder).mFlairTextView.setVisibility(View.VISIBLE);
Spannable flairHTML;
- GlideImageGetter glideImageGetter = new GlideImageGetter(((PostDetailViewHolder) holder).mFlairTextView);
+ GlideImageGetter glideImageGetter = new GlideImageGetter(((PostDetailBaseViewHolder) holder).mFlairTextView);
if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.N) {
flairHTML = (Spannable) Html.fromHtml(mPost.getFlair(), Html.FROM_HTML_MODE_LEGACY, glideImageGetter, null);
} else {
flairHTML = (Spannable) Html.fromHtml(mPost.getFlair(), glideImageGetter, null);
}
- ((PostDetailViewHolder) holder).mFlairTextView.setText(flairHTML);
+ ((PostDetailBaseViewHolder) holder).mFlairTextView.setText(flairHTML);
}
if (mPost.getAwards() != null && !mPost.getAwards().equals("")) {
- ((PostDetailViewHolder) holder).mAwardsTextView.setVisibility(View.VISIBLE);
- Utils.setHTMLWithImageToTextView(((PostDetailViewHolder) holder).mAwardsTextView, mPost.getAwards());
+ ((PostDetailBaseViewHolder) holder).mAwardsTextView.setVisibility(View.VISIBLE);
+ Utils.setHTMLWithImageToTextView(((PostDetailBaseViewHolder) holder).mAwardsTextView, mPost.getAwards());
}
if (mPost.isNSFW()) {
- ((PostDetailViewHolder) holder).mNSFWTextView.setOnClickListener(view -> {
- Intent intent = new Intent(mActivity, FilteredThingActivity.class);
- intent.putExtra(FilteredThingActivity.EXTRA_NAME, mSubredditNamePrefixed.substring(2));
- intent.putExtra(FilteredThingActivity.EXTRA_POST_TYPE, PostDataSource.TYPE_SUBREDDIT);
- intent.putExtra(FilteredThingActivity.EXTRA_FILTER, Post.NSFW_TYPE);
- mActivity.startActivity(intent);
- });
- ((PostDetailViewHolder) holder).mNSFWTextView.setVisibility(View.VISIBLE);
+ ((PostDetailBaseViewHolder) holder).mNSFWTextView.setVisibility(View.VISIBLE);
} else {
- ((PostDetailViewHolder) holder).mNSFWTextView.setVisibility(View.GONE);
+ ((PostDetailBaseViewHolder) holder).mNSFWTextView.setVisibility(View.GONE);
}
- ((PostDetailViewHolder) holder).mScoreTextView.setText(Utils.getNVotes(mShowAbsoluteNumberOfVotes, mPost.getScore() + mPost.getVoteType()));
-
- ((PostDetailViewHolder) holder).mTypeTextView.setOnClickListener(view -> {
- Intent intent = new Intent(mActivity, FilteredThingActivity.class);
- intent.putExtra(FilteredThingActivity.EXTRA_NAME, mSubredditNamePrefixed.substring(2));
- intent.putExtra(FilteredThingActivity.EXTRA_POST_TYPE, PostDataSource.TYPE_SUBREDDIT);
- intent.putExtra(FilteredThingActivity.EXTRA_FILTER, mPost.getPostType());
- mActivity.startActivity(intent);
-
- });
+ ((PostDetailBaseViewHolder) holder).mScoreTextView.setText(Utils.getNVotes(mShowAbsoluteNumberOfVotes, mPost.getScore() + mPost.getVoteType()));
- switch (mPost.getPostType()) {
- case Post.IMAGE_TYPE:
- ((PostDetailViewHolder) holder).mTypeTextView.setText("IMAGE");
-
- ((PostDetailViewHolder) holder).mImageView.setOnClickListener(view -> {
- Intent intent = new Intent(mActivity, ViewImageActivity.class);
- intent.putExtra(ViewImageActivity.IMAGE_URL_KEY, mPost.getUrl());
- intent.putExtra(ViewImageActivity.FILE_NAME_KEY, mPost.getSubredditNamePrefixed().substring(2)
- + "-" + mPost.getId().substring(3) + ".jpg");
- intent.putExtra(ViewImageActivity.POST_TITLE_KEY, mPost.getTitle());
- mActivity.startActivity(intent);
- });
-
- if (mPost.getPreviewWidth() <= 0 || mPost.getPreviewHeight() <= 0) {
- ((PostDetailViewHolder) holder).mImageView.setScaleType(ImageView.ScaleType.CENTER_CROP);
- ((PostDetailViewHolder) holder).mImageView.getLayoutParams().height = (int) (400 * mScale);
- }
- break;
- case Post.LINK_TYPE:
- ((PostDetailViewHolder) holder).mTypeTextView.setText("LINK");
+ ((PostDetailBaseViewHolder) holder).commentsCountTextView.setText(Integer.toString(mPost.getNComments()));
- ((PostDetailViewHolder) holder).mLinkTextView.setVisibility(View.VISIBLE);
- String domain = Uri.parse(mPost.getUrl()).getHost();
- ((PostDetailViewHolder) holder).mLinkTextView.setText(domain);
-
- ((PostDetailViewHolder) holder).mImageView.setOnClickListener(view -> {
- Intent intent = new Intent(mActivity, LinkResolverActivity.class);
- Uri uri = Uri.parse(mPost.getUrl());
- if (uri.getScheme() == null && uri.getHost() == null) {
- intent.setData(LinkResolverActivity.getRedditUriByPath(mPost.getUrl()));
- } else {
- intent.setData(uri);
- }
- mActivity.startActivity(intent);
- });
- break;
- case Post.GIF_TYPE:
- ((PostDetailViewHolder) holder).mTypeTextView.setText("GIF");
-
- ((PostDetailViewHolder) holder).mImageView.setOnClickListener(view -> {
- Intent intent = new Intent(mActivity, ViewGIFActivity.class);
- intent.putExtra(ViewGIFActivity.FILE_NAME_KEY, mPost.getSubredditName()
- + "-" + mPost.getId() + ".gif");
- intent.putExtra(ViewGIFActivity.GIF_URL_KEY, mPost.getVideoUrl());
- intent.putExtra(ViewImageActivity.POST_TITLE_KEY, mPost.getTitle());
- mActivity.startActivity(intent);
- });
-
- ((PostDetailViewHolder) holder).mPlayButtonImageView.setVisibility(View.VISIBLE);
- break;
- case Post.VIDEO_TYPE:
- ((PostDetailViewHolder) holder).mTypeTextView.setText("VIDEO");
-
- final Uri videoUri = Uri.parse(mPost.getVideoUrl());
- ((PostDetailViewHolder) holder).mImageView.setOnClickListener(view -> {
- Intent intent = new Intent(mActivity, ViewVideoActivity.class);
- intent.setData(videoUri);
- intent.putExtra(ViewVideoActivity.EXTRA_VIDEO_DOWNLOAD_URL, mPost.getVideoDownloadUrl());
- intent.putExtra(ViewVideoActivity.EXTRA_SUBREDDIT, mPost.getSubredditName());
- intent.putExtra(ViewVideoActivity.EXTRA_ID, mPost.getId());
- intent.putExtra(ViewVideoActivity.EXTRA_POST_TITLE, mPost.getTitle());
- mActivity.startActivity(intent);
- });
-
- ((PostDetailViewHolder) holder).mPlayButtonImageView.setVisibility(View.VISIBLE);
- break;
- case Post.NO_PREVIEW_LINK_TYPE:
- ((PostDetailViewHolder) holder).mTypeTextView.setText("LINK");
-
- ((PostDetailViewHolder) holder).mLinkTextView.setVisibility(View.VISIBLE);
- String noPreviewLinkDomain = Uri.parse(mPost.getUrl()).getHost();
- ((PostDetailViewHolder) holder).mLinkTextView.setText(noPreviewLinkDomain);
-
- if (mPost.getSelfText() != null && !mPost.getSelfText().equals("")) {
- ((PostDetailViewHolder) holder).mContentMarkdownView.setVisibility(View.VISIBLE);
- LinearLayoutManager linearLayoutManager = new MarkwonLinearLayoutManager(mActivity, new MarkwonLinearLayoutManager.HorizontalScrollViewScrolledListener() {
- @Override
- public void onScrolledLeft() {
- ((ViewPostDetailActivity) mActivity).lockSwipeRightToGoBack();
- }
-
- @Override
- public void onScrolledRight() {
- ((ViewPostDetailActivity) mActivity).unlockSwipeRightToGoBack();
- }
- });
- ((PostDetailViewHolder) holder).mContentMarkdownView.setLayoutManager(linearLayoutManager);
- ((PostDetailViewHolder) holder).mContentMarkdownView.setAdapter(mMarkwonAdapter);
- mMarkwonAdapter.setMarkdown(mPostDetailMarkwon, mPost.getSelfText());
- mMarkwonAdapter.notifyDataSetChanged();
- }
-
- ((PostDetailViewHolder) holder).mNoPreviewLinkImageView.setVisibility(View.VISIBLE);
- ((PostDetailViewHolder) holder).mNoPreviewLinkImageView.setOnClickListener(view -> {
- Intent intent = new Intent(mActivity, LinkResolverActivity.class);
- Uri uri = Uri.parse(mPost.getUrl());
- if (uri.getScheme() == null && uri.getHost() == null) {
- intent.setData(LinkResolverActivity.getRedditUriByPath(mPost.getUrl()));
- } else {
- intent.setData(uri);
- }
- mActivity.startActivity(intent);
- });
- break;
- case Post.TEXT_TYPE:
- ((PostDetailViewHolder) holder).mTypeTextView.setText("TEXT");
-
- if (mPost.getSelfText() != null && !mPost.getSelfText().equals("")) {
- ((PostDetailViewHolder) holder).mContentMarkdownView.setVisibility(View.VISIBLE);
- LinearLayoutManager linearLayoutManager = new MarkwonLinearLayoutManager(mActivity, new MarkwonLinearLayoutManager.HorizontalScrollViewScrolledListener() {
- @Override
- public void onScrolledLeft() {
- ((ViewPostDetailActivity) mActivity).lockSwipeRightToGoBack();
- }
-
- @Override
- public void onScrolledRight() {
- ((ViewPostDetailActivity) mActivity).unlockSwipeRightToGoBack();
- }
- });
- ((PostDetailViewHolder) holder).mContentMarkdownView.setLayoutManager(linearLayoutManager);
- ((PostDetailViewHolder) holder).mContentMarkdownView.setAdapter(mMarkwonAdapter);
- mMarkwonAdapter.setMarkdown(mPostDetailMarkwon, mPost.getSelfText());
- mMarkwonAdapter.notifyDataSetChanged();
- }
- break;
+ if (mPost.isSaved()) {
+ ((PostDetailBaseViewHolder) holder).mSaveButton.setImageResource(R.drawable.ic_bookmark_grey_24dp);
+ } else {
+ ((PostDetailBaseViewHolder) holder).mSaveButton.setImageResource(R.drawable.ic_bookmark_border_grey_24dp);
}
- ((PostDetailViewHolder) holder).commentsCountTextView.setOnClickListener(view -> {
- if (mPost.isArchived()) {
- Toast.makeText(mActivity, R.string.archived_post_reply_unavailable, Toast.LENGTH_SHORT).show();
- return;
+ if (holder instanceof PostDetailVideoAutoplayViewHolder) {
+ ((PostDetailVideoAutoplayViewHolder) holder).aspectRatioFrameLayout.setAspectRatio((float) mPost.getPreviewWidth() / mPost.getPreviewHeight());
+ ((PostDetailVideoAutoplayViewHolder) holder).bindVideoUri(Uri.parse(mPost.getVideoUrl()));
+ } else if (holder instanceof PostDetailVideoAndGifPreviewHolder) {
+ if (mPost.getPostType() == Post.GIF_TYPE) {
+ ((PostDetailVideoAndGifPreviewHolder) holder).mTypeTextView.setText(mActivity.getString(R.string.gif));
+ } else {
+ ((PostDetailVideoAndGifPreviewHolder) holder).mTypeTextView.setText(mActivity.getString(R.string.video));
}
-
- if (mPost.isLocked()) {
- Toast.makeText(mActivity, R.string.locked_post_comment_unavailable, Toast.LENGTH_SHORT).show();
- return;
+ ((PostDetailVideoAndGifPreviewHolder) holder).mImageView.setRatio((float) mPost.getPreviewHeight() / (float) mPost.getPreviewWidth());
+ loadImage((PostDetailVideoAndGifPreviewHolder) holder);
+ } else if (holder instanceof PostDetailImageAndGifAutoplayViewHolder) {
+ if (mPost.getPostType() == Post.GIF_TYPE) {
+ ((PostDetailImageAndGifAutoplayViewHolder) holder).mTypeTextView.setText(mActivity.getString(R.string.gif));
+ } else {
+ ((PostDetailImageAndGifAutoplayViewHolder) holder).mTypeTextView.setText(mActivity.getString(R.string.image));
}
- if (mAccessToken == null) {
- Toast.makeText(mActivity, R.string.login_first, Toast.LENGTH_SHORT).show();
- return;
+ if (mPost.getPreviewWidth() <= 0 || mPost.getPreviewHeight() <= 0) {
+ ((PostDetailImageAndGifAutoplayViewHolder) holder).mImageView.setScaleType(ImageView.ScaleType.CENTER_CROP);
+ ((PostDetailImageAndGifAutoplayViewHolder) holder).mImageView.getLayoutParams().height = (int) (400 * mScale);
}
- Intent intent = new Intent(mActivity, CommentActivity.class);
- intent.putExtra(CommentActivity.EXTRA_PARENT_FULLNAME_KEY, mPost.getFullName());
- intent.putExtra(CommentActivity.EXTRA_COMMENT_PARENT_TEXT_KEY, mPost.getTitle());
- intent.putExtra(CommentActivity.EXTRA_COMMENT_PARENT_BODY_KEY, mPost.getSelfText());
- intent.putExtra(CommentActivity.EXTRA_IS_REPLYING_KEY, false);
- intent.putExtra(CommentActivity.EXTRA_PARENT_DEPTH_KEY, 0);
- mActivity.startActivityForResult(intent, WRITE_COMMENT_REQUEST_CODE);
- });
-
- ((PostDetailViewHolder) holder).commentsCountTextView.setText(Integer.toString(mPost.getNComments()));
-
- if (mPost.isSaved()) {
- ((PostDetailViewHolder) holder).mSaveButton.setImageResource(R.drawable.ic_bookmark_grey_24dp);
- } else {
- ((PostDetailViewHolder) holder).mSaveButton.setImageResource(R.drawable.ic_bookmark_border_grey_24dp);
- }
+ ((PostDetailImageAndGifAutoplayViewHolder) holder).mImageView.setRatio((float) mPost.getPreviewHeight() / (float) mPost.getPreviewWidth());
+ loadImage((PostDetailImageAndGifAutoplayViewHolder) holder);
+ } else if (holder instanceof PostDetailLinkViewHolder) {
+ String domain = Uri.parse(mPost.getUrl()).getHost();
+ ((PostDetailLinkViewHolder) holder).mLinkTextView.setText(domain);
+ ((PostDetailLinkViewHolder) holder).mImageView.setRatio((float) mPost.getPreviewHeight() / (float) mPost.getPreviewWidth());
+ loadImage((PostDetailLinkViewHolder) holder);
+ } else if (holder instanceof PostDetailNoPreviewLinkViewHolder) {
+ String noPreviewLinkDomain = Uri.parse(mPost.getUrl()).getHost();
+ ((PostDetailNoPreviewLinkViewHolder) holder).mLinkTextView.setText(noPreviewLinkDomain);
+
+ if (mPost.getSelfText() != null && !mPost.getSelfText().equals("")) {
+ ((PostDetailNoPreviewLinkViewHolder) holder).mContentMarkdownView.setVisibility(View.VISIBLE);
+ LinearLayoutManager linearLayoutManager = new MarkwonLinearLayoutManager(mActivity, new MarkwonLinearLayoutManager.HorizontalScrollViewScrolledListener() {
+ @Override
+ public void onScrolledLeft() {
+ ((ViewPostDetailActivity) mActivity).lockSwipeRightToGoBack();
+ }
- ((PostDetailViewHolder) holder).mSaveButton.setOnClickListener(view -> {
- if (mAccessToken == null) {
- Toast.makeText(mActivity, R.string.login_first, Toast.LENGTH_SHORT).show();
- return;
+ @Override
+ public void onScrolledRight() {
+ ((ViewPostDetailActivity) mActivity).unlockSwipeRightToGoBack();
+ }
+ });
+ ((PostDetailNoPreviewLinkViewHolder) holder).mContentMarkdownView.setLayoutManager(linearLayoutManager);
+ ((PostDetailNoPreviewLinkViewHolder) holder).mContentMarkdownView.setAdapter(mMarkwonAdapter);
+ mMarkwonAdapter.setMarkdown(mPostDetailMarkwon, mPost.getSelfText());
+ mMarkwonAdapter.notifyDataSetChanged();
}
+ } else if (holder instanceof PostDetailTextViewHolder) {
+ if (mPost.getSelfText() != null && !mPost.getSelfText().equals("")) {
+ ((PostDetailTextViewHolder) holder).mContentMarkdownView.setVisibility(View.VISIBLE);
+ LinearLayoutManager linearLayoutManager = new MarkwonLinearLayoutManager(mActivity, new MarkwonLinearLayoutManager.HorizontalScrollViewScrolledListener() {
+ @Override
+ public void onScrolledLeft() {
+ ((ViewPostDetailActivity) mActivity).lockSwipeRightToGoBack();
+ }
- if (mPost.isSaved()) {
- ((PostDetailViewHolder) holder).mSaveButton.setImageResource(R.drawable.ic_bookmark_border_grey_24dp);
- SaveThing.unsaveThing(mOauthRetrofit, mAccessToken, mPost.getFullName(),
- new SaveThing.SaveThingListener() {
- @Override
- public void success() {
- mPost.setSaved(false);
- ((PostDetailViewHolder) holder).mSaveButton.setImageResource(R.drawable.ic_bookmark_border_grey_24dp);
- Toast.makeText(mActivity, R.string.post_unsaved_success, Toast.LENGTH_SHORT).show();
- mCommentRecyclerViewAdapterCallback.updatePost(mPost);
- }
-
- @Override
- public void failed() {
- mPost.setSaved(true);
- ((PostDetailViewHolder) holder).mSaveButton.setImageResource(R.drawable.ic_bookmark_grey_24dp);
- Toast.makeText(mActivity, R.string.post_unsaved_failed, Toast.LENGTH_SHORT).show();
- mCommentRecyclerViewAdapterCallback.updatePost(mPost);
- }
- });
- } else {
- ((PostDetailViewHolder) holder).mSaveButton.setImageResource(R.drawable.ic_bookmark_grey_24dp);
- SaveThing.saveThing(mOauthRetrofit, mAccessToken, mPost.getFullName(),
- new SaveThing.SaveThingListener() {
- @Override
- public void success() {
- mPost.setSaved(true);
- ((PostDetailViewHolder) holder).mSaveButton.setImageResource(R.drawable.ic_bookmark_grey_24dp);
- Toast.makeText(mActivity, R.string.post_saved_success, Toast.LENGTH_SHORT).show();
- mCommentRecyclerViewAdapterCallback.updatePost(mPost);
- }
-
- @Override
- public void failed() {
- mPost.setSaved(false);
- ((PostDetailViewHolder) holder).mSaveButton.setImageResource(R.drawable.ic_bookmark_border_grey_24dp);
- Toast.makeText(mActivity, R.string.post_saved_failed, Toast.LENGTH_SHORT).show();
- mCommentRecyclerViewAdapterCallback.updatePost(mPost);
- }
- });
+ @Override
+ public void onScrolledRight() {
+ ((ViewPostDetailActivity) mActivity).unlockSwipeRightToGoBack();
+ }
+ });
+ ((PostDetailTextViewHolder) holder).mContentMarkdownView.setLayoutManager(linearLayoutManager);
+ ((PostDetailTextViewHolder) holder).mContentMarkdownView.setAdapter(mMarkwonAdapter);
+ mMarkwonAdapter.setMarkdown(mPostDetailMarkwon, mPost.getSelfText());
+ mMarkwonAdapter.notifyDataSetChanged();
}
- });
+ }
} else if (holder instanceof CommentViewHolder) {
CommentData comment;
if (mIsSingleCommentThreadMode) {
@@ -1202,33 +1104,92 @@ public class CommentAndPostRecyclerViewAdapter extends RecyclerView.Adapter<Recy
}
}
- private void loadImage(PostDetailViewHolder holder) {
- RequestBuilder imageRequestBuilder = mGlide.load(mPost.getPreviewUrl())
- .listener(new RequestListener<Drawable>() {
- @Override
- public boolean onLoadFailed(@Nullable GlideException e, Object model, Target<Drawable> target, boolean isFirstResource) {
- holder.mLoadImageProgressBar.setVisibility(View.GONE);
- holder.mLoadImageErrorTextView.setVisibility(View.VISIBLE);
- holder.mLoadImageErrorTextView.setOnClickListener(view -> {
- holder.mLoadImageProgressBar.setVisibility(View.VISIBLE);
- holder.mLoadImageErrorTextView.setVisibility(View.GONE);
- loadImage(holder);
- });
- return false;
- }
+ private void loadImage(PostDetailBaseViewHolder holder) {
+ if (holder instanceof PostDetailImageAndGifAutoplayViewHolder) {
+ String url = mAutoplay && mPost.getPostType() == Post.GIF_TYPE ? mPost.getUrl() : mPost.getPreviewUrl();
+ RequestBuilder imageRequestBuilder = mGlide.load(url)
+ .listener(new RequestListener<Drawable>() {
+ @Override
+ public boolean onLoadFailed(@Nullable GlideException e, Object model, Target<Drawable> target, boolean isFirstResource) {
+ ((PostDetailImageAndGifAutoplayViewHolder) holder).mLoadImageProgressBar.setVisibility(View.GONE);
+ ((PostDetailImageAndGifAutoplayViewHolder) holder).mLoadImageErrorTextView.setVisibility(View.VISIBLE);
+ ((PostDetailImageAndGifAutoplayViewHolder) holder).mLoadImageErrorTextView.setOnClickListener(view -> {
+ ((PostDetailImageAndGifAutoplayViewHolder) holder).mLoadImageProgressBar.setVisibility(View.VISIBLE);
+ ((PostDetailImageAndGifAutoplayViewHolder) holder).mLoadImageErrorTextView.setVisibility(View.GONE);
+ loadImage(holder);
+ });
+ return false;
+ }
- @Override
- public boolean onResourceReady(Drawable resource, Object model, Target<Drawable> target, DataSource dataSource, boolean isFirstResource) {
- holder.mLoadWrapper.setVisibility(View.GONE);
- return false;
- }
- });
+ @Override
+ public boolean onResourceReady(Drawable resource, Object model, Target<Drawable> target, DataSource dataSource, boolean isFirstResource) {
+ ((PostDetailImageAndGifAutoplayViewHolder) holder).mLoadWrapper.setVisibility(View.GONE);
+ return false;
+ }
+ });
- if ((mPost.isNSFW() && mNeedBlurNSFW) || (mPost.isSpoiler() && mNeedBlurSpoiler)) {
- imageRequestBuilder.apply(RequestOptions.bitmapTransform(new BlurTransformation(50, 10)))
- .into(holder.mImageView);
- } else {
- imageRequestBuilder.into(holder.mImageView);
+ if ((mPost.isNSFW() && mNeedBlurNsfw) || (mPost.isSpoiler() && mNeedBlurSpoiler)) {
+ imageRequestBuilder.apply(RequestOptions.bitmapTransform(new BlurTransformation(50, 10)))
+ .into(((PostDetailImageAndGifAutoplayViewHolder) holder).mImageView);
+ } else {
+ imageRequestBuilder.into(((PostDetailImageAndGifAutoplayViewHolder) holder).mImageView);
+ }
+ } else if (holder instanceof PostDetailVideoAndGifPreviewHolder) {
+ RequestBuilder imageRequestBuilder = mGlide.load(mPost.getPreviewUrl())
+ .listener(new RequestListener<Drawable>() {
+ @Override
+ public boolean onLoadFailed(@Nullable GlideException e, Object model, Target<Drawable> target, boolean isFirstResource) {
+ ((PostDetailVideoAndGifPreviewHolder) holder).mLoadImageProgressBar.setVisibility(View.GONE);
+ ((PostDetailVideoAndGifPreviewHolder) holder).mLoadImageErrorTextView.setVisibility(View.VISIBLE);
+ ((PostDetailVideoAndGifPreviewHolder) holder).mLoadImageErrorTextView.setOnClickListener(view -> {
+ ((PostDetailVideoAndGifPreviewHolder) holder).mLoadImageProgressBar.setVisibility(View.VISIBLE);
+ ((PostDetailVideoAndGifPreviewHolder) holder).mLoadImageErrorTextView.setVisibility(View.GONE);
+ loadImage(holder);
+ });
+ return false;
+ }
+
+ @Override
+ public boolean onResourceReady(Drawable resource, Object model, Target<Drawable> target, DataSource dataSource, boolean isFirstResource) {
+ ((PostDetailVideoAndGifPreviewHolder) holder).mLoadWrapper.setVisibility(View.GONE);
+ return false;
+ }
+ });
+
+ if ((mPost.isNSFW() && mNeedBlurNsfw) || (mPost.isSpoiler() && mNeedBlurSpoiler)) {
+ imageRequestBuilder.apply(RequestOptions.bitmapTransform(new BlurTransformation(50, 10)))
+ .into(((PostDetailVideoAndGifPreviewHolder) holder).mImageView);
+ } else {
+ imageRequestBuilder.into(((PostDetailVideoAndGifPreviewHolder) holder).mImageView);
+ }
+ } else if(holder instanceof PostDetailLinkViewHolder) {
+ RequestBuilder imageRequestBuilder = mGlide.load(mPost.getPreviewUrl())
+ .listener(new RequestListener<Drawable>() {
+ @Override
+ public boolean onLoadFailed(@Nullable GlideException e, Object model, Target<Drawable> target, boolean isFirstResource) {
+ ((PostDetailLinkViewHolder) holder).mLoadImageProgressBar.setVisibility(View.GONE);
+ ((PostDetailLinkViewHolder) holder).mLoadImageErrorTextView.setVisibility(View.VISIBLE);
+ ((PostDetailLinkViewHolder) holder).mLoadImageErrorTextView.setOnClickListener(view -> {
+ ((PostDetailLinkViewHolder) holder).mLoadImageProgressBar.setVisibility(View.VISIBLE);
+ ((PostDetailLinkViewHolder) holder).mLoadImageErrorTextView.setVisibility(View.GONE);
+ loadImage(holder);
+ });
+ return false;
+ }
+
+ @Override
+ public boolean onResourceReady(Drawable resource, Object model, Target<Drawable> target, DataSource dataSource, boolean isFirstResource) {
+ ((PostDetailLinkViewHolder) holder).mLoadWrapper.setVisibility(View.GONE);
+ return false;
+ }
+ });
+
+ if ((mPost.isNSFW() && mNeedBlurNsfw) || (mPost.isSpoiler() && mNeedBlurSpoiler)) {
+ imageRequestBuilder.apply(RequestOptions.bitmapTransform(new BlurTransformation(50, 10)))
+ .into(((PostDetailLinkViewHolder) holder).mImageView);
+ } else {
+ imageRequestBuilder.into(((PostDetailLinkViewHolder) holder).mImageView);
+ }
}
}
@@ -1445,7 +1406,7 @@ public class CommentAndPostRecyclerViewAdapter extends RecyclerView.Adapter<Recy
}
public void setBlurNSFW(boolean needBlurNSFW) {
- mNeedBlurNSFW = needBlurNSFW;
+ mNeedBlurNsfw = needBlurNSFW;
}
public void setBlurSpoiler(boolean needBlurSpoiler) {
@@ -1509,13 +1470,24 @@ public class CommentAndPostRecyclerViewAdapter extends RecyclerView.Adapter<Recy
((CommentViewHolder) holder).verticalBlock.setLayoutParams(params);
((CommentViewHolder) holder).itemView.setPadding(0, 0, 0, 0);
((CommentViewHolder) holder).itemView.setBackgroundColor(mCommentBackgroundColor);
- } else if (holder instanceof PostDetailViewHolder) {
- ((PostDetailViewHolder) holder).mUpvoteButton.setColorFilter(mPostIconAndInfoColor, android.graphics.PorterDuff.Mode.SRC_IN);
- ((PostDetailViewHolder) holder).mScoreTextView.setTextColor(mPostIconAndInfoColor);
- ((PostDetailViewHolder) holder).mDownvoteButton.setColorFilter(mPostIconAndInfoColor, android.graphics.PorterDuff.Mode.SRC_IN);
- ((PostDetailViewHolder) holder).mFlairTextView.setVisibility(View.GONE);
- ((PostDetailViewHolder) holder).mSpoilerTextView.setVisibility(View.GONE);
- ((PostDetailViewHolder) holder).mNSFWTextView.setVisibility(View.GONE);
+ } else if (holder instanceof PostDetailBaseViewHolder) {
+ ((PostDetailBaseViewHolder) holder).mUpvoteButton.setColorFilter(mPostIconAndInfoColor, android.graphics.PorterDuff.Mode.SRC_IN);
+ ((PostDetailBaseViewHolder) holder).mScoreTextView.setTextColor(mPostIconAndInfoColor);
+ ((PostDetailBaseViewHolder) holder).mDownvoteButton.setColorFilter(mPostIconAndInfoColor, android.graphics.PorterDuff.Mode.SRC_IN);
+ ((PostDetailBaseViewHolder) holder).mFlairTextView.setVisibility(View.GONE);
+ ((PostDetailBaseViewHolder) holder).mSpoilerTextView.setVisibility(View.GONE);
+ ((PostDetailBaseViewHolder) holder).mNSFWTextView.setVisibility(View.GONE);
+
+ if (holder instanceof PostDetailVideoAutoplayViewHolder) {
+ ((PostDetailVideoAutoplayViewHolder) holder).muteButton.setVisibility(View.GONE);
+ ((PostDetailVideoAutoplayViewHolder) holder).resetVolume();
+ } else if (holder instanceof PostDetailVideoAndGifPreviewHolder) {
+ mGlide.clear(((PostDetailVideoAndGifPreviewHolder) holder).mImageView);
+ } else if (holder instanceof PostDetailImageAndGifAutoplayViewHolder) {
+ mGlide.clear(((PostDetailImageAndGifAutoplayViewHolder) holder).mImageView);
+ } else if (holder instanceof PostDetailLinkViewHolder) {
+ mGlide.clear(((PostDetailLinkViewHolder) holder).mImageView);
+ }
} else if (holder instanceof LoadMoreChildCommentsViewHolder) {
((LoadMoreChildCommentsViewHolder) holder).itemView.setPadding(0, 0, 0, 0);
ViewGroup.LayoutParams params = ((LoadMoreChildCommentsViewHolder) holder).verticalBlock.getLayoutParams();
@@ -1545,6 +1517,18 @@ public class CommentAndPostRecyclerViewAdapter extends RecyclerView.Adapter<Recy
}
}
+ @Nullable
+ @Override
+ public Object getKeyForOrder(int order) {
+ return mPost;
+ }
+
+ @Nullable
+ @Override
+ public Integer getOrderForKey(@NonNull Object key) {
+ return 0;
+ }
+
public interface CommentRecyclerViewAdapterCallback {
void updatePost(Post post);
@@ -1553,71 +1537,75 @@ public class CommentAndPostRecyclerViewAdapter extends RecyclerView.Adapter<Recy
void retryFetchingMoreComments();
}
- class PostDetailViewHolder extends RecyclerView.ViewHolder {
- @BindView(R.id.icon_gif_image_view_item_post_detail)
+ class PostDetailBaseViewHolder extends RecyclerView.ViewHolder {
AspectRatioGifImageView mIconGifImageView;
- @BindView(R.id.subreddit_text_view_item_post_detail)
TextView mSubredditTextView;
- @BindView(R.id.user_text_view_item_post_detail)
TextView mUserTextView;
- @BindView(R.id.author_flair_text_view_item_post_detail)
TextView mAuthorFlairTextView;
- @BindView(R.id.post_time_text_view_item_post_detail)
TextView mPostTimeTextView;
- @BindView(R.id.title_text_view_item_post_detail)
TextView mTitleTextView;
- @BindView(R.id.content_markdown_view_item_post_detail)
- RecyclerView mContentMarkdownView;
- @BindView(R.id.type_text_view_item_post_detail)
CustomTextView mTypeTextView;
- @BindView(R.id.crosspost_image_view_item_post_detail)
ImageView mCrosspostImageView;
- @BindView(R.id.archived_image_view_item_post_detail)
ImageView mArchivedImageView;
- @BindView(R.id.locked_image_view_item_post_detail)
ImageView mLockedImageView;
- @BindView(R.id.nsfw_text_view_item_post_detail)
CustomTextView mNSFWTextView;
- @BindView(R.id.spoiler_custom_text_view_item_post_detail)
CustomTextView mSpoilerTextView;
- @BindView(R.id.flair_custom_text_view_item_post_detail)
CustomTextView mFlairTextView;
- @BindView(R.id.awards_text_view_item_post_detail)
TextView mAwardsTextView;
- @BindView(R.id.link_text_view_item_post_detail)
- TextView mLinkTextView;
- @BindView(R.id.image_view_wrapper_item_post_detail)
- RelativeLayout mRelativeLayout;
- @BindView(R.id.load_wrapper_item_post_detail)
- RelativeLayout mLoadWrapper;
- @BindView(R.id.progress_bar_item_post_detail)
- ProgressBar mLoadImageProgressBar;
- @BindView(R.id.load_image_error_text_view_item_post_detail)
- TextView mLoadImageErrorTextView;
- @BindView(R.id.image_view_item_post_detail)
- AspectRatioImageView mImageView;
- @BindView(R.id.play_button_image_view_item_post_detail)
- ImageView mPlayButtonImageView;
- @BindView(R.id.image_view_no_preview_link_item_post_detail)
- ImageView mNoPreviewLinkImageView;
- @BindView(R.id.bottom_constraint_layout_item_post_detail)
ConstraintLayout mBottomConstraintLayout;
- @BindView(R.id.plus_button_item_post_detail)
ImageView mUpvoteButton;
- @BindView(R.id.score_text_view_item_post_detail)
TextView mScoreTextView;
- @BindView(R.id.minus_button_item_post_detail)
ImageView mDownvoteButton;
- @BindView(R.id.comments_count_item_post_detail)
TextView commentsCountTextView;
- @BindView(R.id.save_button_item_post_detail)
ImageView mSaveButton;
- @BindView(R.id.share_button_item_post_detail)
ImageView mShareButton;
- PostDetailViewHolder(@NonNull View itemView) {
+ PostDetailBaseViewHolder(@NonNull View itemView) {
super(itemView);
- ButterKnife.bind(this, itemView);
+ }
+
+ void setBaseView(AspectRatioGifImageView mIconGifImageView,
+ TextView mSubredditTextView,
+ TextView mUserTextView,
+ TextView mAuthorFlairTextView,
+ TextView mPostTimeTextView,
+ TextView mTitleTextView,
+ CustomTextView mTypeTextView,
+ ImageView mCrosspostImageView,
+ ImageView mArchivedImageView,
+ ImageView mLockedImageView,
+ CustomTextView mNSFWTextView,
+ CustomTextView mSpoilerTextView,
+ CustomTextView mFlairTextView,
+ TextView mAwardsTextView,
+ ConstraintLayout mBottomConstraintLayout,
+ ImageView mUpvoteButton,
+ TextView mScoreTextView,
+ ImageView mDownvoteButton,
+ TextView commentsCountTextView,
+ ImageView mSaveButton,
+ ImageView mShareButton) {
+ this.mIconGifImageView = mIconGifImageView;
+ this.mSubredditTextView = mSubredditTextView;
+ this.mUserTextView = mUserTextView;
+ this.mAuthorFlairTextView = mAuthorFlairTextView;
+ this.mPostTimeTextView = mPostTimeTextView;
+ this.mTitleTextView = mTitleTextView;
+ this.mTypeTextView = mTypeTextView;
+ this.mCrosspostImageView = mCrosspostImageView;
+ this.mArchivedImageView = mArchivedImageView;
+ this.mLockedImageView = mLockedImageView;
+ this.mNSFWTextView = mNSFWTextView;
+ this.mSpoilerTextView = mSpoilerTextView;
+ this.mFlairTextView = mFlairTextView;
+ this.mAwardsTextView = mAwardsTextView;
+ this.mBottomConstraintLayout = mBottomConstraintLayout;
+ this.mUpvoteButton = mUpvoteButton;
+ this.mScoreTextView = mScoreTextView;
+ this.mDownvoteButton = mDownvoteButton;
+ this.commentsCountTextView = commentsCountTextView;
+ this.mSaveButton = mSaveButton;
+ this.mShareButton = mShareButton;
mIconGifImageView.setOnClickListener(view -> mSubredditTextView.performClick());
@@ -1640,25 +1628,28 @@ public class CommentAndPostRecyclerViewAdapter extends RecyclerView.Adapter<Recy
mActivity.startActivity(intent);
});
- mShareButton.setOnClickListener(view -> {
- Bundle bundle = new Bundle();
- bundle.putString(ShareLinkBottomSheetFragment.EXTRA_POST_LINK, mPost.getPermalink());
- if (mPost.getPostType() != Post.TEXT_TYPE) {
- bundle.putInt(ShareLinkBottomSheetFragment.EXTRA_MEDIA_TYPE, mPost.getPostType());
- switch (mPost.getPostType()) {
- case Post.IMAGE_TYPE:
- case Post.GIF_TYPE:
- case Post.LINK_TYPE:
- case Post.NO_PREVIEW_LINK_TYPE:
- bundle.putString(ShareLinkBottomSheetFragment.EXTRA_MEDIA_LINK, mPost.getUrl());
- break;
- case Post.VIDEO_TYPE:
- bundle.putString(ShareLinkBottomSheetFragment.EXTRA_MEDIA_LINK, mPost.getVideoDownloadUrl());
- break;
- }
- }
- mShareLinkBottomSheetFragment.setArguments(bundle);
- mShareLinkBottomSheetFragment.show(mActivity.getSupportFragmentManager(), mShareLinkBottomSheetFragment.getTag());
+ mAuthorFlairTextView.setOnClickListener(view -> mUserTextView.performClick());
+
+ mCrosspostImageView.setOnClickListener(view -> {
+ Intent crosspostIntent = new Intent(mActivity, ViewPostDetailActivity.class);
+ crosspostIntent.putExtra(ViewPostDetailActivity.EXTRA_POST_ID, mPost.getCrosspostParentId());
+ mActivity.startActivity(crosspostIntent);
+ });
+
+ mTypeTextView.setOnClickListener(view -> {
+ Intent intent = new Intent(mActivity, FilteredThingActivity.class);
+ intent.putExtra(FilteredThingActivity.EXTRA_NAME, mSubredditNamePrefixed.substring(2));
+ intent.putExtra(FilteredThingActivity.EXTRA_POST_TYPE, PostDataSource.TYPE_SUBREDDIT);
+ intent.putExtra(FilteredThingActivity.EXTRA_FILTER, mPost.getPostType());
+ mActivity.startActivity(intent);
+ });
+
+ mNSFWTextView.setOnClickListener(view -> {
+ Intent intent = new Intent(mActivity, FilteredThingActivity.class);
+ intent.putExtra(FilteredThingActivity.EXTRA_NAME, mSubredditNamePrefixed.substring(2));
+ intent.putExtra(FilteredThingActivity.EXTRA_POST_TYPE, PostDataSource.TYPE_SUBREDDIT);
+ intent.putExtra(FilteredThingActivity.EXTRA_FILTER, Post.NSFW_TYPE);
+ mActivity.startActivity(intent);
});
mUpvoteButton.setOnClickListener(view -> {
@@ -1809,6 +1800,101 @@ public class CommentAndPostRecyclerViewAdapter extends RecyclerView.Adapter<Recy
}, mPost.getFullName(), newVoteType);
});
+ commentsCountTextView.setOnClickListener(view -> {
+ if (mPost.isArchived()) {
+ Toast.makeText(mActivity, R.string.archived_post_reply_unavailable, Toast.LENGTH_SHORT).show();
+ return;
+ }
+
+ if (mPost.isLocked()) {
+ Toast.makeText(mActivity, R.string.locked_post_comment_unavailable, Toast.LENGTH_SHORT).show();
+ return;
+ }
+
+ if (mAccessToken == null) {
+ Toast.makeText(mActivity, R.string.login_first, Toast.LENGTH_SHORT).show();
+ return;
+ }
+
+ Intent intent = new Intent(mActivity, CommentActivity.class);
+ intent.putExtra(CommentActivity.EXTRA_PARENT_FULLNAME_KEY, mPost.getFullName());
+ intent.putExtra(CommentActivity.EXTRA_COMMENT_PARENT_TEXT_KEY, mPost.getTitle());
+ intent.putExtra(CommentActivity.EXTRA_COMMENT_PARENT_BODY_KEY, mPost.getSelfText());
+ intent.putExtra(CommentActivity.EXTRA_IS_REPLYING_KEY, false);
+ intent.putExtra(CommentActivity.EXTRA_PARENT_DEPTH_KEY, 0);
+ mActivity.startActivityForResult(intent, WRITE_COMMENT_REQUEST_CODE);
+ });
+
+ mSaveButton.setOnClickListener(view -> {
+ if (mAccessToken == null) {
+ Toast.makeText(mActivity, R.string.login_first, Toast.LENGTH_SHORT).show();
+ return;
+ }
+
+ if (mPost.isSaved()) {
+ mSaveButton.setImageResource(R.drawable.ic_bookmark_border_grey_24dp);
+ SaveThing.unsaveThing(mOauthRetrofit, mAccessToken, mPost.getFullName(),
+ new SaveThing.SaveThingListener() {
+ @Override
+ public void success() {
+ mPost.setSaved(false);
+ mSaveButton.setImageResource(R.drawable.ic_bookmark_border_grey_24dp);
+ Toast.makeText(mActivity, R.string.post_unsaved_success, Toast.LENGTH_SHORT).show();
+ mCommentRecyclerViewAdapterCallback.updatePost(mPost);
+ }
+
+ @Override
+ public void failed() {
+ mPost.setSaved(true);
+ mSaveButton.setImageResource(R.drawable.ic_bookmark_grey_24dp);
+ Toast.makeText(mActivity, R.string.post_unsaved_failed, Toast.LENGTH_SHORT).show();
+ mCommentRecyclerViewAdapterCallback.updatePost(mPost);
+ }
+ });
+ } else {
+ mSaveButton.setImageResource(R.drawable.ic_bookmark_grey_24dp);
+ SaveThing.saveThing(mOauthRetrofit, mAccessToken, mPost.getFullName(),
+ new SaveThing.SaveThingListener() {
+ @Override
+ public void success() {
+ mPost.setSaved(true);
+ mSaveButton.setImageResource(R.drawable.ic_bookmark_grey_24dp);
+ Toast.makeText(mActivity, R.string.post_saved_success, Toast.LENGTH_SHORT).show();
+ mCommentRecyclerViewAdapterCallback.updatePost(mPost);
+ }
+
+ @Override
+ public void failed() {
+ mPost.setSaved(false);
+ mSaveButton.setImageResource(R.drawable.ic_bookmark_border_grey_24dp);
+ Toast.makeText(mActivity, R.string.post_saved_failed, Toast.LENGTH_SHORT).show();
+ mCommentRecyclerViewAdapterCallback.updatePost(mPost);
+ }
+ });
+ }
+ });
+
+ mShareButton.setOnClickListener(view -> {
+ Bundle bundle = new Bundle();
+ bundle.putString(ShareLinkBottomSheetFragment.EXTRA_POST_LINK, mPost.getPermalink());
+ if (mPost.getPostType() != Post.TEXT_TYPE) {
+ bundle.putInt(ShareLinkBottomSheetFragment.EXTRA_MEDIA_TYPE, mPost.getPostType());
+ switch (mPost.getPostType()) {
+ case Post.IMAGE_TYPE:
+ case Post.GIF_TYPE:
+ case Post.LINK_TYPE:
+ case Post.NO_PREVIEW_LINK_TYPE:
+ bundle.putString(ShareLinkBottomSheetFragment.EXTRA_MEDIA_LINK, mPost.getUrl());
+ break;
+ case Post.VIDEO_TYPE:
+ bundle.putString(ShareLinkBottomSheetFragment.EXTRA_MEDIA_LINK, mPost.getVideoDownloadUrl());
+ break;
+ }
+ }
+ mShareLinkBottomSheetFragment.setArguments(bundle);
+ mShareLinkBottomSheetFragment.show(mActivity.getSupportFragmentManager(), mShareLinkBottomSheetFragment.getTag());
+ });
+
if (mVoteButtonsOnTheRight) {
ConstraintSet constraintSet = new ConstraintSet();
constraintSet.clone(mBottomConstraintLayout);
@@ -1850,10 +1936,6 @@ public class CommentAndPostRecyclerViewAdapter extends RecyclerView.Adapter<Recy
mLockedImageView.setColorFilter(mLockedTintColor, PorterDuff.Mode.SRC_IN);
mCrosspostImageView.setColorFilter(mCrosspostTintColor, PorterDuff.Mode.SRC_IN);
mAwardsTextView.setTextColor(mSecondaryTextColor);
- mLinkTextView.setTextColor(mSecondaryTextColor);
- mLoadImageProgressBar.setIndeterminateTintList(ColorStateList.valueOf(mColorAccent));
- mNoPreviewLinkImageView.setBackgroundColor(mNoPreviewLinkBackgroundColor);
- mLoadImageErrorTextView.setTextColor(mPrimaryTextColor);
mUpvoteButton.setColorFilter(mPostIconAndInfoColor, android.graphics.PorterDuff.Mode.SRC_IN);
mScoreTextView.setTextColor(mPostIconAndInfoColor);
mDownvoteButton.setColorFilter(mPostIconAndInfoColor, android.graphics.PorterDuff.Mode.SRC_IN);
@@ -1864,6 +1946,674 @@ public class CommentAndPostRecyclerViewAdapter extends RecyclerView.Adapter<Recy
}
}
+ class PostDetailVideoAutoplayViewHolder extends PostDetailBaseViewHolder implements ToroPlayer {
+ @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)
+ TextView mSubredditTextView;
+ @BindView(R.id.user_text_view_item_post_detail_video_autoplay)
+ TextView mUserTextView;
+ @BindView(R.id.author_flair_text_view_item_post_detail_video_autoplay)
+ TextView mAuthorFlairTextView;
+ @BindView(R.id.post_time_text_view_item_post_detail_video_autoplay)
+ TextView mPostTimeTextView;
+ @BindView(R.id.title_text_view_item_post_detail_video_autoplay)
+ TextView mTitleTextView;
+ @BindView(R.id.type_text_view_item_post_detail_video_autoplay)
+ CustomTextView mTypeTextView;
+ @BindView(R.id.crosspost_image_view_item_post_detail_video_autoplay)
+ ImageView mCrosspostImageView;
+ @BindView(R.id.archived_image_view_item_post_detail_video_autoplay)
+ ImageView mArchivedImageView;
+ @BindView(R.id.locked_image_view_item_post_detail_video_autoplay)
+ ImageView mLockedImageView;
+ @BindView(R.id.nsfw_text_view_item_post_detail_video_autoplay)
+ CustomTextView mNSFWTextView;
+ @BindView(R.id.spoiler_custom_text_view_item_post_detail_video_autoplay)
+ CustomTextView mSpoilerTextView;
+ @BindView(R.id.flair_custom_text_view_item_post_detail_video_autoplay)
+ CustomTextView mFlairTextView;
+ @BindView(R.id.awards_text_view_item_post_detail_video_autoplay)
+ TextView mAwardsTextView;
+ @BindView(R.id.aspect_ratio_frame_layout_item_post_detail_video_autoplay)
+ AspectRatioFrameLayout aspectRatioFrameLayout;
+ @BindView(R.id.player_view_item_post_detail_video_autoplay)
+ PlayerView playerView;
+ @BindView(R.id.mute_exo_playback_control_view)
+ ImageView muteButton;
+ @BindView(R.id.fullscreen_exo_playback_control_view)
+ ImageView fullscreenButton;
+ @BindView(R.id.bottom_constraint_layout_item_post_detail_video_autoplay)
+ ConstraintLayout mBottomConstraintLayout;
+ @BindView(R.id.plus_button_item_post_detail_video_autoplay)
+ ImageView mUpvoteButton;
+ @BindView(R.id.score_text_view_item_post_detail_video_autoplay)
+ TextView mScoreTextView;
+ @BindView(R.id.minus_button_item_post_detail_video_autoplay)
+ ImageView mDownvoteButton;
+ @BindView(R.id.comments_count_item_post_detail_video_autoplay)
+ TextView commentsCountTextView;
+ @BindView(R.id.save_button_item_post_detail_video_autoplay)
+ ImageView mSaveButton;
+ @BindView(R.id.share_button_item_post_detail_video_autoplay)
+ ImageView mShareButton;
+
+ @Nullable
+ ExoPlayerViewHelper helper;
+ private Uri mediaUri;
+ private float volume = 0f;
+
+ public PostDetailVideoAutoplayViewHolder(@NonNull View itemView) {
+ super(itemView);
+ ButterKnife.bind(this, itemView);
+ setBaseView(mIconGifImageView,
+ mSubredditTextView,
+ mUserTextView,
+ mAuthorFlairTextView,
+ mPostTimeTextView,
+ mTitleTextView,
+ mTypeTextView,
+ mCrosspostImageView,
+ mArchivedImageView,
+ mLockedImageView,
+ mNSFWTextView,
+ mSpoilerTextView,
+ mFlairTextView,
+ mAwardsTextView,
+ mBottomConstraintLayout,
+ mUpvoteButton,
+ mScoreTextView,
+ mDownvoteButton,
+ commentsCountTextView,
+ mSaveButton,
+ mShareButton);
+
+ aspectRatioFrameLayout.setOnClickListener(null);
+
+ muteButton.setOnClickListener(view -> {
+ if (helper != null) {
+ if (helper.getVolume() != 0) {
+ muteButton.setImageDrawable(mActivity.getDrawable(R.drawable.ic_mute_white_rounded_18dp));
+ helper.setVolume(0f);
+ volume = 0f;
+ } else {
+ muteButton.setImageDrawable(mActivity.getDrawable(R.drawable.ic_unmute_white_rounded_18dp));
+ helper.setVolume(1f);
+ volume = 1f;
+ }
+ }
+ });
+
+ fullscreenButton.setOnClickListener(view -> {
+ Intent intent = new Intent(mActivity, ViewVideoActivity.class);
+ intent.setData(Uri.parse(mPost.getVideoUrl()));
+ intent.putExtra(ViewVideoActivity.EXTRA_VIDEO_DOWNLOAD_URL, mPost.getVideoDownloadUrl());
+ intent.putExtra(ViewVideoActivity.EXTRA_SUBREDDIT, mPost.getSubredditName());
+ intent.putExtra(ViewVideoActivity.EXTRA_ID, mPost.getId());
+ intent.putExtra(ViewVideoActivity.EXTRA_POST_TITLE, mPost.getTitle());
+ mActivity.startActivity(intent);
+ });
+ }
+
+ void bindVideoUri(Uri videoUri) {
+ mediaUri = videoUri;
+ }
+
+ void resetVolume() {
+ volume = 0f;
+ }
+
+ @NonNull
+ @Override
+ public View getPlayerView() {
+ return playerView;
+ }
+
+ @NonNull
+ @Override
+ public PlaybackInfo getCurrentPlaybackInfo() {
+ return helper != null ? helper.getLatestPlaybackInfo() : new PlaybackInfo();
+ }
+
+ @Override
+ public void initialize(@NonNull Container container, @NonNull PlaybackInfo playbackInfo) {
+ if (helper == null) {
+ helper = new ExoPlayerViewHelper(this, mediaUri, null, mExoCreator);
+ helper.addEventListener(new Playable.EventListener() {
+ @Override
+ public void onTracksChanged(TrackGroupArray trackGroups, TrackSelectionArray trackSelections) {
+ if (!trackGroups.isEmpty()) {
+ for (int i = 0; i < trackGroups.length; i++) {
+ String mimeType = trackGroups.get(i).getFormat(0).sampleMimeType;
+ if (mimeType != null && mimeType.contains("audio")) {
+ helper.setVolume(volume);
+ muteButton.setVisibility(View.VISIBLE);
+ if (volume != 0f) {
+ muteButton.setImageDrawable(mActivity.getDrawable(R.drawable.ic_unmute_white_rounded_18dp));
+ } else {
+ muteButton.setImageDrawable(mActivity.getDrawable(R.drawable.ic_mute_white_rounded_18dp));
+ }
+ break;
+ }
+ }
+ } else {
+ muteButton.setVisibility(View.GONE);
+ }
+ }
+
+ @Override
+ public void onMetadata(Metadata metadata) {
+
+ }
+
+ @Override
+ public void onCues(List<Cue> cues) {
+
+ }
+ });
+ }
+ helper.initialize(container, playbackInfo);
+ }
+
+ @Override
+ public void play() {
+ if (helper != null) helper.play();
+ }
+
+ @Override
+ public void pause() {
+ if (helper != null) helper.pause();
+ }
+
+ @Override
+ public boolean isPlaying() {
+ return helper != null && helper.isPlaying();
+ }
+
+ @Override
+ public void release() {
+ if (helper != null) {
+ helper.release();
+ helper = null;
+ }
+ }
+
+ @Override
+ public boolean wantsToPlay() {
+ return ToroUtil.visibleAreaOffset(this, itemView.getParent()) >= 0.85;
+ }
+
+ @Override
+ public int getPlayerOrder() {
+ return getAdapterPosition();
+ }
+ }
+
+ class PostDetailVideoAndGifPreviewHolder extends PostDetailBaseViewHolder {
+ @BindView(R.id.icon_gif_image_view_item_post_detail_video_and_gif_preview)
+ AspectRatioGifImageView mIconGifImageView;
+ @BindView(R.id.subreddit_text_view_item_post_detail_video_and_gif_preview)
+ TextView mSubredditTextView;
+ @BindView(R.id.user_text_view_item_post_detail_video_and_gif_preview)
+ TextView mUserTextView;
+ @BindView(R.id.author_flair_text_view_item_post_detail_video_and_gif_preview)
+ TextView mAuthorFlairTextView;
+ @BindView(R.id.post_time_text_view_item_post_detail_video_and_gif_preview)
+ TextView mPostTimeTextView;
+ @BindView(R.id.title_text_view_item_post_detail_video_and_gif_preview)
+ TextView mTitleTextView;
+ @BindView(R.id.type_text_view_item_post_detail_video_and_gif_preview)
+ CustomTextView mTypeTextView;
+ @BindView(R.id.crosspost_image_view_item_post_detail_video_and_gif_preview)
+ ImageView mCrosspostImageView;
+ @BindView(R.id.archived_image_view_item_post_detail_video_and_gif_preview)
+ ImageView mArchivedImageView;
+ @BindView(R.id.locked_image_view_item_post_detail_video_and_gif_preview)
+ ImageView mLockedImageView;
+ @BindView(R.id.nsfw_text_view_item_post_detail_video_and_gif_preview)
+ CustomTextView mNSFWTextView;
+ @BindView(R.id.spoiler_custom_text_view_item_post_detail_video_and_gif_preview)
+ CustomTextView mSpoilerTextView;
+ @BindView(R.id.flair_custom_text_view_item_post_detail_video_and_gif_preview)
+ CustomTextView mFlairTextView;
+ @BindView(R.id.awards_text_view_item_post_detail_video_and_gif_preview)
+ TextView mAwardsTextView;
+ @BindView(R.id.load_wrapper_item_post_detail_video_and_gif_preview)
+ RelativeLayout mLoadWrapper;
+ @BindView(R.id.progress_bar_item_post_detail_video_and_gif_preview)
+ ProgressBar mLoadImageProgressBar;
+ @BindView(R.id.load_image_error_text_view_item_post_detail_video_and_gif_preview)
+ TextView mLoadImageErrorTextView;
+ @BindView(R.id.image_view_item_post_detail_video_and_gif_preview)
+ AspectRatioImageView mImageView;
+ @BindView(R.id.bottom_constraint_layout_item_post_detail_video_and_gif_preview)
+ ConstraintLayout mBottomConstraintLayout;
+ @BindView(R.id.plus_button_item_post_detail_video_and_gif_preview)
+ ImageView mUpvoteButton;
+ @BindView(R.id.score_text_view_item_post_detail_video_and_gif_preview)
+ TextView mScoreTextView;
+ @BindView(R.id.minus_button_item_post_detail_video_and_gif_preview)
+ ImageView mDownvoteButton;
+ @BindView(R.id.comments_count_item_post_detail_video_and_gif_preview)
+ TextView commentsCountTextView;
+ @BindView(R.id.save_button_item_post_detail_video_and_gif_preview)
+ ImageView mSaveButton;
+ @BindView(R.id.share_button_item_post_detail_video_and_gif_preview)
+ ImageView mShareButton;
+
+ PostDetailVideoAndGifPreviewHolder(@NonNull View itemView) {
+ super(itemView);
+ ButterKnife.bind(this, itemView);
+ setBaseView(mIconGifImageView,
+ mSubredditTextView,
+ mUserTextView,
+ mAuthorFlairTextView,
+ mPostTimeTextView,
+ mTitleTextView,
+ mTypeTextView,
+ mCrosspostImageView,
+ mArchivedImageView,
+ mLockedImageView,
+ mNSFWTextView,
+ mSpoilerTextView,
+ mFlairTextView,
+ mAwardsTextView,
+ mBottomConstraintLayout,
+ mUpvoteButton,
+ mScoreTextView,
+ mDownvoteButton,
+ commentsCountTextView,
+ mSaveButton,
+ mShareButton);
+
+ mLoadImageProgressBar.setIndeterminateTintList(ColorStateList.valueOf(mColorAccent));
+ mLoadImageErrorTextView.setTextColor(mPrimaryTextColor);
+
+ mImageView.setOnClickListener(view -> {
+ if (mPost.getPostType() == Post.VIDEO_TYPE) {
+ Intent intent = new Intent(mActivity, ViewVideoActivity.class);
+ intent.setData(Uri.parse(mPost.getVideoUrl()));
+ intent.putExtra(ViewVideoActivity.EXTRA_VIDEO_DOWNLOAD_URL, mPost.getVideoDownloadUrl());
+ intent.putExtra(ViewVideoActivity.EXTRA_SUBREDDIT, mPost.getSubredditName());
+ intent.putExtra(ViewVideoActivity.EXTRA_ID, mPost.getId());
+ intent.putExtra(ViewVideoActivity.EXTRA_POST_TITLE, mPost.getTitle());
+ mActivity.startActivity(intent);
+ } else if (mPost.getPostType() == Post.GIF_TYPE) {
+ Intent intent = new Intent(mActivity, ViewGIFActivity.class);
+ intent.putExtra(ViewGIFActivity.FILE_NAME_KEY, mPost.getSubredditName()
+ + "-" + mPost.getId() + ".gif");
+ intent.putExtra(ViewGIFActivity.GIF_URL_KEY, mPost.getVideoUrl());
+ intent.putExtra(ViewImageActivity.POST_TITLE_KEY, mPost.getTitle());
+ mActivity.startActivity(intent);
+ }
+ });
+ }
+ }
+
+ class PostDetailImageAndGifAutoplayViewHolder extends PostDetailBaseViewHolder {
+ @BindView(R.id.icon_gif_image_view_item_post_detail_image_and_gif_autoplay)
+ AspectRatioGifImageView mIconGifImageView;
+ @BindView(R.id.subreddit_text_view_item_post_detail_image_and_gif_autoplay)
+ TextView mSubredditTextView;
+ @BindView(R.id.user_text_view_item_post_detail_image_and_gif_autoplay)
+ TextView mUserTextView;
+ @BindView(R.id.author_flair_text_view_item_post_detail_image_and_gif_autoplay)
+ TextView mAuthorFlairTextView;
+ @BindView(R.id.post_time_text_view_item_post_detail_image_and_gif_autoplay)
+ TextView mPostTimeTextView;
+ @BindView(R.id.title_text_view_item_post_detail_image_and_gif_autoplay)
+ TextView mTitleTextView;
+ @BindView(R.id.type_text_view_item_post_detail_image_and_gif_autoplay)
+ CustomTextView mTypeTextView;
+ @BindView(R.id.crosspost_image_view_item_post_detail_image_and_gif_autoplay)
+ ImageView mCrosspostImageView;
+ @BindView(R.id.archived_image_view_item_post_detail_image_and_gif_autoplay)
+ ImageView mArchivedImageView;
+ @BindView(R.id.locked_image_view_item_post_detail_image_and_gif_autoplay)
+ ImageView mLockedImageView;
+ @BindView(R.id.nsfw_text_view_item_post_detail_image_and_gif_autoplay)
+ CustomTextView mNSFWTextView;
+ @BindView(R.id.spoiler_custom_text_view_item_post_detail_image_and_gif_autoplay)
+ CustomTextView mSpoilerTextView;
+ @BindView(R.id.flair_custom_text_view_item_post_detail_image_and_gif_autoplay)
+ CustomTextView mFlairTextView;
+ @BindView(R.id.awards_text_view_item_post_detail_image_and_gif_autoplay)
+ TextView mAwardsTextView;
+ @BindView(R.id.image_view_wrapper_item_post_detail_image_and_gif_autoplay)
+ RelativeLayout mRelativeLayout;
+ @BindView(R.id.load_wrapper_item_post_detail_image_and_gif_autoplay)
+ RelativeLayout mLoadWrapper;
+ @BindView(R.id.progress_bar_item_post_detail_image_and_gif_autoplay)
+ ProgressBar mLoadImageProgressBar;
+ @BindView(R.id.load_image_error_text_view_item_post_detail_image_and_gif_autoplay)
+ TextView mLoadImageErrorTextView;
+ @BindView(R.id.image_view_item_post_detail_image_and_gif_autoplay)
+ AspectRatioImageView mImageView;
+ @BindView(R.id.bottom_constraint_layout_item_post_detail_image_and_gif_autoplay)
+ ConstraintLayout mBottomConstraintLayout;
+ @BindView(R.id.plus_button_item_post_detail_image_and_gif_autoplay)
+ ImageView mUpvoteButton;
+ @BindView(R.id.score_text_view_item_post_detail_image_and_gif_autoplay)
+ TextView mScoreTextView;
+ @BindView(R.id.minus_button_item_post_detail_image_and_gif_autoplay)
+ ImageView mDownvoteButton;
+ @BindView(R.id.comments_count_item_post_detail_image_and_gif_autoplay)
+ TextView commentsCountTextView;
+ @BindView(R.id.save_button_item_post_detail_image_and_gif_autoplay)
+ ImageView mSaveButton;
+ @BindView(R.id.share_button_item_post_detail_image_and_gif_autoplay)
+ ImageView mShareButton;
+
+ PostDetailImageAndGifAutoplayViewHolder(@NonNull View itemView) {
+ super(itemView);
+ ButterKnife.bind(this, itemView);
+ setBaseView(mIconGifImageView,
+ mSubredditTextView,
+ mUserTextView,
+ mAuthorFlairTextView,
+ mPostTimeTextView,
+ mTitleTextView,
+ mTypeTextView,
+ mCrosspostImageView,
+ mArchivedImageView,
+ mLockedImageView,
+ mNSFWTextView,
+ mSpoilerTextView,
+ mFlairTextView,
+ mAwardsTextView,
+ mBottomConstraintLayout,
+ mUpvoteButton,
+ mScoreTextView,
+ mDownvoteButton,
+ commentsCountTextView,
+ mSaveButton,
+ mShareButton);
+
+ mLoadImageProgressBar.setIndeterminateTintList(ColorStateList.valueOf(mColorAccent));
+ mLoadImageErrorTextView.setTextColor(mPrimaryTextColor);
+
+ mImageView.setOnClickListener(view -> {
+ if (mPost.getPostType() == Post.IMAGE_TYPE) {
+ Intent intent = new Intent(mActivity, ViewImageActivity.class);
+ intent.putExtra(ViewImageActivity.IMAGE_URL_KEY, mPost.getUrl());
+ intent.putExtra(ViewImageActivity.FILE_NAME_KEY, mPost.getSubredditNamePrefixed().substring(2)
+ + "-" + mPost.getId().substring(3) + ".jpg");
+ intent.putExtra(ViewImageActivity.POST_TITLE_KEY, mPost.getTitle());
+ mActivity.startActivity(intent);
+ } else if (mPost.getPostType() == Post.GIF_TYPE) {
+ Intent intent = new Intent(mActivity, ViewGIFActivity.class);
+ intent.putExtra(ViewGIFActivity.FILE_NAME_KEY, mPost.getSubredditName()
+ + "-" + mPost.getId() + ".gif");
+ intent.putExtra(ViewGIFActivity.GIF_URL_KEY, mPost.getVideoUrl());
+ intent.putExtra(ViewImageActivity.POST_TITLE_KEY, mPost.getTitle());
+ mActivity.startActivity(intent);
+ }
+ });
+ }
+ }
+
+ class PostDetailLinkViewHolder extends PostDetailBaseViewHolder {
+ @BindView(R.id.icon_gif_image_view_item_post_detail_link)
+ AspectRatioGifImageView mIconGifImageView;
+ @BindView(R.id.subreddit_text_view_item_post_detail_link)
+ TextView mSubredditTextView;
+ @BindView(R.id.user_text_view_item_post_detail_link)
+ TextView mUserTextView;
+ @BindView(R.id.author_flair_text_view_item_post_detail_link)
+ TextView mAuthorFlairTextView;
+ @BindView(R.id.post_time_text_view_item_post_detail_link)
+ TextView mPostTimeTextView;
+ @BindView(R.id.title_text_view_item_post_detail_link)
+ TextView mTitleTextView;
+ @BindView(R.id.type_text_view_item_post_detail_link)
+ CustomTextView mTypeTextView;
+ @BindView(R.id.crosspost_image_view_item_post_detail_link)
+ ImageView mCrosspostImageView;
+ @BindView(R.id.archived_image_view_item_post_detail_link)
+ ImageView mArchivedImageView;
+ @BindView(R.id.locked_image_view_item_post_detail_link)
+ ImageView mLockedImageView;
+ @BindView(R.id.nsfw_text_view_item_post_detail_link)
+ CustomTextView mNSFWTextView;
+ @BindView(R.id.spoiler_custom_text_view_item_post_detail_link)
+ CustomTextView mSpoilerTextView;
+ @BindView(R.id.flair_custom_text_view_item_post_detail_link)
+ CustomTextView mFlairTextView;
+ @BindView(R.id.awards_text_view_item_post_detail_link)
+ TextView mAwardsTextView;
+ @BindView(R.id.link_text_view_item_post_detail_link)
+ TextView mLinkTextView;
+ @BindView(R.id.image_view_wrapper_item_post_detail_link)
+ RelativeLayout mRelativeLayout;
+ @BindView(R.id.load_wrapper_item_post_detail_link)
+ RelativeLayout mLoadWrapper;
+ @BindView(R.id.progress_bar_item_post_detail_link)
+ ProgressBar mLoadImageProgressBar;
+ @BindView(R.id.load_image_error_text_view_item_post_detail_link)
+ TextView mLoadImageErrorTextView;
+ @BindView(R.id.image_view_item_post_detail_link)
+ AspectRatioImageView mImageView;
+ @BindView(R.id.bottom_constraint_layout_item_post_detail_link)
+ ConstraintLayout mBottomConstraintLayout;
+ @BindView(R.id.plus_button_item_post_detail_link)
+ ImageView mUpvoteButton;
+ @BindView(R.id.score_text_view_item_post_detail_link)
+ TextView mScoreTextView;
+ @BindView(R.id.minus_button_item_post_detail_link)
+ ImageView mDownvoteButton;
+ @BindView(R.id.comments_count_item_post_detail_link)
+ TextView commentsCountTextView;
+ @BindView(R.id.save_button_item_post_detail_link)
+ ImageView mSaveButton;
+ @BindView(R.id.share_button_item_post_detail_link)
+ ImageView mShareButton;
+
+ PostDetailLinkViewHolder(@NonNull View itemView) {
+ super(itemView);
+ ButterKnife.bind(this, itemView);
+ setBaseView(mIconGifImageView,
+ mSubredditTextView,
+ mUserTextView,
+ mAuthorFlairTextView,
+ mPostTimeTextView,
+ mTitleTextView,
+ mTypeTextView,
+ mCrosspostImageView,
+ mArchivedImageView,
+ mLockedImageView,
+ mNSFWTextView,
+ mSpoilerTextView,
+ mFlairTextView,
+ mAwardsTextView,
+ mBottomConstraintLayout,
+ mUpvoteButton,
+ mScoreTextView,
+ mDownvoteButton,
+ commentsCountTextView,
+ mSaveButton,
+ mShareButton);
+
+ mLinkTextView.setTextColor(mSecondaryTextColor);
+ mLoadImageProgressBar.setIndeterminateTintList(ColorStateList.valueOf(mColorAccent));
+ mLoadImageErrorTextView.setTextColor(mPrimaryTextColor);
+
+ mImageView.setOnClickListener(view -> {
+ Intent intent = new Intent(mActivity, LinkResolverActivity.class);
+ Uri uri = Uri.parse(mPost.getUrl());
+ if (uri.getScheme() == null && uri.getHost() == null) {
+ intent.setData(LinkResolverActivity.getRedditUriByPath(mPost.getUrl()));
+ } else {
+ intent.setData(uri);
+ }
+ mActivity.startActivity(intent);
+ });
+ }
+ }
+
+ class PostDetailNoPreviewLinkViewHolder extends PostDetailBaseViewHolder {
+ @BindView(R.id.icon_gif_image_view_item_post_detail_no_preview_link)
+ AspectRatioGifImageView mIconGifImageView;
+ @BindView(R.id.subreddit_text_view_item_post_detail_no_preview_link)
+ TextView mSubredditTextView;
+ @BindView(R.id.user_text_view_item_post_detail_no_preview_link)
+ TextView mUserTextView;
+ @BindView(R.id.author_flair_text_view_item_post_detail_no_preview_link)
+ TextView mAuthorFlairTextView;
+ @BindView(R.id.post_time_text_view_item_post_detail_no_preview_link)
+ TextView mPostTimeTextView;
+ @BindView(R.id.title_text_view_item_post_detail_no_preview_link)
+ TextView mTitleTextView;
+ @BindView(R.id.content_markdown_view_item_post_detail_no_preview_link)
+ RecyclerView mContentMarkdownView;
+ @BindView(R.id.type_text_view_item_post_detail_no_preview_link)
+ CustomTextView mTypeTextView;
+ @BindView(R.id.crosspost_image_view_item_post_detail_no_preview_link)
+ ImageView mCrosspostImageView;
+ @BindView(R.id.archived_image_view_item_post_detail_no_preview_link)
+ ImageView mArchivedImageView;
+ @BindView(R.id.locked_image_view_item_post_detail_no_preview_link)
+ ImageView mLockedImageView;
+ @BindView(R.id.nsfw_text_view_item_post_detail_no_preview_link)
+ CustomTextView mNSFWTextView;
+ @BindView(R.id.spoiler_custom_text_view_item_post_detail_no_preview_link)
+ CustomTextView mSpoilerTextView;
+ @BindView(R.id.flair_custom_text_view_item_post_detail_no_preview_link)
+ CustomTextView mFlairTextView;
+ @BindView(R.id.awards_text_view_item_post_detail_no_preview_link)
+ TextView mAwardsTextView;
+ @BindView(R.id.link_text_view_item_post_detail_no_preview_link)
+ TextView mLinkTextView;
+ @BindView(R.id.image_view_no_preview_link_item_post_detail_no_preview_link)
+ ImageView mNoPreviewLinkImageView;
+ @BindView(R.id.bottom_constraint_layout_item_post_detail_no_preview_link)
+ ConstraintLayout mBottomConstraintLayout;
+ @BindView(R.id.plus_button_item_post_detail_no_preview_link)
+ ImageView mUpvoteButton;
+ @BindView(R.id.score_text_view_item_post_detail_no_preview_link)
+ TextView mScoreTextView;
+ @BindView(R.id.minus_button_item_post_detail_no_preview_link)
+ ImageView mDownvoteButton;
+ @BindView(R.id.comments_count_item_post_detail_no_preview_link)
+ TextView commentsCountTextView;
+ @BindView(R.id.save_button_item_post_detail_no_preview_link)
+ ImageView mSaveButton;
+ @BindView(R.id.share_button_item_post_detail_no_preview_link)
+ ImageView mShareButton;
+
+ PostDetailNoPreviewLinkViewHolder(@NonNull View itemView) {
+ super(itemView);
+ ButterKnife.bind(this, itemView);
+ setBaseView(mIconGifImageView,
+ mSubredditTextView,
+ mUserTextView,
+ mAuthorFlairTextView,
+ mPostTimeTextView,
+ mTitleTextView,
+ mTypeTextView,
+ mCrosspostImageView,
+ mArchivedImageView,
+ mLockedImageView,
+ mNSFWTextView,
+ mSpoilerTextView,
+ mFlairTextView,
+ mAwardsTextView,
+ mBottomConstraintLayout,
+ mUpvoteButton,
+ mScoreTextView,
+ mDownvoteButton,
+ commentsCountTextView,
+ mSaveButton,
+ mShareButton);
+
+ mLinkTextView.setTextColor(mSecondaryTextColor);
+ mNoPreviewLinkImageView.setBackgroundColor(mNoPreviewLinkBackgroundColor);
+
+ mNoPreviewLinkImageView.setOnClickListener(view -> {
+ Intent intent = new Intent(mActivity, LinkResolverActivity.class);
+ Uri uri = Uri.parse(mPost.getUrl());
+ if (uri.getScheme() == null && uri.getHost() == null) {
+ intent.setData(LinkResolverActivity.getRedditUriByPath(mPost.getUrl()));
+ } else {
+ intent.setData(uri);
+ }
+ mActivity.startActivity(intent);
+ });
+ }
+ }
+
+ class PostDetailTextViewHolder extends PostDetailBaseViewHolder {
+ @BindView(R.id.icon_gif_image_view_item_post_detail_text)
+ AspectRatioGifImageView mIconGifImageView;
+ @BindView(R.id.subreddit_text_view_item_post_detail_text)
+ TextView mSubredditTextView;
+ @BindView(R.id.user_text_view_item_post_detail_text)
+ TextView mUserTextView;
+ @BindView(R.id.author_flair_text_view_item_post_detail_text)
+ TextView mAuthorFlairTextView;
+ @BindView(R.id.post_time_text_view_item_post_detail_text)
+ TextView mPostTimeTextView;
+ @BindView(R.id.title_text_view_item_post_detail_text)
+ TextView mTitleTextView;
+ @BindView(R.id.content_markdown_view_item_post_detail_text)
+ RecyclerView mContentMarkdownView;
+ @BindView(R.id.type_text_view_item_post_detail_text)
+ CustomTextView mTypeTextView;
+ @BindView(R.id.crosspost_image_view_item_post_detail_text)
+ ImageView mCrosspostImageView;
+ @BindView(R.id.archived_image_view_item_post_detail_text)
+ ImageView mArchivedImageView;
+ @BindView(R.id.locked_image_view_item_post_detail_text)
+ ImageView mLockedImageView;
+ @BindView(R.id.nsfw_text_view_item_post_detail_text)
+ CustomTextView mNSFWTextView;
+ @BindView(R.id.spoiler_custom_text_view_item_post_detail_text)
+ CustomTextView mSpoilerTextView;
+ @BindView(R.id.flair_custom_text_view_item_post_detail_text)
+ CustomTextView mFlairTextView;
+ @BindView(R.id.awards_text_view_item_post_detail_text)
+ TextView mAwardsTextView;
+ @BindView(R.id.bottom_constraint_layout_item_post_detail_text)
+ ConstraintLayout mBottomConstraintLayout;
+ @BindView(R.id.plus_button_item_post_detail_text)
+ ImageView mUpvoteButton;
+ @BindView(R.id.score_text_view_item_post_detail_text)
+ TextView mScoreTextView;
+ @BindView(R.id.minus_button_item_post_detail_text)
+ ImageView mDownvoteButton;
+ @BindView(R.id.comments_count_item_post_detail_text)
+ TextView commentsCountTextView;
+ @BindView(R.id.save_button_item_post_detail_text)
+ ImageView mSaveButton;
+ @BindView(R.id.share_button_item_post_detail_text)
+ ImageView mShareButton;
+
+ PostDetailTextViewHolder(@NonNull View itemView) {
+ super(itemView);
+ ButterKnife.bind(this, itemView);
+ setBaseView(mIconGifImageView,
+ mSubredditTextView,
+ mUserTextView,
+ mAuthorFlairTextView,
+ mPostTimeTextView,
+ mTitleTextView,
+ mTypeTextView,
+ mCrosspostImageView,
+ mArchivedImageView,
+ mLockedImageView,
+ mNSFWTextView,
+ mSpoilerTextView,
+ mFlairTextView,
+ mAwardsTextView,
+ mBottomConstraintLayout,
+ mUpvoteButton,
+ mScoreTextView,
+ mDownvoteButton,
+ commentsCountTextView,
+ mSaveButton,
+ mShareButton);
+ }
+ }
+
class CommentViewHolder extends RecyclerView.ViewHolder {
@BindView(R.id.linear_layout_item_comment)
LinearLayout linearLayout;
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/Adapter/PostRecyclerViewAdapter.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Adapter/PostRecyclerViewAdapter.java
index 3623fb54..2d89858a 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/Adapter/PostRecyclerViewAdapter.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Adapter/PostRecyclerViewAdapter.java
@@ -127,6 +127,7 @@ public class PostRecyclerViewAdapter extends PagedListAdapter<Post, RecyclerView
private int mColorPrimaryLightTheme;
private int mColorAccent;
private int mCardViewBackgroundColor;
+ private int mPrimaryTextColor;
private int mSecondaryTextColor;
private int mPostTitleColor;
private int mPostContentColor;
@@ -198,6 +199,7 @@ public class PostRecyclerViewAdapter extends PagedListAdapter<Post, RecyclerView
mColorPrimaryLightTheme = customThemeWrapper.getColorPrimaryLightTheme();
mColorAccent = customThemeWrapper.getColorAccent();
mCardViewBackgroundColor = customThemeWrapper.getCardViewBackgroundColor();
+ mPrimaryTextColor = customThemeWrapper.getPrimaryTextColor();
mSecondaryTextColor = customThemeWrapper.getSecondaryTextColor();
mPostTitleColor = customThemeWrapper.getPostTitleColor();
mPostContentColor = customThemeWrapper.getPostContentColor();
@@ -289,15 +291,15 @@ public class PostRecyclerViewAdapter extends PagedListAdapter<Post, RecyclerView
if (viewType == VIEW_TYPE_POST_CARD_VIDEO_TYPE_AUTOPLAY) {
return new PostVideoAutoplayViewHolder(LayoutInflater.from(parent.getContext()).inflate(R.layout.item_post_video_type_autoplay, parent, false));
} else if (viewType == VIEW_TYPE_POST_CARD_VIDEO_AND_GIF_PREVIEW_TYPE) {
- return new PostGifAndVideoPreviewViewHolder(LayoutInflater.from(parent.getContext()).inflate(R.layout.item_post_video_and_gif_preview_type, parent, false));
+ return new PostVideoAndGifPreviewViewHolder(LayoutInflater.from(parent.getContext()).inflate(R.layout.item_post_video_and_gif_preview, parent, false));
} else if (viewType == VIEW_TYPE_POST_CARD_IMAGE_AND_GIF_AUTOPLAY_TYPE) {
- return new PostImageAndGifAutoplayTypeViewHolder(LayoutInflater.from(parent.getContext()).inflate(R.layout.item_post_image_and_gif_autoplay_type, parent, false));
+ return new PostImageAndGifAutoplayViewHolder(LayoutInflater.from(parent.getContext()).inflate(R.layout.item_post_image_and_gif_autoplay, parent, false));
} else if (viewType == VIEW_TYPE_POST_CARD_LINK_TYPE) {
- return new PostLinkTypeViewHolder(LayoutInflater.from(parent.getContext()).inflate(R.layout.item_post_link_type, parent, false));
+ return new PostLinkTypeViewHolder(LayoutInflater.from(parent.getContext()).inflate(R.layout.item_post_link, parent, false));
} else if (viewType == VIEW_TYPE_POST_CARD_NO_PREVIEW_LINK_TYPE) {
- return new PostNoPreviewLinkTypeViewHolder(LayoutInflater.from(parent.getContext()).inflate(R.layout.item_post_no_preview_link_type, parent, false));
+ return new PostNoPreviewLinkTypeViewHolder(LayoutInflater.from(parent.getContext()).inflate(R.layout.item_post_no_preview_link, parent, false));
} else if (viewType == VIEW_TYPE_POST_CARD_TEXT_TYPE) {
- return new PostTextTypeViewHolder(LayoutInflater.from(parent.getContext()).inflate(R.layout.item_post_text_type, parent, false));
+ return new PostTextTypeViewHolder(LayoutInflater.from(parent.getContext()).inflate(R.layout.item_post_text, parent, false));
} else if (viewType == VIEW_TYPE_POST_COMPACT) {
return new PostCompactViewHolder(LayoutInflater.from(parent.getContext()).inflate(R.layout.item_post_compact, parent, false));
} else if (viewType == VIEW_TYPE_ERROR) {
@@ -500,35 +502,35 @@ public class PostRecyclerViewAdapter extends PagedListAdapter<Post, RecyclerView
if (holder instanceof PostVideoAutoplayViewHolder) {
((PostVideoAutoplayViewHolder) holder).aspectRatioFrameLayout.setAspectRatio((float) post.getPreviewWidth() / post.getPreviewHeight());
((PostVideoAutoplayViewHolder) holder).bindVideoUri(Uri.parse(post.getVideoUrl()));
- } else if (holder instanceof PostGifAndVideoPreviewViewHolder) {
+ } else if (holder instanceof PostVideoAndGifPreviewViewHolder) {
if (post.getPostType() == Post.VIDEO_TYPE) {
- ((PostGifAndVideoPreviewViewHolder) holder).typeTextView.setText(mActivity.getString(R.string.video));
+ ((PostVideoAndGifPreviewViewHolder) holder).typeTextView.setText(mActivity.getString(R.string.video));
} else {
- ((PostGifAndVideoPreviewViewHolder) holder).typeTextView.setText(mActivity.getString(R.string.gif));
+ ((PostVideoAndGifPreviewViewHolder) holder).typeTextView.setText(mActivity.getString(R.string.gif));
}
- ((PostGifAndVideoPreviewViewHolder) holder).progressBar.setVisibility(View.VISIBLE);
- ((PostGifAndVideoPreviewViewHolder) holder).imageView
+ ((PostVideoAndGifPreviewViewHolder) holder).progressBar.setVisibility(View.VISIBLE);
+ ((PostVideoAndGifPreviewViewHolder) holder).imageView
.setRatio((float) post.getPreviewHeight() / post.getPreviewWidth());
loadImage(holder, post);
if (post.getPreviewWidth() <= 0 || post.getPreviewHeight() <= 0) {
- ((PostGifAndVideoPreviewViewHolder) holder).imageView.setScaleType(ImageView.ScaleType.CENTER_CROP);
- ((PostGifAndVideoPreviewViewHolder) holder).imageView.getLayoutParams().height = (int) (400 * mScale);
+ ((PostVideoAndGifPreviewViewHolder) holder).imageView.setScaleType(ImageView.ScaleType.CENTER_CROP);
+ ((PostVideoAndGifPreviewViewHolder) holder).imageView.getLayoutParams().height = (int) (400 * mScale);
}
- } else if (holder instanceof PostImageAndGifAutoplayTypeViewHolder) {
+ } else if (holder instanceof PostImageAndGifAutoplayViewHolder) {
if (post.getPostType() == Post.GIF_TYPE) {
- ((PostImageAndGifAutoplayTypeViewHolder) holder).typeTextView.setText(mActivity.getString(R.string.gif));
+ ((PostImageAndGifAutoplayViewHolder) holder).typeTextView.setText(mActivity.getString(R.string.gif));
} else {
- ((PostImageAndGifAutoplayTypeViewHolder) holder).typeTextView.setText(mActivity.getString(R.string.image));
+ ((PostImageAndGifAutoplayViewHolder) holder).typeTextView.setText(mActivity.getString(R.string.image));
}
- ((PostImageAndGifAutoplayTypeViewHolder) holder).progressBar.setVisibility(View.VISIBLE);
- ((PostImageAndGifAutoplayTypeViewHolder) holder).imageView
+ ((PostImageAndGifAutoplayViewHolder) holder).progressBar.setVisibility(View.VISIBLE);
+ ((PostImageAndGifAutoplayViewHolder) holder).imageView
.setRatio((float) post.getPreviewHeight() / post.getPreviewWidth());
loadImage(holder, post);
if (post.getPreviewWidth() <= 0 || post.getPreviewHeight() <= 0) {
- ((PostImageAndGifAutoplayTypeViewHolder) holder).imageView.setScaleType(ImageView.ScaleType.CENTER_CROP);
- ((PostImageAndGifAutoplayTypeViewHolder) holder).imageView.getLayoutParams().height = (int) (400 * mScale);
+ ((PostImageAndGifAutoplayViewHolder) holder).imageView.setScaleType(ImageView.ScaleType.CENTER_CROP);
+ ((PostImageAndGifAutoplayViewHolder) holder).imageView.getLayoutParams().height = (int) (400 * mScale);
}
} else if (holder instanceof PostLinkTypeViewHolder) {
((PostLinkTypeViewHolder) holder).progressBar.setVisibility(View.VISIBLE);
@@ -536,13 +538,12 @@ public class PostRecyclerViewAdapter extends PagedListAdapter<Post, RecyclerView
.setRatio((float) post.getPreviewHeight() / post.getPreviewWidth());
loadImage(holder, post);
- ((PostLinkTypeViewHolder) holder).linkTextView.setVisibility(View.VISIBLE);
String domain = Uri.parse(post.getUrl()).getHost();
+ ((PostLinkTypeViewHolder) holder).linkTextView.setVisibility(View.VISIBLE);
((PostLinkTypeViewHolder) holder).linkTextView.setText(domain);
} else if (holder instanceof PostNoPreviewLinkTypeViewHolder) {
- String noPreviewLinkUrl = post.getUrl();
+ String noPreviewLinkDomain = Uri.parse(post.getUrl()).getHost();
((PostNoPreviewLinkTypeViewHolder) holder).linkTextView.setVisibility(View.VISIBLE);
- String noPreviewLinkDomain = Uri.parse(noPreviewLinkUrl).getHost();
((PostNoPreviewLinkTypeViewHolder) holder).linkTextView.setText(noPreviewLinkDomain);
} else if (holder instanceof PostTextTypeViewHolder) {
if (post.getSelfTextPlainTrimmed() != null && !post.getSelfTextPlainTrimmed().equals("")) {
@@ -1104,16 +1105,16 @@ public class PostRecyclerViewAdapter extends PagedListAdapter<Post, RecyclerView
}
private void loadImage(final RecyclerView.ViewHolder holder, final Post post) {
- if (holder instanceof PostImageAndGifAutoplayTypeViewHolder) {
+ if (holder instanceof PostImageAndGifAutoplayViewHolder) {
String url = mAutoplay && post.getPostType() == Post.GIF_TYPE ? post.getUrl() : post.getPreviewUrl();
RequestBuilder<Drawable> imageRequestBuilder = mGlide.load(url).listener(new RequestListener<Drawable>() {
@Override
public boolean onLoadFailed(@Nullable GlideException e, Object model, Target<Drawable> target, boolean isFirstResource) {
- ((PostImageAndGifAutoplayTypeViewHolder) holder).progressBar.setVisibility(View.GONE);
- ((PostImageAndGifAutoplayTypeViewHolder) holder).errorRelativeLayout.setVisibility(View.VISIBLE);
- ((PostImageAndGifAutoplayTypeViewHolder) holder).errorRelativeLayout.setOnClickListener(view -> {
- ((PostImageAndGifAutoplayTypeViewHolder) holder).progressBar.setVisibility(View.VISIBLE);
- ((PostImageAndGifAutoplayTypeViewHolder) holder).errorRelativeLayout.setVisibility(View.GONE);
+ ((PostImageAndGifAutoplayViewHolder) holder).progressBar.setVisibility(View.GONE);
+ ((PostImageAndGifAutoplayViewHolder) holder).errorRelativeLayout.setVisibility(View.VISIBLE);
+ ((PostImageAndGifAutoplayViewHolder) holder).errorRelativeLayout.setOnClickListener(view -> {
+ ((PostImageAndGifAutoplayViewHolder) holder).progressBar.setVisibility(View.VISIBLE);
+ ((PostImageAndGifAutoplayViewHolder) holder).errorRelativeLayout.setVisibility(View.GONE);
loadImage(holder, post);
});
return false;
@@ -1121,27 +1122,27 @@ public class PostRecyclerViewAdapter extends PagedListAdapter<Post, RecyclerView
@Override
public boolean onResourceReady(Drawable resource, Object model, Target<Drawable> target, DataSource dataSource, boolean isFirstResource) {
- ((PostImageAndGifAutoplayTypeViewHolder) holder).errorRelativeLayout.setVisibility(View.GONE);
- ((PostImageAndGifAutoplayTypeViewHolder) holder).progressBar.setVisibility(View.GONE);
+ ((PostImageAndGifAutoplayViewHolder) holder).errorRelativeLayout.setVisibility(View.GONE);
+ ((PostImageAndGifAutoplayViewHolder) holder).progressBar.setVisibility(View.GONE);
return false;
}
});
if ((post.isNSFW() && mNeedBlurNSFW) || post.isSpoiler() && mNeedBlurSpoiler) {
imageRequestBuilder.apply(RequestOptions.bitmapTransform(new BlurTransformation(50, 10)))
- .into(((PostImageAndGifAutoplayTypeViewHolder) holder).imageView);
+ .into(((PostImageAndGifAutoplayViewHolder) holder).imageView);
} else {
- imageRequestBuilder.into(((PostImageAndGifAutoplayTypeViewHolder) holder).imageView);
+ imageRequestBuilder.into(((PostImageAndGifAutoplayViewHolder) holder).imageView);
}
- } else if (holder instanceof PostGifAndVideoPreviewViewHolder) {
+ } else if (holder instanceof PostVideoAndGifPreviewViewHolder) {
RequestBuilder<Drawable> imageRequestBuilder = mGlide.load(post.getPreviewUrl()).listener(new RequestListener<Drawable>() {
@Override
public boolean onLoadFailed(@Nullable GlideException e, Object model, Target<Drawable> target, boolean isFirstResource) {
- ((PostGifAndVideoPreviewViewHolder) holder).progressBar.setVisibility(View.GONE);
- ((PostGifAndVideoPreviewViewHolder) holder).errorRelativeLayout.setVisibility(View.VISIBLE);
- ((PostGifAndVideoPreviewViewHolder) holder).errorRelativeLayout.setOnClickListener(view -> {
- ((PostGifAndVideoPreviewViewHolder) holder).progressBar.setVisibility(View.VISIBLE);
- ((PostGifAndVideoPreviewViewHolder) holder).errorRelativeLayout.setVisibility(View.GONE);
+ ((PostVideoAndGifPreviewViewHolder) holder).progressBar.setVisibility(View.GONE);
+ ((PostVideoAndGifPreviewViewHolder) holder).errorRelativeLayout.setVisibility(View.VISIBLE);
+ ((PostVideoAndGifPreviewViewHolder) holder).errorRelativeLayout.setOnClickListener(view -> {
+ ((PostVideoAndGifPreviewViewHolder) holder).progressBar.setVisibility(View.VISIBLE);
+ ((PostVideoAndGifPreviewViewHolder) holder).errorRelativeLayout.setVisibility(View.GONE);
loadImage(holder, post);
});
return false;
@@ -1149,17 +1150,17 @@ public class PostRecyclerViewAdapter extends PagedListAdapter<Post, RecyclerView
@Override
public boolean onResourceReady(Drawable resource, Object model, Target<Drawable> target, DataSource dataSource, boolean isFirstResource) {
- ((PostGifAndVideoPreviewViewHolder) holder).errorRelativeLayout.setVisibility(View.GONE);
- ((PostGifAndVideoPreviewViewHolder) holder).progressBar.setVisibility(View.GONE);
+ ((PostVideoAndGifPreviewViewHolder) holder).errorRelativeLayout.setVisibility(View.GONE);
+ ((PostVideoAndGifPreviewViewHolder) holder).progressBar.setVisibility(View.GONE);
return false;
}
});
if ((post.isNSFW() && mNeedBlurNSFW) || post.isSpoiler() && mNeedBlurSpoiler) {
imageRequestBuilder.apply(RequestOptions.bitmapTransform(new BlurTransformation(50, 10)))
- .into(((PostGifAndVideoPreviewViewHolder) holder).imageView);
+ .into(((PostVideoAndGifPreviewViewHolder) holder).imageView);
} else {
- imageRequestBuilder.into(((PostGifAndVideoPreviewViewHolder) holder).imageView);
+ imageRequestBuilder.into(((PostVideoAndGifPreviewViewHolder) holder).imageView);
}
} else if (holder instanceof PostLinkTypeViewHolder) {
RequestBuilder<Drawable> imageRequestBuilder = mGlide.load(post.getPreviewUrl()).listener(new RequestListener<Drawable>() {
@@ -1309,13 +1310,13 @@ public class PostRecyclerViewAdapter extends PagedListAdapter<Post, RecyclerView
super.onViewRecycled(holder);
if (holder instanceof PostBaseViewHolder) {
if (holder instanceof PostVideoAutoplayViewHolder) {
- ((PostVideoAutoplayViewHolder) holder).muteButton.setImageDrawable(mActivity.getDrawable(R.drawable.ic_mute_24dp));
((PostVideoAutoplayViewHolder) holder).muteButton.setVisibility(View.GONE);
- } else if (holder instanceof PostImageAndGifAutoplayTypeViewHolder) {
- mGlide.clear(((PostImageAndGifAutoplayTypeViewHolder) holder).imageView);
- ((PostImageAndGifAutoplayTypeViewHolder) holder).imageView.setScaleType(ImageView.ScaleType.FIT_START);
- ((PostImageAndGifAutoplayTypeViewHolder) holder).imageView.getLayoutParams().height = FrameLayout.LayoutParams.WRAP_CONTENT;
- ((PostImageAndGifAutoplayTypeViewHolder) holder).errorRelativeLayout.setVisibility(View.GONE);
+ ((PostVideoAutoplayViewHolder) holder).resetVolume();
+ } else if (holder instanceof PostImageAndGifAutoplayViewHolder) {
+ mGlide.clear(((PostImageAndGifAutoplayViewHolder) holder).imageView);
+ ((PostImageAndGifAutoplayViewHolder) holder).imageView.setScaleType(ImageView.ScaleType.FIT_START);
+ ((PostImageAndGifAutoplayViewHolder) holder).imageView.getLayoutParams().height = FrameLayout.LayoutParams.WRAP_CONTENT;
+ ((PostImageAndGifAutoplayViewHolder) holder).errorRelativeLayout.setVisibility(View.GONE);
} else if (holder instanceof PostLinkTypeViewHolder) {
mGlide.clear(((PostLinkTypeViewHolder) holder).imageView);
((PostLinkTypeViewHolder) holder).imageView.setScaleType(ImageView.ScaleType.FIT_START);
@@ -1822,9 +1823,9 @@ public class PostRecyclerViewAdapter extends PagedListAdapter<Post, RecyclerView
TextView userTextView;
@BindView(R.id.stickied_post_image_view_item_post_video_type_autoplay)
ImageView stickiedPostImageView;
- @BindView(R.id.post_time_text_view_best_item_post_video_type_autoplay)
+ @BindView(R.id.post_time_text_view_item_post_video_type_autoplay)
TextView postTimeTextView;
- @BindView(R.id.title_text_view_best_item_post_video_type_autoplay)
+ @BindView(R.id.title_text_view_item_post_video_type_autoplay)
TextView titleTextView;
@BindView(R.id.type_text_view_item_post_video_type_autoplay)
CustomTextView typeTextView;
@@ -1842,7 +1843,7 @@ public class PostRecyclerViewAdapter extends PagedListAdapter<Post, RecyclerView
CustomTextView flairTextView;
@BindView(R.id.awards_text_view_item_post_video_type_autoplay)
CustomTextView awardsTextView;
- @BindView(R.id.aspect)
+ @BindView(R.id.aspect_ratio_frame_layout_item_post_video_type_autoplay)
AspectRatioFrameLayout aspectRatioFrameLayout;
@BindView(R.id.player_view_item_post_video_type_autoplay)
PlayerView videoPlayer;
@@ -1930,6 +1931,10 @@ public class PostRecyclerViewAdapter extends PagedListAdapter<Post, RecyclerView
mediaUri = videoUri;
}
+ void resetVolume() {
+ volume = 0f;
+ }
+
@NonNull
@Override
public View getPlayerView() {
@@ -2016,61 +2021,61 @@ public class PostRecyclerViewAdapter extends PagedListAdapter<Post, RecyclerView
}
}
- class PostGifAndVideoPreviewViewHolder extends PostBaseViewHolder {
- @BindView(R.id.card_view_item_post_gif_type_autoplay)
+ class PostVideoAndGifPreviewViewHolder extends PostBaseViewHolder {
+ @BindView(R.id.card_view_item_post_video_and_gif_preview)
MaterialCardView cardView;
- @BindView(R.id.icon_gif_image_view_item_post_gif_type_autoplay)
+ @BindView(R.id.icon_gif_image_view_item_post_video_and_gif_preview)
AspectRatioGifImageView iconGifImageView;
- @BindView(R.id.subreddit_name_text_view_item_post_gif_type_autoplay)
+ @BindView(R.id.subreddit_name_text_view_item_post_video_and_gif_preview)
TextView subredditTextView;
- @BindView(R.id.user_text_view_item_post_gif_type_autoplay)
+ @BindView(R.id.user_text_view_item_post_video_and_gif_preview)
TextView userTextView;
- @BindView(R.id.stickied_post_image_view_item_post_gif_type_autoplay)
+ @BindView(R.id.stickied_post_image_view_item_post_video_and_gif_preview)
ImageView stickiedPostImageView;
- @BindView(R.id.post_time_text_view_best_item_post_gif_type_autoplay)
+ @BindView(R.id.post_time_text_view_item_post_video_and_gif_preview)
TextView postTimeTextView;
- @BindView(R.id.title_text_view_best_item_post_gif_type_autoplay)
+ @BindView(R.id.title_text_view_item_post_video_and_gif_preview)
TextView titleTextView;
- @BindView(R.id.type_text_view_item_post_gif_type_autoplay)
+ @BindView(R.id.type_text_view_item_post_video_and_gif_preview)
CustomTextView typeTextView;
- @BindView(R.id.archived_image_view_item_post_gif_type_autoplay)
+ @BindView(R.id.archived_image_view_item_post_video_and_gif_preview)
ImageView archivedImageView;
- @BindView(R.id.locked_image_view_item_post_gif_type_autoplay)
+ @BindView(R.id.locked_image_view_item_post_video_and_gif_preview)
ImageView lockedImageView;
- @BindView(R.id.crosspost_image_view_item_post_gif_type_autoplay)
+ @BindView(R.id.crosspost_image_view_item_post_video_and_gif_preview)
ImageView crosspostImageView;
- @BindView(R.id.nsfw_text_view_item_post_gif_type_autoplay)
+ @BindView(R.id.nsfw_text_view_item_post_video_and_gif_preview)
CustomTextView nsfwTextView;
- @BindView(R.id.spoiler_custom_text_view_item_post_gif_type_autoplay)
+ @BindView(R.id.spoiler_custom_text_view_item_post_video_and_gif_preview)
CustomTextView spoilerTextView;
- @BindView(R.id.flair_custom_text_view_item_post_gif_type_autoplay)
+ @BindView(R.id.flair_custom_text_view_item_post_video_and_gif_preview)
CustomTextView flairTextView;
- @BindView(R.id.awards_text_view_item_post_gif_type_autoplay)
+ @BindView(R.id.awards_text_view_item_post_video_and_gif_preview)
CustomTextView awardsTextView;
- @BindView(R.id.image_view_wrapper_item_post_gif_type_autoplay)
- RelativeLayout relativeLayout;
- @BindView(R.id.progress_bar_item_post_gif_type_autoplay)
+ @BindView(R.id.progress_bar_item_post_video_and_gif_preview)
ProgressBar progressBar;
- @BindView(R.id.image_view_item_post_gif_type_autoplay)
+ @BindView(R.id.image_view_item_post_video_and_gif_preview)
AspectRatioGifImageView imageView;
- @BindView(R.id.load_image_error_relative_layout_item_post_gif_type_autoplay)
+ @BindView(R.id.load_image_error_relative_layout_item_post_video_and_gif_preview)
RelativeLayout errorRelativeLayout;
- @BindView(R.id.bottom_constraint_layout_item_post_gif_type_autoplay)
+ @BindView(R.id.load_image_error_text_view_item_post_video_and_gif_preview)
+ TextView errorTextView;
+ @BindView(R.id.bottom_constraint_layout_item_post_video_and_gif_preview)
ConstraintLayout bottomConstraintLayout;
- @BindView(R.id.plus_button_item_post_gif_type_autoplay)
+ @BindView(R.id.plus_button_item_post_video_and_gif_preview)
ImageView upvoteButton;
- @BindView(R.id.score_text_view_item_post_gif_type_autoplay)
+ @BindView(R.id.score_text_view_item_post_video_and_gif_preview)
TextView scoreTextView;
- @BindView(R.id.minus_button_item_post_gif_type_autoplay)
+ @BindView(R.id.minus_button_item_post_video_and_gif_preview)
ImageView downvoteButton;
- @BindView(R.id.comments_count_item_post_gif_type_autoplay)
+ @BindView(R.id.comments_count_item_post_video_and_gif_preview)
TextView commentsCountTextView;
- @BindView(R.id.save_button_item_post_gif_type_autoplay)
+ @BindView(R.id.save_button_item_post_video_and_gif_preview)
ImageView saveButton;
- @BindView(R.id.share_button_item_post_gif_type_autoplay)
+ @BindView(R.id.share_button_item_post_video_and_gif_preview)
ImageView shareButton;
- PostGifAndVideoPreviewViewHolder(View itemView) {
+ PostVideoAndGifPreviewViewHolder(View itemView) {
super(itemView);
ButterKnife.bind(this, itemView);
setBaseView(cardView,
@@ -2097,6 +2102,7 @@ public class PostRecyclerViewAdapter extends PagedListAdapter<Post, RecyclerView
shareButton);
progressBar.setIndeterminateTintList(ColorStateList.valueOf(mColorAccent));
+ errorTextView.setTextColor(mPrimaryTextColor);
imageView.setOnClickListener(view -> {
Post post = getItem(getAdapterPosition());
@@ -2123,61 +2129,61 @@ public class PostRecyclerViewAdapter extends PagedListAdapter<Post, RecyclerView
}
}
- class PostImageAndGifAutoplayTypeViewHolder extends PostBaseViewHolder {
- @BindView(R.id.card_view_item_post_image_type)
+ class PostImageAndGifAutoplayViewHolder extends PostBaseViewHolder {
+ @BindView(R.id.card_view_item_post_image_and_gif_autoplay)
MaterialCardView cardView;
- @BindView(R.id.icon_gif_image_view_item_post_image_type)
+ @BindView(R.id.icon_gif_image_view_item_post_image_and_gif_autoplay)
AspectRatioGifImageView iconGifImageView;
- @BindView(R.id.subreddit_name_text_view_item_post_image_type)
+ @BindView(R.id.subreddit_name_text_view_item_post_image_and_gif_autoplay)
TextView subredditTextView;
- @BindView(R.id.user_text_view_item_post_image_type)
+ @BindView(R.id.user_text_view_item_post_image_and_gif_autoplay)
TextView userTextView;
- @BindView(R.id.stickied_post_image_view_item_post_image_type)
+ @BindView(R.id.stickied_post_image_view_item_post_image_and_gif_autoplay)
ImageView stickiedPostImageView;
- @BindView(R.id.post_time_text_view_best_item_post_image_type)
+ @BindView(R.id.post_time_text_view_item_post_image_and_gif_autoplay)
TextView postTimeTextView;
- @BindView(R.id.title_text_view_best_item_post_image_type)
+ @BindView(R.id.title_text_view_item_post_image_and_gif_autoplay)
TextView titleTextView;
- @BindView(R.id.type_text_view_item_post_image_type)
+ @BindView(R.id.type_text_view_item_post_image_and_gif_autoplay)
CustomTextView typeTextView;
- @BindView(R.id.archived_image_view_item_post_image_type)
+ @BindView(R.id.archived_image_view_item_post_image_and_gif_autoplay)
ImageView archivedImageView;
- @BindView(R.id.locked_image_view_item_post_image_type)
+ @BindView(R.id.locked_image_view_item_post_image_and_gif_autoplay)
ImageView lockedImageView;
- @BindView(R.id.crosspost_image_view_item_post_image_type)
+ @BindView(R.id.crosspost_image_view_item_post_image_and_gif_autoplay)
ImageView crosspostImageView;
- @BindView(R.id.nsfw_text_view_item_post_image_type)
+ @BindView(R.id.nsfw_text_view_item_post_image_and_gif_autoplay)
CustomTextView nsfwTextView;
- @BindView(R.id.spoiler_custom_text_view_item_post_image_type)
+ @BindView(R.id.spoiler_custom_text_view_item_post_image_and_gif_autoplay)
CustomTextView spoilerTextView;
- @BindView(R.id.flair_custom_text_view_item_post_image_type)
+ @BindView(R.id.flair_custom_text_view_item_post_image_and_gif_autoplay)
CustomTextView flairTextView;
- @BindView(R.id.awards_text_view_item_post_image_type)
+ @BindView(R.id.awards_text_view_item_post_image_and_gif_autoplay)
CustomTextView awardsTextView;
- @BindView(R.id.image_view_wrapper_item_post_image_type)
- RelativeLayout relativeLayout;
- @BindView(R.id.progress_bar_item_post_image_type)
+ @BindView(R.id.progress_bar_item_post_image_and_gif_autoplay)
ProgressBar progressBar;
- @BindView(R.id.image_view_best_post_item)
+ @BindView(R.id.image_view_item_post_image_and_gif_autoplay)
AspectRatioGifImageView imageView;
- @BindView(R.id.load_image_error_relative_layout_item_post_image_type)
+ @BindView(R.id.load_image_error_relative_layout_item_post_image_and_gif_autoplay)
RelativeLayout errorRelativeLayout;
- @BindView(R.id.bottom_constraint_layout_item_post_image_type)
+ @BindView(R.id.load_image_error_text_view_item_post_image_and_gif_autoplay)
+ TextView errorTextView;
+ @BindView(R.id.bottom_constraint_layout_item_post_image_and_gif_autoplay)
ConstraintLayout bottomConstraintLayout;
- @BindView(R.id.plus_button_item_post_image_type)
+ @BindView(R.id.plus_button_item_post_image_and_gif_autoplay)
ImageView upvoteButton;
- @BindView(R.id.score_text_view_item_post_image_type)
+ @BindView(R.id.score_text_view_item_post_image_and_gif_autoplay)
TextView scoreTextView;
- @BindView(R.id.minus_button_item_post_image_type)
+ @BindView(R.id.minus_button_item_post_image_and_gif_autoplay)
ImageView downvoteButton;
- @BindView(R.id.comments_count_item_post_image_type)
+ @BindView(R.id.comments_count_item_post_image_and_gif_autoplay)
TextView commentsCountTextView;
- @BindView(R.id.save_button_item_post_image_type)
+ @BindView(R.id.save_button_item_post_image_and_gif_autoplay)
ImageView saveButton;
- @BindView(R.id.share_button_item_post_image_type)
+ @BindView(R.id.share_button_item_post_image_and_gif_autoplay)
ImageView shareButton;
- PostImageAndGifAutoplayTypeViewHolder(View itemView) {
+ PostImageAndGifAutoplayViewHolder(View itemView) {
super(itemView);
ButterKnife.bind(this, itemView);
setBaseView(cardView,
@@ -2204,6 +2210,7 @@ public class PostRecyclerViewAdapter extends PagedListAdapter<Post, RecyclerView
shareButton);
progressBar.setIndeterminateTintList(ColorStateList.valueOf(mColorAccent));
+ errorTextView.setTextColor(mPrimaryTextColor);
imageView.setOnClickListener(view -> {
Post post = getItem(getAdapterPosition());
@@ -2220,59 +2227,59 @@ public class PostRecyclerViewAdapter extends PagedListAdapter<Post, RecyclerView
}
class PostLinkTypeViewHolder extends PostBaseViewHolder {
- @BindView(R.id.card_view_item_post_link_type)
+ @BindView(R.id.card_view_item_post_link)
MaterialCardView cardView;
- @BindView(R.id.icon_gif_image_view_item_post_link_type)
+ @BindView(R.id.icon_gif_image_view_item_post_link)
AspectRatioGifImageView iconGifImageView;
- @BindView(R.id.subreddit_name_text_view_item_post_link_type)
+ @BindView(R.id.subreddit_name_text_view_item_post_link)
TextView subredditTextView;
- @BindView(R.id.user_text_view_item_post_link_type)
+ @BindView(R.id.user_text_view_item_post_link)
TextView userTextView;
- @BindView(R.id.stickied_post_image_view_item_post_link_type)
+ @BindView(R.id.stickied_post_image_view_item_post_link)
ImageView stickiedPostImageView;
- @BindView(R.id.post_time_text_view_best_item_post_link_type)
+ @BindView(R.id.post_time_text_view_item_post_link)
TextView postTimeTextView;
- @BindView(R.id.title_text_view_best_item_post_link_type)
+ @BindView(R.id.title_text_view_item_post_link)
TextView titleTextView;
- @BindView(R.id.type_text_view_item_post_link_type)
+ @BindView(R.id.type_text_view_item_post_link)
CustomTextView typeTextView;
- @BindView(R.id.archived_image_view_item_post_link_type)
+ @BindView(R.id.archived_image_view_item_post_link)
ImageView archivedImageView;
- @BindView(R.id.locked_image_view_item_post_link_type)
+ @BindView(R.id.locked_image_view_item_post_link)
ImageView lockedImageView;
- @BindView(R.id.crosspost_image_view_item_post_link_type)
+ @BindView(R.id.crosspost_image_view_item_post_link)
ImageView crosspostImageView;
- @BindView(R.id.nsfw_text_view_item_post_link_type)
+ @BindView(R.id.nsfw_text_view_item_post_link)
CustomTextView nsfwTextView;
- @BindView(R.id.spoiler_custom_text_view_item_post_link_type)
+ @BindView(R.id.spoiler_custom_text_view_item_post_link)
CustomTextView spoilerTextView;
- @BindView(R.id.flair_custom_text_view_item_post_link_type)
+ @BindView(R.id.flair_custom_text_view_item_post_link)
CustomTextView flairTextView;
- @BindView(R.id.awards_text_view_item_post_link_type)
+ @BindView(R.id.awards_text_view_item_post_link)
CustomTextView awardsTextView;
- @BindView(R.id.link_text_view_item_post_link_type)
+ @BindView(R.id.link_text_view_item_post_link)
TextView linkTextView;
- @BindView(R.id.image_view_wrapper_item_post_link_type)
- RelativeLayout relativeLayout;
- @BindView(R.id.progress_bar_item_post_link_type)
+ @BindView(R.id.progress_bar_item_post_link)
ProgressBar progressBar;
- @BindView(R.id.image_view_best_post_item)
+ @BindView(R.id.image_view_item_post_link)
AspectRatioGifImageView imageView;
- @BindView(R.id.load_image_error_relative_layout_item_post_link_type)
+ @BindView(R.id.load_image_error_relative_layout_item_post_link)
RelativeLayout errorRelativeLayout;
- @BindView(R.id.bottom_constraint_layout_item_post_link_type)
+ @BindView(R.id.load_image_error_text_view_item_post_link)
+ TextView errorTextView;
+ @BindView(R.id.bottom_constraint_layout_item_post_link)
ConstraintLayout bottomConstraintLayout;
- @BindView(R.id.plus_button_item_post_link_type)
+ @BindView(R.id.plus_button_item_post_link)
ImageView upvoteButton;
- @BindView(R.id.score_text_view_item_post_link_type)
+ @BindView(R.id.score_text_view_item_post_link)
TextView scoreTextView;
- @BindView(R.id.minus_button_item_post_link_type)
+ @BindView(R.id.minus_button_item_post_link)
ImageView downvoteButton;
- @BindView(R.id.comments_count_item_post_link_type)
+ @BindView(R.id.comments_count_item_post_link)
TextView commentsCountTextView;
- @BindView(R.id.save_button_item_post_link_type)
+ @BindView(R.id.save_button_item_post_link)
ImageView saveButton;
- @BindView(R.id.share_button_item_post_link_type)
+ @BindView(R.id.share_button_item_post_link)
ImageView shareButton;
PostLinkTypeViewHolder(View itemView) {
@@ -2303,6 +2310,7 @@ public class PostRecyclerViewAdapter extends PagedListAdapter<Post, RecyclerView
linkTextView.setTextColor(mSecondaryTextColor);
progressBar.setIndeterminateTintList(ColorStateList.valueOf(mColorAccent));
+ errorTextView.setTextColor(mPrimaryTextColor);
imageView.setOnClickListener(view -> {
Post post = getItem(getAdapterPosition());
@@ -2331,9 +2339,9 @@ public class PostRecyclerViewAdapter extends PagedListAdapter<Post, RecyclerView
TextView userTextView;
@BindView(R.id.stickied_post_image_view_item_post_no_preview_link_type)
ImageView stickiedPostImageView;
- @BindView(R.id.post_time_text_view_best_item_post_no_preview_link_type)
+ @BindView(R.id.post_time_text_view_item_post_no_preview_link_type)
TextView postTimeTextView;
- @BindView(R.id.title_text_view_best_item_post_no_preview_link_type)
+ @BindView(R.id.title_text_view_item_post_no_preview_link_type)
TextView titleTextView;
@BindView(R.id.type_text_view_item_post_no_preview_link_type)
CustomTextView typeTextView;
@@ -2426,9 +2434,9 @@ public class PostRecyclerViewAdapter extends PagedListAdapter<Post, RecyclerView
TextView userTextView;
@BindView(R.id.stickied_post_image_view_item_post_text_type)
ImageView stickiedPostImageView;
- @BindView(R.id.post_time_text_view_best_item_post_text_type)
+ @BindView(R.id.post_time_text_view_item_post_text_type)
TextView postTimeTextView;
- @BindView(R.id.title_text_view_best_item_post_text_type)
+ @BindView(R.id.title_text_view_item_post_text_type)
TextView titleTextView;
@BindView(R.id.type_text_view_item_post_text_type)
CustomTextView typeTextView;
@@ -2500,9 +2508,9 @@ public class PostRecyclerViewAdapter extends PagedListAdapter<Post, RecyclerView
TextView nameTextView;
@BindView(R.id.stickied_post_image_view_item_post_compact)
ImageView stickiedPostImageView;
- @BindView(R.id.post_time_text_view_best_item_post_compact)
+ @BindView(R.id.post_time_text_view_item_post_compact)
TextView postTimeTextView;
- @BindView(R.id.title_text_view_best_item_post_compact)
+ @BindView(R.id.title_text_view_item_post_compact)
TextView titleTextView;
@BindView(R.id.type_text_view_item_post_compact)
CustomTextView typeTextView;
@@ -2526,7 +2534,7 @@ public class PostRecyclerViewAdapter extends PagedListAdapter<Post, RecyclerView
RelativeLayout relativeLayout;
@BindView(R.id.progress_bar_item_post_compact)
ProgressBar progressBar;
- @BindView(R.id.image_view_best_post_item)
+ @BindView(R.id.image_view_item_post_compact)
ImageView imageView;
@BindView(R.id.play_button_image_view_item_post_compact)
ImageView playButtonImageView;
diff --git a/app/src/main/res/layout/activity_view_post_detail.xml b/app/src/main/res/layout/activity_view_post_detail.xml
index 3b0dd281..d867c596 100644
--- a/app/src/main/res/layout/activity_view_post_detail.xml
+++ b/app/src/main/res/layout/activity_view_post_detail.xml
@@ -37,7 +37,7 @@
android:layout_height="match_parent"
app:layout_behavior="@string/appbar_scrolling_view_behavior">
- <androidx.recyclerview.widget.RecyclerView
+ <ml.docilealligator.infinityforreddit.CustomView.CustomToroContainer
android:id="@+id/recycler_view_view_post_detail"
android:layout_width="match_parent"
android:layout_height="wrap_content"
diff --git a/app/src/main/res/layout/item_post.xml b/app/src/main/res/layout/item_post.xml
deleted file mode 100644
index 9de730bf..00000000
--- a/app/src/main/res/layout/item_post.xml
+++ /dev/null
@@ -1,361 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<com.google.android.material.card.MaterialCardView xmlns:android="http://schemas.android.com/apk/res/android"
- xmlns:app="http://schemas.android.com/apk/res-auto"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:layout_marginTop="8dp"
- android:layout_marginBottom="8dp"
- android:id="@+id/card_view_item_post"
- app:cardBackgroundColor="?attr/cardViewBackgroundColor"
- app:cardElevation="2dp"
- app:cardCornerRadius="16dp">
-
- <LinearLayout
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:orientation="vertical">
-
- <androidx.constraintlayout.widget.ConstraintLayout
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:padding="16dp">
-
- <ml.docilealligator.infinityforreddit.CustomView.AspectRatioGifImageView
- android:id="@+id/icon_gif_image_view_item_post"
- android:layout_width="24dp"
- android:layout_height="24dp"
- android:layout_gravity="center"
- app:layout_constraintBottom_toBottomOf="parent"
- app:layout_constraintStart_toStartOf="parent"
- app:layout_constraintTop_toTopOf="parent"/>
-
- <TextView
- android:id="@+id/subreddit_name_text_view_item_post"
- android:layout_width="0dp"
- android:layout_height="wrap_content"
- android:layout_gravity="center"
- android:layout_marginStart="16dp"
- android:layout_marginEnd="8dp"
- android:textSize="?attr/font_default"
- app:layout_constraintBottom_toTopOf="@id/user_text_view_item_post"
- app:layout_constraintStart_toEndOf="@id/icon_gif_image_view_item_post"
- app:layout_constraintEnd_toStartOf="@id/stickied_post_image_view_item_post"
- app:layout_constraintTop_toTopOf="parent"/>
-
- <TextView
- android:id="@+id/user_text_view_item_post"
- android:layout_width="0dp"
- android:layout_height="wrap_content"
- android:layout_marginStart="16dp"
- android:layout_marginEnd="8dp"
- android:textSize="?attr/font_default"
- android:maxLines="2"
- android:ellipsize="end"
- app:layout_constraintBottom_toBottomOf="parent"
- app:layout_constraintStart_toEndOf="@+id/icon_gif_image_view_item_post"
- app:layout_constraintEnd_toStartOf="@id/stickied_post_image_view_item_post"
- app:layout_constraintTop_toBottomOf="@+id/subreddit_name_text_view_item_post"
- app:layout_constraintHorizontal_bias="0" />
-
- <ImageView
- android:id="@+id/stickied_post_image_view_item_post"
- android:layout_width="24dp"
- android:layout_height="24dp"
- android:layout_marginEnd="8dp"
- android:visibility="gone"
- app:layout_constraintBottom_toBottomOf="parent"
- app:layout_constraintStart_toEndOf="@id/subreddit_name_text_view_item_post"
- app:layout_constraintEnd_toStartOf="@+id/guideline2"
- app:layout_constraintTop_toTopOf="parent"/>
-
- <TextView
- android:id="@+id/post_time_text_view_best_item_post"
- android:layout_width="0dp"
- android:layout_height="wrap_content"
- android:gravity="end"
- android:textSize="?attr/font_default"
- app:layout_constraintBottom_toBottomOf="parent"
- app:layout_constraintEnd_toEndOf="parent"
- app:layout_constraintStart_toEndOf="@id/guideline2"
- app:layout_constraintTop_toTopOf="parent" />
-
- <androidx.constraintlayout.widget.Guideline
- android:id="@+id/guideline2"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:orientation="vertical"
- app:layout_constraintGuide_percent="0.6" />
-
- </androidx.constraintlayout.widget.ConstraintLayout>
-
- <TextView
- android:id="@+id/title_text_view_best_item_post"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:paddingStart="16dp"
- android:paddingEnd="16dp"
- android:textSize="?attr/title_font_18" />
-
- <TextView
- android:id="@+id/content_text_view_item_post"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:layout_marginTop="16dp"
- android:paddingStart="16dp"
- android:paddingEnd="16dp"
- android:maxLines="4"
- android:visibility="gone"
- android:textSize="?attr/content_font_default"
- android:ellipsize="end" />
-
- <com.nex3z.flowlayout.FlowLayout
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:padding="16dp"
- app:flChildSpacing="16dp"
- app:flChildSpacingForLastRow="align"
- app:flRowSpacing="8dp">
-
- <com.libRG.CustomTextView
- android:id="@+id/type_text_view_item_post"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:padding="4dp"
- android:textSize="?attr/font_12"
- app:lib_setRadius="3dp"
- app:lib_setRoundedView="true"
- app:lib_setShape="rectangle" />
-
- <com.libRG.CustomTextView
- android:id="@+id/spoiler_custom_text_view_item_post"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_gravity="center"
- android:text="@string/spoiler"
- android:textSize="?attr/font_12"
- android:padding="4dp"
- android:visibility="gone"
- app:lib_setRadius="3dp"
- app:lib_setRoundedView="true"
- app:lib_setShape="rectangle" />
-
- <com.libRG.CustomTextView
- android:id="@+id/nsfw_text_view_item_post"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:padding="4dp"
- android:text="@string/nsfw"
- android:textSize="?attr/font_12"
- android:visibility="gone"
- app:lib_setRadius="3dp"
- app:lib_setRoundedView="true"
- app:lib_setShape="rectangle" />
-
- <com.libRG.CustomTextView
- android:id="@+id/flair_custom_text_view_item_post"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_gravity="center"
- android:textSize="?attr/font_12"
- android:padding="4dp"
- android:visibility="gone"
- app:lib_setRadius="3dp"
- app:lib_setRoundedView="true"
- app:lib_setShape="rectangle" />
-
- <com.libRG.CustomTextView
- android:id="@+id/awards_text_view_item_post"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:padding="4dp"
- android:textSize="?attr/font_12"
- android:visibility="gone"
- app:lib_setRadius="3dp"
- app:lib_setRoundedView="true"
- app:lib_setShape="rectangle" />
-
- <ImageView
- android:id="@+id/archived_image_view_item_post"
- android:layout_width="24dp"
- android:layout_height="24dp"
- android:src="@drawable/ic_archive_outline"
- android:visibility="gone" />
-
- <ImageView
- android:id="@+id/locked_image_view_item_post"
- android:layout_width="24dp"
- android:layout_height="24dp"
- android:src="@drawable/ic_outline_lock_24dp"
- android:visibility="gone" />
-
- <ImageView
- android:id="@+id/crosspost_image_view_item_post"
- android:layout_width="24dp"
- android:layout_height="24dp"
- android:src="@drawable/crosspost"
- android:visibility="gone" />
-
- </com.nex3z.flowlayout.FlowLayout>
-
- <TextView
- android:id="@+id/link_text_view_item_post"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:layout_marginBottom="16dp"
- android:paddingStart="16dp"
- android:paddingEnd="16dp"
- android:textSize="?attr/font_12"
- android:visibility="gone" />
-
- <RelativeLayout
- android:id="@+id/image_view_wrapper_item_post"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:visibility="gone">
-
- <FrameLayout
- android:layout_width="match_parent"
- android:layout_height="wrap_content">
-
- <ml.docilealligator.infinityforreddit.CustomView.AspectRatioGifImageView
- android:id="@+id/image_view_best_post_item"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:adjustViewBounds="true"
- android:scaleType="fitStart" />
-
- <ImageView
- android:id="@+id/play_button_image_view_item_post"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_margin="16dp"
- android:layout_gravity="start"
- android:background="@drawable/play_button_round_background"
- android:src="@drawable/ic_play_circle_36dp"
- android:visibility="gone" />
-
- </FrameLayout>
-
- <ProgressBar
- android:id="@+id/progress_bar_item_post"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_centerInParent="true" />
-
- <RelativeLayout
- android:id="@+id/load_image_error_relative_layout_item_post"
- android:layout_width="match_parent"
- android:layout_height="match_parent"
- android:layout_centerInParent="true"
- android:visibility="gone">
-
- <TextView
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:drawableTop="@drawable/ic_error_outline_black_24dp"
- android:layout_gravity="center"
- android:gravity="center"
- android:text="@string/error_loading_image_tap_to_retry"
- android:textSize="?attr/font_default" />
-
- </RelativeLayout>
-
- </RelativeLayout>
-
- <ImageView
- android:id="@+id/image_view_no_preview_link_item_post"
- android:layout_width="match_parent"
- android:layout_height="150dp"
- android:scaleType="center"
- android:src="@drawable/ic_link"
- android:tint="@android:color/tab_indicator_text"
- android:visibility="gone"/>
-
- <androidx.constraintlayout.widget.ConstraintLayout
- android:id="@+id/bottom_constraint_layout_item_post"
- android:layout_width="match_parent"
- android:layout_height="wrap_content">
-
- <ImageView
- android:id="@+id/plus_button_item_post"
- 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"
- app:layout_constraintBottom_toBottomOf="parent"
- app:layout_constraintStart_toStartOf="parent" />
-
- <TextView
- android:id="@+id/score_text_view_item_post"
- android:layout_width="64dp"
- android:layout_height="wrap_content"
- android:gravity="center"
- android:textSize="?attr/font_12"
- android:textStyle="bold"
- app:layout_constraintTop_toTopOf="parent"
- app:layout_constraintBottom_toBottomOf="parent"
- app:layout_constraintStart_toEndOf="@id/plus_button_item_post" />
-
- <ImageView
- android:id="@+id/minus_button_item_post"
- 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"
- app:layout_constraintBottom_toBottomOf="parent"
- app:layout_constraintStart_toEndOf="@id/score_text_view_item_post" />
-
- <TextView
- android:id="@+id/comments_count_item_post"
- 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:drawableStart="@drawable/ic_comment_grey_24dp"
- android:drawablePadding="12dp"
- app:layout_constraintTop_toTopOf="parent"
- app:layout_constraintBottom_toBottomOf="parent"
- app:layout_constraintStart_toEndOf="@id/minus_button_item_post" />
-
- <ImageView
- android:id="@+id/save_button_item_post"
- 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"
- app:layout_constraintBottom_toBottomOf="parent"
- app:layout_constraintStart_toEndOf="@id/comments_count_item_post"
- app:layout_constraintEnd_toStartOf="@id/share_button_item_post" />
-
- <ImageView
- android:id="@+id/share_button_item_post"
- 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"
- app:layout_constraintBottom_toBottomOf="parent"
- app:layout_constraintEnd_toEndOf="parent" />
-
- </androidx.constraintlayout.widget.ConstraintLayout>
-
- </LinearLayout>
-
-</com.google.android.material.card.MaterialCardView> \ No newline at end of file
diff --git a/app/src/main/res/layout/item_post_compact.xml b/app/src/main/res/layout/item_post_compact.xml
index 8b65f934..d81a2bdc 100644
--- a/app/src/main/res/layout/item_post_compact.xml
+++ b/app/src/main/res/layout/item_post_compact.xml
@@ -54,7 +54,7 @@
app:layout_constraintTop_toTopOf="parent" />
<TextView
- android:id="@+id/post_time_text_view_best_item_post_compact"
+ android:id="@+id/post_time_text_view_item_post_compact"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:gravity="end"
@@ -78,7 +78,7 @@
android:layout_height="wrap_content">
<TextView
- android:id="@+id/title_text_view_best_item_post_compact"
+ android:id="@+id/title_text_view_item_post_compact"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:paddingStart="16dp"
@@ -98,7 +98,7 @@
android:paddingBottom="8dp"
android:paddingStart="16dp"
android:paddingEnd="16dp"
- app:layout_constraintTop_toBottomOf="@id/title_text_view_best_item_post_compact"
+ app:layout_constraintTop_toBottomOf="@id/title_text_view_item_post_compact"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toStartOf="@id/barrier2"
app:layout_constraintBottom_toTopOf="@id/link_text_view_item_post_compact"
@@ -220,7 +220,7 @@
android:layout_height="match_parent">
<ImageView
- android:id="@+id/image_view_best_post_item"
+ android:id="@+id/image_view_item_post_compact"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scaleType="center" />
diff --git a/app/src/main/res/layout/item_post_detail_image_and_gif_autoplay.xml b/app/src/main/res/layout/item_post_detail_image_and_gif_autoplay.xml
new file mode 100644
index 00000000..3667d7b5
--- /dev/null
+++ b/app/src/main/res/layout/item_post_detail_image_and_gif_autoplay.xml
@@ -0,0 +1,317 @@
+<?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"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:orientation="vertical"
+ android:background="?attr/cardViewBackgroundColor">
+
+ <androidx.constraintlayout.widget.ConstraintLayout
+ android:id="@+id/constraint_layout_item_post_detail_image_and_gif_autoplay"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:padding="16dp">
+
+ <ml.docilealligator.infinityforreddit.CustomView.AspectRatioGifImageView
+ android:id="@+id/icon_gif_image_view_item_post_detail_image_and_gif_autoplay"
+ android:layout_width="24dp"
+ android:layout_height="24dp"
+ app:layout_constraintBottom_toBottomOf="parent"
+ app:layout_constraintStart_toStartOf="parent"
+ app:layout_constraintTop_toTopOf="parent" />
+
+ <TextView
+ android:id="@+id/subreddit_text_view_item_post_detail_image_and_gif_autoplay"
+ android:layout_width="0dp"
+ android:layout_height="wrap_content"
+ android:layout_marginStart="16dp"
+ android:layout_marginEnd="8dp"
+ android:textSize="?attr/font_default"
+ android:maxLines="2"
+ android:ellipsize="end"
+ app:layout_constraintStart_toEndOf="@+id/icon_gif_image_view_item_post_detail_image_and_gif_autoplay"
+ app:layout_constraintEnd_toStartOf="@id/guideline"
+ app:layout_constraintTop_toTopOf="parent"
+ app:layout_constraintHorizontal_bias="0" />
+
+ <TextView
+ android:id="@+id/user_text_view_item_post_detail_image_and_gif_autoplay"
+ android:layout_width="0dp"
+ android:layout_height="wrap_content"
+ android:layout_marginStart="16dp"
+ android:layout_marginEnd="8dp"
+ android:textSize="?attr/font_default"
+ android:maxLines="2"
+ android:ellipsize="end"
+ app:layout_constraintBottom_toTopOf="@+id/author_flair_text_view_item_post_detail_image_and_gif_autoplay"
+ app:layout_constraintStart_toEndOf="@+id/icon_gif_image_view_item_post_detail_image_and_gif_autoplay"
+ app:layout_constraintEnd_toStartOf="@id/guideline"
+ app:layout_constraintTop_toBottomOf="@+id/subreddit_text_view_item_post_detail_image_and_gif_autoplay"
+ app:layout_constraintHorizontal_bias="0" />
+
+ <TextView
+ android:id="@+id/author_flair_text_view_item_post_detail_image_and_gif_autoplay"
+ android:layout_width="0dp"
+ android:layout_height="wrap_content"
+ android:layout_marginStart="16dp"
+ android:layout_marginEnd="8dp"
+ android:textSize="?attr/font_12"
+ android:maxLines="2"
+ android:ellipsize="end"
+ android:visibility="gone"
+ app:layout_constraintBottom_toBottomOf="parent"
+ app:layout_constraintStart_toEndOf="@+id/icon_gif_image_view_item_post_detail_image_and_gif_autoplay"
+ app:layout_constraintEnd_toStartOf="@id/guideline"
+ app:layout_constraintTop_toBottomOf="@+id/user_text_view_item_post_detail_image_and_gif_autoplay"
+ app:layout_constraintHorizontal_bias="0" />
+
+ <TextView
+ android:id="@+id/post_time_text_view_item_post_detail_image_and_gif_autoplay"
+ android:layout_width="0dp"
+ android:layout_height="wrap_content"
+ android:gravity="end"
+ android:textSize="?attr/font_default"
+ app:layout_constraintHorizontal_bias="1"
+ app:layout_constraintBottom_toBottomOf="parent"
+ app:layout_constraintStart_toEndOf="@id/guideline"
+ app:layout_constraintEnd_toEndOf="parent"
+ app:layout_constraintTop_toTopOf="parent" />
+
+ <androidx.constraintlayout.widget.Guideline
+ android:id="@+id/guideline"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:orientation="vertical"
+ app:layout_constraintGuide_percent="0.6" />
+
+ </androidx.constraintlayout.widget.ConstraintLayout>
+
+ <TextView
+ android:id="@+id/title_text_view_item_post_detail_image_and_gif_autoplay"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:paddingStart="16dp"
+ android:paddingEnd="16dp"
+ android:textColor="?attr/primaryTextColor"
+ android:textSize="?attr/title_font_18"
+ android:textIsSelectable="true"
+ android:enabled="true"
+ android:focusable="true"
+ android:longClickable="true" />
+
+ <com.nex3z.flowlayout.FlowLayout
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:padding="16dp"
+ app:flChildSpacing="16dp"
+ app:flChildSpacingForLastRow="align"
+ app:flRowSpacing="8dp">
+
+ <com.libRG.CustomTextView
+ android:id="@+id/type_text_view_item_post_detail_image_and_gif_autoplay"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:padding="4dp"
+ android:textSize="?attr/font_12"
+ android:textColor="@android:color/white"
+ app:lib_setRadius="3dp"
+ app:lib_setRoundedView="true"
+ app:lib_setShape="rectangle" />
+
+ <com.libRG.CustomTextView
+ android:id="@+id/spoiler_custom_text_view_item_post_detail_image_and_gif_autoplay"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_gravity="center"
+ android:text="@string/spoiler"
+ android:textSize="?attr/font_12"
+ android:textColor="@android:color/white"
+ android:padding="4dp"
+ android:visibility="gone"
+ app:lib_setRadius="3dp"
+ app:lib_setRoundedView="true"
+ app:lib_setShape="rectangle" />
+
+ <com.libRG.CustomTextView
+ android:id="@+id/nsfw_text_view_item_post_detail_image_and_gif_autoplay"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:padding="4dp"
+ android:text="@string/nsfw"
+ android:textSize="?attr/font_12"
+ android:textColor="@android:color/white"
+ android:visibility="gone"
+ app:lib_setRadius="3dp"
+ app:lib_setRoundedView="true"
+ app:lib_setShape="rectangle" />
+
+ <com.libRG.CustomTextView
+ android:id="@+id/flair_custom_text_view_item_post_detail_image_and_gif_autoplay"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_gravity="center"
+ android:padding="4dp"
+ android:textSize="?attr/font_12"
+ android:textColor="@android:color/white"
+ android:visibility="gone"
+ app:lib_setRadius="3dp"
+ app:lib_setRoundedView="true"
+ app:lib_setShape="rectangle" />
+
+ <ImageView
+ android:id="@+id/archived_image_view_item_post_detail_image_and_gif_autoplay"
+ android:layout_width="20dp"
+ android:layout_height="20dp"
+ android:src="@drawable/ic_archive_outline"
+ android:visibility="gone" />
+
+ <ImageView
+ android:id="@+id/locked_image_view_item_post_detail_image_and_gif_autoplay"
+ android:layout_width="20dp"
+ android:layout_height="20dp"
+ android:src="@drawable/ic_outline_lock_24dp"
+ android:visibility="gone" />
+
+ <ImageView
+ android:id="@+id/crosspost_image_view_item_post_detail_image_and_gif_autoplay"
+ android:layout_width="20dp"
+ android:layout_height="20dp"
+ android:src="@drawable/crosspost"
+ android:visibility="gone" />
+
+ <TextView
+ android:id="@+id/awards_text_view_item_post_detail_image_and_gif_autoplay"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:visibility="gone" />
+
+ </com.nex3z.flowlayout.FlowLayout>
+
+ <RelativeLayout
+ android:id="@+id/image_view_wrapper_item_post_detail_image_and_gif_autoplay"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content">
+
+ <com.santalu.aspectratioimageview.AspectRatioImageView
+ android:id="@+id/image_view_item_post_detail_image_and_gif_autoplay"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:adjustViewBounds="true"
+ android:scaleType="fitStart"/>
+
+ <RelativeLayout
+ android:id="@+id/load_wrapper_item_post_detail_image_and_gif_autoplay"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:layout_centerInParent="true">
+
+ <ProgressBar
+ android:id="@+id/progress_bar_item_post_detail_image_and_gif_autoplay"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_centerInParent="true" />
+
+ <TextView
+ android:id="@+id/load_image_error_text_view_item_post_detail_image_and_gif_autoplay"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:drawableTop="@drawable/ic_error_outline_black_24dp"
+ android:layout_centerInParent="true"
+ android:gravity="center"
+ android:text="@string/error_loading_image_tap_to_retry"
+ android:textSize="?attr/font_default"
+ android:visibility="gone" />
+
+ </RelativeLayout>
+
+ </RelativeLayout>
+
+ <androidx.constraintlayout.widget.ConstraintLayout
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:id="@+id/bottom_constraint_layout_item_post_detail_image_and_gif_autoplay">
+
+ <ImageView
+ android:id="@+id/plus_button_item_post_detail_image_and_gif_autoplay"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:padding="12dp"
+ android:src="@drawable/ic_arrow_upward_grey_24dp"
+ android:tint="@android:color/tab_indicator_text"
+ android:background="?actionBarItemBackground"
+ android:clickable="true"
+ android:focusable="true"
+ app:layout_constraintTop_toTopOf="parent"
+ app:layout_constraintBottom_toBottomOf="parent"
+ app:layout_constraintStart_toStartOf="parent" />
+
+ <TextView
+ android:id="@+id/score_text_view_item_post_detail_image_and_gif_autoplay"
+ android:layout_width="64dp"
+ android:layout_height="wrap_content"
+ android:gravity="center"
+ android:textSize="?attr/font_12"
+ android:textStyle="bold"
+ app:layout_constraintTop_toTopOf="parent"
+ app:layout_constraintBottom_toBottomOf="parent"
+ app:layout_constraintStart_toEndOf="@id/plus_button_item_post_detail_image_and_gif_autoplay" />
+
+ <ImageView
+ android:id="@+id/minus_button_item_post_detail_image_and_gif_autoplay"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:padding="12dp"
+ android:src="@drawable/ic_arrow_downward_grey_24dp"
+ android:tint="@android:color/tab_indicator_text"
+ android:background="?actionBarItemBackground"
+ android:clickable="true"
+ android:focusable="true"
+ app:layout_constraintTop_toTopOf="parent"
+ app:layout_constraintBottom_toBottomOf="parent"
+ app:layout_constraintStart_toEndOf="@id/score_text_view_item_post_detail_image_and_gif_autoplay" />
+
+ <TextView
+ android:id="@+id/comments_count_item_post_detail_image_and_gif_autoplay"
+ 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:drawableStart="@drawable/ic_comment_grey_24dp"
+ android:drawablePadding="12dp"
+ app:layout_constraintTop_toTopOf="parent"
+ app:layout_constraintBottom_toBottomOf="parent"
+ app:layout_constraintStart_toEndOf="@id/minus_button_item_post_detail_image_and_gif_autoplay" />
+
+ <ImageView
+ android:id="@+id/save_button_item_post_detail_image_and_gif_autoplay"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:padding="12dp"
+ android:tint="@android:color/tab_indicator_text"
+ android:background="?actionBarItemBackground"
+ android:clickable="true"
+ android:focusable="true"
+ app:layout_constraintHorizontal_bias="1"
+ app:layout_constraintTop_toTopOf="parent"
+ app:layout_constraintBottom_toBottomOf="parent"
+ app:layout_constraintStart_toEndOf="@id/comments_count_item_post_detail_image_and_gif_autoplay"
+ app:layout_constraintEnd_toStartOf="@id/share_button_item_post_detail_image_and_gif_autoplay" />
+
+ <ImageView
+ android:id="@+id/share_button_item_post_detail_image_and_gif_autoplay"
+ 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"
+ app:layout_constraintBottom_toBottomOf="parent"
+ app:layout_constraintEnd_toEndOf="parent" />
+
+ </androidx.constraintlayout.widget.ConstraintLayout>
+
+</LinearLayout> \ No newline at end of file
diff --git a/app/src/main/res/layout/item_post_detail_link.xml b/app/src/main/res/layout/item_post_detail_link.xml
new file mode 100644
index 00000000..1b8570da
--- /dev/null
+++ b/app/src/main/res/layout/item_post_detail_link.xml
@@ -0,0 +1,327 @@
+<?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"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:orientation="vertical"
+ android:background="?attr/cardViewBackgroundColor">
+
+ <androidx.constraintlayout.widget.ConstraintLayout
+ android:id="@+id/constraint_layout_item_post_detail_link"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:padding="16dp">
+
+ <ml.docilealligator.infinityforreddit.CustomView.AspectRatioGifImageView
+ android:id="@+id/icon_gif_image_view_item_post_detail_link"
+ android:layout_width="24dp"
+ android:layout_height="24dp"
+ app:layout_constraintBottom_toBottomOf="parent"
+ app:layout_constraintStart_toStartOf="parent"
+ app:layout_constraintTop_toTopOf="parent" />
+
+ <TextView
+ android:id="@+id/subreddit_text_view_item_post_detail_link"
+ android:layout_width="0dp"
+ android:layout_height="wrap_content"
+ android:layout_marginStart="16dp"
+ android:layout_marginEnd="8dp"
+ android:textSize="?attr/font_default"
+ android:maxLines="2"
+ android:ellipsize="end"
+ app:layout_constraintStart_toEndOf="@+id/icon_gif_image_view_item_post_detail_link"
+ app:layout_constraintEnd_toStartOf="@id/guideline"
+ app:layout_constraintTop_toTopOf="parent"
+ app:layout_constraintHorizontal_bias="0" />
+
+ <TextView
+ android:id="@+id/user_text_view_item_post_detail_link"
+ android:layout_width="0dp"
+ android:layout_height="wrap_content"
+ android:layout_marginStart="16dp"
+ android:layout_marginEnd="8dp"
+ android:textSize="?attr/font_default"
+ android:maxLines="2"
+ android:ellipsize="end"
+ app:layout_constraintBottom_toTopOf="@+id/author_flair_text_view_item_post_detail_link"
+ app:layout_constraintStart_toEndOf="@+id/icon_gif_image_view_item_post_detail_link"
+ app:layout_constraintEnd_toStartOf="@id/guideline"
+ app:layout_constraintTop_toBottomOf="@+id/subreddit_text_view_item_post_detail_link"
+ app:layout_constraintHorizontal_bias="0" />
+
+ <TextView
+ android:id="@+id/author_flair_text_view_item_post_detail_link"
+ android:layout_width="0dp"
+ android:layout_height="wrap_content"
+ android:layout_marginStart="16dp"
+ android:layout_marginEnd="8dp"
+ android:textSize="?attr/font_12"
+ android:maxLines="2"
+ android:ellipsize="end"
+ android:visibility="gone"
+ app:layout_constraintBottom_toBottomOf="parent"
+ app:layout_constraintStart_toEndOf="@+id/icon_gif_image_view_item_post_detail_link"
+ app:layout_constraintEnd_toStartOf="@id/guideline"
+ app:layout_constraintTop_toBottomOf="@+id/user_text_view_item_post_detail_link"
+ app:layout_constraintHorizontal_bias="0" />
+
+ <TextView
+ android:id="@+id/post_time_text_view_item_post_detail_link"
+ android:layout_width="0dp"
+ android:layout_height="wrap_content"
+ android:gravity="end"
+ android:textSize="?attr/font_default"
+ app:layout_constraintHorizontal_bias="1"
+ app:layout_constraintBottom_toBottomOf="parent"
+ app:layout_constraintStart_toEndOf="@id/guideline"
+ app:layout_constraintEnd_toEndOf="parent"
+ app:layout_constraintTop_toTopOf="parent" />
+
+ <androidx.constraintlayout.widget.Guideline
+ android:id="@+id/guideline"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:orientation="vertical"
+ app:layout_constraintGuide_percent="0.6" />
+
+ </androidx.constraintlayout.widget.ConstraintLayout>
+
+ <TextView
+ android:id="@+id/title_text_view_item_post_detail_link"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:paddingStart="16dp"
+ android:paddingEnd="16dp"
+ android:textColor="?attr/primaryTextColor"
+ android:textSize="?attr/title_font_18"
+ android:textIsSelectable="true"
+ android:enabled="true"
+ android:focusable="true"
+ android:longClickable="true" />
+
+ <com.nex3z.flowlayout.FlowLayout
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:padding="16dp"
+ app:flChildSpacing="16dp"
+ app:flChildSpacingForLastRow="align"
+ app:flRowSpacing="8dp">
+
+ <com.libRG.CustomTextView
+ android:id="@+id/type_text_view_item_post_detail_link"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:padding="4dp"
+ android:text="@string/link"
+ android:textSize="?attr/font_12"
+ android:textColor="@android:color/white"
+ app:lib_setRadius="3dp"
+ app:lib_setRoundedView="true"
+ app:lib_setShape="rectangle" />
+
+ <com.libRG.CustomTextView
+ android:id="@+id/spoiler_custom_text_view_item_post_detail_link"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_gravity="center"
+ android:text="@string/spoiler"
+ android:textSize="?attr/font_12"
+ android:textColor="@android:color/white"
+ android:padding="4dp"
+ android:visibility="gone"
+ app:lib_setRadius="3dp"
+ app:lib_setRoundedView="true"
+ app:lib_setShape="rectangle" />
+
+ <com.libRG.CustomTextView
+ android:id="@+id/nsfw_text_view_item_post_detail_link"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:padding="4dp"
+ android:text="@string/nsfw"
+ android:textSize="?attr/font_12"
+ android:textColor="@android:color/white"
+ android:visibility="gone"
+ app:lib_setRadius="3dp"
+ app:lib_setRoundedView="true"
+ app:lib_setShape="rectangle" />
+
+ <com.libRG.CustomTextView
+ android:id="@+id/flair_custom_text_view_item_post_detail_link"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_gravity="center"
+ android:padding="4dp"
+ android:textSize="?attr/font_12"
+ android:textColor="@android:color/white"
+ android:visibility="gone"
+ app:lib_setRadius="3dp"
+ app:lib_setRoundedView="true"
+ app:lib_setShape="rectangle" />
+
+ <ImageView
+ android:id="@+id/archived_image_view_item_post_detail_link"
+ android:layout_width="20dp"
+ android:layout_height="20dp"
+ android:src="@drawable/ic_archive_outline"
+ android:visibility="gone" />
+
+ <ImageView
+ android:id="@+id/locked_image_view_item_post_detail_link"
+ android:layout_width="20dp"
+ android:layout_height="20dp"
+ android:src="@drawable/ic_outline_lock_24dp"
+ android:visibility="gone" />
+
+ <ImageView
+ android:id="@+id/crosspost_image_view_item_post_detail_link"
+ android:layout_width="20dp"
+ android:layout_height="20dp"
+ android:src="@drawable/crosspost"
+ android:visibility="gone" />
+
+ <TextView
+ android:id="@+id/awards_text_view_item_post_detail_link"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:visibility="gone" />
+
+ </com.nex3z.flowlayout.FlowLayout>
+
+ <TextView
+ android:id="@+id/link_text_view_item_post_detail_link"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:layout_marginBottom="16dp"
+ android:paddingStart="16dp"
+ android:paddingEnd="16dp"
+ android:textSize="?attr/font_12" />
+
+ <RelativeLayout
+ android:id="@+id/image_view_wrapper_item_post_detail_link"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content">
+
+ <com.santalu.aspectratioimageview.AspectRatioImageView
+ android:id="@+id/image_view_item_post_detail_link"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:adjustViewBounds="true"
+ android:scaleType="fitStart"/>
+
+ <RelativeLayout
+ android:id="@+id/load_wrapper_item_post_detail_link"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:layout_centerInParent="true">
+
+ <ProgressBar
+ android:id="@+id/progress_bar_item_post_detail_link"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_centerInParent="true" />
+
+ <TextView
+ android:id="@+id/load_image_error_text_view_item_post_detail_link"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:drawableTop="@drawable/ic_error_outline_black_24dp"
+ android:layout_centerInParent="true"
+ android:gravity="center"
+ android:text="@string/error_loading_image_tap_to_retry"
+ android:textSize="?attr/font_default"
+ android:visibility="gone" />
+
+ </RelativeLayout>
+
+ </RelativeLayout>
+
+ <androidx.constraintlayout.widget.ConstraintLayout
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:id="@+id/bottom_constraint_layout_item_post_detail_link">
+
+ <ImageView
+ android:id="@+id/plus_button_item_post_detail_link"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:padding="12dp"
+ android:src="@drawable/ic_arrow_upward_grey_24dp"
+ android:tint="@android:color/tab_indicator_text"
+ android:background="?actionBarItemBackground"
+ android:clickable="true"
+ android:focusable="true"
+ app:layout_constraintTop_toTopOf="parent"
+ app:layout_constraintBottom_toBottomOf="parent"
+ app:layout_constraintStart_toStartOf="parent" />
+
+ <TextView
+ android:id="@+id/score_text_view_item_post_detail_link"
+ android:layout_width="64dp"
+ android:layout_height="wrap_content"
+ android:gravity="center"
+ android:textSize="?attr/font_12"
+ android:textStyle="bold"
+ app:layout_constraintTop_toTopOf="parent"
+ app:layout_constraintBottom_toBottomOf="parent"
+ app:layout_constraintStart_toEndOf="@id/plus_button_item_post_detail_link" />
+
+ <ImageView
+ android:id="@+id/minus_button_item_post_detail_link"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:padding="12dp"
+ android:src="@drawable/ic_arrow_downward_grey_24dp"
+ android:tint="@android:color/tab_indicator_text"
+ android:background="?actionBarItemBackground"
+ android:clickable="true"
+ android:focusable="true"
+ app:layout_constraintTop_toTopOf="parent"
+ app:layout_constraintBottom_toBottomOf="parent"
+ app:layout_constraintStart_toEndOf="@id/score_text_view_item_post_detail_link" />
+
+ <TextView
+ android:id="@+id/comments_count_item_post_detail_link"
+ 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:drawableStart="@drawable/ic_comment_grey_24dp"
+ android:drawablePadding="12dp"
+ app:layout_constraintTop_toTopOf="parent"
+ app:layout_constraintBottom_toBottomOf="parent"
+ app:layout_constraintStart_toEndOf="@id/minus_button_item_post_detail_link" />
+
+ <ImageView
+ android:id="@+id/save_button_item_post_detail_link"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:padding="12dp"
+ android:tint="@android:color/tab_indicator_text"
+ android:background="?actionBarItemBackground"
+ android:clickable="true"
+ android:focusable="true"
+ app:layout_constraintHorizontal_bias="1"
+ app:layout_constraintTop_toTopOf="parent"
+ app:layout_constraintBottom_toBottomOf="parent"
+ app:layout_constraintStart_toEndOf="@id/comments_count_item_post_detail_link"
+ app:layout_constraintEnd_toStartOf="@id/share_button_item_post_detail_link" />
+
+ <ImageView
+ android:id="@+id/share_button_item_post_detail_link"
+ 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"
+ app:layout_constraintBottom_toBottomOf="parent"
+ app:layout_constraintEnd_toEndOf="parent" />
+
+ </androidx.constraintlayout.widget.ConstraintLayout>
+
+</LinearLayout> \ No newline at end of file
diff --git a/app/src/main/res/layout/item_post_detail_no_preview_link.xml b/app/src/main/res/layout/item_post_detail_no_preview_link.xml
new file mode 100644
index 00000000..01e887fb
--- /dev/null
+++ b/app/src/main/res/layout/item_post_detail_no_preview_link.xml
@@ -0,0 +1,305 @@
+<?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"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:orientation="vertical"
+ android:background="?attr/cardViewBackgroundColor">
+
+ <androidx.constraintlayout.widget.ConstraintLayout
+ android:id="@+id/constraint_layout_item_post_detail_no_preview_link"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:padding="16dp">
+
+ <ml.docilealligator.infinityforreddit.CustomView.AspectRatioGifImageView
+ android:id="@+id/icon_gif_image_view_item_post_detail_no_preview_link"
+ android:layout_width="24dp"
+ android:layout_height="24dp"
+ app:layout_constraintBottom_toBottomOf="parent"
+ app:layout_constraintStart_toStartOf="parent"
+ app:layout_constraintTop_toTopOf="parent" />
+
+ <TextView
+ android:id="@+id/subreddit_text_view_item_post_detail_no_preview_link"
+ android:layout_width="0dp"
+ android:layout_height="wrap_content"
+ android:layout_marginStart="16dp"
+ android:layout_marginEnd="8dp"
+ android:textSize="?attr/font_default"
+ android:maxLines="2"
+ android:ellipsize="end"
+ app:layout_constraintStart_toEndOf="@+id/icon_gif_image_view_item_post_detail_no_preview_link"
+ app:layout_constraintEnd_toStartOf="@id/guideline"
+ app:layout_constraintTop_toTopOf="parent"
+ app:layout_constraintHorizontal_bias="0" />
+
+ <TextView
+ android:id="@+id/user_text_view_item_post_detail_no_preview_link"
+ android:layout_width="0dp"
+ android:layout_height="wrap_content"
+ android:layout_marginStart="16dp"
+ android:layout_marginEnd="8dp"
+ android:textSize="?attr/font_default"
+ android:maxLines="2"
+ android:ellipsize="end"
+ app:layout_constraintBottom_toTopOf="@+id/author_flair_text_view_item_post_detail_no_preview_link"
+ app:layout_constraintStart_toEndOf="@+id/icon_gif_image_view_item_post_detail_no_preview_link"
+ app:layout_constraintEnd_toStartOf="@id/guideline"
+ app:layout_constraintTop_toBottomOf="@+id/subreddit_text_view_item_post_detail_no_preview_link"
+ app:layout_constraintHorizontal_bias="0" />
+
+ <TextView
+ android:id="@+id/author_flair_text_view_item_post_detail_no_preview_link"
+ android:layout_width="0dp"
+ android:layout_height="wrap_content"
+ android:layout_marginStart="16dp"
+ android:layout_marginEnd="8dp"
+ android:textSize="?attr/font_12"
+ android:maxLines="2"
+ android:ellipsize="end"
+ android:visibility="gone"
+ app:layout_constraintBottom_toBottomOf="parent"
+ app:layout_constraintStart_toEndOf="@+id/icon_gif_image_view_item_post_detail_no_preview_link"
+ app:layout_constraintEnd_toStartOf="@id/guideline"
+ app:layout_constraintTop_toBottomOf="@+id/user_text_view_item_post_detail_no_preview_link"
+ app:layout_constraintHorizontal_bias="0" />
+
+ <TextView
+ android:id="@+id/post_time_text_view_item_post_detail_no_preview_link"
+ android:layout_width="0dp"
+ android:layout_height="wrap_content"
+ android:gravity="end"
+ android:textSize="?attr/font_default"
+ app:layout_constraintHorizontal_bias="1"
+ app:layout_constraintBottom_toBottomOf="parent"
+ app:layout_constraintStart_toEndOf="@id/guideline"
+ app:layout_constraintEnd_toEndOf="parent"
+ app:layout_constraintTop_toTopOf="parent" />
+
+ <androidx.constraintlayout.widget.Guideline
+ android:id="@+id/guideline"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:orientation="vertical"
+ app:layout_constraintGuide_percent="0.6" />
+
+ </androidx.constraintlayout.widget.ConstraintLayout>
+
+ <TextView
+ android:id="@+id/title_text_view_item_post_detail_no_preview_link"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:paddingStart="16dp"
+ android:paddingEnd="16dp"
+ android:textColor="?attr/primaryTextColor"
+ android:textSize="?attr/title_font_18"
+ android:textIsSelectable="true"
+ android:enabled="true"
+ android:focusable="true"
+ android:longClickable="true" />
+
+ <androidx.recyclerview.widget.RecyclerView
+ android:id="@+id/content_markdown_view_item_post_detail_no_preview_link"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:layout_marginTop="16dp"
+ android:layout_marginStart="16dp"
+ android:layout_marginEnd="16dp"
+ android:visibility="gone" />
+
+ <com.nex3z.flowlayout.FlowLayout
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:padding="16dp"
+ app:flChildSpacing="16dp"
+ app:flChildSpacingForLastRow="align"
+ app:flRowSpacing="8dp">
+
+ <com.libRG.CustomTextView
+ android:id="@+id/type_text_view_item_post_detail_no_preview_link"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:padding="4dp"
+ android:text="@string/link"
+ android:textSize="?attr/font_12"
+ android:textColor="@android:color/white"
+ app:lib_setRadius="3dp"
+ app:lib_setRoundedView="true"
+ app:lib_setShape="rectangle" />
+
+ <com.libRG.CustomTextView
+ android:id="@+id/spoiler_custom_text_view_item_post_detail_no_preview_link"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_gravity="center"
+ android:text="@string/spoiler"
+ android:textSize="?attr/font_12"
+ android:textColor="@android:color/white"
+ android:padding="4dp"
+ android:visibility="gone"
+ app:lib_setRadius="3dp"
+ app:lib_setRoundedView="true"
+ app:lib_setShape="rectangle" />
+
+ <com.libRG.CustomTextView
+ android:id="@+id/nsfw_text_view_item_post_detail_no_preview_link"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:padding="4dp"
+ android:text="@string/nsfw"
+ android:textSize="?attr/font_12"
+ android:textColor="@android:color/white"
+ android:visibility="gone"
+ app:lib_setRadius="3dp"
+ app:lib_setRoundedView="true"
+ app:lib_setShape="rectangle" />
+
+ <com.libRG.CustomTextView
+ android:id="@+id/flair_custom_text_view_item_post_detail_no_preview_link"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_gravity="center"
+ android:padding="4dp"
+ android:textSize="?attr/font_12"
+ android:textColor="@android:color/white"
+ android:visibility="gone"
+ app:lib_setRadius="3dp"
+ app:lib_setRoundedView="true"
+ app:lib_setShape="rectangle" />
+
+ <ImageView
+ android:id="@+id/archived_image_view_item_post_detail_no_preview_link"
+ android:layout_width="20dp"
+ android:layout_height="20dp"
+ android:src="@drawable/ic_archive_outline"
+ android:visibility="gone" />
+
+ <ImageView
+ android:id="@+id/locked_image_view_item_post_detail_no_preview_link"
+ android:layout_width="20dp"
+ android:layout_height="20dp"
+ android:src="@drawable/ic_outline_lock_24dp"
+ android:visibility="gone" />
+
+ <ImageView
+ android:id="@+id/crosspost_image_view_item_post_detail_no_preview_link"
+ android:layout_width="20dp"
+ android:layout_height="20dp"
+ android:src="@drawable/crosspost"
+ android:visibility="gone" />
+
+ <TextView
+ android:id="@+id/awards_text_view_item_post_detail_no_preview_link"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:visibility="gone" />
+
+ </com.nex3z.flowlayout.FlowLayout>
+
+ <TextView
+ android:id="@+id/link_text_view_item_post_detail_no_preview_link"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:layout_marginBottom="16dp"
+ android:paddingStart="16dp"
+ android:paddingEnd="16dp"
+ android:textSize="?attr/font_12" />
+
+ <ImageView
+ android:id="@+id/image_view_no_preview_link_item_post_detail_no_preview_link"
+ android:layout_width="match_parent"
+ android:layout_height="150dp"
+ android:scaleType="center"
+ android:src="@drawable/ic_link"
+ android:tint="@android:color/tab_indicator_text" />
+
+ <androidx.constraintlayout.widget.ConstraintLayout
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:id="@+id/bottom_constraint_layout_item_post_detail_no_preview_link">
+
+ <ImageView
+ android:id="@+id/plus_button_item_post_detail_no_preview_link"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:padding="12dp"
+ android:src="@drawable/ic_arrow_upward_grey_24dp"
+ android:tint="@android:color/tab_indicator_text"
+ android:background="?actionBarItemBackground"
+ android:clickable="true"
+ android:focusable="true"
+ app:layout_constraintTop_toTopOf="parent"
+ app:layout_constraintBottom_toBottomOf="parent"
+ app:layout_constraintStart_toStartOf="parent" />
+
+ <TextView
+ android:id="@+id/score_text_view_item_post_detail_no_preview_link"
+ android:layout_width="64dp"
+ android:layout_height="wrap_content"
+ android:gravity="center"
+ android:textSize="?attr/font_12"
+ android:textStyle="bold"
+ app:layout_constraintTop_toTopOf="parent"
+ app:layout_constraintBottom_toBottomOf="parent"
+ app:layout_constraintStart_toEndOf="@id/plus_button_item_post_detail_no_preview_link" />
+
+ <ImageView
+ android:id="@+id/minus_button_item_post_detail_no_preview_link"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:padding="12dp"
+ android:src="@drawable/ic_arrow_downward_grey_24dp"
+ android:tint="@android:color/tab_indicator_text"
+ android:background="?actionBarItemBackground"
+ android:clickable="true"
+ android:focusable="true"
+ app:layout_constraintTop_toTopOf="parent"
+ app:layout_constraintBottom_toBottomOf="parent"
+ app:layout_constraintStart_toEndOf="@id/score_text_view_item_post_detail_no_preview_link" />
+
+ <TextView
+ android:id="@+id/comments_count_item_post_detail_no_preview_link"
+ 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:drawableStart="@drawable/ic_comment_grey_24dp"
+ android:drawablePadding="12dp"
+ app:layout_constraintTop_toTopOf="parent"
+ app:layout_constraintBottom_toBottomOf="parent"
+ app:layout_constraintStart_toEndOf="@id/minus_button_item_post_detail_no_preview_link" />
+
+ <ImageView
+ android:id="@+id/save_button_item_post_detail_no_preview_link"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:padding="12dp"
+ android:tint="@android:color/tab_indicator_text"
+ android:background="?actionBarItemBackground"
+ android:clickable="true"
+ android:focusable="true"
+ app:layout_constraintHorizontal_bias="1"
+ app:layout_constraintTop_toTopOf="parent"
+ app:layout_constraintBottom_toBottomOf="parent"
+ app:layout_constraintStart_toEndOf="@id/comments_count_item_post_detail_no_preview_link"
+ app:layout_constraintEnd_toStartOf="@id/share_button_item_post_detail_no_preview_link" />
+
+ <ImageView
+ android:id="@+id/share_button_item_post_detail_no_preview_link"
+ 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"
+ app:layout_constraintBottom_toBottomOf="parent"
+ app:layout_constraintEnd_toEndOf="parent" />
+
+ </androidx.constraintlayout.widget.ConstraintLayout>
+
+</LinearLayout> \ No newline at end of file
diff --git a/app/src/main/res/layout/item_post_detail_text.xml b/app/src/main/res/layout/item_post_detail_text.xml
new file mode 100644
index 00000000..00b81547
--- /dev/null
+++ b/app/src/main/res/layout/item_post_detail_text.xml
@@ -0,0 +1,288 @@
+<?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"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:orientation="vertical"
+ android:background="?attr/cardViewBackgroundColor">
+
+ <androidx.constraintlayout.widget.ConstraintLayout
+ android:id="@+id/constraint_layout_item_post_detail_text"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:padding="16dp">
+
+ <ml.docilealligator.infinityforreddit.CustomView.AspectRatioGifImageView
+ android:id="@+id/icon_gif_image_view_item_post_detail_text"
+ android:layout_width="24dp"
+ android:layout_height="24dp"
+ app:layout_constraintBottom_toBottomOf="parent"
+ app:layout_constraintStart_toStartOf="parent"
+ app:layout_constraintTop_toTopOf="parent" />
+
+ <TextView
+ android:id="@+id/subreddit_text_view_item_post_detail_text"
+ android:layout_width="0dp"
+ android:layout_height="wrap_content"
+ android:layout_marginStart="16dp"
+ android:layout_marginEnd="8dp"
+ android:textSize="?attr/font_default"
+ android:maxLines="2"
+ android:ellipsize="end"
+ app:layout_constraintStart_toEndOf="@+id/icon_gif_image_view_item_post_detail_text"
+ app:layout_constraintEnd_toStartOf="@id/guideline"
+ app:layout_constraintTop_toTopOf="parent"
+ app:layout_constraintHorizontal_bias="0" />
+
+ <TextView
+ android:id="@+id/user_text_view_item_post_detail_text"
+ android:layout_width="0dp"
+ android:layout_height="wrap_content"
+ android:layout_marginStart="16dp"
+ android:layout_marginEnd="8dp"
+ android:textSize="?attr/font_default"
+ android:maxLines="2"
+ android:ellipsize="end"
+ app:layout_constraintBottom_toTopOf="@+id/author_flair_text_view_item_post_detail_text"
+ app:layout_constraintStart_toEndOf="@+id/icon_gif_image_view_item_post_detail_text"
+ app:layout_constraintEnd_toStartOf="@id/guideline"
+ app:layout_constraintTop_toBottomOf="@+id/subreddit_text_view_item_post_detail_text"
+ app:layout_constraintHorizontal_bias="0" />
+
+ <TextView
+ android:id="@+id/author_flair_text_view_item_post_detail_text"
+ android:layout_width="0dp"
+ android:layout_height="wrap_content"
+ android:layout_marginStart="16dp"
+ android:layout_marginEnd="8dp"
+ android:textSize="?attr/font_12"
+ android:maxLines="2"
+ android:ellipsize="end"
+ android:visibility="gone"
+ app:layout_constraintBottom_toBottomOf="parent"
+ app:layout_constraintStart_toEndOf="@+id/icon_gif_image_view_item_post_detail_text"
+ app:layout_constraintEnd_toStartOf="@id/guideline"
+ app:layout_constraintTop_toBottomOf="@+id/user_text_view_item_post_detail_text"
+ app:layout_constraintHorizontal_bias="0" />
+
+ <TextView
+ android:id="@+id/post_time_text_view_item_post_detail_text"
+ android:layout_width="0dp"
+ android:layout_height="wrap_content"
+ android:gravity="end"
+ android:textSize="?attr/font_default"
+ app:layout_constraintHorizontal_bias="1"
+ app:layout_constraintBottom_toBottomOf="parent"
+ app:layout_constraintStart_toEndOf="@id/guideline"
+ app:layout_constraintEnd_toEndOf="parent"
+ app:layout_constraintTop_toTopOf="parent" />
+
+ <androidx.constraintlayout.widget.Guideline
+ android:id="@+id/guideline"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:orientation="vertical"
+ app:layout_constraintGuide_percent="0.6" />
+
+ </androidx.constraintlayout.widget.ConstraintLayout>
+
+ <TextView
+ android:id="@+id/title_text_view_item_post_detail_text"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:paddingStart="16dp"
+ android:paddingEnd="16dp"
+ android:textColor="?attr/primaryTextColor"
+ android:textSize="?attr/title_font_18"
+ android:textIsSelectable="true"
+ android:enabled="true"
+ android:focusable="true"
+ android:longClickable="true" />
+
+ <androidx.recyclerview.widget.RecyclerView
+ android:id="@+id/content_markdown_view_item_post_detail_text"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:layout_marginTop="16dp"
+ android:layout_marginStart="16dp"
+ android:layout_marginEnd="16dp"
+ android:visibility="gone" />
+
+ <com.nex3z.flowlayout.FlowLayout
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:padding="16dp"
+ app:flChildSpacing="16dp"
+ app:flChildSpacingForLastRow="align"
+ app:flRowSpacing="8dp">
+
+ <com.libRG.CustomTextView
+ android:id="@+id/type_text_view_item_post_detail_text"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:padding="4dp"
+ android:text="@string/text"
+ android:textSize="?attr/font_12"
+ android:textColor="@android:color/white"
+ app:lib_setRadius="3dp"
+ app:lib_setRoundedView="true"
+ app:lib_setShape="rectangle" />
+
+ <com.libRG.CustomTextView
+ android:id="@+id/spoiler_custom_text_view_item_post_detail_text"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_gravity="center"
+ android:text="@string/spoiler"
+ android:textSize="?attr/font_12"
+ android:textColor="@android:color/white"
+ android:padding="4dp"
+ android:visibility="gone"
+ app:lib_setRadius="3dp"
+ app:lib_setRoundedView="true"
+ app:lib_setShape="rectangle" />
+
+ <com.libRG.CustomTextView
+ android:id="@+id/nsfw_text_view_item_post_detail_text"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:padding="4dp"
+ android:text="@string/nsfw"
+ android:textSize="?attr/font_12"
+ android:textColor="@android:color/white"
+ android:visibility="gone"
+ app:lib_setRadius="3dp"
+ app:lib_setRoundedView="true"
+ app:lib_setShape="rectangle" />
+
+ <com.libRG.CustomTextView
+ android:id="@+id/flair_custom_text_view_item_post_detail_text"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_gravity="center"
+ android:padding="4dp"
+ android:textSize="?attr/font_12"
+ android:textColor="@android:color/white"
+ android:visibility="gone"
+ app:lib_setRadius="3dp"
+ app:lib_setRoundedView="true"
+ app:lib_setShape="rectangle" />
+
+ <ImageView
+ android:id="@+id/archived_image_view_item_post_detail_text"
+ android:layout_width="20dp"
+ android:layout_height="20dp"
+ android:src="@drawable/ic_archive_outline"
+ android:visibility="gone" />
+
+ <ImageView
+ android:id="@+id/locked_image_view_item_post_detail_text"
+ android:layout_width="20dp"
+ android:layout_height="20dp"
+ android:src="@drawable/ic_outline_lock_24dp"
+ android:visibility="gone" />
+
+ <ImageView
+ android:id="@+id/crosspost_image_view_item_post_detail_text"
+ android:layout_width="20dp"
+ android:layout_height="20dp"
+ android:src="@drawable/crosspost"
+ android:visibility="gone" />
+
+ <TextView
+ android:id="@+id/awards_text_view_item_post_detail_text"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:visibility="gone" />
+
+ </com.nex3z.flowlayout.FlowLayout>
+
+ <androidx.constraintlayout.widget.ConstraintLayout
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:id="@+id/bottom_constraint_layout_item_post_detail_text">
+
+ <ImageView
+ android:id="@+id/plus_button_item_post_detail_text"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:padding="12dp"
+ android:src="@drawable/ic_arrow_upward_grey_24dp"
+ android:tint="@android:color/tab_indicator_text"
+ android:background="?actionBarItemBackground"
+ android:clickable="true"
+ android:focusable="true"
+ app:layout_constraintTop_toTopOf="parent"
+ app:layout_constraintBottom_toBottomOf="parent"
+ app:layout_constraintStart_toStartOf="parent" />
+
+ <TextView
+ android:id="@+id/score_text_view_item_post_detail_text"
+ android:layout_width="64dp"
+ android:layout_height="wrap_content"
+ android:gravity="center"
+ android:textSize="?attr/font_12"
+ android:textStyle="bold"
+ app:layout_constraintTop_toTopOf="parent"
+ app:layout_constraintBottom_toBottomOf="parent"
+ app:layout_constraintStart_toEndOf="@id/plus_button_item_post_detail_text" />
+
+ <ImageView
+ android:id="@+id/minus_button_item_post_detail_text"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:padding="12dp"
+ android:src="@drawable/ic_arrow_downward_grey_24dp"
+ android:tint="@android:color/tab_indicator_text"
+ android:background="?actionBarItemBackground"
+ android:clickable="true"
+ android:focusable="true"
+ app:layout_constraintTop_toTopOf="parent"
+ app:layout_constraintBottom_toBottomOf="parent"
+ app:layout_constraintStart_toEndOf="@id/score_text_view_item_post_detail_text" />
+
+ <TextView
+ android:id="@+id/comments_count_item_post_detail_text"
+ 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:drawableStart="@drawable/ic_comment_grey_24dp"
+ android:drawablePadding="12dp"
+ app:layout_constraintTop_toTopOf="parent"
+ app:layout_constraintBottom_toBottomOf="parent"
+ app:layout_constraintStart_toEndOf="@id/minus_button_item_post_detail_text" />
+
+ <ImageView
+ android:id="@+id/save_button_item_post_detail_text"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:padding="12dp"
+ android:tint="@android:color/tab_indicator_text"
+ android:background="?actionBarItemBackground"
+ android:clickable="true"
+ android:focusable="true"
+ app:layout_constraintHorizontal_bias="1"
+ app:layout_constraintTop_toTopOf="parent"
+ app:layout_constraintBottom_toBottomOf="parent"
+ app:layout_constraintStart_toEndOf="@id/comments_count_item_post_detail_text"
+ app:layout_constraintEnd_toStartOf="@id/share_button_item_post_detail_text" />
+
+ <ImageView
+ android:id="@+id/share_button_item_post_detail_text"
+ 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"
+ app:layout_constraintBottom_toBottomOf="parent"
+ app:layout_constraintEnd_toEndOf="parent" />
+
+ </androidx.constraintlayout.widget.ConstraintLayout>
+
+</LinearLayout> \ No newline at end of file
diff --git a/app/src/main/res/layout/item_post_detail.xml b/app/src/main/res/layout/item_post_detail_video_and_gif_preview.xml
index ce515feb..5de14a3e 100644
--- a/app/src/main/res/layout/item_post_detail.xml
+++ b/app/src/main/res/layout/item_post_detail_video_and_gif_preview.xml
@@ -7,13 +7,13 @@
android:background="?attr/cardViewBackgroundColor">
<androidx.constraintlayout.widget.ConstraintLayout
- android:id="@+id/constraint_layout_item_post_detail"
+ android:id="@+id/constraint_layout_item_post_detail_video_and_gif_preview"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="16dp">
<ml.docilealligator.infinityforreddit.CustomView.AspectRatioGifImageView
- android:id="@+id/icon_gif_image_view_item_post_detail"
+ android:id="@+id/icon_gif_image_view_item_post_detail_video_and_gif_preview"
android:layout_width="24dp"
android:layout_height="24dp"
app:layout_constraintBottom_toBottomOf="parent"
@@ -21,7 +21,7 @@
app:layout_constraintTop_toTopOf="parent" />
<TextView
- android:id="@+id/subreddit_text_view_item_post_detail"
+ android:id="@+id/subreddit_text_view_item_post_detail_video_and_gif_preview"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
@@ -29,13 +29,13 @@
android:textSize="?attr/font_default"
android:maxLines="2"
android:ellipsize="end"
- app:layout_constraintStart_toEndOf="@+id/icon_gif_image_view_item_post_detail"
+ app:layout_constraintStart_toEndOf="@+id/icon_gif_image_view_item_post_detail_video_and_gif_preview"
app:layout_constraintEnd_toStartOf="@id/guideline"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintHorizontal_bias="0" />
<TextView
- android:id="@+id/user_text_view_item_post_detail"
+ android:id="@+id/user_text_view_item_post_detail_video_and_gif_preview"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
@@ -43,14 +43,14 @@
android:textSize="?attr/font_default"
android:maxLines="2"
android:ellipsize="end"
- app:layout_constraintBottom_toTopOf="@+id/author_flair_text_view_item_post_detail"
- app:layout_constraintStart_toEndOf="@+id/icon_gif_image_view_item_post_detail"
+ app:layout_constraintBottom_toTopOf="@+id/author_flair_text_view_item_post_detail_video_and_gif_preview"
+ app:layout_constraintStart_toEndOf="@+id/icon_gif_image_view_item_post_detail_video_and_gif_preview"
app:layout_constraintEnd_toStartOf="@id/guideline"
- app:layout_constraintTop_toBottomOf="@+id/subreddit_text_view_item_post_detail"
+ app:layout_constraintTop_toBottomOf="@+id/subreddit_text_view_item_post_detail_video_and_gif_preview"
app:layout_constraintHorizontal_bias="0" />
<TextView
- android:id="@+id/author_flair_text_view_item_post_detail"
+ android:id="@+id/author_flair_text_view_item_post_detail_video_and_gif_preview"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
@@ -60,13 +60,13 @@
android:ellipsize="end"
android:visibility="gone"
app:layout_constraintBottom_toBottomOf="parent"
- app:layout_constraintStart_toEndOf="@+id/icon_gif_image_view_item_post_detail"
+ app:layout_constraintStart_toEndOf="@+id/icon_gif_image_view_item_post_detail_video_and_gif_preview"
app:layout_constraintEnd_toStartOf="@id/guideline"
- app:layout_constraintTop_toBottomOf="@+id/user_text_view_item_post_detail"
+ app:layout_constraintTop_toBottomOf="@+id/user_text_view_item_post_detail_video_and_gif_preview"
app:layout_constraintHorizontal_bias="0" />
<TextView
- android:id="@+id/post_time_text_view_item_post_detail"
+ android:id="@+id/post_time_text_view_item_post_detail_video_and_gif_preview"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:gravity="end"
@@ -87,7 +87,7 @@
</androidx.constraintlayout.widget.ConstraintLayout>
<TextView
- android:id="@+id/title_text_view_item_post_detail"
+ android:id="@+id/title_text_view_item_post_detail_video_and_gif_preview"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingStart="16dp"
@@ -99,15 +99,6 @@
android:focusable="true"
android:longClickable="true" />
- <androidx.recyclerview.widget.RecyclerView
- android:id="@+id/content_markdown_view_item_post_detail"
- android:layout_width="match_parent"
- android:layout_height="match_parent"
- android:layout_marginTop="16dp"
- android:layout_marginStart="16dp"
- android:layout_marginEnd="16dp"
- android:visibility="gone" />
-
<com.nex3z.flowlayout.FlowLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
@@ -117,7 +108,7 @@
app:flRowSpacing="8dp">
<com.libRG.CustomTextView
- android:id="@+id/type_text_view_item_post_detail"
+ android:id="@+id/type_text_view_item_post_detail_video_and_gif_preview"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="4dp"
@@ -128,7 +119,7 @@
app:lib_setShape="rectangle" />
<com.libRG.CustomTextView
- android:id="@+id/spoiler_custom_text_view_item_post_detail"
+ android:id="@+id/spoiler_custom_text_view_item_post_detail_video_and_gif_preview"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
@@ -142,7 +133,7 @@
app:lib_setShape="rectangle" />
<com.libRG.CustomTextView
- android:id="@+id/nsfw_text_view_item_post_detail"
+ android:id="@+id/nsfw_text_view_item_post_detail_video_and_gif_preview"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="4dp"
@@ -155,7 +146,7 @@
app:lib_setShape="rectangle" />
<com.libRG.CustomTextView
- android:id="@+id/flair_custom_text_view_item_post_detail"
+ android:id="@+id/flair_custom_text_view_item_post_detail_video_and_gif_preview"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
@@ -168,87 +159,73 @@
app:lib_setShape="rectangle" />
<ImageView
- android:id="@+id/archived_image_view_item_post_detail"
+ android:id="@+id/archived_image_view_item_post_detail_video_and_gif_preview"
android:layout_width="20dp"
android:layout_height="20dp"
android:src="@drawable/ic_archive_outline"
android:visibility="gone" />
<ImageView
- android:id="@+id/locked_image_view_item_post_detail"
+ android:id="@+id/locked_image_view_item_post_detail_video_and_gif_preview"
android:layout_width="20dp"
android:layout_height="20dp"
android:src="@drawable/ic_outline_lock_24dp"
android:visibility="gone" />
<ImageView
- android:id="@+id/crosspost_image_view_item_post_detail"
+ android:id="@+id/crosspost_image_view_item_post_detail_video_and_gif_preview"
android:layout_width="20dp"
android:layout_height="20dp"
android:src="@drawable/crosspost"
android:visibility="gone" />
<TextView
- android:id="@+id/awards_text_view_item_post_detail"
+ android:id="@+id/awards_text_view_item_post_detail_video_and_gif_preview"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:visibility="gone" />
</com.nex3z.flowlayout.FlowLayout>
- <TextView
- android:id="@+id/link_text_view_item_post_detail"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:layout_marginBottom="16dp"
- android:paddingStart="16dp"
- android:paddingEnd="16dp"
- android:textSize="?attr/font_12"
- android:visibility="gone"/>
-
<RelativeLayout
- android:id="@+id/image_view_wrapper_item_post_detail"
android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:visibility="gone">
+ android:layout_height="wrap_content">
<FrameLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<com.santalu.aspectratioimageview.AspectRatioImageView
- android:id="@+id/image_view_item_post_detail"
+ android:id="@+id/image_view_item_post_detail_video_and_gif_preview"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:adjustViewBounds="true"
android:scaleType="fitStart"/>
<ImageView
- android:id="@+id/play_button_image_view_item_post_detail"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="16dp"
android:layout_gravity="start"
android:background="@drawable/play_button_round_background"
- android:src="@drawable/ic_play_circle_36dp"
- android:visibility="gone" />
+ android:src="@drawable/ic_play_circle_36dp" />
</FrameLayout>
<RelativeLayout
- android:id="@+id/load_wrapper_item_post_detail"
+ android:id="@+id/load_wrapper_item_post_detail_video_and_gif_preview"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_centerInParent="true">
<ProgressBar
- android:id="@+id/progress_bar_item_post_detail"
+ android:id="@+id/progress_bar_item_post_detail_video_and_gif_preview"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true" />
<TextView
- android:id="@+id/load_image_error_text_view_item_post_detail"
+ android:id="@+id/load_image_error_text_view_item_post_detail_video_and_gif_preview"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:drawableTop="@drawable/ic_error_outline_black_24dp"
@@ -262,22 +239,13 @@
</RelativeLayout>
- <ImageView
- android:id="@+id/image_view_no_preview_link_item_post_detail"
- android:layout_width="match_parent"
- android:layout_height="150dp"
- android:scaleType="center"
- android:src="@drawable/ic_link"
- android:tint="@android:color/tab_indicator_text"
- android:visibility="gone" />
-
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
- android:id="@+id/bottom_constraint_layout_item_post_detail">
+ android:id="@+id/bottom_constraint_layout_item_post_detail_video_and_gif_preview">
<ImageView
- android:id="@+id/plus_button_item_post_detail"
+ android:id="@+id/plus_button_item_post_detail_video_and_gif_preview"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="12dp"
@@ -291,7 +259,7 @@
app:layout_constraintStart_toStartOf="parent" />
<TextView
- android:id="@+id/score_text_view_item_post_detail"
+ android:id="@+id/score_text_view_item_post_detail_video_and_gif_preview"
android:layout_width="64dp"
android:layout_height="wrap_content"
android:gravity="center"
@@ -299,10 +267,10 @@
android:textStyle="bold"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toBottomOf="parent"
- app:layout_constraintStart_toEndOf="@id/plus_button_item_post_detail" />
+ app:layout_constraintStart_toEndOf="@id/plus_button_item_post_detail_video_and_gif_preview" />
<ImageView
- android:id="@+id/minus_button_item_post_detail"
+ android:id="@+id/minus_button_item_post_detail_video_and_gif_preview"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="12dp"
@@ -313,10 +281,10 @@
android:focusable="true"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toBottomOf="parent"
- app:layout_constraintStart_toEndOf="@id/score_text_view_item_post_detail" />
+ app:layout_constraintStart_toEndOf="@id/score_text_view_item_post_detail_video_and_gif_preview" />
<TextView
- android:id="@+id/comments_count_item_post_detail"
+ android:id="@+id/comments_count_item_post_detail_video_and_gif_preview"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="12dp"
@@ -327,10 +295,10 @@
android:drawablePadding="12dp"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toBottomOf="parent"
- app:layout_constraintStart_toEndOf="@id/minus_button_item_post_detail" />
+ app:layout_constraintStart_toEndOf="@id/minus_button_item_post_detail_video_and_gif_preview" />
<ImageView
- android:id="@+id/save_button_item_post_detail"
+ android:id="@+id/save_button_item_post_detail_video_and_gif_preview"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="12dp"
@@ -341,11 +309,11 @@
app:layout_constraintHorizontal_bias="1"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toBottomOf="parent"
- app:layout_constraintStart_toEndOf="@id/comments_count_item_post_detail"
- app:layout_constraintEnd_toStartOf="@id/share_button_item_post_detail" />
+ app:layout_constraintStart_toEndOf="@id/comments_count_item_post_detail_video_and_gif_preview"
+ app:layout_constraintEnd_toStartOf="@id/share_button_item_post_detail_video_and_gif_preview" />
<ImageView
- android:id="@+id/share_button_item_post_detail"
+ android:id="@+id/share_button_item_post_detail_video_and_gif_preview"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="12dp"
diff --git a/app/src/main/res/layout/item_post_detail_video_autoplay.xml b/app/src/main/res/layout/item_post_detail_video_autoplay.xml
new file mode 100644
index 00000000..b73fae27
--- /dev/null
+++ b/app/src/main/res/layout/item_post_detail_video_autoplay.xml
@@ -0,0 +1,294 @@
+<?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"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:orientation="vertical"
+ android:background="?attr/cardViewBackgroundColor">
+
+ <androidx.constraintlayout.widget.ConstraintLayout
+ android:id="@+id/constraint_layout_item_post_detail_video_autoplay"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:padding="16dp">
+
+ <ml.docilealligator.infinityforreddit.CustomView.AspectRatioGifImageView
+ android:id="@+id/icon_gif_image_view_item_post_detail_video_autoplay"
+ android:layout_width="24dp"
+ android:layout_height="24dp"
+ app:layout_constraintBottom_toBottomOf="parent"
+ app:layout_constraintStart_toStartOf="parent"
+ app:layout_constraintTop_toTopOf="parent" />
+
+ <TextView
+ android:id="@+id/subreddit_text_view_item_post_detail_video_autoplay"
+ android:layout_width="0dp"
+ android:layout_height="wrap_content"
+ android:layout_marginStart="16dp"
+ android:layout_marginEnd="8dp"
+ android:textSize="?attr/font_default"
+ android:maxLines="2"
+ android:ellipsize="end"
+ app:layout_constraintStart_toEndOf="@+id/icon_gif_image_view_item_post_detail_video_autoplay"
+ app:layout_constraintEnd_toStartOf="@id/guideline"
+ app:layout_constraintTop_toTopOf="parent"
+ app:layout_constraintHorizontal_bias="0" />
+
+ <TextView
+ android:id="@+id/user_text_view_item_post_detail_video_autoplay"
+ android:layout_width="0dp"
+ android:layout_height="wrap_content"
+ android:layout_marginStart="16dp"
+ android:layout_marginEnd="8dp"
+ android:textSize="?attr/font_default"
+ android:maxLines="2"
+ android:ellipsize="end"
+ app:layout_constraintBottom_toTopOf="@+id/author_flair_text_view_item_post_detail_video_autoplay"
+ app:layout_constraintStart_toEndOf="@+id/icon_gif_image_view_item_post_detail_video_autoplay"
+ app:layout_constraintEnd_toStartOf="@id/guideline"
+ app:layout_constraintTop_toBottomOf="@+id/subreddit_text_view_item_post_detail_video_autoplay"
+ app:layout_constraintHorizontal_bias="0" />
+
+ <TextView
+ android:id="@+id/author_flair_text_view_item_post_detail_video_autoplay"
+ android:layout_width="0dp"
+ android:layout_height="wrap_content"
+ android:layout_marginStart="16dp"
+ android:layout_marginEnd="8dp"
+ android:textSize="?attr/font_12"
+ android:maxLines="2"
+ android:ellipsize="end"
+ android:visibility="gone"
+ app:layout_constraintBottom_toBottomOf="parent"
+ app:layout_constraintStart_toEndOf="@+id/icon_gif_image_view_item_post_detail_video_autoplay"
+ app:layout_constraintEnd_toStartOf="@id/guideline"
+ app:layout_constraintTop_toBottomOf="@+id/user_text_view_item_post_detail_video_autoplay"
+ app:layout_constraintHorizontal_bias="0" />
+
+ <TextView
+ android:id="@+id/post_time_text_view_item_post_detail_video_autoplay"
+ android:layout_width="0dp"
+ android:layout_height="wrap_content"
+ android:gravity="end"
+ android:textSize="?attr/font_default"
+ app:layout_constraintHorizontal_bias="1"
+ app:layout_constraintBottom_toBottomOf="parent"
+ app:layout_constraintStart_toEndOf="@id/guideline"
+ app:layout_constraintEnd_toEndOf="parent"
+ app:layout_constraintTop_toTopOf="parent" />
+
+ <androidx.constraintlayout.widget.Guideline
+ android:id="@+id/guideline"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:orientation="vertical"
+ app:layout_constraintGuide_percent="0.6" />
+
+ </androidx.constraintlayout.widget.ConstraintLayout>
+
+ <TextView
+ android:id="@+id/title_text_view_item_post_detail_video_autoplay"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:paddingStart="16dp"
+ android:paddingEnd="16dp"
+ android:textColor="?attr/primaryTextColor"
+ android:textSize="?attr/title_font_18"
+ android:textIsSelectable="true"
+ android:enabled="true"
+ android:focusable="true"
+ android:longClickable="true" />
+
+ <com.nex3z.flowlayout.FlowLayout
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:padding="16dp"
+ app:flChildSpacing="16dp"
+ app:flChildSpacingForLastRow="align"
+ app:flRowSpacing="8dp">
+
+ <com.libRG.CustomTextView
+ android:id="@+id/type_text_view_item_post_detail_video_autoplay"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:padding="4dp"
+ android:text="@string/video"
+ android:textSize="?attr/font_12"
+ android:textColor="@android:color/white"
+ app:lib_setRadius="3dp"
+ app:lib_setRoundedView="true"
+ app:lib_setShape="rectangle" />
+
+ <com.libRG.CustomTextView
+ android:id="@+id/spoiler_custom_text_view_item_post_detail_video_autoplay"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_gravity="center"
+ android:text="@string/spoiler"
+ android:textSize="?attr/font_12"
+ android:textColor="@android:color/white"
+ android:padding="4dp"
+ android:visibility="gone"
+ app:lib_setRadius="3dp"
+ app:lib_setRoundedView="true"
+ app:lib_setShape="rectangle" />
+
+ <com.libRG.CustomTextView
+ android:id="@+id/nsfw_text_view_item_post_detail_video_autoplay"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:padding="4dp"
+ android:text="@string/nsfw"
+ android:textSize="?attr/font_12"
+ android:textColor="@android:color/white"
+ android:visibility="gone"
+ app:lib_setRadius="3dp"
+ app:lib_setRoundedView="true"
+ app:lib_setShape="rectangle" />
+
+ <com.libRG.CustomTextView
+ android:id="@+id/flair_custom_text_view_item_post_detail_video_autoplay"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_gravity="center"
+ android:padding="4dp"
+ android:textSize="?attr/font_12"
+ android:textColor="@android:color/white"
+ android:visibility="gone"
+ app:lib_setRadius="3dp"
+ app:lib_setRoundedView="true"
+ app:lib_setShape="rectangle" />
+
+ <ImageView
+ android:id="@+id/archived_image_view_item_post_detail_video_autoplay"
+ android:layout_width="20dp"
+ android:layout_height="20dp"
+ android:src="@drawable/ic_archive_outline"
+ android:visibility="gone" />
+
+ <ImageView
+ android:id="@+id/locked_image_view_item_post_detail_video_autoplay"
+ android:layout_width="20dp"
+ android:layout_height="20dp"
+ android:src="@drawable/ic_outline_lock_24dp"
+ android:visibility="gone" />
+
+ <ImageView
+ android:id="@+id/crosspost_image_view_item_post_detail_video_autoplay"
+ android:layout_width="20dp"
+ android:layout_height="20dp"
+ android:src="@drawable/crosspost"
+ android:visibility="gone" />
+
+ <TextView
+ android:id="@+id/awards_text_view_item_post_detail_video_autoplay"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:visibility="gone" />
+
+ </com.nex3z.flowlayout.FlowLayout>
+
+ <com.google.android.exoplayer2.ui.AspectRatioFrameLayout
+ android:id="@+id/aspect_ratio_frame_layout_item_post_detail_video_autoplay"
+ android:layout_width="match_parent"
+ android:layout_height="0dp"
+ android:background="#000000"
+ app:resize_mode="fixed_width">
+
+ <com.google.android.exoplayer2.ui.PlayerView
+ android:id="@+id/player_view_item_post_detail_video_autoplay"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ app:controller_layout_id="@layout/exo_autoplay_playback_control_view"/>
+
+ </com.google.android.exoplayer2.ui.AspectRatioFrameLayout>
+
+ <androidx.constraintlayout.widget.ConstraintLayout
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:id="@+id/bottom_constraint_layout_item_post_detail_video_autoplay">
+
+ <ImageView
+ android:id="@+id/plus_button_item_post_detail_video_autoplay"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:padding="12dp"
+ android:src="@drawable/ic_arrow_upward_grey_24dp"
+ android:tint="@android:color/tab_indicator_text"
+ android:background="?actionBarItemBackground"
+ android:clickable="true"
+ android:focusable="true"
+ app:layout_constraintTop_toTopOf="parent"
+ app:layout_constraintBottom_toBottomOf="parent"
+ app:layout_constraintStart_toStartOf="parent" />
+
+ <TextView
+ android:id="@+id/score_text_view_item_post_detail_video_autoplay"
+ android:layout_width="64dp"
+ android:layout_height="wrap_content"
+ android:gravity="center"
+ android:textSize="?attr/font_12"
+ android:textStyle="bold"
+ app:layout_constraintTop_toTopOf="parent"
+ app:layout_constraintBottom_toBottomOf="parent"
+ app:layout_constraintStart_toEndOf="@id/plus_button_item_post_detail_video_autoplay" />
+
+ <ImageView
+ android:id="@+id/minus_button_item_post_detail_video_autoplay"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:padding="12dp"
+ android:src="@drawable/ic_arrow_downward_grey_24dp"
+ android:tint="@android:color/tab_indicator_text"
+ android:background="?actionBarItemBackground"
+ android:clickable="true"
+ android:focusable="true"
+ app:layout_constraintTop_toTopOf="parent"
+ app:layout_constraintBottom_toBottomOf="parent"
+ app:layout_constraintStart_toEndOf="@id/score_text_view_item_post_detail_video_autoplay" />
+
+ <TextView
+ android:id="@+id/comments_count_item_post_detail_video_autoplay"
+ 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:drawableStart="@drawable/ic_comment_grey_24dp"
+ android:drawablePadding="12dp"
+ app:layout_constraintTop_toTopOf="parent"
+ app:layout_constraintBottom_toBottomOf="parent"
+ app:layout_constraintStart_toEndOf="@id/minus_button_item_post_detail_video_autoplay" />
+
+ <ImageView
+ android:id="@+id/save_button_item_post_detail_video_autoplay"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:padding="12dp"
+ android:tint="@android:color/tab_indicator_text"
+ android:background="?actionBarItemBackground"
+ android:clickable="true"
+ android:focusable="true"
+ app:layout_constraintHorizontal_bias="1"
+ app:layout_constraintTop_toTopOf="parent"
+ app:layout_constraintBottom_toBottomOf="parent"
+ app:layout_constraintStart_toEndOf="@id/comments_count_item_post_detail_video_autoplay"
+ app:layout_constraintEnd_toStartOf="@id/share_button_item_post_detail_video_autoplay" />
+
+ <ImageView
+ android:id="@+id/share_button_item_post_detail_video_autoplay"
+ 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"
+ app:layout_constraintBottom_toBottomOf="parent"
+ app:layout_constraintEnd_toEndOf="parent" />
+
+ </androidx.constraintlayout.widget.ConstraintLayout>
+
+</LinearLayout> \ No newline at end of file
diff --git a/app/src/main/res/layout/item_post_image_and_gif_autoplay_type.xml b/app/src/main/res/layout/item_post_image_and_gif_autoplay.xml
index b2fdf016..e29f4287 100644
--- a/app/src/main/res/layout/item_post_image_and_gif_autoplay_type.xml
+++ b/app/src/main/res/layout/item_post_image_and_gif_autoplay.xml
@@ -5,7 +5,7 @@
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:layout_marginBottom="8dp"
- android:id="@+id/card_view_item_post_image_type"
+ android:id="@+id/card_view_item_post_image_and_gif_autoplay"
app:cardBackgroundColor="?attr/cardViewBackgroundColor"
app:cardElevation="2dp"
app:cardCornerRadius="16dp">
@@ -21,7 +21,7 @@
android:padding="16dp">
<ml.docilealligator.infinityforreddit.CustomView.AspectRatioGifImageView
- android:id="@+id/icon_gif_image_view_item_post_image_type"
+ android:id="@+id/icon_gif_image_view_item_post_image_and_gif_autoplay"
android:layout_width="24dp"
android:layout_height="24dp"
android:layout_gravity="center"
@@ -30,20 +30,20 @@
app:layout_constraintTop_toTopOf="parent"/>
<TextView
- android:id="@+id/subreddit_name_text_view_item_post_image_type"
+ android:id="@+id/subreddit_name_text_view_item_post_image_and_gif_autoplay"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginStart="16dp"
android:layout_marginEnd="8dp"
android:textSize="?attr/font_default"
- app:layout_constraintBottom_toTopOf="@id/user_text_view_item_post_image_type"
- app:layout_constraintStart_toEndOf="@id/icon_gif_image_view_item_post_image_type"
- app:layout_constraintEnd_toStartOf="@id/stickied_post_image_view_item_post_image_type"
+ app:layout_constraintBottom_toTopOf="@id/user_text_view_item_post_image_and_gif_autoplay"
+ app:layout_constraintStart_toEndOf="@id/icon_gif_image_view_item_post_image_and_gif_autoplay"
+ app:layout_constraintEnd_toStartOf="@id/stickied_post_image_view_item_post_image_and_gif_autoplay"
app:layout_constraintTop_toTopOf="parent"/>
<TextView
- android:id="@+id/user_text_view_item_post_image_type"
+ android:id="@+id/user_text_view_item_post_image_and_gif_autoplay"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
@@ -52,24 +52,24 @@
android:maxLines="2"
android:ellipsize="end"
app:layout_constraintBottom_toBottomOf="parent"
- app:layout_constraintStart_toEndOf="@+id/icon_gif_image_view_item_post_image_type"
- app:layout_constraintEnd_toStartOf="@id/stickied_post_image_view_item_post_image_type"
- app:layout_constraintTop_toBottomOf="@+id/subreddit_name_text_view_item_post_image_type"
+ app:layout_constraintStart_toEndOf="@+id/icon_gif_image_view_item_post_image_and_gif_autoplay"
+ app:layout_constraintEnd_toStartOf="@id/stickied_post_image_view_item_post_image_and_gif_autoplay"
+ app:layout_constraintTop_toBottomOf="@+id/subreddit_name_text_view_item_post_image_and_gif_autoplay"
app:layout_constraintHorizontal_bias="0" />
<ImageView
- android:id="@+id/stickied_post_image_view_item_post_image_type"
+ android:id="@+id/stickied_post_image_view_item_post_image_and_gif_autoplay"
android:layout_width="24dp"
android:layout_height="24dp"
android:layout_marginEnd="8dp"
android:visibility="gone"
app:layout_constraintBottom_toBottomOf="parent"
- app:layout_constraintStart_toEndOf="@id/subreddit_name_text_view_item_post_image_type"
+ app:layout_constraintStart_toEndOf="@id/subreddit_name_text_view_item_post_image_and_gif_autoplay"
app:layout_constraintEnd_toStartOf="@+id/guideline2"
app:layout_constraintTop_toTopOf="parent"/>
<TextView
- android:id="@+id/post_time_text_view_best_item_post_image_type"
+ android:id="@+id/post_time_text_view_item_post_image_and_gif_autoplay"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:gravity="end"
@@ -89,7 +89,7 @@
</androidx.constraintlayout.widget.ConstraintLayout>
<TextView
- android:id="@+id/title_text_view_best_item_post_image_type"
+ android:id="@+id/title_text_view_item_post_image_and_gif_autoplay"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingStart="16dp"
@@ -105,7 +105,7 @@
app:flRowSpacing="8dp">
<com.libRG.CustomTextView
- android:id="@+id/type_text_view_item_post_image_type"
+ android:id="@+id/type_text_view_item_post_image_and_gif_autoplay"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="4dp"
@@ -115,7 +115,7 @@
app:lib_setShape="rectangle" />
<com.libRG.CustomTextView
- android:id="@+id/spoiler_custom_text_view_item_post_image_type"
+ android:id="@+id/spoiler_custom_text_view_item_post_image_and_gif_autoplay"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
@@ -128,7 +128,7 @@
app:lib_setShape="rectangle" />
<com.libRG.CustomTextView
- android:id="@+id/nsfw_text_view_item_post_image_type"
+ android:id="@+id/nsfw_text_view_item_post_image_and_gif_autoplay"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="4dp"
@@ -140,7 +140,7 @@
app:lib_setShape="rectangle" />
<com.libRG.CustomTextView
- android:id="@+id/flair_custom_text_view_item_post_image_type"
+ android:id="@+id/flair_custom_text_view_item_post_image_and_gif_autoplay"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
@@ -152,7 +152,7 @@
app:lib_setShape="rectangle" />
<com.libRG.CustomTextView
- android:id="@+id/awards_text_view_item_post_image_type"
+ android:id="@+id/awards_text_view_item_post_image_and_gif_autoplay"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="4dp"
@@ -163,21 +163,21 @@
app:lib_setShape="rectangle" />
<ImageView
- android:id="@+id/archived_image_view_item_post_image_type"
+ android:id="@+id/archived_image_view_item_post_image_and_gif_autoplay"
android:layout_width="24dp"
android:layout_height="24dp"
android:src="@drawable/ic_archive_outline"
android:visibility="gone" />
<ImageView
- android:id="@+id/locked_image_view_item_post_image_type"
+ android:id="@+id/locked_image_view_item_post_image_and_gif_autoplay"
android:layout_width="24dp"
android:layout_height="24dp"
android:src="@drawable/ic_outline_lock_24dp"
android:visibility="gone" />
<ImageView
- android:id="@+id/crosspost_image_view_item_post_image_type"
+ android:id="@+id/crosspost_image_view_item_post_image_and_gif_autoplay"
android:layout_width="24dp"
android:layout_height="24dp"
android:src="@drawable/crosspost"
@@ -186,31 +186,31 @@
</com.nex3z.flowlayout.FlowLayout>
<RelativeLayout
- android:id="@+id/image_view_wrapper_item_post_image_type"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<ml.docilealligator.infinityforreddit.CustomView.AspectRatioGifImageView
- android:id="@+id/image_view_best_post_item"
+ android:id="@+id/image_view_item_post_image_and_gif_autoplay"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:adjustViewBounds="true"
android:scaleType="fitStart" />
<ProgressBar
- android:id="@+id/progress_bar_item_post_image_type"
+ android:id="@+id/progress_bar_item_post_image_and_gif_autoplay"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true" />
<RelativeLayout
- android:id="@+id/load_image_error_relative_layout_item_post_image_type"
+ android:id="@+id/load_image_error_relative_layout_item_post_image_and_gif_autoplay"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_centerInParent="true"
android:visibility="gone">
<TextView
+ android:id="@+id/load_image_error_text_view_item_post_image_and_gif_autoplay"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:drawableTop="@drawable/ic_error_outline_black_24dp"
@@ -224,12 +224,12 @@
</RelativeLayout>
<androidx.constraintlayout.widget.ConstraintLayout
- android:id="@+id/bottom_constraint_layout_item_post_image_type"
+ android:id="@+id/bottom_constraint_layout_item_post_image_and_gif_autoplay"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<ImageView
- android:id="@+id/plus_button_item_post_image_type"
+ android:id="@+id/plus_button_item_post_image_and_gif_autoplay"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="12dp"
@@ -242,7 +242,7 @@
app:layout_constraintStart_toStartOf="parent" />
<TextView
- android:id="@+id/score_text_view_item_post_image_type"
+ android:id="@+id/score_text_view_item_post_image_and_gif_autoplay"
android:layout_width="64dp"
android:layout_height="wrap_content"
android:gravity="center"
@@ -250,10 +250,10 @@
android:textStyle="bold"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toBottomOf="parent"
- app:layout_constraintStart_toEndOf="@id/plus_button_item_post_image_type" />
+ app:layout_constraintStart_toEndOf="@id/plus_button_item_post_image_and_gif_autoplay" />
<ImageView
- android:id="@+id/minus_button_item_post_image_type"
+ android:id="@+id/minus_button_item_post_image_and_gif_autoplay"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="12dp"
@@ -263,10 +263,10 @@
android:focusable="true"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toBottomOf="parent"
- app:layout_constraintStart_toEndOf="@id/score_text_view_item_post_image_type" />
+ app:layout_constraintStart_toEndOf="@id/score_text_view_item_post_image_and_gif_autoplay" />
<TextView
- android:id="@+id/comments_count_item_post_image_type"
+ android:id="@+id/comments_count_item_post_image_and_gif_autoplay"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="12dp"
@@ -277,10 +277,10 @@
android:drawablePadding="12dp"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toBottomOf="parent"
- app:layout_constraintStart_toEndOf="@id/minus_button_item_post_image_type" />
+ app:layout_constraintStart_toEndOf="@id/minus_button_item_post_image_and_gif_autoplay" />
<ImageView
- android:id="@+id/save_button_item_post_image_type"
+ android:id="@+id/save_button_item_post_image_and_gif_autoplay"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="12dp"
@@ -290,11 +290,11 @@
app:layout_constraintHorizontal_bias="1"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toBottomOf="parent"
- app:layout_constraintStart_toEndOf="@id/comments_count_item_post_image_type"
- app:layout_constraintEnd_toStartOf="@id/share_button_item_post_image_type" />
+ app:layout_constraintStart_toEndOf="@id/comments_count_item_post_image_and_gif_autoplay"
+ app:layout_constraintEnd_toStartOf="@id/share_button_item_post_image_and_gif_autoplay" />
<ImageView
- android:id="@+id/share_button_item_post_image_type"
+ android:id="@+id/share_button_item_post_image_and_gif_autoplay"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="12dp"
diff --git a/app/src/main/res/layout/item_post_link_type.xml b/app/src/main/res/layout/item_post_link.xml
index 43f51b10..66c55908 100644
--- a/app/src/main/res/layout/item_post_link_type.xml
+++ b/app/src/main/res/layout/item_post_link.xml
@@ -5,7 +5,7 @@
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:layout_marginBottom="8dp"
- android:id="@+id/card_view_item_post_link_type"
+ android:id="@+id/card_view_item_post_link"
app:cardBackgroundColor="?attr/cardViewBackgroundColor"
app:cardElevation="2dp"
app:cardCornerRadius="16dp">
@@ -21,7 +21,7 @@
android:padding="16dp">
<ml.docilealligator.infinityforreddit.CustomView.AspectRatioGifImageView
- android:id="@+id/icon_gif_image_view_item_post_link_type"
+ android:id="@+id/icon_gif_image_view_item_post_link"
android:layout_width="24dp"
android:layout_height="24dp"
android:layout_gravity="center"
@@ -30,20 +30,20 @@
app:layout_constraintTop_toTopOf="parent"/>
<TextView
- android:id="@+id/subreddit_name_text_view_item_post_link_type"
+ android:id="@+id/subreddit_name_text_view_item_post_link"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginStart="16dp"
android:layout_marginEnd="8dp"
android:textSize="?attr/font_default"
- app:layout_constraintBottom_toTopOf="@id/user_text_view_item_post_link_type"
- app:layout_constraintStart_toEndOf="@id/icon_gif_image_view_item_post_link_type"
- app:layout_constraintEnd_toStartOf="@id/stickied_post_image_view_item_post_link_type"
+ app:layout_constraintBottom_toTopOf="@id/user_text_view_item_post_link"
+ app:layout_constraintStart_toEndOf="@id/icon_gif_image_view_item_post_link"
+ app:layout_constraintEnd_toStartOf="@id/stickied_post_image_view_item_post_link"
app:layout_constraintTop_toTopOf="parent"/>
<TextView
- android:id="@+id/user_text_view_item_post_link_type"
+ android:id="@+id/user_text_view_item_post_link"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
@@ -52,24 +52,24 @@
android:maxLines="2"
android:ellipsize="end"
app:layout_constraintBottom_toBottomOf="parent"
- app:layout_constraintStart_toEndOf="@+id/icon_gif_image_view_item_post_link_type"
- app:layout_constraintEnd_toStartOf="@id/stickied_post_image_view_item_post_link_type"
- app:layout_constraintTop_toBottomOf="@+id/subreddit_name_text_view_item_post_link_type"
+ app:layout_constraintStart_toEndOf="@+id/icon_gif_image_view_item_post_link"
+ app:layout_constraintEnd_toStartOf="@id/stickied_post_image_view_item_post_link"
+ app:layout_constraintTop_toBottomOf="@+id/subreddit_name_text_view_item_post_link"
app:layout_constraintHorizontal_bias="0" />
<ImageView
- android:id="@+id/stickied_post_image_view_item_post_link_type"
+ android:id="@+id/stickied_post_image_view_item_post_link"
android:layout_width="24dp"
android:layout_height="24dp"
android:layout_marginEnd="8dp"
android:visibility="gone"
app:layout_constraintBottom_toBottomOf="parent"
- app:layout_constraintStart_toEndOf="@id/subreddit_name_text_view_item_post_link_type"
+ app:layout_constraintStart_toEndOf="@id/subreddit_name_text_view_item_post_link"
app:layout_constraintEnd_toStartOf="@+id/guideline2"
app:layout_constraintTop_toTopOf="parent"/>
<TextView
- android:id="@+id/post_time_text_view_best_item_post_link_type"
+ android:id="@+id/post_time_text_view_item_post_link"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:gravity="end"
@@ -89,7 +89,7 @@
</androidx.constraintlayout.widget.ConstraintLayout>
<TextView
- android:id="@+id/title_text_view_best_item_post_link_type"
+ android:id="@+id/title_text_view_item_post_link"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingStart="16dp"
@@ -105,7 +105,7 @@
app:flRowSpacing="8dp">
<com.libRG.CustomTextView
- android:id="@+id/type_text_view_item_post_link_type"
+ android:id="@+id/type_text_view_item_post_link"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="4dp"
@@ -116,7 +116,7 @@
app:lib_setShape="rectangle" />
<com.libRG.CustomTextView
- android:id="@+id/spoiler_custom_text_view_item_post_link_type"
+ android:id="@+id/spoiler_custom_text_view_item_post_link"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
@@ -129,7 +129,7 @@
app:lib_setShape="rectangle" />
<com.libRG.CustomTextView
- android:id="@+id/nsfw_text_view_item_post_link_type"
+ android:id="@+id/nsfw_text_view_item_post_link"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="4dp"
@@ -141,7 +141,7 @@
app:lib_setShape="rectangle" />
<com.libRG.CustomTextView
- android:id="@+id/flair_custom_text_view_item_post_link_type"
+ android:id="@+id/flair_custom_text_view_item_post_link"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
@@ -153,7 +153,7 @@
app:lib_setShape="rectangle" />
<com.libRG.CustomTextView
- android:id="@+id/awards_text_view_item_post_link_type"
+ android:id="@+id/awards_text_view_item_post_link"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="4dp"
@@ -164,21 +164,21 @@
app:lib_setShape="rectangle" />
<ImageView
- android:id="@+id/archived_image_view_item_post_link_type"
+ android:id="@+id/archived_image_view_item_post_link"
android:layout_width="24dp"
android:layout_height="24dp"
android:src="@drawable/ic_archive_outline"
android:visibility="gone" />
<ImageView
- android:id="@+id/locked_image_view_item_post_link_type"
+ android:id="@+id/locked_image_view_item_post_link"
android:layout_width="24dp"
android:layout_height="24dp"
android:src="@drawable/ic_outline_lock_24dp"
android:visibility="gone" />
<ImageView
- android:id="@+id/crosspost_image_view_item_post_link_type"
+ android:id="@+id/crosspost_image_view_item_post_link"
android:layout_width="24dp"
android:layout_height="24dp"
android:src="@drawable/crosspost"
@@ -187,7 +187,7 @@
</com.nex3z.flowlayout.FlowLayout>
<TextView
- android:id="@+id/link_text_view_item_post_link_type"
+ android:id="@+id/link_text_view_item_post_link"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="16dp"
@@ -197,31 +197,31 @@
android:visibility="gone" />
<RelativeLayout
- android:id="@+id/image_view_wrapper_item_post_link_type"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<ml.docilealligator.infinityforreddit.CustomView.AspectRatioGifImageView
- android:id="@+id/image_view_best_post_item"
+ android:id="@+id/image_view_item_post_link"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:adjustViewBounds="true"
android:scaleType="fitStart" />
<ProgressBar
- android:id="@+id/progress_bar_item_post_link_type"
+ android:id="@+id/progress_bar_item_post_link"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true" />
<RelativeLayout
- android:id="@+id/load_image_error_relative_layout_item_post_link_type"
+ android:id="@+id/load_image_error_relative_layout_item_post_link"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_centerInParent="true"
android:visibility="gone">
<TextView
+ android:id="@+id/load_image_error_text_view_item_post_link"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:drawableTop="@drawable/ic_error_outline_black_24dp"
@@ -235,12 +235,12 @@
</RelativeLayout>
<androidx.constraintlayout.widget.ConstraintLayout
- android:id="@+id/bottom_constraint_layout_item_post_link_type"
+ android:id="@+id/bottom_constraint_layout_item_post_link"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<ImageView
- android:id="@+id/plus_button_item_post_link_type"
+ android:id="@+id/plus_button_item_post_link"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="12dp"
@@ -253,7 +253,7 @@
app:layout_constraintStart_toStartOf="parent" />
<TextView
- android:id="@+id/score_text_view_item_post_link_type"
+ android:id="@+id/score_text_view_item_post_link"
android:layout_width="64dp"
android:layout_height="wrap_content"
android:gravity="center"
@@ -261,10 +261,10 @@
android:textStyle="bold"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toBottomOf="parent"
- app:layout_constraintStart_toEndOf="@id/plus_button_item_post_link_type" />
+ app:layout_constraintStart_toEndOf="@id/plus_button_item_post_link" />
<ImageView
- android:id="@+id/minus_button_item_post_link_type"
+ android:id="@+id/minus_button_item_post_link"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="12dp"
@@ -274,10 +274,10 @@
android:focusable="true"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toBottomOf="parent"
- app:layout_constraintStart_toEndOf="@id/score_text_view_item_post_link_type" />
+ app:layout_constraintStart_toEndOf="@id/score_text_view_item_post_link" />
<TextView
- android:id="@+id/comments_count_item_post_link_type"
+ android:id="@+id/comments_count_item_post_link"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="12dp"
@@ -288,10 +288,10 @@
android:drawablePadding="12dp"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toBottomOf="parent"
- app:layout_constraintStart_toEndOf="@id/minus_button_item_post_link_type" />
+ app:layout_constraintStart_toEndOf="@id/minus_button_item_post_link" />
<ImageView
- android:id="@+id/save_button_item_post_link_type"
+ android:id="@+id/save_button_item_post_link"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="12dp"
@@ -301,11 +301,11 @@
app:layout_constraintHorizontal_bias="1"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toBottomOf="parent"
- app:layout_constraintStart_toEndOf="@id/comments_count_item_post_link_type"
- app:layout_constraintEnd_toStartOf="@id/share_button_item_post_link_type" />
+ app:layout_constraintStart_toEndOf="@id/comments_count_item_post_link"
+ app:layout_constraintEnd_toStartOf="@id/share_button_item_post_link" />
<ImageView
- android:id="@+id/share_button_item_post_link_type"
+ android:id="@+id/share_button_item_post_link"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="12dp"
diff --git a/app/src/main/res/layout/item_post_no_preview_link_type.xml b/app/src/main/res/layout/item_post_no_preview_link.xml
index a6ef9eeb..bf1ba331 100644
--- a/app/src/main/res/layout/item_post_no_preview_link_type.xml
+++ b/app/src/main/res/layout/item_post_no_preview_link.xml
@@ -69,7 +69,7 @@
app:layout_constraintTop_toTopOf="parent"/>
<TextView
- android:id="@+id/post_time_text_view_best_item_post_no_preview_link_type"
+ android:id="@+id/post_time_text_view_item_post_no_preview_link_type"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:gravity="end"
@@ -89,7 +89,7 @@
</androidx.constraintlayout.widget.ConstraintLayout>
<TextView
- android:id="@+id/title_text_view_best_item_post_no_preview_link_type"
+ android:id="@+id/title_text_view_item_post_no_preview_link_type"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingStart="16dp"
diff --git a/app/src/main/res/layout/item_post_text_type.xml b/app/src/main/res/layout/item_post_text.xml
index cc7a3bb9..39ea56f4 100644
--- a/app/src/main/res/layout/item_post_text_type.xml
+++ b/app/src/main/res/layout/item_post_text.xml
@@ -69,7 +69,7 @@
app:layout_constraintTop_toTopOf="parent"/>
<TextView
- android:id="@+id/post_time_text_view_best_item_post_text_type"
+ android:id="@+id/post_time_text_view_item_post_text_type"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:gravity="end"
@@ -89,7 +89,7 @@
</androidx.constraintlayout.widget.ConstraintLayout>
<TextView
- android:id="@+id/title_text_view_best_item_post_text_type"
+ android:id="@+id/title_text_view_item_post_text_type"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingStart="16dp"
diff --git a/app/src/main/res/layout/item_post_video_and_gif_preview_type.xml b/app/src/main/res/layout/item_post_video_and_gif_preview.xml
index c3549df4..ad2e3b9d 100644
--- a/app/src/main/res/layout/item_post_video_and_gif_preview_type.xml
+++ b/app/src/main/res/layout/item_post_video_and_gif_preview.xml
@@ -5,7 +5,7 @@
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:layout_marginBottom="8dp"
- android:id="@+id/card_view_item_post_gif_type_autoplay"
+ android:id="@+id/card_view_item_post_video_and_gif_preview"
app:cardBackgroundColor="?attr/cardViewBackgroundColor"
app:cardElevation="2dp"
app:cardCornerRadius="16dp">
@@ -21,7 +21,7 @@
android:padding="16dp">
<ml.docilealligator.infinityforreddit.CustomView.AspectRatioGifImageView
- android:id="@+id/icon_gif_image_view_item_post_gif_type_autoplay"
+ android:id="@+id/icon_gif_image_view_item_post_video_and_gif_preview"
android:layout_width="24dp"
android:layout_height="24dp"
android:layout_gravity="center"
@@ -30,20 +30,20 @@
app:layout_constraintTop_toTopOf="parent"/>
<TextView
- android:id="@+id/subreddit_name_text_view_item_post_gif_type_autoplay"
+ android:id="@+id/subreddit_name_text_view_item_post_video_and_gif_preview"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginStart="16dp"
android:layout_marginEnd="8dp"
android:textSize="?attr/font_default"
- app:layout_constraintBottom_toTopOf="@id/user_text_view_item_post_gif_type_autoplay"
- app:layout_constraintStart_toEndOf="@id/icon_gif_image_view_item_post_gif_type_autoplay"
- app:layout_constraintEnd_toStartOf="@id/stickied_post_image_view_item_post_gif_type_autoplay"
+ app:layout_constraintBottom_toTopOf="@id/user_text_view_item_post_video_and_gif_preview"
+ app:layout_constraintStart_toEndOf="@id/icon_gif_image_view_item_post_video_and_gif_preview"
+ app:layout_constraintEnd_toStartOf="@id/stickied_post_image_view_item_post_video_and_gif_preview"
app:layout_constraintTop_toTopOf="parent"/>
<TextView
- android:id="@+id/user_text_view_item_post_gif_type_autoplay"
+ android:id="@+id/user_text_view_item_post_video_and_gif_preview"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
@@ -52,24 +52,24 @@
android:maxLines="2"
android:ellipsize="end"
app:layout_constraintBottom_toBottomOf="parent"
- app:layout_constraintStart_toEndOf="@+id/icon_gif_image_view_item_post_gif_type_autoplay"
- app:layout_constraintEnd_toStartOf="@id/stickied_post_image_view_item_post_gif_type_autoplay"
- app:layout_constraintTop_toBottomOf="@+id/subreddit_name_text_view_item_post_gif_type_autoplay"
+ app:layout_constraintStart_toEndOf="@+id/icon_gif_image_view_item_post_video_and_gif_preview"
+ app:layout_constraintEnd_toStartOf="@id/stickied_post_image_view_item_post_video_and_gif_preview"
+ app:layout_constraintTop_toBottomOf="@+id/subreddit_name_text_view_item_post_video_and_gif_preview"
app:layout_constraintHorizontal_bias="0" />
<ImageView
- android:id="@+id/stickied_post_image_view_item_post_gif_type_autoplay"
+ android:id="@+id/stickied_post_image_view_item_post_video_and_gif_preview"
android:layout_width="24dp"
android:layout_height="24dp"
android:layout_marginEnd="8dp"
android:visibility="gone"
app:layout_constraintBottom_toBottomOf="parent"
- app:layout_constraintStart_toEndOf="@id/subreddit_name_text_view_item_post_gif_type_autoplay"
+ app:layout_constraintStart_toEndOf="@id/subreddit_name_text_view_item_post_video_and_gif_preview"
app:layout_constraintEnd_toStartOf="@+id/guideline2"
app:layout_constraintTop_toTopOf="parent"/>
<TextView
- android:id="@+id/post_time_text_view_best_item_post_gif_type_autoplay"
+ android:id="@+id/post_time_text_view_item_post_video_and_gif_preview"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:gravity="end"
@@ -89,7 +89,7 @@
</androidx.constraintlayout.widget.ConstraintLayout>
<TextView
- android:id="@+id/title_text_view_best_item_post_gif_type_autoplay"
+ android:id="@+id/title_text_view_item_post_video_and_gif_preview"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingStart="16dp"
@@ -105,7 +105,7 @@
app:flRowSpacing="8dp">
<com.libRG.CustomTextView
- android:id="@+id/type_text_view_item_post_gif_type_autoplay"
+ android:id="@+id/type_text_view_item_post_video_and_gif_preview"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="4dp"
@@ -116,7 +116,7 @@
app:lib_setShape="rectangle" />
<com.libRG.CustomTextView
- android:id="@+id/spoiler_custom_text_view_item_post_gif_type_autoplay"
+ android:id="@+id/spoiler_custom_text_view_item_post_video_and_gif_preview"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
@@ -129,7 +129,7 @@
app:lib_setShape="rectangle" />
<com.libRG.CustomTextView
- android:id="@+id/nsfw_text_view_item_post_gif_type_autoplay"
+ android:id="@+id/nsfw_text_view_item_post_video_and_gif_preview"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="4dp"
@@ -141,7 +141,7 @@
app:lib_setShape="rectangle" />
<com.libRG.CustomTextView
- android:id="@+id/flair_custom_text_view_item_post_gif_type_autoplay"
+ android:id="@+id/flair_custom_text_view_item_post_video_and_gif_preview"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
@@ -153,7 +153,7 @@
app:lib_setShape="rectangle" />
<com.libRG.CustomTextView
- android:id="@+id/awards_text_view_item_post_gif_type_autoplay"
+ android:id="@+id/awards_text_view_item_post_video_and_gif_preview"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="4dp"
@@ -164,21 +164,21 @@
app:lib_setShape="rectangle" />
<ImageView
- android:id="@+id/archived_image_view_item_post_gif_type_autoplay"
+ android:id="@+id/archived_image_view_item_post_video_and_gif_preview"
android:layout_width="24dp"
android:layout_height="24dp"
android:src="@drawable/ic_archive_outline"
android:visibility="gone" />
<ImageView
- android:id="@+id/locked_image_view_item_post_gif_type_autoplay"
+ android:id="@+id/locked_image_view_item_post_video_and_gif_preview"
android:layout_width="24dp"
android:layout_height="24dp"
android:src="@drawable/ic_outline_lock_24dp"
android:visibility="gone" />
<ImageView
- android:id="@+id/crosspost_image_view_item_post_gif_type_autoplay"
+ android:id="@+id/crosspost_image_view_item_post_video_and_gif_preview"
android:layout_width="24dp"
android:layout_height="24dp"
android:src="@drawable/crosspost"
@@ -187,7 +187,6 @@
</com.nex3z.flowlayout.FlowLayout>
<RelativeLayout
- android:id="@+id/image_view_wrapper_item_post_gif_type_autoplay"
android:layout_width="match_parent"
android:layout_height="wrap_content">
@@ -196,7 +195,7 @@
android:layout_height="wrap_content">
<ml.docilealligator.infinityforreddit.CustomView.AspectRatioGifImageView
- android:id="@+id/image_view_item_post_gif_type_autoplay"
+ android:id="@+id/image_view_item_post_video_and_gif_preview"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:adjustViewBounds="true"
@@ -213,19 +212,20 @@
</FrameLayout>
<ProgressBar
- android:id="@+id/progress_bar_item_post_gif_type_autoplay"
+ android:id="@+id/progress_bar_item_post_video_and_gif_preview"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true" />
<RelativeLayout
- android:id="@+id/load_image_error_relative_layout_item_post_gif_type_autoplay"
+ android:id="@+id/load_image_error_relative_layout_item_post_video_and_gif_preview"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_centerInParent="true"
android:visibility="gone">
<TextView
+ android:id="@+id/load_image_error_text_view_item_post_video_and_gif_preview"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:drawableTop="@drawable/ic_error_outline_black_24dp"
@@ -239,12 +239,12 @@
</RelativeLayout>
<androidx.constraintlayout.widget.ConstraintLayout
- android:id="@+id/bottom_constraint_layout_item_post_gif_type_autoplay"
+ android:id="@+id/bottom_constraint_layout_item_post_video_and_gif_preview"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<ImageView
- android:id="@+id/plus_button_item_post_gif_type_autoplay"
+ android:id="@+id/plus_button_item_post_video_and_gif_preview"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="12dp"
@@ -257,7 +257,7 @@
app:layout_constraintStart_toStartOf="parent" />
<TextView
- android:id="@+id/score_text_view_item_post_gif_type_autoplay"
+ android:id="@+id/score_text_view_item_post_video_and_gif_preview"
android:layout_width="64dp"
android:layout_height="wrap_content"
android:gravity="center"
@@ -265,10 +265,10 @@
android:textStyle="bold"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toBottomOf="parent"
- app:layout_constraintStart_toEndOf="@id/plus_button_item_post_gif_type_autoplay" />
+ app:layout_constraintStart_toEndOf="@id/plus_button_item_post_video_and_gif_preview" />
<ImageView
- android:id="@+id/minus_button_item_post_gif_type_autoplay"
+ android:id="@+id/minus_button_item_post_video_and_gif_preview"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="12dp"
@@ -278,10 +278,10 @@
android:focusable="true"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toBottomOf="parent"
- app:layout_constraintStart_toEndOf="@id/score_text_view_item_post_gif_type_autoplay" />
+ app:layout_constraintStart_toEndOf="@id/score_text_view_item_post_video_and_gif_preview" />
<TextView
- android:id="@+id/comments_count_item_post_gif_type_autoplay"
+ android:id="@+id/comments_count_item_post_video_and_gif_preview"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="12dp"
@@ -292,10 +292,10 @@
android:drawablePadding="12dp"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toBottomOf="parent"
- app:layout_constraintStart_toEndOf="@id/minus_button_item_post_gif_type_autoplay" />
+ app:layout_constraintStart_toEndOf="@id/minus_button_item_post_video_and_gif_preview" />
<ImageView
- android:id="@+id/save_button_item_post_gif_type_autoplay"
+ android:id="@+id/save_button_item_post_video_and_gif_preview"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="12dp"
@@ -305,11 +305,11 @@
app:layout_constraintHorizontal_bias="1"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toBottomOf="parent"
- app:layout_constraintStart_toEndOf="@id/comments_count_item_post_gif_type_autoplay"
- app:layout_constraintEnd_toStartOf="@id/share_button_item_post_gif_type_autoplay" />
+ app:layout_constraintStart_toEndOf="@id/comments_count_item_post_video_and_gif_preview"
+ app:layout_constraintEnd_toStartOf="@id/share_button_item_post_video_and_gif_preview" />
<ImageView
- android:id="@+id/share_button_item_post_gif_type_autoplay"
+ android:id="@+id/share_button_item_post_video_and_gif_preview"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="12dp"
diff --git a/app/src/main/res/layout/item_post_video_type_autoplay.xml b/app/src/main/res/layout/item_post_video_type_autoplay.xml
index 138090d8..bfbc7456 100644
--- a/app/src/main/res/layout/item_post_video_type_autoplay.xml
+++ b/app/src/main/res/layout/item_post_video_type_autoplay.xml
@@ -69,7 +69,7 @@
app:layout_constraintTop_toTopOf="parent"/>
<TextView
- android:id="@+id/post_time_text_view_best_item_post_video_type_autoplay"
+ android:id="@+id/post_time_text_view_item_post_video_type_autoplay"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:gravity="end"
@@ -89,7 +89,7 @@
</androidx.constraintlayout.widget.ConstraintLayout>
<TextView
- android:id="@+id/title_text_view_best_item_post_video_type_autoplay"
+ android:id="@+id/title_text_view_item_post_video_type_autoplay"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingStart="16dp"
@@ -187,7 +187,7 @@
</com.nex3z.flowlayout.FlowLayout>
<com.google.android.exoplayer2.ui.AspectRatioFrameLayout
- android:id="@+id/aspect"
+ android:id="@+id/aspect_ratio_frame_layout_item_post_video_type_autoplay"
android:layout_width="match_parent"
android:layout_height="0dp"
android:background="#000000"