mirror of
https://codeberg.org/Bazsalanszky/Infinity-For-Lemmy.git
synced 2024-11-07 03:07:26 +01:00
Stop autoplay when wifi is lost in ViewPostDetailActivity if video autoplay is set to wifi only.
This commit is contained in:
parent
e439b84095
commit
c705292bf8
@ -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);
|
||||
|
@ -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) {
|
||||
|
Loading…
Reference in New Issue
Block a user