mirror of
https://github.com/revanced/revanced-patches
synced 2024-12-13 16:37:54 +01:00
fix(YouTube - ReturnYouTubeDislike): Fix text alignment on videos that don't use rolling number animations
This commit is contained in:
parent
90987d821f
commit
8fe9df75ef
@ -207,6 +207,26 @@ object ReturnYouTubeDislikePatch : BytecodePatch(
|
|||||||
}
|
}
|
||||||
} ?: throw RollingNumberMeasureTextFingerprint.exception
|
} ?: throw RollingNumberMeasureTextFingerprint.exception
|
||||||
|
|
||||||
|
// Additional text measurement method. Used if YouTube decides not to animate the likes count
|
||||||
|
// and sometimes used for initial video load.
|
||||||
|
RollingNumberStaticLabelMeasureTextFingerprint.also {
|
||||||
|
if (!it.resolve(context, RollingNumberMeasureTextParentFingerprint.result!!.classDef))
|
||||||
|
throw it.exception
|
||||||
|
}.result?.also {
|
||||||
|
it.mutableMethod.apply {
|
||||||
|
val measureTextIndex = it.scanResult.patternScanResult!!.startIndex + 1
|
||||||
|
val freeRegister = getInstruction<TwoRegisterInstruction>(0).registerA
|
||||||
|
|
||||||
|
addInstructions(
|
||||||
|
measureTextIndex + 1,
|
||||||
|
"""
|
||||||
|
move-result v$freeRegister
|
||||||
|
invoke-static {p1, v$freeRegister}, $INTEGRATIONS_CLASS_DESCRIPTOR->onRollingNumberMeasured(Ljava/lang/String;F)F
|
||||||
|
"""
|
||||||
|
)
|
||||||
|
}
|
||||||
|
} ?: throw RollingNumberStaticLabelMeasureTextFingerprint.exception
|
||||||
|
|
||||||
// The rolling number Span is missing styling since it's initially set as a String.
|
// The rolling number Span is missing styling since it's initially set as a String.
|
||||||
// Modify the UI text view and use the styled like/dislike Span.
|
// Modify the UI text view and use the styled like/dislike Span.
|
||||||
RollingNumberTextViewFingerprint.result?.let {
|
RollingNumberTextViewFingerprint.result?.let {
|
||||||
|
@ -0,0 +1,21 @@
|
|||||||
|
package app.revanced.patches.youtube.layout.returnyoutubedislike.fingerprints
|
||||||
|
|
||||||
|
import app.revanced.patcher.extensions.or
|
||||||
|
import app.revanced.patcher.fingerprint.MethodFingerprint
|
||||||
|
import com.android.tools.smali.dexlib2.AccessFlags
|
||||||
|
import com.android.tools.smali.dexlib2.Opcode
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Resolves to class found in [RollingNumberMeasureTextParentFingerprint].
|
||||||
|
*/
|
||||||
|
object RollingNumberStaticLabelMeasureTextFingerprint : MethodFingerprint(
|
||||||
|
returnType = "F",
|
||||||
|
accessFlags = AccessFlags.PUBLIC or AccessFlags.FINAL,
|
||||||
|
parameters = listOf("Ljava/lang/String;"),
|
||||||
|
opcodes = listOf(
|
||||||
|
Opcode.IGET_OBJECT,
|
||||||
|
Opcode.INVOKE_VIRTUAL,
|
||||||
|
Opcode.MOVE_RESULT,
|
||||||
|
Opcode.RETURN
|
||||||
|
)
|
||||||
|
)
|
Loading…
Reference in New Issue
Block a user