Pause post video in background. Fixes https://github.com/austinhuang0131/barinsta/issues/413
This commit is contained in:
parent
a271ba5ab7
commit
321af4cad4
@ -323,6 +323,20 @@ public class PostViewV2Fragment extends SharedElementTransitionDialogFragment im
|
||||
if (bottomSheetBehavior != null) {
|
||||
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
|
||||
@ -1124,6 +1138,16 @@ public class PostViewV2Fragment extends SharedElementTransitionDialogFragment im
|
||||
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() {
|
||||
if (binding.sliderParent.getVisibility() != View.VISIBLE) return;
|
||||
final View view = binding.sliderParent.getChildAt(0);
|
||||
|
@ -1,8 +1,9 @@
|
||||
package awais.instagrabber.repositories.responses;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Objects;
|
||||
|
||||
public class AnimatedMediaFixedHeight {
|
||||
public class AnimatedMediaFixedHeight implements Serializable {
|
||||
private final int height;
|
||||
private final int width;
|
||||
private final String mp4;
|
||||
|
@ -1,8 +1,9 @@
|
||||
package awais.instagrabber.repositories.responses;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Objects;
|
||||
|
||||
public class AnimatedMediaImages {
|
||||
public class AnimatedMediaImages implements Serializable {
|
||||
private final AnimatedMediaFixedHeight fixedHeight;
|
||||
|
||||
public AnimatedMediaImages(final AnimatedMediaFixedHeight fixedHeight) {
|
||||
|
@ -2,6 +2,7 @@ package awais.instagrabber.repositories.responses.directmessages;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.time.Instant;
|
||||
import java.time.LocalDateTime;
|
||||
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.User;
|
||||
|
||||
public class DirectItem implements Cloneable {
|
||||
public class DirectItem implements Cloneable, Serializable {
|
||||
private String itemId;
|
||||
private final long userId;
|
||||
private long timestamp;
|
||||
@ -43,7 +44,7 @@ public class DirectItem implements Cloneable {
|
||||
private final int hideInThread;
|
||||
private Date date;
|
||||
private boolean isPending;
|
||||
private boolean showForwardAttribution;
|
||||
private final boolean showForwardAttribution;
|
||||
private LocalDateTime localDateTime;
|
||||
|
||||
public DirectItem(final String itemId,
|
||||
@ -220,7 +221,8 @@ public class DirectItem implements Cloneable {
|
||||
|
||||
public LocalDateTime getLocalDateTime() {
|
||||
if (localDateTime == null) {
|
||||
localDateTime = Instant.ofEpochMilli(timestamp / 1000).atZone(ZoneId.systemDefault()).toLocalDateTime();;
|
||||
localDateTime = Instant.ofEpochMilli(timestamp / 1000).atZone(ZoneId.systemDefault()).toLocalDateTime();
|
||||
;
|
||||
}
|
||||
return localDateTime;
|
||||
}
|
||||
|
@ -1,9 +1,10 @@
|
||||
package awais.instagrabber.repositories.responses.directmessages;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
public class DirectItemActionLog {
|
||||
public class DirectItemActionLog implements Serializable {
|
||||
private final String description;
|
||||
private final List<TextRange> bold;
|
||||
private final List<TextRange> textAttributes;
|
||||
|
@ -1,10 +1,11 @@
|
||||
package awais.instagrabber.repositories.responses.directmessages;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Objects;
|
||||
|
||||
import awais.instagrabber.repositories.responses.AnimatedMediaImages;
|
||||
|
||||
public final class DirectItemAnimatedMedia {
|
||||
public final class DirectItemAnimatedMedia implements Serializable {
|
||||
private final String id;
|
||||
private final AnimatedMediaImages images;
|
||||
private final boolean isRandom;
|
||||
|
@ -1,10 +1,11 @@
|
||||
package awais.instagrabber.repositories.responses.directmessages;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Objects;
|
||||
|
||||
import awais.instagrabber.repositories.responses.Media;
|
||||
|
||||
public class DirectItemClip {
|
||||
public class DirectItemClip implements Serializable {
|
||||
private final Media clip;
|
||||
|
||||
public DirectItemClip(final Media clip) {
|
||||
|
@ -1,10 +1,11 @@
|
||||
package awais.instagrabber.repositories.responses.directmessages;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Objects;
|
||||
|
||||
import awais.instagrabber.repositories.responses.Media;
|
||||
|
||||
public class DirectItemFelixShare {
|
||||
public class DirectItemFelixShare implements Serializable {
|
||||
private final Media video;
|
||||
|
||||
public DirectItemFelixShare(final Media video) {
|
||||
|
@ -1,8 +1,9 @@
|
||||
package awais.instagrabber.repositories.responses.directmessages;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Objects;
|
||||
|
||||
public class DirectItemLink {
|
||||
public class DirectItemLink implements Serializable {
|
||||
private final String text;
|
||||
private final DirectItemLinkContext linkContext;
|
||||
private final String clientContext;
|
||||
|
@ -1,8 +1,9 @@
|
||||
package awais.instagrabber.repositories.responses.directmessages;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Objects;
|
||||
|
||||
public class DirectItemLinkContext {
|
||||
public class DirectItemLinkContext implements Serializable {
|
||||
private final String linkUrl;
|
||||
private final String linkTitle;
|
||||
private final String linkSummary;
|
||||
|
@ -1,8 +1,9 @@
|
||||
package awais.instagrabber.repositories.responses.directmessages;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Objects;
|
||||
|
||||
public class DirectItemPlaceholder {
|
||||
public class DirectItemPlaceholder implements Serializable {
|
||||
private final boolean isLinked;
|
||||
private final String title;
|
||||
private final String message;
|
||||
|
@ -1,10 +1,11 @@
|
||||
package awais.instagrabber.repositories.responses.directmessages;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Objects;
|
||||
|
||||
import awais.instagrabber.repositories.responses.Media;
|
||||
|
||||
public class DirectItemReelShare {
|
||||
public class DirectItemReelShare implements Serializable {
|
||||
private final String text;
|
||||
private final String type;
|
||||
private final long reelOwnerId;
|
||||
|
@ -1,8 +1,9 @@
|
||||
package awais.instagrabber.repositories.responses.directmessages;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Objects;
|
||||
|
||||
public class DirectItemReelShareReactionInfo {
|
||||
public class DirectItemReelShareReactionInfo implements Serializable {
|
||||
private final String emoji;
|
||||
private final String intensity;
|
||||
|
||||
|
@ -1,10 +1,11 @@
|
||||
package awais.instagrabber.repositories.responses.directmessages;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Objects;
|
||||
|
||||
import awais.instagrabber.repositories.responses.Media;
|
||||
|
||||
public class DirectItemStoryShare {
|
||||
public class DirectItemStoryShare implements Serializable {
|
||||
private final String reelId;
|
||||
private final String reelType;
|
||||
private final String text;
|
||||
|
@ -1,9 +1,10 @@
|
||||
package awais.instagrabber.repositories.responses.directmessages;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
public final class DirectItemVideoCallEvent {
|
||||
public final class DirectItemVideoCallEvent implements Serializable {
|
||||
private final String action;
|
||||
private final String encodedServerDataInfo;
|
||||
private final String description;
|
||||
|
@ -1,12 +1,13 @@
|
||||
package awais.instagrabber.repositories.responses.directmessages;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
import awais.instagrabber.models.enums.RavenMediaViewMode;
|
||||
import awais.instagrabber.repositories.responses.Media;
|
||||
|
||||
public class DirectItemVisualMedia {
|
||||
public class DirectItemVisualMedia implements Serializable {
|
||||
private final long urlExpireAtSecs;
|
||||
private final int playbackDurationSecs;
|
||||
private final List<Long> seenUserIds;
|
||||
|
@ -1,10 +1,11 @@
|
||||
package awais.instagrabber.repositories.responses.directmessages;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Objects;
|
||||
|
||||
import awais.instagrabber.repositories.responses.Media;
|
||||
|
||||
public class DirectItemVoiceMedia {
|
||||
public class DirectItemVoiceMedia implements Serializable {
|
||||
private final Media media;
|
||||
private final int seenCount;
|
||||
private final String viewMode;
|
||||
|
@ -1,9 +1,10 @@
|
||||
package awais.instagrabber.repositories.responses.directmessages;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
public class DirectThreadDirectStory {
|
||||
public class DirectThreadDirectStory implements Serializable {
|
||||
private final List<DirectItem> items;
|
||||
private final int unseenCount;
|
||||
|
||||
|
@ -1,8 +1,9 @@
|
||||
package awais.instagrabber.repositories.responses.directmessages;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Objects;
|
||||
|
||||
public class DirectThreadLastSeenAt {
|
||||
public class DirectThreadLastSeenAt implements Serializable {
|
||||
private final String timestamp;
|
||||
private final String itemId;
|
||||
|
||||
|
@ -2,9 +2,10 @@ package awais.instagrabber.repositories.responses.directmessages;
|
||||
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Objects;
|
||||
|
||||
public final class RavenExpiringMediaActionSummary {
|
||||
public final class RavenExpiringMediaActionSummary implements Serializable {
|
||||
private final ActionType type;
|
||||
private final long timestamp;
|
||||
private final int count;
|
||||
|
Loading…
Reference in New Issue
Block a user