1
0
mirror of https://github.com/KokaKiwi/BarInsta synced 2024-11-22 22:57:29 +00:00

Fix auto play videos setting not correctly set

This commit is contained in:
Ammar Githam 2020-09-09 00:38:49 +09:00
parent d4a28d6aa1
commit 3de2f4ea99

View File

@ -67,7 +67,6 @@ public class FeedFragment extends Fragment implements SwipeRefreshLayout.OnRefre
private static final String TAG = "FeedFragment"; private static final String TAG = "FeedFragment";
private static final double MAX_VIDEO_HEIGHT = 0.9 * Utils.displayMetrics.heightPixels; private static final double MAX_VIDEO_HEIGHT = 0.9 * Utils.displayMetrics.heightPixels;
private static final int RESIZED_VIDEO_HEIGHT = (int) (0.8 * Utils.displayMetrics.heightPixels); private static final int RESIZED_VIDEO_HEIGHT = (int) (0.8 * Utils.displayMetrics.heightPixels);
private static final boolean SHOULD_AUTO_PLAY = settingsHelper.getBoolean(Constants.AUTOPLAY_VIDEOS);
private MainActivity fragmentActivity; private MainActivity fragmentActivity;
private CoordinatorLayout root; private CoordinatorLayout root;
@ -80,6 +79,7 @@ public class FeedFragment extends Fragment implements SwipeRefreshLayout.OnRefre
private boolean shouldRefresh = true; private boolean shouldRefresh = true;
private boolean isPullToRefresh; private boolean isPullToRefresh;
private final boolean shouldAutoPlay = settingsHelper.getBoolean(Constants.AUTOPLAY_VIDEOS);
private final FetchListener<FeedModel[]> feedFetchListener = new FetchListener<FeedModel[]>() { private final FetchListener<FeedModel[]> feedFetchListener = new FetchListener<FeedModel[]>() {
@Override @Override
public void doBefore() { public void doBefore() {
@ -320,7 +320,7 @@ public class FeedFragment extends Fragment implements SwipeRefreshLayout.OnRefre
@Override @Override
public void onResume() { public void onResume() {
super.onResume(); super.onResume();
if (videoAwareRecyclerScroller != null && SHOULD_AUTO_PLAY) { if (videoAwareRecyclerScroller != null && shouldAutoPlay) {
videoAwareRecyclerScroller.startPlaying(); videoAwareRecyclerScroller.startPlaying();
} }
} }
@ -347,7 +347,7 @@ public class FeedFragment extends Fragment implements SwipeRefreshLayout.OnRefre
fetchFeed(); fetchFeed();
} }
}); });
if (SHOULD_AUTO_PLAY) { if (shouldAutoPlay) {
videoAwareRecyclerScroller = new VideoAwareRecyclerScroller(); videoAwareRecyclerScroller = new VideoAwareRecyclerScroller();
binding.feedRecyclerView.addOnScrollListener(videoAwareRecyclerScroller); binding.feedRecyclerView.addOnScrollListener(videoAwareRecyclerScroller);
} }