mirror of
https://codeberg.org/Bazsalanszky/Infinity-For-Lemmy.git
synced 2024-11-07 19:27:26 +01:00
Show a play button on the image if the post is a video or an image.
This commit is contained in:
parent
f0c04a2f6d
commit
ae49dd50d4
@ -466,6 +466,8 @@ public class CommentAndPostRecyclerViewAdapter extends RecyclerView.Adapter<Recy
|
|||||||
intent.putExtra(ViewGIFActivity.IMAGE_URL_KEY, mPost.getVideoUrl());
|
intent.putExtra(ViewGIFActivity.IMAGE_URL_KEY, mPost.getVideoUrl());
|
||||||
mActivity.startActivity(intent);
|
mActivity.startActivity(intent);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
((PostDetailViewHolder) holder).mPlayButtonImageView.setVisibility(View.VISIBLE);
|
||||||
break;
|
break;
|
||||||
case Post.VIDEO_TYPE:
|
case Post.VIDEO_TYPE:
|
||||||
((PostDetailViewHolder) holder).mTypeTextView.setText("VIDEO");
|
((PostDetailViewHolder) holder).mTypeTextView.setText("VIDEO");
|
||||||
@ -479,6 +481,8 @@ public class CommentAndPostRecyclerViewAdapter extends RecyclerView.Adapter<Recy
|
|||||||
intent.putExtra(ViewVideoActivity.EXTRA_ID, mPost.getId());
|
intent.putExtra(ViewVideoActivity.EXTRA_ID, mPost.getId());
|
||||||
mActivity.startActivity(intent);
|
mActivity.startActivity(intent);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
((PostDetailViewHolder) holder).mPlayButtonImageView.setVisibility(View.VISIBLE);
|
||||||
break;
|
break;
|
||||||
case Post.NO_PREVIEW_LINK_TYPE:
|
case Post.NO_PREVIEW_LINK_TYPE:
|
||||||
((PostDetailViewHolder) holder).mTypeTextView.setText("LINK");
|
((PostDetailViewHolder) holder).mTypeTextView.setText("LINK");
|
||||||
@ -1576,6 +1580,8 @@ public class CommentAndPostRecyclerViewAdapter extends RecyclerView.Adapter<Recy
|
|||||||
TextView mLoadImageErrorTextView;
|
TextView mLoadImageErrorTextView;
|
||||||
@BindView(R.id.image_view_item_post_detail)
|
@BindView(R.id.image_view_item_post_detail)
|
||||||
AspectRatioImageView mImageView;
|
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)
|
@BindView(R.id.image_view_no_preview_link_item_post_detail)
|
||||||
ImageView mNoPreviewLinkImageView;
|
ImageView mNoPreviewLinkImageView;
|
||||||
@BindView(R.id.bottom_constraint_layout_item_post_detail)
|
@BindView(R.id.bottom_constraint_layout_item_post_detail)
|
||||||
|
@ -465,6 +465,8 @@ public class PostRecyclerViewAdapter extends PagedListAdapter<Post, RecyclerView
|
|||||||
intent.putExtra(ViewGIFActivity.IMAGE_URL_KEY, post.getVideoUrl());
|
intent.putExtra(ViewGIFActivity.IMAGE_URL_KEY, post.getVideoUrl());
|
||||||
mContext.startActivity(intent);
|
mContext.startActivity(intent);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
((PostViewHolder) holder).playButtonImageView.setVisibility(View.VISIBLE);
|
||||||
break;
|
break;
|
||||||
case Post.VIDEO_TYPE:
|
case Post.VIDEO_TYPE:
|
||||||
((PostViewHolder) holder).typeTextView.setText(R.string.video);
|
((PostViewHolder) holder).typeTextView.setText(R.string.video);
|
||||||
@ -478,6 +480,8 @@ public class PostRecyclerViewAdapter extends PagedListAdapter<Post, RecyclerView
|
|||||||
intent.putExtra(ViewVideoActivity.EXTRA_ID, fullName);
|
intent.putExtra(ViewVideoActivity.EXTRA_ID, fullName);
|
||||||
mContext.startActivity(intent);
|
mContext.startActivity(intent);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
((PostViewHolder) holder).playButtonImageView.setVisibility(View.VISIBLE);
|
||||||
break;
|
break;
|
||||||
case Post.NO_PREVIEW_LINK_TYPE:
|
case Post.NO_PREVIEW_LINK_TYPE:
|
||||||
((PostViewHolder) holder).typeTextView.setText(R.string.link);
|
((PostViewHolder) holder).typeTextView.setText(R.string.link);
|
||||||
@ -943,7 +947,9 @@ public class PostRecyclerViewAdapter extends PagedListAdapter<Post, RecyclerView
|
|||||||
|
|
||||||
if (post.getPostType() != Post.TEXT_TYPE && post.getPostType() != Post.NO_PREVIEW_LINK_TYPE) {
|
if (post.getPostType() != Post.TEXT_TYPE && post.getPostType() != Post.NO_PREVIEW_LINK_TYPE) {
|
||||||
((PostCompactViewHolder) holder).relativeLayout.setVisibility(View.VISIBLE);
|
((PostCompactViewHolder) holder).relativeLayout.setVisibility(View.VISIBLE);
|
||||||
|
if (post.getPostType() != Post.GIF_TYPE && post.getPostType() != Post.VIDEO_TYPE) {
|
||||||
((PostCompactViewHolder) holder).progressBar.setVisibility(View.VISIBLE);
|
((PostCompactViewHolder) holder).progressBar.setVisibility(View.VISIBLE);
|
||||||
|
}
|
||||||
((PostCompactViewHolder) holder).imageView.setVisibility(View.VISIBLE);
|
((PostCompactViewHolder) holder).imageView.setVisibility(View.VISIBLE);
|
||||||
loadImage(holder, post);
|
loadImage(holder, post);
|
||||||
}
|
}
|
||||||
@ -1013,6 +1019,8 @@ public class PostRecyclerViewAdapter extends PagedListAdapter<Post, RecyclerView
|
|||||||
intent.putExtra(ViewGIFActivity.IMAGE_URL_KEY, post.getVideoUrl());
|
intent.putExtra(ViewGIFActivity.IMAGE_URL_KEY, post.getVideoUrl());
|
||||||
mContext.startActivity(intent);
|
mContext.startActivity(intent);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
((PostCompactViewHolder) holder).playButtonImageView.setVisibility(View.VISIBLE);
|
||||||
break;
|
break;
|
||||||
case Post.VIDEO_TYPE:
|
case Post.VIDEO_TYPE:
|
||||||
((PostCompactViewHolder) holder).typeTextView.setText(R.string.video);
|
((PostCompactViewHolder) holder).typeTextView.setText(R.string.video);
|
||||||
@ -1026,6 +1034,8 @@ public class PostRecyclerViewAdapter extends PagedListAdapter<Post, RecyclerView
|
|||||||
intent.putExtra(ViewVideoActivity.EXTRA_ID, fullName);
|
intent.putExtra(ViewVideoActivity.EXTRA_ID, fullName);
|
||||||
mContext.startActivity(intent);
|
mContext.startActivity(intent);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
((PostCompactViewHolder) holder).playButtonImageView.setVisibility(View.VISIBLE);
|
||||||
break;
|
break;
|
||||||
case Post.NO_PREVIEW_LINK_TYPE:
|
case Post.NO_PREVIEW_LINK_TYPE:
|
||||||
((PostCompactViewHolder) holder).typeTextView.setText(R.string.link);
|
((PostCompactViewHolder) holder).typeTextView.setText(R.string.link);
|
||||||
@ -1406,6 +1416,7 @@ public class PostRecyclerViewAdapter extends PagedListAdapter<Post, RecyclerView
|
|||||||
((PostViewHolder) holder).linkTextView.setVisibility(View.GONE);
|
((PostViewHolder) holder).linkTextView.setVisibility(View.GONE);
|
||||||
((PostViewHolder) holder).progressBar.setVisibility(View.GONE);
|
((PostViewHolder) holder).progressBar.setVisibility(View.GONE);
|
||||||
((PostViewHolder) holder).imageView.setVisibility(View.GONE);
|
((PostViewHolder) holder).imageView.setVisibility(View.GONE);
|
||||||
|
((PostViewHolder) holder).playButtonImageView.setVisibility(View.GONE);
|
||||||
((PostViewHolder) holder).errorRelativeLayout.setVisibility(View.GONE);
|
((PostViewHolder) holder).errorRelativeLayout.setVisibility(View.GONE);
|
||||||
((PostViewHolder) holder).noPreviewLinkImageView.setVisibility(View.GONE);
|
((PostViewHolder) holder).noPreviewLinkImageView.setVisibility(View.GONE);
|
||||||
((PostViewHolder) holder).contentTextView.setVisibility(View.GONE);
|
((PostViewHolder) holder).contentTextView.setVisibility(View.GONE);
|
||||||
@ -1427,6 +1438,7 @@ public class PostRecyclerViewAdapter extends PagedListAdapter<Post, RecyclerView
|
|||||||
((PostCompactViewHolder) holder).linkTextView.setVisibility(View.GONE);
|
((PostCompactViewHolder) holder).linkTextView.setVisibility(View.GONE);
|
||||||
((PostCompactViewHolder) holder).progressBar.setVisibility(View.GONE);
|
((PostCompactViewHolder) holder).progressBar.setVisibility(View.GONE);
|
||||||
((PostCompactViewHolder) holder).imageView.setVisibility(View.GONE);
|
((PostCompactViewHolder) holder).imageView.setVisibility(View.GONE);
|
||||||
|
((PostCompactViewHolder) holder).playButtonImageView.setVisibility(View.GONE);
|
||||||
((PostCompactViewHolder) holder).noPreviewLinkImageView.setVisibility(View.GONE);
|
((PostCompactViewHolder) holder).noPreviewLinkImageView.setVisibility(View.GONE);
|
||||||
((PostCompactViewHolder) holder).upvoteButton.clearColorFilter();
|
((PostCompactViewHolder) holder).upvoteButton.clearColorFilter();
|
||||||
((PostCompactViewHolder) holder).scoreTextView.setTextColor(ContextCompat.getColor(mContext, R.color.defaultTextColor));
|
((PostCompactViewHolder) holder).scoreTextView.setTextColor(ContextCompat.getColor(mContext, R.color.defaultTextColor));
|
||||||
@ -1479,6 +1491,8 @@ public class PostRecyclerViewAdapter extends PagedListAdapter<Post, RecyclerView
|
|||||||
ProgressBar progressBar;
|
ProgressBar progressBar;
|
||||||
@BindView(R.id.image_view_best_post_item)
|
@BindView(R.id.image_view_best_post_item)
|
||||||
AspectRatioGifImageView imageView;
|
AspectRatioGifImageView imageView;
|
||||||
|
@BindView(R.id.play_button_image_view_item_post)
|
||||||
|
ImageView playButtonImageView;
|
||||||
@BindView(R.id.load_image_error_relative_layout_item_post)
|
@BindView(R.id.load_image_error_relative_layout_item_post)
|
||||||
RelativeLayout errorRelativeLayout;
|
RelativeLayout errorRelativeLayout;
|
||||||
@BindView(R.id.image_view_no_preview_link_item_post)
|
@BindView(R.id.image_view_no_preview_link_item_post)
|
||||||
@ -1563,6 +1577,8 @@ public class PostRecyclerViewAdapter extends PagedListAdapter<Post, RecyclerView
|
|||||||
ProgressBar progressBar;
|
ProgressBar progressBar;
|
||||||
@BindView(R.id.image_view_best_post_item)
|
@BindView(R.id.image_view_best_post_item)
|
||||||
ImageView imageView;
|
ImageView imageView;
|
||||||
|
@BindView(R.id.play_button_image_view_item_post_compact)
|
||||||
|
ImageView playButtonImageView;
|
||||||
@BindView(R.id.image_view_no_preview_link_item_post_compact)
|
@BindView(R.id.image_view_no_preview_link_item_post_compact)
|
||||||
ImageView noPreviewLinkImageView;
|
ImageView noPreviewLinkImageView;
|
||||||
@BindView(R.id.bottom_constraint_layout_item_post_compact)
|
@BindView(R.id.bottom_constraint_layout_item_post_compact)
|
||||||
|
4
app/src/main/res/drawable-night/ic_play_circle_36dp.xml
Normal file
4
app/src/main/res/drawable-night/ic_play_circle_36dp.xml
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
<vector android:height="36dp" android:viewportHeight="24"
|
||||||
|
android:viewportWidth="24" android:width="36dp" xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
|
<path android:fillColor="#FF000000" android:pathData="M10,16.5l6,-4.5 -6,-4.5zM12,2C6.48,2 2,6.48 2,12s4.48,10 10,10 10,-4.48 10,-10S17.52,2 12,2zM12,20c-4.41,0 -8,-3.59 -8,-8s3.59,-8 8,-8 8,3.59 8,8 -3.59,8 -8,8z"/>
|
||||||
|
</vector>
|
4
app/src/main/res/drawable/ic_play_circle_36dp.xml
Normal file
4
app/src/main/res/drawable/ic_play_circle_36dp.xml
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
<vector android:height="36dp" android:viewportHeight="24"
|
||||||
|
android:viewportWidth="24" android:width="36dp" xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
|
<path android:fillColor="#FFFFFFFF" android:pathData="M10,16.5l6,-4.5 -6,-4.5zM12,2C6.48,2 2,6.48 2,12s4.48,10 10,10 10,-4.48 10,-10S17.52,2 12,2zM12,20c-4.41,0 -8,-3.59 -8,-8s3.59,-8 8,-8 8,3.59 8,8 -3.59,8 -8,8z"/>
|
||||||
|
</vector>
|
@ -0,0 +1,9 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<layer-list xmlns:android="http://schemas.android.com/apk/res/android" >
|
||||||
|
<item>
|
||||||
|
<shape android:shape="oval">
|
||||||
|
<solid android:color="@color/backgroundColorInverse" />
|
||||||
|
</shape>
|
||||||
|
</item>
|
||||||
|
|
||||||
|
</layer-list>
|
@ -231,11 +231,9 @@
|
|||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:visibility="gone">
|
android:visibility="gone">
|
||||||
|
|
||||||
<ProgressBar
|
<FrameLayout
|
||||||
android:id="@+id/progress_bar_item_post"
|
android:layout_width="match_parent"
|
||||||
android:layout_width="wrap_content"
|
android:layout_height="wrap_content">
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_centerInParent="true" />
|
|
||||||
|
|
||||||
<ml.docilealligator.infinityforreddit.CustomView.AspectRatioGifImageView
|
<ml.docilealligator.infinityforreddit.CustomView.AspectRatioGifImageView
|
||||||
android:id="@+id/image_view_best_post_item"
|
android:id="@+id/image_view_best_post_item"
|
||||||
@ -244,6 +242,24 @@
|
|||||||
android:adjustViewBounds="true"
|
android:adjustViewBounds="true"
|
||||||
android:scaleType="fitStart" />
|
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
|
<RelativeLayout
|
||||||
android:id="@+id/load_image_error_relative_layout_item_post"
|
android:id="@+id/load_image_error_relative_layout_item_post"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
|
@ -230,11 +230,9 @@
|
|||||||
app:layout_constraintTop_toTopOf="parent"
|
app:layout_constraintTop_toTopOf="parent"
|
||||||
tools:visibility="visible">
|
tools:visibility="visible">
|
||||||
|
|
||||||
<ProgressBar
|
<FrameLayout
|
||||||
android:id="@+id/progress_bar_item_post_compact"
|
android:layout_width="match_parent"
|
||||||
android:layout_width="36dp"
|
android:layout_height="match_parent">
|
||||||
android:layout_height="36dp"
|
|
||||||
android:layout_centerInParent="true" />
|
|
||||||
|
|
||||||
<ImageView
|
<ImageView
|
||||||
android:id="@+id/image_view_best_post_item"
|
android:id="@+id/image_view_best_post_item"
|
||||||
@ -242,6 +240,24 @@
|
|||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:scaleType="center" />
|
android:scaleType="center" />
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/play_button_image_view_item_post_compact"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_margin="0dp"
|
||||||
|
android:layout_gravity="center"
|
||||||
|
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_compact"
|
||||||
|
android:layout_width="36dp"
|
||||||
|
android:layout_height="36dp"
|
||||||
|
android:layout_centerInParent="true" />
|
||||||
|
|
||||||
</RelativeLayout>
|
</RelativeLayout>
|
||||||
|
|
||||||
<ImageView
|
<ImageView
|
||||||
|
@ -210,6 +210,10 @@
|
|||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:visibility="gone">
|
android:visibility="gone">
|
||||||
|
|
||||||
|
<FrameLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content">
|
||||||
|
|
||||||
<com.santalu.aspectratioimageview.AspectRatioImageView
|
<com.santalu.aspectratioimageview.AspectRatioImageView
|
||||||
android:id="@+id/image_view_item_post_detail"
|
android:id="@+id/image_view_item_post_detail"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
@ -217,6 +221,18 @@
|
|||||||
android:adjustViewBounds="true"
|
android:adjustViewBounds="true"
|
||||||
android:scaleType="fitStart"/>
|
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" />
|
||||||
|
|
||||||
|
</FrameLayout>
|
||||||
|
|
||||||
<RelativeLayout
|
<RelativeLayout
|
||||||
android:id="@+id/load_wrapper_item_post_detail"
|
android:id="@+id/load_wrapper_item_post_detail"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
|
@ -22,6 +22,8 @@
|
|||||||
|
|
||||||
<color name="backgroundColorPrimaryDark">#1565C0</color>
|
<color name="backgroundColorPrimaryDark">#1565C0</color>
|
||||||
|
|
||||||
|
<color name="backgroundColorInverse">#FFFFFF</color>
|
||||||
|
|
||||||
<color name="roundedBottomSheetPrimaryBackground">#242424</color>
|
<color name="roundedBottomSheetPrimaryBackground">#242424</color>
|
||||||
|
|
||||||
<color name="voteAndReplyUnavailableVoteButtonColor">#3C3C3C</color>
|
<color name="voteAndReplyUnavailableVoteButtonColor">#3C3C3C</color>
|
||||||
|
@ -22,6 +22,8 @@
|
|||||||
|
|
||||||
<color name="backgroundColorPrimaryDark">@color/colorPrimaryDark</color>
|
<color name="backgroundColorPrimaryDark">@color/colorPrimaryDark</color>
|
||||||
|
|
||||||
|
<color name="backgroundColorInverse">#000000</color>
|
||||||
|
|
||||||
<color name="roundedBottomSheetPrimaryBackground">#FFFFFF</color>
|
<color name="roundedBottomSheetPrimaryBackground">#FFFFFF</color>
|
||||||
|
|
||||||
<color name="roundedBottomSheetPrimaryNavigationBarColor">@android:color/black</color>
|
<color name="roundedBottomSheetPrimaryNavigationBarColor">@android:color/black</color>
|
||||||
|
Loading…
Reference in New Issue
Block a user