mirror of
https://github.com/revanced/revanced-integrations.git
synced 2025-01-08 11:05:49 +01:00
fix(youtube/sponsorblock): always show the video time without segments using left to right layout (#359)
This commit is contained in:
parent
2ea55af9ce
commit
86c27890ad
@ -58,23 +58,23 @@ public class SegmentPlaybackController {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Because loading can take time, show the skip to highlight for a few seconds after the segments load.
|
* Because loading can take time, show the skip to highlight for a few seconds after the segments load.
|
||||||
* This is the end time (in milliseconds) to no longer show the initial display skip to highlight.
|
* This is the system time (in milliseconds) to no longer show the initial display skip to highlight.
|
||||||
*/
|
*/
|
||||||
private static long highlightSegmentInitialShowEndTime;
|
private static long highlightSegmentInitialShowEndTime;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Current (non-highlight) segment that user can manually skip
|
* Current (non-highlight) segment that user can manually skip.
|
||||||
*/
|
*/
|
||||||
@Nullable
|
@Nullable
|
||||||
private static SponsorSegment segmentCurrentlyPlaying;
|
private static SponsorSegment segmentCurrentlyPlaying;
|
||||||
/**
|
/**
|
||||||
* Currently playing manual skip segment, that is scheduled to hide.
|
* Currently playing manual skip segment, that is scheduled to hide.
|
||||||
* This will always be NULL or equal to {@link #segmentCurrentlyPlaying}
|
* This will always be NULL or equal to {@link #segmentCurrentlyPlaying}.
|
||||||
*/
|
*/
|
||||||
@Nullable
|
@Nullable
|
||||||
private static SponsorSegment scheduledHideSegment;
|
private static SponsorSegment scheduledHideSegment;
|
||||||
/**
|
/**
|
||||||
* Upcoming segment that is scheduled to either autoskip or show the manual skip button
|
* Upcoming segment that is scheduled to either autoskip or show the manual skip button.
|
||||||
*/
|
*/
|
||||||
@Nullable
|
@Nullable
|
||||||
private static SponsorSegment scheduledUpcomingSegment;
|
private static SponsorSegment scheduledUpcomingSegment;
|
||||||
@ -110,7 +110,7 @@ public class SegmentPlaybackController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Clears all downloaded data
|
* Clears all downloaded data.
|
||||||
*/
|
*/
|
||||||
private static void clearData() {
|
private static void clearData() {
|
||||||
currentVideoId = null;
|
currentVideoId = null;
|
||||||
@ -507,7 +507,7 @@ public class SegmentPlaybackController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param segment can be either a highlight or a regular manual skip segment
|
* @param segment can be either a highlight or a regular manual skip segment.
|
||||||
*/
|
*/
|
||||||
public static void onSkipSegmentClicked(@NonNull SponsorSegment segment) {
|
public static void onSkipSegmentClicked(@NonNull SponsorSegment segment) {
|
||||||
try {
|
try {
|
||||||
@ -524,7 +524,7 @@ public class SegmentPlaybackController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Injection point
|
* Injection point.
|
||||||
*/
|
*/
|
||||||
public static void setSponsorBarAbsoluteLeft(final Rect rect) {
|
public static void setSponsorBarAbsoluteLeft(final Rect rect) {
|
||||||
setSponsorBarAbsoluteLeft(rect.left);
|
setSponsorBarAbsoluteLeft(rect.left);
|
||||||
@ -557,7 +557,7 @@ public class SegmentPlaybackController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Injection point
|
* Injection point.
|
||||||
*/
|
*/
|
||||||
public static void setSponsorBarAbsoluteRight(final Rect rect) {
|
public static void setSponsorBarAbsoluteRight(final Rect rect) {
|
||||||
setSponsorBarAbsoluteRight(rect.right);
|
setSponsorBarAbsoluteRight(rect.right);
|
||||||
@ -589,13 +589,14 @@ public class SegmentPlaybackController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Injection point
|
* Injection point.
|
||||||
*/
|
*/
|
||||||
public static String appendTimeWithoutSegments(String totalTime) {
|
public static String appendTimeWithoutSegments(String totalTime) {
|
||||||
try {
|
try {
|
||||||
if (SettingsEnum.SB_ENABLED.getBoolean() && SettingsEnum.SB_SHOW_TIME_WITHOUT_SEGMENTS.getBoolean()
|
if (SettingsEnum.SB_ENABLED.getBoolean() && SettingsEnum.SB_SHOW_TIME_WITHOUT_SEGMENTS.getBoolean()
|
||||||
&& !TextUtils.isEmpty(totalTime) && !TextUtils.isEmpty(timeWithoutSegments)) {
|
&& !TextUtils.isEmpty(totalTime) && !TextUtils.isEmpty(timeWithoutSegments)) {
|
||||||
return totalTime + timeWithoutSegments;
|
// Force LTR layout, to match the same LTR video time/length layout YouTube uses for all languages
|
||||||
|
return "\u202D" + totalTime + timeWithoutSegments; // u202D = left to right override
|
||||||
}
|
}
|
||||||
} catch (Exception ex) {
|
} catch (Exception ex) {
|
||||||
LogHelper.printException(() -> "appendTimeWithoutSegments failure", ex);
|
LogHelper.printException(() -> "appendTimeWithoutSegments failure", ex);
|
||||||
@ -631,13 +632,13 @@ public class SegmentPlaybackController {
|
|||||||
if (highlightSegmentTimeBarScreenWidth == -1) {
|
if (highlightSegmentTimeBarScreenWidth == -1) {
|
||||||
highlightSegmentTimeBarScreenWidth = (int) TypedValue.applyDimension(
|
highlightSegmentTimeBarScreenWidth = (int) TypedValue.applyDimension(
|
||||||
TypedValue.COMPLEX_UNIT_DIP, HIGHLIGHT_SEGMENT_DRAW_BAR_WIDTH,
|
TypedValue.COMPLEX_UNIT_DIP, HIGHLIGHT_SEGMENT_DRAW_BAR_WIDTH,
|
||||||
ReVancedUtils.getContext().getResources().getDisplayMetrics());
|
Objects.requireNonNull(ReVancedUtils.getContext()).getResources().getDisplayMetrics());
|
||||||
}
|
}
|
||||||
return highlightSegmentTimeBarScreenWidth;
|
return highlightSegmentTimeBarScreenWidth;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Injection point
|
* Injection point.
|
||||||
*/
|
*/
|
||||||
public static void drawSponsorTimeBars(final Canvas canvas, final float posY) {
|
public static void drawSponsorTimeBars(final Canvas canvas, final float posY) {
|
||||||
try {
|
try {
|
||||||
|
Loading…
Reference in New Issue
Block a user