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
|
|
@ -5,10 +5,12 @@ import android.net.Uri;
|
|||
import android.widget.Toast;
|
||||
|
||||
import androidx.fragment.app.Fragment;
|
||||
import androidx.preference.PreferenceManager;
|
||||
|
||||
import org.schabi.newpipe.NewPipeDatabase;
|
||||
import org.schabi.newpipe.R;
|
||||
import org.schabi.newpipe.extractor.stream.StreamInfoItem;
|
||||
import org.schabi.newpipe.extractor.stream.StreamType;
|
||||
import org.schabi.newpipe.local.dialog.PlaylistAppendDialog;
|
||||
import org.schabi.newpipe.local.dialog.PlaylistCreationDialog;
|
||||
import org.schabi.newpipe.local.history.HistoryRecordManager;
|
||||
|
|
@ -191,6 +193,16 @@ public enum StreamDialogEntry {
|
|||
void onClick(Fragment fragment, StreamInfoItem infoItem);
|
||||
}
|
||||
|
||||
public static boolean shouldAddMarkAsWatched(final StreamType streamType,
|
||||
final Context context) {
|
||||
final boolean isWatchHistoryEnabled = PreferenceManager
|
||||
.getDefaultSharedPreferences(context)
|
||||
.getBoolean(context.getString(R.string.enable_watch_history_key), false);
|
||||
return streamType != StreamType.AUDIO_LIVE_STREAM
|
||||
&& streamType != StreamType.LIVE_STREAM
|
||||
&& isWatchHistoryEnabled;
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////
|
||||
// private method to open channel fragment //
|
||||
/////////////////////////////////////////////
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue