mirror of
https://github.com/revanced/revanced-integrations.git
synced 2025-02-10 11:06:47 +01:00
Merge pull request #31 from caneleex/patch/buttons-behavior
fix a lot of unintended button behaviors
This commit is contained in:
commit
0797155a25
@ -272,6 +272,10 @@ public class PlayerController {
|
|||||||
* Called very high frequency (once every about 100ms), also in background. It sometimes triggers when a video is paused (couple times in the row with the same value)
|
* Called very high frequency (once every about 100ms), also in background. It sometimes triggers when a video is paused (couple times in the row with the same value)
|
||||||
*/
|
*/
|
||||||
public static void setCurrentVideoTimeHighPrecision(final long millis) {
|
public static void setCurrentVideoTimeHighPrecision(final long millis) {
|
||||||
|
if ((millis < lastKnownVideoTime && lastKnownVideoTime >= currentVideoLength) || millis == 0) {
|
||||||
|
SponsorBlockUtils.showShieldButton(); // skipping from end to the video will show the buttons again
|
||||||
|
SponsorBlockUtils.showVoteButton();
|
||||||
|
}
|
||||||
if (lastKnownVideoTime > 0) {
|
if (lastKnownVideoTime > 0) {
|
||||||
lastKnownVideoTime = millis;
|
lastKnownVideoTime = millis;
|
||||||
VideoInformation.lastKnownVideoTime = lastKnownVideoTime;
|
VideoInformation.lastKnownVideoTime = lastKnownVideoTime;
|
||||||
|
@ -103,7 +103,7 @@ public class ShieldButton {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static boolean shouldBeShown() {
|
static boolean shouldBeShown() {
|
||||||
return SponsorBlockSettings.isSponsorBlockEnabled && SponsorBlockSettings.isAddNewSegmentEnabled;
|
return SponsorBlockSettings.isSponsorBlockEnabled && SponsorBlockSettings.isAddNewSegmentEnabled;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -84,13 +84,14 @@ public class SponsorBlockSettings {
|
|||||||
SkipSegmentView.hide();
|
SkipSegmentView.hide();
|
||||||
NewSegmentHelperLayout.hide();
|
NewSegmentHelperLayout.hide();
|
||||||
SponsorBlockUtils.hideShieldButton();
|
SponsorBlockUtils.hideShieldButton();
|
||||||
|
SponsorBlockUtils.hideVoteButton();
|
||||||
PlayerController.sponsorSegmentsOfCurrentVideo = null;
|
PlayerController.sponsorSegmentsOfCurrentVideo = null;
|
||||||
} else if (/*isAddNewSegmentEnabled*/false) {
|
} else if (/*isAddNewSegmentEnabled*/false) {
|
||||||
SponsorBlockUtils.showShieldButton();
|
SponsorBlockUtils.showShieldButton();
|
||||||
}
|
}
|
||||||
|
|
||||||
isAddNewSegmentEnabled = preferences.getBoolean(PREFERENCES_KEY_NEW_SEGMENT_ENABLED, isAddNewSegmentEnabled);
|
isAddNewSegmentEnabled = preferences.getBoolean(PREFERENCES_KEY_NEW_SEGMENT_ENABLED, isAddNewSegmentEnabled);
|
||||||
if (!/*isAddNewSegmentEnabled*/false) {
|
if (!isAddNewSegmentEnabled) {
|
||||||
NewSegmentHelperLayout.hide();
|
NewSegmentHelperLayout.hide();
|
||||||
SponsorBlockUtils.hideShieldButton();
|
SponsorBlockUtils.hideShieldButton();
|
||||||
} else {
|
} else {
|
||||||
|
@ -296,7 +296,7 @@ public abstract class SponsorBlockUtils {
|
|||||||
|
|
||||||
public static void showShieldButton() {
|
public static void showShieldButton() {
|
||||||
View i = ShieldButton._shieldBtn.get();
|
View i = ShieldButton._shieldBtn.get();
|
||||||
if (i == null) return;
|
if (i == null || !ShieldButton.shouldBeShown()) return;
|
||||||
i.setVisibility(VISIBLE);
|
i.setVisibility(VISIBLE);
|
||||||
i.bringToFront();
|
i.bringToFront();
|
||||||
i.requestLayout();
|
i.requestLayout();
|
||||||
@ -311,7 +311,7 @@ public abstract class SponsorBlockUtils {
|
|||||||
|
|
||||||
public static void showVoteButton() {
|
public static void showVoteButton() {
|
||||||
View i = VotingButton._votingButton.get();
|
View i = VotingButton._votingButton.get();
|
||||||
if (i == null) return;
|
if (i == null || !VotingButton.shouldBeShown()) return;
|
||||||
i.setVisibility(VISIBLE);
|
i.setVisibility(VISIBLE);
|
||||||
i.bringToFront();
|
i.bringToFront();
|
||||||
i.requestLayout();
|
i.requestLayout();
|
||||||
|
@ -103,7 +103,7 @@ public class VotingButton {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static boolean shouldBeShown() {
|
static boolean shouldBeShown() {
|
||||||
return SponsorBlockSettings.isVotingEnabled && SponsorBlockSettings.isSponsorBlockEnabled;
|
return SponsorBlockSettings.isVotingEnabled && SponsorBlockSettings.isSponsorBlockEnabled;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user