Factor out shouldAddMarkAsWatched as a shared function

This commit is contained in:
Nathan Schulzke 2021-11-13 10:14:54 -07:00
parent 108af48b76
commit dee32c3dc5
6 changed files with 23 additions and 38 deletions

View file

@ -380,13 +380,7 @@ public abstract class BaseListFragment<I, N> extends BaseStateFragment<I>
}
// show "mark as watched" only when watch history is enabled
final boolean isWatchHistoryEnabled = PreferenceManager
.getDefaultSharedPreferences(context)
.getBoolean(getString(R.string.enable_watch_history_key), false);
if (item.getStreamType() != StreamType.AUDIO_LIVE_STREAM
&& item.getStreamType() != StreamType.LIVE_STREAM
&& isWatchHistoryEnabled
) {
if (StreamDialogEntry.shouldAddMarkAsWatched(item.getStreamType(), context)) {
entries.add(
StreamDialogEntry.mark_as_watched
);

View file

@ -15,7 +15,6 @@ import android.view.ViewGroup;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.appcompat.content.res.AppCompatResources;
import androidx.preference.PreferenceManager;
import androidx.viewbinding.ViewBinding;
import org.reactivestreams.Subscriber;
@ -178,13 +177,7 @@ public class PlaylistFragment extends BaseListInfoFragment<PlaylistInfo> {
}
// show "mark as watched" only when watch history is enabled
final boolean isWatchHistoryEnabled = PreferenceManager
.getDefaultSharedPreferences(context)
.getBoolean(getString(R.string.enable_watch_history_key), false);
if (item.getStreamType() != StreamType.AUDIO_LIVE_STREAM
&& item.getStreamType() != StreamType.LIVE_STREAM
&& isWatchHistoryEnabled
) {
if (StreamDialogEntry.shouldAddMarkAsWatched(item.getStreamType(), context)) {
entries.add(
StreamDialogEntry.mark_as_watched
);