Revert "highlight locked segments in the vote menu"

This reverts commit 95f54b11
This commit is contained in:
caneleex 2022-01-25 22:47:53 +01:00
parent 7445ce6fa2
commit 4e040c8deb
3 changed files with 9 additions and 24 deletions

View File

@ -72,7 +72,6 @@ public abstract class SponsorBlockUtils {
public static boolean videoHasSegments = false;
public static String timeWithoutSegments = "";
private static final int sponsorBtnId = 1234;
private static final String LOCKED_COLOR = "#FFC83D";
public static final View.OnClickListener sponsorBlockBtnListener = v -> {
if (debug) {
Log.d(TAG, "Shield button clicked");
@ -213,17 +212,10 @@ public abstract class SponsorBlockUtils {
final SponsorSegment segment = sponsorSegmentsOfCurrentVideo[which];
final VoteOption[] voteOptions = VoteOption.values();
CharSequence[] items = new CharSequence[voteOptions.length];
String[] items = new String[voteOptions.length];
for (int i = 0; i < voteOptions.length; i++) {
VoteOption voteOption = voteOptions[i];
String title = voteOption.title;
if (segment.isLocked && voteOption.shouldHighlight) {
items[i] = Html.fromHtml(String.format("<font color=\"%s\">%s</font>", LOCKED_COLOR, title));
}
else {
items[i] = title;
}
items[i] = voteOptions[i].title;
}
new AlertDialog.Builder(context)
@ -424,7 +416,7 @@ public abstract class SponsorBlockUtils {
final SponsorSegment[] segments = original == null ? new SponsorSegment[1] : Arrays.copyOf(original, original.length + 1);
segments[segments.length - 1] = new SponsorSegment(newSponsorSegmentStartMillis, newSponsorSegmentEndMillis,
SponsorBlockSettings.SegmentInfo.UNSUBMITTED, null, false);
SponsorBlockSettings.SegmentInfo.UNSUBMITTED, null);
Arrays.sort(segments);
sponsorSegmentsOfCurrentVideo = segments;
@ -659,17 +651,14 @@ public abstract class SponsorBlockUtils {
}
public enum VoteOption {
UPVOTE(str("vote_upvote"), false),
DOWNVOTE(str("vote_downvote"), true),
CATEGORY_CHANGE(str("vote_category"), true);
UPVOTE(str("vote_upvote")),
DOWNVOTE(str("vote_downvote")),
CATEGORY_CHANGE(str("vote_category"));
public final String title;
public final boolean shouldHighlight;
VoteOption(String title, boolean shouldHighlight) {
VoteOption(String title) {
this.title = title;
this.shouldHighlight = shouldHighlight;
}
}

View File

@ -7,14 +7,12 @@ public class SponsorSegment implements Comparable<SponsorSegment> {
public final long end;
public final SponsorBlockSettings.SegmentInfo category;
public final String UUID;
public final boolean isLocked;
public SponsorSegment(long start, long end, SponsorBlockSettings.SegmentInfo category, String UUID, boolean isLocked) {
public SponsorSegment(long start, long end, SponsorBlockSettings.SegmentInfo category, String UUID) {
this.start = start;
this.end = end;
this.category = category;
this.UUID = UUID;
this.isLocked = isLocked;
}
@Override
@ -23,7 +21,6 @@ public class SponsorSegment implements Comparable<SponsorSegment> {
"start=" + start +
", end=" + end +
", category='" + category + '\'' +
", locked=" + isLocked +
'}';
}

View File

@ -54,11 +54,10 @@ public class Requester {
long end = (long) (segment.getDouble(1) * 1000);
String category = obj.getString("category");
String uuid = obj.getString("UUID");
boolean locked = obj.getInt("locked") == 1;
SponsorBlockSettings.SegmentInfo segmentCategory = SponsorBlockSettings.SegmentInfo.byCategoryKey(category);
if (segmentCategory != null && segmentCategory.behaviour.showOnTimeBar) {
SponsorSegment sponsorSegment = new SponsorSegment(start, end, segmentCategory, uuid, locked);
SponsorSegment sponsorSegment = new SponsorSegment(start, end, segmentCategory, uuid);
segments.add(sponsorSegment);
}
}