From b343c40d423e668ad3af699b8a0e926ea95aa45f 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 --- app/src/main/java/pl/jakubweg/SponsorBlockUtils.java | 4 +++- app/src/main/res/values/strings.xml | 1 + 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/pl/jakubweg/SponsorBlockUtils.java b/app/src/main/java/pl/jakubweg/SponsorBlockUtils.java index 6be97cc..cfc4cfb 100644 --- a/app/src/main/java/pl/jakubweg/SponsorBlockUtils.java +++ b/app/src/main/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/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index a3484f1..05b7a05 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/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