aboutsummaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
Diffstat (limited to 'app')
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/Adapter/PostRecyclerViewAdapter.java4
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/Fragment/PostFragment.java17
2 files changed, 21 insertions, 0 deletions
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/Adapter/PostRecyclerViewAdapter.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Adapter/PostRecyclerViewAdapter.java
index 19df7a8c..9840d050 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/Adapter/PostRecyclerViewAdapter.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Adapter/PostRecyclerViewAdapter.java
@@ -1305,6 +1305,10 @@ public class PostRecyclerViewAdapter extends PagedListAdapter<Post, RecyclerView
mAutoplay = autoplay;
}
+ public boolean isAutoplay() {
+ return mAutoplay;
+ }
+
@Override
public void onViewRecycled(@NonNull RecyclerView.ViewHolder holder) {
super.onViewRecycled(holder);
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/Fragment/PostFragment.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Fragment/PostFragment.java
index 9d058e3b..53dd904b 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/Fragment/PostFragment.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Fragment/PostFragment.java
@@ -674,6 +674,11 @@ public class PostFragment extends Fragment implements FragmentCommunicator {
return false;
}
+ if (mAdapter != null && mAdapter.isAutoplay()) {
+ mAdapter.setAutoplay(false);
+ refreshAdapter();
+ }
+
isInLazyMode = true;
isLazyModePaused = false;
@@ -688,6 +693,14 @@ public class PostFragment extends Fragment implements FragmentCommunicator {
@Override
public void stopLazyMode() {
+ if (mAdapter != null) {
+ String autoplayString = mSharedPreferences.getString(SharedPreferencesUtils.VIDEO_AUTOPLAY, SharedPreferencesUtils.VIDEO_AUTOPLAY_VALUE_NEVER);
+ if (autoplayString.equals(SharedPreferencesUtils.VIDEO_AUTOPLAY_VALUE_ALWAYS_ON) ||
+ (autoplayString.equals(SharedPreferencesUtils.VIDEO_AUTOPLAY_VALUE_ON_WIFI) && Utils.isConnectedToWifi(activity))) {
+ mAdapter.setAutoplay(true);
+ refreshAdapter();
+ }
+ }
isInLazyMode = false;
isLazyModePaused = false;
lazyModeRunnable.resetOldPosition();
@@ -700,6 +713,10 @@ public class PostFragment extends Fragment implements FragmentCommunicator {
@Override
public void resumeLazyMode(boolean resumeNow) {
if (isInLazyMode) {
+ if (mAdapter != null && mAdapter.isAutoplay()) {
+ mAdapter.setAutoplay(false);
+ refreshAdapter();
+ }
isLazyModePaused = false;
window.addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);