aboutsummaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
Diffstat (limited to 'app')
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/adapters/HistoryPostRecyclerViewAdapter.java43
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/adapters/PostDetailRecyclerViewAdapter.java14
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/adapters/PostRecyclerViewAdapter.java42
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/post/Post.java4
4 files changed, 59 insertions, 44 deletions
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/HistoryPostRecyclerViewAdapter.java b/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/HistoryPostRecyclerViewAdapter.java
index 8c538e47..863d4484 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/HistoryPostRecyclerViewAdapter.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/HistoryPostRecyclerViewAdapter.java
@@ -25,7 +25,6 @@ import android.widget.Toast;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
-import androidx.appcompat.content.res.AppCompatResources;
import androidx.constraintlayout.widget.Barrier;
import androidx.constraintlayout.widget.ConstraintLayout;
import androidx.constraintlayout.widget.ConstraintSet;
@@ -3323,12 +3322,14 @@ public class HistoryPostRecyclerViewAdapter extends PagingDataAdapter<Post, Recy
}
void loadFallbackDirectVideo() {
- mediaUri = Uri.parse(post.getVideoFallBackDirectUrl());
- post.setVideoDownloadUrl(post.getVideoFallBackDirectUrl());
- post.setVideoUrl(post.getVideoFallBackDirectUrl());
- post.setLoadRedgifsOrStreamableVideoSuccess(true);
- if (container != null) {
- container.onScrollStateChanged(RecyclerView.SCROLL_STATE_IDLE);
+ if (post.getVideoFallBackDirectUrl() != null) {
+ mediaUri = Uri.parse(post.getVideoFallBackDirectUrl());
+ post.setVideoDownloadUrl(post.getVideoFallBackDirectUrl());
+ post.setVideoUrl(post.getVideoFallBackDirectUrl());
+ post.setLoadRedgifsOrStreamableVideoSuccess(true);
+ if (container != null) {
+ container.onScrollStateChanged(RecyclerView.SCROLL_STATE_IDLE);
+ }
}
}
@@ -4978,12 +4979,14 @@ public class HistoryPostRecyclerViewAdapter extends PagingDataAdapter<Post, Recy
}
void loadFallbackDirectVideo() {
- mediaUri = Uri.parse(post.getVideoFallBackDirectUrl());
- post.setVideoDownloadUrl(post.getVideoFallBackDirectUrl());
- post.setVideoUrl(post.getVideoFallBackDirectUrl());
- post.setLoadRedgifsOrStreamableVideoSuccess(true);
- if (container != null) {
- container.onScrollStateChanged(RecyclerView.SCROLL_STATE_IDLE);
+ if (post.getVideoFallBackDirectUrl() != null) {
+ mediaUri = Uri.parse(post.getVideoFallBackDirectUrl());
+ post.setVideoDownloadUrl(post.getVideoFallBackDirectUrl());
+ post.setVideoUrl(post.getVideoFallBackDirectUrl());
+ post.setLoadRedgifsOrStreamableVideoSuccess(true);
+ if (container != null) {
+ container.onScrollStateChanged(RecyclerView.SCROLL_STATE_IDLE);
+ }
}
}
@@ -5972,12 +5975,14 @@ public class HistoryPostRecyclerViewAdapter extends PagingDataAdapter<Post, Recy
}
void loadFallbackDirectVideo() {
- mediaUri = Uri.parse(post.getVideoFallBackDirectUrl());
- post.setVideoDownloadUrl(post.getVideoFallBackDirectUrl());
- post.setVideoUrl(post.getVideoFallBackDirectUrl());
- post.setLoadRedgifsOrStreamableVideoSuccess(true);
- if (container != null) {
- container.onScrollStateChanged(RecyclerView.SCROLL_STATE_IDLE);
+ if (post.getVideoFallBackDirectUrl() != null) {
+ mediaUri = Uri.parse(post.getVideoFallBackDirectUrl());
+ post.setVideoDownloadUrl(post.getVideoFallBackDirectUrl());
+ post.setVideoUrl(post.getVideoFallBackDirectUrl());
+ post.setLoadRedgifsOrStreamableVideoSuccess(true);
+ if (container != null) {
+ container.onScrollStateChanged(RecyclerView.SCROLL_STATE_IDLE);
+ }
}
}
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/PostDetailRecyclerViewAdapter.java b/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/PostDetailRecyclerViewAdapter.java
index 7e08d604..c46091fa 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/PostDetailRecyclerViewAdapter.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/PostDetailRecyclerViewAdapter.java
@@ -1785,12 +1785,14 @@ public class PostDetailRecyclerViewAdapter extends RecyclerView.Adapter<Recycler
}
void loadFallbackDirectVideo() {
- mediaUri = Uri.parse(mPost.getVideoFallBackDirectUrl());
- mPost.setVideoDownloadUrl(mPost.getVideoFallBackDirectUrl());
- mPost.setVideoUrl(mPost.getVideoFallBackDirectUrl());
- mPost.setLoadRedgifsOrStreamableVideoSuccess(true);
- if (container != null) {
- container.onScrollStateChanged(RecyclerView.SCROLL_STATE_IDLE);
+ if (mPost.getVideoFallBackDirectUrl() != null) {
+ mediaUri = Uri.parse(mPost.getVideoFallBackDirectUrl());
+ mPost.setVideoDownloadUrl(mPost.getVideoFallBackDirectUrl());
+ mPost.setVideoUrl(mPost.getVideoFallBackDirectUrl());
+ mPost.setLoadRedgifsOrStreamableVideoSuccess(true);
+ if (container != null) {
+ container.onScrollStateChanged(RecyclerView.SCROLL_STATE_IDLE);
+ }
}
}
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/PostRecyclerViewAdapter.java b/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/PostRecyclerViewAdapter.java
index a1cb9447..4f5dcdb7 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/PostRecyclerViewAdapter.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/PostRecyclerViewAdapter.java
@@ -3485,12 +3485,14 @@ public class PostRecyclerViewAdapter extends PagingDataAdapter<Post, RecyclerVie
}
void loadFallbackDirectVideo() {
- mediaUri = Uri.parse(post.getVideoFallBackDirectUrl());
- post.setVideoDownloadUrl(post.getVideoFallBackDirectUrl());
- post.setVideoUrl(post.getVideoFallBackDirectUrl());
- post.setLoadRedgifsOrStreamableVideoSuccess(true);
- if (container != null) {
- container.onScrollStateChanged(RecyclerView.SCROLL_STATE_IDLE);
+ if (post.getVideoFallBackDirectUrl() != null) {
+ mediaUri = Uri.parse(post.getVideoFallBackDirectUrl());
+ post.setVideoDownloadUrl(post.getVideoFallBackDirectUrl());
+ post.setVideoUrl(post.getVideoFallBackDirectUrl());
+ post.setLoadRedgifsOrStreamableVideoSuccess(true);
+ if (container != null) {
+ container.onScrollStateChanged(RecyclerView.SCROLL_STATE_IDLE);
+ }
}
}
@@ -5208,12 +5210,14 @@ public class PostRecyclerViewAdapter extends PagingDataAdapter<Post, RecyclerVie
}
void loadFallbackDirectVideo() {
- mediaUri = Uri.parse(post.getVideoFallBackDirectUrl());
- post.setVideoDownloadUrl(post.getVideoFallBackDirectUrl());
- post.setVideoUrl(post.getVideoFallBackDirectUrl());
- post.setLoadRedgifsOrStreamableVideoSuccess(true);
- if (container != null) {
- container.onScrollStateChanged(RecyclerView.SCROLL_STATE_IDLE);
+ if (post.getVideoFallBackDirectUrl() != null) {
+ mediaUri = Uri.parse(post.getVideoFallBackDirectUrl());
+ post.setVideoDownloadUrl(post.getVideoFallBackDirectUrl());
+ post.setVideoUrl(post.getVideoFallBackDirectUrl());
+ post.setLoadRedgifsOrStreamableVideoSuccess(true);
+ if (container != null) {
+ container.onScrollStateChanged(RecyclerView.SCROLL_STATE_IDLE);
+ }
}
}
@@ -6238,12 +6242,14 @@ public class PostRecyclerViewAdapter extends PagingDataAdapter<Post, RecyclerVie
}
void loadFallbackDirectVideo() {
- mediaUri = Uri.parse(post.getVideoFallBackDirectUrl());
- post.setVideoDownloadUrl(post.getVideoFallBackDirectUrl());
- post.setVideoUrl(post.getVideoFallBackDirectUrl());
- post.setLoadRedgifsOrStreamableVideoSuccess(true);
- if (container != null) {
- container.onScrollStateChanged(RecyclerView.SCROLL_STATE_IDLE);
+ if (post.getVideoFallBackDirectUrl() != null) {
+ mediaUri = Uri.parse(post.getVideoFallBackDirectUrl());
+ post.setVideoDownloadUrl(post.getVideoFallBackDirectUrl());
+ post.setVideoUrl(post.getVideoFallBackDirectUrl());
+ post.setLoadRedgifsOrStreamableVideoSuccess(true);
+ if (container != null) {
+ container.onScrollStateChanged(RecyclerView.SCROLL_STATE_IDLE);
+ }
}
}
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/post/Post.java b/app/src/main/java/ml/docilealligator/infinityforreddit/post/Post.java
index d15c6f7e..52c1bf22 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/post/Post.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/post/Post.java
@@ -43,6 +43,7 @@ public class Post implements Parcelable {
private String url;
private String videoUrl;
private String videoDownloadUrl;
+ @Nullable
private String videoFallBackDirectUrl;
private String redgifsId;
private String streamableShortCode;
@@ -330,11 +331,12 @@ public class Post implements Parcelable {
this.videoDownloadUrl = videoDownloadUrl;
}
+ @Nullable
public String getVideoFallBackDirectUrl() {
return videoFallBackDirectUrl;
}
- public void setVideoFallBackDirectUrl(String videoFallBackDirectUrl) {
+ public void setVideoFallBackDirectUrl(@Nullable String videoFallBackDirectUrl) {
this.videoFallBackDirectUrl = videoFallBackDirectUrl;
}