mirror of
https://github.com/inotia00/revanced-patches.git
synced 2025-05-16 22:37:17 +02:00
feat(YouTube - Overlay buttons): Add missing ALL_CONTENTS_WITH_TIME_ASCENDING
type (#105)
* Add `ALL_CONTENTS_WITH_TIME_ASCENDING` type * Rewrite function * Update arrays.xml * Update strings.xml * Update strings.xml * chore: Simplify * fix: Apply code review suggestions --------- Co-authored-by: inotia00 <108592928+inotia00@users.noreply.github.com>
This commit is contained in:
parent
dad6b3d5e4
commit
7023e5b323
@ -7,18 +7,19 @@ public enum PlaylistIdPrefix {
|
||||
* To check all available prefixes,
|
||||
* See <a href="https://github.com/RobertWesner/YouTube-Play-All/blob/main/documentation/available-lists.md">this document</a>.
|
||||
*/
|
||||
ALL_CONTENTS_WITH_TIME_DESCENDING("UU"),
|
||||
ALL_CONTENTS_WITH_POPULAR_DESCENDING("PU"),
|
||||
VIDEOS_ONLY_WITH_TIME_DESCENDING("UULF"),
|
||||
VIDEOS_ONLY_WITH_POPULAR_DESCENDING("UULP"),
|
||||
SHORTS_ONLY_WITH_TIME_DESCENDING("UUSH"),
|
||||
SHORTS_ONLY_WITH_POPULAR_DESCENDING("UUPS"),
|
||||
LIVESTREAMS_ONLY_WITH_TIME_DESCENDING("UULV"),
|
||||
LIVESTREAMS_ONLY_WITH_POPULAR_DESCENDING("UUPV"),
|
||||
ALL_MEMBERSHIPS_CONTENTS("UUMO"),
|
||||
MEMBERSHIPS_VIDEOS_ONLY("UUMF"),
|
||||
MEMBERSHIPS_SHORTS_ONLY("UUMS"),
|
||||
MEMBERSHIPS_LIVESTREAMS_ONLY("UUMV");
|
||||
ALL_CONTENTS_WITH_TIME_ASCENDING("UL", false),
|
||||
ALL_CONTENTS_WITH_TIME_DESCENDING("UU", true),
|
||||
ALL_CONTENTS_WITH_POPULAR_DESCENDING("PU", true),
|
||||
VIDEOS_ONLY_WITH_TIME_DESCENDING("UULF", true),
|
||||
VIDEOS_ONLY_WITH_POPULAR_DESCENDING("UULP", true),
|
||||
SHORTS_ONLY_WITH_TIME_DESCENDING("UUSH", true),
|
||||
SHORTS_ONLY_WITH_POPULAR_DESCENDING("UUPS", true),
|
||||
LIVESTREAMS_ONLY_WITH_TIME_DESCENDING("UULV", true),
|
||||
LIVESTREAMS_ONLY_WITH_POPULAR_DESCENDING("UUPV", true),
|
||||
ALL_MEMBERSHIPS_CONTENTS("UUMO", true),
|
||||
MEMBERSHIPS_VIDEOS_ONLY("UUMF", true),
|
||||
MEMBERSHIPS_SHORTS_ONLY("UUMS", true),
|
||||
MEMBERSHIPS_LIVESTREAMS_ONLY("UUMV", true);
|
||||
|
||||
/**
|
||||
* Prefix of playlist id.
|
||||
@ -26,7 +27,13 @@ public enum PlaylistIdPrefix {
|
||||
@NonNull
|
||||
public final String prefixId;
|
||||
|
||||
PlaylistIdPrefix(@NonNull String prefixId) {
|
||||
/**
|
||||
* Whether to use channelId.
|
||||
*/
|
||||
public final boolean useChannelId;
|
||||
|
||||
PlaylistIdPrefix(@NonNull String prefixId, boolean useChannelId) {
|
||||
this.prefixId = prefixId;
|
||||
this.useChannelId = useChannelId;
|
||||
}
|
||||
}
|
||||
|
@ -7,7 +7,6 @@ import static app.revanced.extension.youtube.patches.video.PlaybackSpeedPatch.us
|
||||
import android.app.AlertDialog;
|
||||
import android.content.Context;
|
||||
import android.media.AudioManager;
|
||||
import android.text.TextUtils;
|
||||
import android.util.Log;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
@ -128,34 +127,37 @@ public class VideoUtils extends IntentUtils {
|
||||
}
|
||||
|
||||
public static void openVideo(@NonNull String videoId) {
|
||||
openVideo(getVideoScheme(videoId, false), "");
|
||||
openVideo(getVideoScheme(videoId, false), false, null);
|
||||
}
|
||||
|
||||
public static void openVideo(@NonNull String videoId, boolean isShorts) {
|
||||
openVideo(getVideoScheme(videoId, isShorts), "");
|
||||
openVideo(getVideoScheme(videoId, isShorts), isShorts, null);
|
||||
}
|
||||
|
||||
public static void openVideo(@NonNull PlaylistIdPrefix prefixId) {
|
||||
openVideo(getVideoScheme(), prefixId.prefixId);
|
||||
public static void openVideo(@NonNull PlaylistIdPrefix playlistIdPrefix) {
|
||||
openVideo(getVideoScheme(), false, playlistIdPrefix);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create playlist with all channel videos.
|
||||
*/
|
||||
public static void openVideo(@NonNull String videoScheme, @NonNull String prefixId) {
|
||||
if (!TextUtils.isEmpty(prefixId)) {
|
||||
final String channelId = VideoInformation.getChannelId();
|
||||
// Channel id always starts with `UC` prefix
|
||||
if (!channelId.startsWith("UC")) {
|
||||
showToastShort(str("revanced_overlay_button_play_all_not_available_toast"));
|
||||
return;
|
||||
public static void openVideo(@NonNull String videoId, boolean isShorts, @Nullable PlaylistIdPrefix playlistIdPrefix) {
|
||||
final StringBuilder sb = new StringBuilder(getVideoScheme(videoId, isShorts));
|
||||
// Create playlist with all channel videos.
|
||||
if (playlistIdPrefix != null) {
|
||||
sb.append("&list=");
|
||||
sb.append(playlistIdPrefix.prefixId);
|
||||
if (playlistIdPrefix.useChannelId) {
|
||||
final String channelId = VideoInformation.getChannelId();
|
||||
// Channel id always starts with `UC` prefix
|
||||
if (!channelId.startsWith("UC")) {
|
||||
showToastShort(str("revanced_overlay_button_play_all_not_available_toast"));
|
||||
return;
|
||||
}
|
||||
sb.append(channelId.substring(2));
|
||||
} else {
|
||||
sb.append(videoId);
|
||||
}
|
||||
videoScheme += "&list=" + prefixId + channelId.substring(2);
|
||||
}
|
||||
final String finalVideoScheme = videoScheme;
|
||||
Logger.printInfo(() -> finalVideoScheme);
|
||||
|
||||
launchView(videoScheme, getContext().getPackageName());
|
||||
launchView(sb.toString(), getContext().getPackageName());
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -136,6 +136,7 @@
|
||||
<item>https://github.com/deniscerri/ytdlnis/releases/latest</item>
|
||||
</string-array>
|
||||
<string-array name="revanced_overlay_button_play_all_type_entries">
|
||||
<item>@string/revanced_overlay_button_play_all_type_entry_0</item>
|
||||
<item>@string/revanced_overlay_button_play_all_type_entry_1</item>
|
||||
<item>@string/revanced_overlay_button_play_all_type_entry_2</item>
|
||||
<item>@string/revanced_overlay_button_play_all_type_entry_3</item>
|
||||
@ -150,6 +151,7 @@
|
||||
<item>@string/revanced_overlay_button_play_all_type_entry_12</item>
|
||||
</string-array>
|
||||
<string-array name="revanced_overlay_button_play_all_type_entry_values">
|
||||
<item>ALL_CONTENTS_WITH_TIME_ASCENDING</item>
|
||||
<item>ALL_CONTENTS_WITH_TIME_DESCENDING</item>
|
||||
<item>ALL_CONTENTS_WITH_POPULAR_DESCENDING</item>
|
||||
<item>VIDEOS_ONLY_WITH_TIME_DESCENDING</item>
|
||||
|
@ -1057,6 +1057,7 @@ Tap and hold to undo.
|
||||
Info:
|
||||
• May not work on livestreams."</string>
|
||||
<string name="revanced_overlay_button_play_all_type_title">Generate playlist mode</string>
|
||||
<string name="revanced_overlay_button_play_all_type_entry_0">All contents (Sort by time, Ascending)</string>
|
||||
<string name="revanced_overlay_button_play_all_type_entry_1">All contents (Sort by time)</string>
|
||||
<string name="revanced_overlay_button_play_all_type_entry_2">All contents (Sort by popular)</string>
|
||||
<string name="revanced_overlay_button_play_all_type_entry_3">Videos only (Sort by time)</string>
|
||||
@ -1948,4 +1949,4 @@ AVC (H.264) has a maximum resolution of 1080p, and video playback will use more
|
||||
<string name="revanced_patches_excluded">Excluded</string>
|
||||
<string name="revanced_patches_included">Included</string>
|
||||
<string name="revanced_theme_default">Stock</string>
|
||||
</resources>
|
||||
</resources>
|
||||
|
Loading…
x
Reference in New Issue
Block a user