1
mirror of https://github.com/revanced/revanced-integrations synced 2024-11-22 05:02:19 +01:00

fix(youtube/return-youtube-dislike): fix right to left text layout (#333)

This commit is contained in:
LisoUseInAIKyrios 2023-03-14 22:52:45 +04:00 committed by GitHub
commit 2dd14313a6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -434,14 +434,14 @@ public class ReturnYouTubeDislike {
// left separator
final Rect leftSeparatorBounds = new Rect(0, 0, 3, 54);
String leftSeparatorString = ReVancedUtils.isRightToLeftTextLayout()
? "\u200F " // u200F = right to left character
: "\u2FF0 "; // u2FF0 = left to right character
? "\u200F " // u200F = right to left character
: "\u200E "; // u200E = left to right character
Spannable leftSeparatorSpan = new SpannableString(leftSeparatorString);
ShapeDrawable shapeDrawable = new ShapeDrawable(new RectShape());
shapeDrawable.getPaint().setColor(separatorColor);
shapeDrawable.setBounds(leftSeparatorBounds);
leftSeparatorSpan.setSpan(new VerticallyCenteredImageSpan(shapeDrawable), 0, 1,
Spannable.SPAN_INCLUSIVE_EXCLUSIVE);
leftSeparatorSpan.setSpan(new VerticallyCenteredImageSpan(shapeDrawable), 1, 2,
Spannable.SPAN_INCLUSIVE_EXCLUSIVE); // drawable cannot overwrite RTL or LTR character
builder.append(leftSeparatorSpan);
}