From d7b82ff43aa1b9678637f346ed52a8600e62c558 Mon Sep 17 00:00:00 2001 From: caneleex Date: Sun, 25 Apr 2021 15:20:31 +0200 Subject: [PATCH] add toast when voting while no segments are present --- integrations/java/pl/jakubweg/SponsorBlockUtils.java | 4 +++- integrations/res/values/strings.xml | 1 + 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/integrations/java/pl/jakubweg/SponsorBlockUtils.java b/integrations/java/pl/jakubweg/SponsorBlockUtils.java index 6be97ccaa..cfc4cfba9 100644 --- a/integrations/java/pl/jakubweg/SponsorBlockUtils.java +++ b/integrations/java/pl/jakubweg/SponsorBlockUtils.java @@ -374,8 +374,10 @@ public abstract class SponsorBlockUtils { } public static void onVotingClicked(final Context context) { - if (sponsorSegmentsOfCurrentVideo == null || sponsorSegmentsOfCurrentVideo.length == 0) // prevent crashing or empty dialog + if (sponsorSegmentsOfCurrentVideo == null || sponsorSegmentsOfCurrentVideo.length == 0) { + Toast.makeText(context.getApplicationContext(), str("vote_no_segments"), Toast.LENGTH_SHORT).show(); return; + } CharSequence[] titles = new CharSequence[sponsorSegmentsOfCurrentVideo.length]; for (int i = 0; i < sponsorSegmentsOfCurrentVideo.length; i++) { SponsorSegment segment = sponsorSegmentsOfCurrentVideo[i]; diff --git a/integrations/res/values/strings.xml b/integrations/res/values/strings.xml index a3484f165..05b7a0566 100644 --- a/integrations/res/values/strings.xml +++ b/integrations/res/values/strings.xml @@ -198,6 +198,7 @@ Upvote Downvote Change category + There are no segments to vote for Choose the segment category You\'ve disabled this category in the settings, enable it to be able to submit