diff options
author | Alex Ning <chineseperson5@gmail.com> | 2020-05-07 06:10:41 +0000 |
---|---|---|
committer | Alex Ning <chineseperson5@gmail.com> | 2020-05-07 06:10:41 +0000 |
commit | c705292bf8f8568621e2831f58e9200479706e31 (patch) | |
tree | a2349e5dc9c379acfad03f965280b5d2d28d118c /app/src | |
parent | e439b840957030cdce7b310b595cfa9add844422 (diff) | |
download | infinity-for-reddit-c705292bf8f8568621e2831f58e9200479706e31.tar infinity-for-reddit-c705292bf8f8568621e2831f58e9200479706e31.tar.gz infinity-for-reddit-c705292bf8f8568621e2831f58e9200479706e31.tar.bz2 infinity-for-reddit-c705292bf8f8568621e2831f58e9200479706e31.tar.lz infinity-for-reddit-c705292bf8f8568621e2831f58e9200479706e31.tar.xz infinity-for-reddit-c705292bf8f8568621e2831f58e9200479706e31.tar.zst infinity-for-reddit-c705292bf8f8568621e2831f58e9200479706e31.zip |
Stop autoplay when wifi is lost in ViewPostDetailActivity if video autoplay is set to wifi only.
Diffstat (limited to '')
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) { |