Browse Source

Pause post video in background. Fixes https://github.com/austinhuang0131/barinsta/issues/413

renovate/org.robolectric-robolectric-4.x
Ammar Githam 4 years ago
parent
commit
321af4cad4
  1. 24
      app/src/main/java/awais/instagrabber/fragments/PostViewV2Fragment.java
  2. 3
      app/src/main/java/awais/instagrabber/repositories/responses/AnimatedMediaFixedHeight.java
  3. 3
      app/src/main/java/awais/instagrabber/repositories/responses/AnimatedMediaImages.java
  4. 8
      app/src/main/java/awais/instagrabber/repositories/responses/directmessages/DirectItem.java
  5. 3
      app/src/main/java/awais/instagrabber/repositories/responses/directmessages/DirectItemActionLog.java
  6. 3
      app/src/main/java/awais/instagrabber/repositories/responses/directmessages/DirectItemAnimatedMedia.java
  7. 3
      app/src/main/java/awais/instagrabber/repositories/responses/directmessages/DirectItemClip.java
  8. 3
      app/src/main/java/awais/instagrabber/repositories/responses/directmessages/DirectItemFelixShare.java
  9. 3
      app/src/main/java/awais/instagrabber/repositories/responses/directmessages/DirectItemLink.java
  10. 3
      app/src/main/java/awais/instagrabber/repositories/responses/directmessages/DirectItemLinkContext.java
  11. 3
      app/src/main/java/awais/instagrabber/repositories/responses/directmessages/DirectItemPlaceholder.java
  12. 3
      app/src/main/java/awais/instagrabber/repositories/responses/directmessages/DirectItemReelShare.java
  13. 3
      app/src/main/java/awais/instagrabber/repositories/responses/directmessages/DirectItemReelShareReactionInfo.java
  14. 3
      app/src/main/java/awais/instagrabber/repositories/responses/directmessages/DirectItemStoryShare.java
  15. 3
      app/src/main/java/awais/instagrabber/repositories/responses/directmessages/DirectItemVideoCallEvent.java
  16. 3
      app/src/main/java/awais/instagrabber/repositories/responses/directmessages/DirectItemVisualMedia.java
  17. 3
      app/src/main/java/awais/instagrabber/repositories/responses/directmessages/DirectItemVoiceMedia.java
  18. 3
      app/src/main/java/awais/instagrabber/repositories/responses/directmessages/DirectThreadDirectStory.java
  19. 3
      app/src/main/java/awais/instagrabber/repositories/responses/directmessages/DirectThreadLastSeenAt.java
  20. 3
      app/src/main/java/awais/instagrabber/repositories/responses/directmessages/RavenExpiringMediaActionSummary.java

24
app/src/main/java/awais/instagrabber/fragments/PostViewV2Fragment.java

@ -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);

3
app/src/main/java/awais/instagrabber/repositories/responses/AnimatedMediaFixedHeight.java

@ -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;

3
app/src/main/java/awais/instagrabber/repositories/responses/AnimatedMediaImages.java

@ -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) {

8
app/src/main/java/awais/instagrabber/repositories/responses/directmessages/DirectItem.java

@ -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;
}

3
app/src/main/java/awais/instagrabber/repositories/responses/directmessages/DirectItemActionLog.java

@ -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;

3
app/src/main/java/awais/instagrabber/repositories/responses/directmessages/DirectItemAnimatedMedia.java

@ -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;

3
app/src/main/java/awais/instagrabber/repositories/responses/directmessages/DirectItemClip.java

@ -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) {

3
app/src/main/java/awais/instagrabber/repositories/responses/directmessages/DirectItemFelixShare.java

@ -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) {

3
app/src/main/java/awais/instagrabber/repositories/responses/directmessages/DirectItemLink.java

@ -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;

3
app/src/main/java/awais/instagrabber/repositories/responses/directmessages/DirectItemLinkContext.java

@ -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;

3
app/src/main/java/awais/instagrabber/repositories/responses/directmessages/DirectItemPlaceholder.java

@ -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;

3
app/src/main/java/awais/instagrabber/repositories/responses/directmessages/DirectItemReelShare.java

@ -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;

3
app/src/main/java/awais/instagrabber/repositories/responses/directmessages/DirectItemReelShareReactionInfo.java

@ -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;

3
app/src/main/java/awais/instagrabber/repositories/responses/directmessages/DirectItemStoryShare.java

@ -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;

3
app/src/main/java/awais/instagrabber/repositories/responses/directmessages/DirectItemVideoCallEvent.java

@ -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;

3
app/src/main/java/awais/instagrabber/repositories/responses/directmessages/DirectItemVisualMedia.java

@ -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;

3
app/src/main/java/awais/instagrabber/repositories/responses/directmessages/DirectItemVoiceMedia.java

@ -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;

3
app/src/main/java/awais/instagrabber/repositories/responses/directmessages/DirectThreadDirectStory.java

@ -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;

3
app/src/main/java/awais/instagrabber/repositories/responses/directmessages/DirectThreadLastSeenAt.java

@ -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;

3
app/src/main/java/awais/instagrabber/repositories/responses/directmessages/RavenExpiringMediaActionSummary.java

@ -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…
Cancel
Save