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 // left separator
final Rect leftSeparatorBounds = new Rect(0, 0, 3, 54); final Rect leftSeparatorBounds = new Rect(0, 0, 3, 54);
String leftSeparatorString = ReVancedUtils.isRightToLeftTextLayout() String leftSeparatorString = ReVancedUtils.isRightToLeftTextLayout()
? "\u200F " // u200F = right to left character ? "\u200F " // u200F = right to left character
: "\u2FF0 "; // u2FF0 = left to right character : "\u200E "; // u200E = left to right character
Spannable leftSeparatorSpan = new SpannableString(leftSeparatorString); Spannable leftSeparatorSpan = new SpannableString(leftSeparatorString);
ShapeDrawable shapeDrawable = new ShapeDrawable(new RectShape()); ShapeDrawable shapeDrawable = new ShapeDrawable(new RectShape());
shapeDrawable.getPaint().setColor(separatorColor); shapeDrawable.getPaint().setColor(separatorColor);
shapeDrawable.setBounds(leftSeparatorBounds); shapeDrawable.setBounds(leftSeparatorBounds);
leftSeparatorSpan.setSpan(new VerticallyCenteredImageSpan(shapeDrawable), 0, 1, leftSeparatorSpan.setSpan(new VerticallyCenteredImageSpan(shapeDrawable), 1, 2,
Spannable.SPAN_INCLUSIVE_EXCLUSIVE); Spannable.SPAN_INCLUSIVE_EXCLUSIVE); // drawable cannot overwrite RTL or LTR character
builder.append(leftSeparatorSpan); builder.append(leftSeparatorSpan);
} }