Factor out shouldAddMarkAsWatched as a shared function
This commit is contained in:
parent
108af48b76
commit
dee32c3dc5
6 changed files with 23 additions and 38 deletions
|
|
@ -356,13 +356,7 @@ class FeedFragment : BaseStateFragment<FeedState>() {
|
|||
}
|
||||
|
||||
// show "mark as watched" only when watch history is enabled
|
||||
val isWatchHistoryEnabled = PreferenceManager
|
||||
.getDefaultSharedPreferences(context)
|
||||
.getBoolean(getString(R.string.enable_watch_history_key), false)
|
||||
if (item.streamType != StreamType.AUDIO_LIVE_STREAM &&
|
||||
item.streamType != StreamType.LIVE_STREAM &&
|
||||
isWatchHistoryEnabled
|
||||
) {
|
||||
if (StreamDialogEntry.shouldAddMarkAsWatched(item.streamType, context)) {
|
||||
entries.add(
|
||||
StreamDialogEntry.mark_as_watched
|
||||
)
|
||||
|
|
|
|||
|
|
@ -14,7 +14,6 @@ import android.widget.Toast;
|
|||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.preference.PreferenceManager;
|
||||
import androidx.viewbinding.ViewBinding;
|
||||
|
||||
import com.google.android.material.snackbar.Snackbar;
|
||||
|
|
@ -369,13 +368,10 @@ public class StatisticsPlaylistFragment
|
|||
}
|
||||
|
||||
// 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.getStreamEntity().getStreamType() != StreamType.AUDIO_LIVE_STREAM
|
||||
&& item.getStreamEntity().getStreamType() != StreamType.LIVE_STREAM
|
||||
&& isWatchHistoryEnabled
|
||||
) {
|
||||
if (StreamDialogEntry.shouldAddMarkAsWatched(
|
||||
item.getStreamEntity().getStreamType(),
|
||||
context
|
||||
)) {
|
||||
entries.add(
|
||||
StreamDialogEntry.mark_as_watched
|
||||
);
|
||||
|
|
|
|||
|
|
@ -19,7 +19,6 @@ import android.widget.Toast;
|
|||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.appcompat.app.AlertDialog;
|
||||
import androidx.preference.PreferenceManager;
|
||||
import androidx.recyclerview.widget.ItemTouchHelper;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
import androidx.viewbinding.ViewBinding;
|
||||
|
|
@ -785,13 +784,10 @@ public class LocalPlaylistFragment extends BaseLocalListFragment<List<PlaylistSt
|
|||
}
|
||||
|
||||
// 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.getStreamEntity().getStreamType() != StreamType.AUDIO_LIVE_STREAM
|
||||
&& item.getStreamEntity().getStreamType() != StreamType.LIVE_STREAM
|
||||
&& isWatchHistoryEnabled
|
||||
) {
|
||||
if (StreamDialogEntry.shouldAddMarkAsWatched(
|
||||
item.getStreamEntity().getStreamType(),
|
||||
context
|
||||
)) {
|
||||
entries.add(
|
||||
StreamDialogEntry.mark_as_watched
|
||||
);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue