mirror of
https://github.com/revanced/revanced-patches
synced 2025-01-02 18:55:49 +01:00
fix(YouTube - Exit fullscreen mode): Exit fullscreen mode of first video opened after cold start
This commit is contained in:
parent
c5b3255f33
commit
be5cf2e834
@ -38,13 +38,20 @@ public class ExitFullscreenPatch {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ImageView fullscreenButton = PlayerControlsPatch.fullscreenButtonRef.get();
|
// If the user cold launches the app and plays a video but does not
|
||||||
if (fullscreenButton == null) {
|
// tap to show the overlay controls, the fullscreen button is not
|
||||||
Logger.printDebug(() -> "Fullscreen button is null, cannot click");
|
// set because the overlay controls are not attached.
|
||||||
} else {
|
// To fix this, push the perform click to the back fo the main thread,
|
||||||
Logger.printDebug(() -> "Clicking fullscreen button");
|
// and by then the overlay controls will be visible since the video is now finished.
|
||||||
fullscreenButton.performClick();
|
Utils.runOnMainThread(() -> {
|
||||||
}
|
ImageView button = PlayerControlsPatch.fullscreenButtonRef.get();
|
||||||
|
if (button == null) {
|
||||||
|
Logger.printDebug(() -> "Fullscreen button is null, cannot click");
|
||||||
|
} else {
|
||||||
|
Logger.printDebug(() -> "Clicking fullscreen button");
|
||||||
|
button.performClick();
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
} catch (Exception ex) {
|
} catch (Exception ex) {
|
||||||
Logger.printException(() -> "endOfVideoReached failure", ex);
|
Logger.printException(() -> "endOfVideoReached failure", ex);
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
package app.revanced.patches.youtube.layout.player.fullscreen
|
package app.revanced.patches.youtube.layout.player.fullscreen
|
||||||
|
|
||||||
import app.revanced.patcher.extensions.InstructionExtensions.addInstruction
|
|
||||||
import app.revanced.patcher.patch.bytecodePatch
|
import app.revanced.patcher.patch.bytecodePatch
|
||||||
import app.revanced.patches.all.misc.resources.addResources
|
import app.revanced.patches.all.misc.resources.addResources
|
||||||
import app.revanced.patches.all.misc.resources.addResourcesPatch
|
import app.revanced.patches.all.misc.resources.addResourcesPatch
|
||||||
@ -12,6 +11,7 @@ import app.revanced.patches.youtube.misc.settings.PreferenceScreen
|
|||||||
import app.revanced.patches.youtube.misc.settings.settingsPatch
|
import app.revanced.patches.youtube.misc.settings.settingsPatch
|
||||||
import app.revanced.patches.youtube.shared.autoRepeatFingerprint
|
import app.revanced.patches.youtube.shared.autoRepeatFingerprint
|
||||||
import app.revanced.patches.youtube.shared.autoRepeatParentFingerprint
|
import app.revanced.patches.youtube.shared.autoRepeatParentFingerprint
|
||||||
|
import app.revanced.util.addInstructionsAtControlFlowLabel
|
||||||
|
|
||||||
@Suppress("unused")
|
@Suppress("unused")
|
||||||
internal val exitFullscreenPatch = bytecodePatch(
|
internal val exitFullscreenPatch = bytecodePatch(
|
||||||
@ -57,9 +57,11 @@ internal val exitFullscreenPatch = bytecodePatch(
|
|||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
autoRepeatFingerprint.match(autoRepeatParentFingerprint.originalClassDef).method.addInstruction(
|
autoRepeatFingerprint.match(autoRepeatParentFingerprint.originalClassDef).method.apply {
|
||||||
0,
|
addInstructionsAtControlFlowLabel(
|
||||||
"invoke-static {}, $EXTENSION_CLASS_DESCRIPTOR->endOfVideoReached()V",
|
implementation!!.instructions.lastIndex,
|
||||||
)
|
"invoke-static {}, $EXTENSION_CLASS_DESCRIPTOR->endOfVideoReached()V",
|
||||||
|
)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user