diff options
Diffstat (limited to 'app/src/main/java/ml/docilealligator/infinityforreddit')
2 files changed, 16 insertions, 0 deletions
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/ViewPostDetailActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/ViewPostDetailActivity.java index 764ede0d..f7068f0b 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/ViewPostDetailActivity.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/ViewPostDetailActivity.java @@ -64,6 +64,7 @@ import ml.docilealligator.infinityforreddit.CustomView.CustomToroContainer; import ml.docilealligator.infinityforreddit.DeleteThing; import ml.docilealligator.infinityforreddit.Event.ChangeNSFWBlurEvent; import ml.docilealligator.infinityforreddit.Event.ChangeSpoilerBlurEvent; +import ml.docilealligator.infinityforreddit.Event.ChangeWifiStatusEvent; import ml.docilealligator.infinityforreddit.Event.PostUpdateEventToDetailActivity; import ml.docilealligator.infinityforreddit.Event.PostUpdateEventToPostList; import ml.docilealligator.infinityforreddit.Event.SwitchAccountEvent; @@ -1238,6 +1239,17 @@ public class ViewPostDetailActivity extends BaseActivity implements FlairBottomS } } + @Subscribe + public void onChangeWifiStatusEvent(ChangeWifiStatusEvent changeWifiStatusEvent) { + if (mAdapter != null) { + String autoplay = mSharedPreferences.getString(SharedPreferencesUtils.VIDEO_AUTOPLAY, SharedPreferencesUtils.VIDEO_AUTOPLAY_VALUE_NEVER); + if (autoplay.equals(SharedPreferencesUtils.VIDEO_AUTOPLAY_VALUE_ON_WIFI)) { + mAdapter.setAutoplay(changeWifiStatusEvent.isConnectedToWifi); + refreshAdapter(); + } + } + } + @Override public boolean onCreateOptionsMenu(Menu menu) { getMenuInflater().inflate(R.menu.view_post_detail_activity, menu); diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/Adapter/CommentAndPostRecyclerViewAdapter.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Adapter/CommentAndPostRecyclerViewAdapter.java index 14d6686b..674dff72 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/Adapter/CommentAndPostRecyclerViewAdapter.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Adapter/CommentAndPostRecyclerViewAdapter.java @@ -1451,6 +1451,10 @@ public class CommentAndPostRecyclerViewAdapter extends RecyclerView.Adapter<Recy return -1; } + public void setAutoplay(boolean autoplay) { + mAutoplay = autoplay; + } + @Override public void onViewRecycled(@NonNull RecyclerView.ViewHolder holder) { if (holder instanceof CommentViewHolder) { |