This commit is contained in:
tom79 2019-10-13 17:09:46 +02:00
parent 953cda5719
commit 50e1b493e7
2 changed files with 27 additions and 11 deletions

View File

@ -380,7 +380,7 @@ public class PixelfedListAdapter extends RecyclerView.Adapter implements OnPostA
private class ViewHolderPixelfed extends RecyclerView.ViewHolder {
SliderView imageSlider;
ImageView art_media, pf_pp, pf_comment;
ImageView art_media, art_media_play, pf_pp, pf_comment;
SparkButton pf_fav, pf_share;
TextView pf_username, pf_likes, pf_description, pf_date;
CardView pf_cardview;
@ -398,6 +398,7 @@ public class PixelfedListAdapter extends RecyclerView.Adapter implements OnPostA
ViewHolderPixelfed(View itemView) {
super(itemView);
art_media = itemView.findViewById(R.id.art_media);
art_media_play = itemView.findViewById(R.id.art_media_play);
imageSlider = itemView.findViewById(R.id.imageSlider);
pf_pp = itemView.findViewById(R.id.pf_pp);
pf_username = itemView.findViewById(R.id.pf_username);
@ -615,7 +616,7 @@ public class PixelfedListAdapter extends RecyclerView.Adapter implements OnPostA
}
holder.art_media_play.setVisibility(View.GONE);
if (status.getMedia_attachments() != null && status.getMedia_attachments().size() > 1){
SliderAdapter sliderAdapter = new SliderAdapter(new WeakReference<>((Activity)context), false, status.getMedia_attachments());
@ -627,6 +628,9 @@ public class PixelfedListAdapter extends RecyclerView.Adapter implements OnPostA
}else if(status.getMedia_attachments() != null ){
holder.art_media.setVisibility(View.VISIBLE);
holder.imageSlider.setVisibility(View.GONE);
if( status.getMedia_attachments().get(0).getType().toLowerCase().equals("video")){
holder.art_media_play.setVisibility(View.VISIBLE);
}
String url;
if(status.getMedia_attachments().get(0).getPreview_url().endsWith("no-preview.png") ){
url = status.getMedia_attachments().get(0).getUrl();

View File

@ -74,13 +74,28 @@
app:sliderScrollTimeInSec="1"
app:sliderStartAutoCycle="false" />
<ImageView
android:visibility="gone"
android:id="@+id/art_media"
android:scaleType="fitCenter"
android:adjustViewBounds="true"
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content" />
android:layout_height="wrap_content"
>
<ImageView
android:visibility="gone"
android:id="@+id/art_media"
android:scaleType="fitCenter"
android:adjustViewBounds="true"
android:layout_width="match_parent"
android:layout_height="wrap_content"
tools:ignore="ContentDescription" />
<ImageView
android:id="@+id/art_media_play"
android:layout_width="30dp"
android:layout_height="30dp"
android:layout_centerInParent="true"
android:contentDescription="@string/play_video"
android:src="@drawable/ic_play_arrow"
android:visibility="gone" />
</RelativeLayout>
<LinearLayout
android:layout_width="match_parent"
@ -107,7 +122,6 @@
<ImageView
android:layout_marginStart="15dp"
android:layout_marginLeft="15dp"
android:id="@+id/pf_comment"
android:contentDescription="@string/leave_a_comment"
android:src="@drawable/ic_pixelfed_comment"
@ -116,7 +130,6 @@
<com.varunest.sparkbutton.SparkButton
android:layout_marginStart="15dp"
android:layout_marginLeft="15dp"
android:id="@+id/pf_share"
app:sparkbutton_activeImage="@drawable/ic_repeat_boost"
app:sparkbutton_inActiveImage="@drawable/ic_repeat"
@ -126,7 +139,6 @@
app:sparkbutton_iconSize="30dp" />
<ImageView
android:layout_marginStart="15dp"
android:layout_marginLeft="15dp"
android:id="@+id/status_more"
android:layout_width="30dp"
android:layout_height="30dp"