From 1eedfd7eee3d45640caa485b77df50d17ba57dd2 Mon Sep 17 00:00:00 2001 From: "Yevhen Babiichuk (DustDFG)" Date: Fri, 9 Jan 2026 13:11:29 +0200 Subject: [PATCH] Convert /newpipe/util/StreamTypeUtil to kotlin --- .../schabi/newpipe/util/StreamTypeUtil.java | 50 ----------------- .../org/schabi/newpipe/util/StreamTypeUtil.kt | 54 +++++++++++++++++++ 2 files changed, 54 insertions(+), 50 deletions(-) delete mode 100644 app/src/main/java/org/schabi/newpipe/util/StreamTypeUtil.java create mode 100644 app/src/main/java/org/schabi/newpipe/util/StreamTypeUtil.kt diff --git a/app/src/main/java/org/schabi/newpipe/util/StreamTypeUtil.java b/app/src/main/java/org/schabi/newpipe/util/StreamTypeUtil.java deleted file mode 100644 index 0cc0ecf1f..000000000 --- a/app/src/main/java/org/schabi/newpipe/util/StreamTypeUtil.java +++ /dev/null @@ -1,50 +0,0 @@ -package org.schabi.newpipe.util; - -import org.schabi.newpipe.extractor.stream.StreamType; - -/** - * Utility class for {@link StreamType}. - */ -public final class StreamTypeUtil { - private StreamTypeUtil() { - // No impl pls - } - - /** - * Check if the {@link StreamType} of a stream is a livestream. - * - * @param streamType the stream type of the stream - * @return whether the stream type is {@link StreamType#AUDIO_STREAM}, - * {@link StreamType#AUDIO_LIVE_STREAM} or {@link StreamType#POST_LIVE_AUDIO_STREAM} - */ - public static boolean isAudio(final StreamType streamType) { - return streamType == StreamType.AUDIO_STREAM - || streamType == StreamType.AUDIO_LIVE_STREAM - || streamType == StreamType.POST_LIVE_AUDIO_STREAM; - } - - /** - * Check if the {@link StreamType} of a stream is a livestream. - * - * @param streamType the stream type of the stream - * @return whether the stream type is {@link StreamType#VIDEO_STREAM}, - * {@link StreamType#LIVE_STREAM} or {@link StreamType#POST_LIVE_STREAM} - */ - public static boolean isVideo(final StreamType streamType) { - return streamType == StreamType.VIDEO_STREAM - || streamType == StreamType.LIVE_STREAM - || streamType == StreamType.POST_LIVE_STREAM; - } - - /** - * Check if the {@link StreamType} of a stream is a livestream. - * - * @param streamType the stream type of the stream - * @return whether the stream type is {@link StreamType#LIVE_STREAM} or - * {@link StreamType#AUDIO_LIVE_STREAM} - */ - public static boolean isLiveStream(final StreamType streamType) { - return streamType == StreamType.LIVE_STREAM - || streamType == StreamType.AUDIO_LIVE_STREAM; - } -} diff --git a/app/src/main/java/org/schabi/newpipe/util/StreamTypeUtil.kt b/app/src/main/java/org/schabi/newpipe/util/StreamTypeUtil.kt new file mode 100644 index 000000000..2401a4f49 --- /dev/null +++ b/app/src/main/java/org/schabi/newpipe/util/StreamTypeUtil.kt @@ -0,0 +1,54 @@ +/* + * SPDX-FileCopyrightText: 2021-2026 NewPipe contributors + * SPDX-License-Identifier: GPL-3.0-or-later + */ + +package org.schabi.newpipe.util + +import org.schabi.newpipe.extractor.stream.StreamType + +/** + * Utility class for [StreamType]. + */ +object StreamTypeUtil { + /** + * Check if the [StreamType] of a stream is a livestream. + * + * @param streamType the stream type of the stream + * @return whether the stream type is [StreamType.AUDIO_STREAM], + * [StreamType.AUDIO_LIVE_STREAM] or [StreamType.POST_LIVE_AUDIO_STREAM] + */ + @JvmStatic + fun isAudio(streamType: StreamType): Boolean { + return streamType == StreamType.AUDIO_STREAM || + streamType == StreamType.AUDIO_LIVE_STREAM || + streamType == StreamType.POST_LIVE_AUDIO_STREAM + } + + /** + * Check if the [StreamType] of a stream is a livestream. + * + * @param streamType the stream type of the stream + * @return whether the stream type is [StreamType.VIDEO_STREAM], + * [StreamType.LIVE_STREAM] or [StreamType.POST_LIVE_STREAM] + */ + @JvmStatic + fun isVideo(streamType: StreamType): Boolean { + return streamType == StreamType.VIDEO_STREAM || + streamType == StreamType.LIVE_STREAM || + streamType == StreamType.POST_LIVE_STREAM + } + + /** + * Check if the [StreamType] of a stream is a livestream. + * + * @param streamType the stream type of the stream + * @return whether the stream type is [StreamType.LIVE_STREAM] or + * [StreamType.AUDIO_LIVE_STREAM] + */ + @JvmStatic + fun isLiveStream(streamType: StreamType): Boolean { + return streamType == StreamType.LIVE_STREAM || + streamType == StreamType.AUDIO_LIVE_STREAM + } +}