This commit is contained in:
Ammar Githam 2021-03-17 22:35:49 +09:00
parent a271ba5ab7
commit 321af4cad4
20 changed files with 65 additions and 21 deletions

View File

@ -323,6 +323,20 @@ public class PostViewV2Fragment extends SharedElementTransitionDialogFragment im
if (bottomSheetBehavior != null) { if (bottomSheetBehavior != null) {
captionState = bottomSheetBehavior.getState(); captionState = bottomSheetBehavior.getState();
} }
final Media media = viewModel.getMedia();
if (media == null) return;
switch (media.getMediaType()) {
case MEDIA_TYPE_VIDEO:
if (videoPlayerViewHelper != null) {
videoPlayerViewHelper.pause();
}
return;
case MEDIA_TYPE_SLIDER:
if (sliderItemsAdapter != null) {
pauseSliderPlayer();
}
default:
}
} }
@Override @Override
@ -1124,6 +1138,16 @@ public class PostViewV2Fragment extends SharedElementTransitionDialogFragment im
sliderItemsAdapter.submitList(media.getCarouselMedia()); sliderItemsAdapter.submitList(media.getCarouselMedia());
} }
private void pauseSliderPlayer() {
if (binding.sliderParent.getVisibility() != View.VISIBLE) return;
final int currentItem = binding.sliderParent.getCurrentItem();
final View view = binding.sliderParent.getChildAt(0);
if (!(view instanceof RecyclerView)) return;
final RecyclerView.ViewHolder viewHolder = ((RecyclerView) view).findViewHolderForAdapterPosition(currentItem);
if (!(viewHolder instanceof SliderVideoViewHolder)) return;
((SliderVideoViewHolder) viewHolder).pause();
}
private void releaseAllSliderPlayers() { private void releaseAllSliderPlayers() {
if (binding.sliderParent.getVisibility() != View.VISIBLE) return; if (binding.sliderParent.getVisibility() != View.VISIBLE) return;
final View view = binding.sliderParent.getChildAt(0); final View view = binding.sliderParent.getChildAt(0);

View File

@ -1,8 +1,9 @@
package awais.instagrabber.repositories.responses; package awais.instagrabber.repositories.responses;
import java.io.Serializable;
import java.util.Objects; import java.util.Objects;
public class AnimatedMediaFixedHeight { public class AnimatedMediaFixedHeight implements Serializable {
private final int height; private final int height;
private final int width; private final int width;
private final String mp4; private final String mp4;

View File

@ -1,8 +1,9 @@
package awais.instagrabber.repositories.responses; package awais.instagrabber.repositories.responses;
import java.io.Serializable;
import java.util.Objects; import java.util.Objects;
public class AnimatedMediaImages { public class AnimatedMediaImages implements Serializable {
private final AnimatedMediaFixedHeight fixedHeight; private final AnimatedMediaFixedHeight fixedHeight;
public AnimatedMediaImages(final AnimatedMediaFixedHeight fixedHeight) { public AnimatedMediaImages(final AnimatedMediaFixedHeight fixedHeight) {

View File

@ -2,6 +2,7 @@ package awais.instagrabber.repositories.responses.directmessages;
import androidx.annotation.NonNull; import androidx.annotation.NonNull;
import java.io.Serializable;
import java.time.Instant; import java.time.Instant;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import java.time.ZoneId; import java.time.ZoneId;
@ -14,7 +15,7 @@ import awais.instagrabber.repositories.responses.Location;
import awais.instagrabber.repositories.responses.Media; import awais.instagrabber.repositories.responses.Media;
import awais.instagrabber.repositories.responses.User; import awais.instagrabber.repositories.responses.User;
public class DirectItem implements Cloneable { public class DirectItem implements Cloneable, Serializable {
private String itemId; private String itemId;
private final long userId; private final long userId;
private long timestamp; private long timestamp;
@ -43,7 +44,7 @@ public class DirectItem implements Cloneable {
private final int hideInThread; private final int hideInThread;
private Date date; private Date date;
private boolean isPending; private boolean isPending;
private boolean showForwardAttribution; private final boolean showForwardAttribution;
private LocalDateTime localDateTime; private LocalDateTime localDateTime;
public DirectItem(final String itemId, public DirectItem(final String itemId,
@ -220,7 +221,8 @@ public class DirectItem implements Cloneable {
public LocalDateTime getLocalDateTime() { public LocalDateTime getLocalDateTime() {
if (localDateTime == null) { if (localDateTime == null) {
localDateTime = Instant.ofEpochMilli(timestamp / 1000).atZone(ZoneId.systemDefault()).toLocalDateTime();; localDateTime = Instant.ofEpochMilli(timestamp / 1000).atZone(ZoneId.systemDefault()).toLocalDateTime();
;
} }
return localDateTime; return localDateTime;
} }

View File

@ -1,9 +1,10 @@
package awais.instagrabber.repositories.responses.directmessages; package awais.instagrabber.repositories.responses.directmessages;
import java.io.Serializable;
import java.util.List; import java.util.List;
import java.util.Objects; import java.util.Objects;
public class DirectItemActionLog { public class DirectItemActionLog implements Serializable {
private final String description; private final String description;
private final List<TextRange> bold; private final List<TextRange> bold;
private final List<TextRange> textAttributes; private final List<TextRange> textAttributes;

View File

@ -1,10 +1,11 @@
package awais.instagrabber.repositories.responses.directmessages; package awais.instagrabber.repositories.responses.directmessages;
import java.io.Serializable;
import java.util.Objects; import java.util.Objects;
import awais.instagrabber.repositories.responses.AnimatedMediaImages; import awais.instagrabber.repositories.responses.AnimatedMediaImages;
public final class DirectItemAnimatedMedia { public final class DirectItemAnimatedMedia implements Serializable {
private final String id; private final String id;
private final AnimatedMediaImages images; private final AnimatedMediaImages images;
private final boolean isRandom; private final boolean isRandom;

View File

@ -1,10 +1,11 @@
package awais.instagrabber.repositories.responses.directmessages; package awais.instagrabber.repositories.responses.directmessages;
import java.io.Serializable;
import java.util.Objects; import java.util.Objects;
import awais.instagrabber.repositories.responses.Media; import awais.instagrabber.repositories.responses.Media;
public class DirectItemClip { public class DirectItemClip implements Serializable {
private final Media clip; private final Media clip;
public DirectItemClip(final Media clip) { public DirectItemClip(final Media clip) {

View File

@ -1,10 +1,11 @@
package awais.instagrabber.repositories.responses.directmessages; package awais.instagrabber.repositories.responses.directmessages;
import java.io.Serializable;
import java.util.Objects; import java.util.Objects;
import awais.instagrabber.repositories.responses.Media; import awais.instagrabber.repositories.responses.Media;
public class DirectItemFelixShare { public class DirectItemFelixShare implements Serializable {
private final Media video; private final Media video;
public DirectItemFelixShare(final Media video) { public DirectItemFelixShare(final Media video) {

View File

@ -1,8 +1,9 @@
package awais.instagrabber.repositories.responses.directmessages; package awais.instagrabber.repositories.responses.directmessages;
import java.io.Serializable;
import java.util.Objects; import java.util.Objects;
public class DirectItemLink { public class DirectItemLink implements Serializable {
private final String text; private final String text;
private final DirectItemLinkContext linkContext; private final DirectItemLinkContext linkContext;
private final String clientContext; private final String clientContext;

View File

@ -1,8 +1,9 @@
package awais.instagrabber.repositories.responses.directmessages; package awais.instagrabber.repositories.responses.directmessages;
import java.io.Serializable;
import java.util.Objects; import java.util.Objects;
public class DirectItemLinkContext { public class DirectItemLinkContext implements Serializable {
private final String linkUrl; private final String linkUrl;
private final String linkTitle; private final String linkTitle;
private final String linkSummary; private final String linkSummary;

View File

@ -1,8 +1,9 @@
package awais.instagrabber.repositories.responses.directmessages; package awais.instagrabber.repositories.responses.directmessages;
import java.io.Serializable;
import java.util.Objects; import java.util.Objects;
public class DirectItemPlaceholder { public class DirectItemPlaceholder implements Serializable {
private final boolean isLinked; private final boolean isLinked;
private final String title; private final String title;
private final String message; private final String message;

View File

@ -1,10 +1,11 @@
package awais.instagrabber.repositories.responses.directmessages; package awais.instagrabber.repositories.responses.directmessages;
import java.io.Serializable;
import java.util.Objects; import java.util.Objects;
import awais.instagrabber.repositories.responses.Media; import awais.instagrabber.repositories.responses.Media;
public class DirectItemReelShare { public class DirectItemReelShare implements Serializable {
private final String text; private final String text;
private final String type; private final String type;
private final long reelOwnerId; private final long reelOwnerId;

View File

@ -1,8 +1,9 @@
package awais.instagrabber.repositories.responses.directmessages; package awais.instagrabber.repositories.responses.directmessages;
import java.io.Serializable;
import java.util.Objects; import java.util.Objects;
public class DirectItemReelShareReactionInfo { public class DirectItemReelShareReactionInfo implements Serializable {
private final String emoji; private final String emoji;
private final String intensity; private final String intensity;

View File

@ -1,10 +1,11 @@
package awais.instagrabber.repositories.responses.directmessages; package awais.instagrabber.repositories.responses.directmessages;
import java.io.Serializable;
import java.util.Objects; import java.util.Objects;
import awais.instagrabber.repositories.responses.Media; import awais.instagrabber.repositories.responses.Media;
public class DirectItemStoryShare { public class DirectItemStoryShare implements Serializable {
private final String reelId; private final String reelId;
private final String reelType; private final String reelType;
private final String text; private final String text;

View File

@ -1,9 +1,10 @@
package awais.instagrabber.repositories.responses.directmessages; package awais.instagrabber.repositories.responses.directmessages;
import java.io.Serializable;
import java.util.List; import java.util.List;
import java.util.Objects; import java.util.Objects;
public final class DirectItemVideoCallEvent { public final class DirectItemVideoCallEvent implements Serializable {
private final String action; private final String action;
private final String encodedServerDataInfo; private final String encodedServerDataInfo;
private final String description; private final String description;

View File

@ -1,12 +1,13 @@
package awais.instagrabber.repositories.responses.directmessages; package awais.instagrabber.repositories.responses.directmessages;
import java.io.Serializable;
import java.util.List; import java.util.List;
import java.util.Objects; import java.util.Objects;
import awais.instagrabber.models.enums.RavenMediaViewMode; import awais.instagrabber.models.enums.RavenMediaViewMode;
import awais.instagrabber.repositories.responses.Media; import awais.instagrabber.repositories.responses.Media;
public class DirectItemVisualMedia { public class DirectItemVisualMedia implements Serializable {
private final long urlExpireAtSecs; private final long urlExpireAtSecs;
private final int playbackDurationSecs; private final int playbackDurationSecs;
private final List<Long> seenUserIds; private final List<Long> seenUserIds;

View File

@ -1,10 +1,11 @@
package awais.instagrabber.repositories.responses.directmessages; package awais.instagrabber.repositories.responses.directmessages;
import java.io.Serializable;
import java.util.Objects; import java.util.Objects;
import awais.instagrabber.repositories.responses.Media; import awais.instagrabber.repositories.responses.Media;
public class DirectItemVoiceMedia { public class DirectItemVoiceMedia implements Serializable {
private final Media media; private final Media media;
private final int seenCount; private final int seenCount;
private final String viewMode; private final String viewMode;

View File

@ -1,9 +1,10 @@
package awais.instagrabber.repositories.responses.directmessages; package awais.instagrabber.repositories.responses.directmessages;
import java.io.Serializable;
import java.util.List; import java.util.List;
import java.util.Objects; import java.util.Objects;
public class DirectThreadDirectStory { public class DirectThreadDirectStory implements Serializable {
private final List<DirectItem> items; private final List<DirectItem> items;
private final int unseenCount; private final int unseenCount;

View File

@ -1,8 +1,9 @@
package awais.instagrabber.repositories.responses.directmessages; package awais.instagrabber.repositories.responses.directmessages;
import java.io.Serializable;
import java.util.Objects; import java.util.Objects;
public class DirectThreadLastSeenAt { public class DirectThreadLastSeenAt implements Serializable {
private final String timestamp; private final String timestamp;
private final String itemId; private final String itemId;

View File

@ -2,9 +2,10 @@ package awais.instagrabber.repositories.responses.directmessages;
import com.google.gson.annotations.SerializedName; import com.google.gson.annotations.SerializedName;
import java.io.Serializable;
import java.util.Objects; import java.util.Objects;
public final class RavenExpiringMediaActionSummary { public final class RavenExpiringMediaActionSummary implements Serializable {
private final ActionType type; private final ActionType type;
private final long timestamp; private final long timestamp;
private final int count; private final int count;