Make toolbar direction for RTL layouts adjustable (#574)

This commit is contained in:
codokie 2024-03-27 07:04:59 +02:00 committed by GitHub
parent 613f2e80a3
commit fb9008e9fe
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 23 additions and 5 deletions

View file

@ -126,9 +126,7 @@ public final class SuggestionStripView extends RelativeLayout implements OnClick
showSuggestionsStrip();
}
public void setLayoutDirection(final boolean isRtlLanguage) {
final int layoutDirection = isRtlLanguage ? ViewCompat.LAYOUT_DIRECTION_RTL
: ViewCompat.LAYOUT_DIRECTION_LTR;
public void setLayoutDirection(final int layoutDirection) {
ViewCompat.setLayoutDirection(mSuggestionStripView, layoutDirection);
ViewCompat.setLayoutDirection(mSuggestionsStrip, layoutDirection);
}
@ -265,8 +263,14 @@ public final class SuggestionStripView extends RelativeLayout implements OnClick
}
public void setRtl(final boolean isRtlLanguage) {
mStripVisibilityGroup.setLayoutDirection(isRtlLanguage);
mRtl = isRtlLanguage ? -1 : 1;
final int layoutDirection;
if (!Settings.getInstance().getCurrent().mVarToolbarDirection)
layoutDirection = ViewCompat.LAYOUT_DIRECTION_LOCALE;
else{
layoutDirection = isRtlLanguage ? ViewCompat.LAYOUT_DIRECTION_RTL : ViewCompat.LAYOUT_DIRECTION_LTR;
mRtl = isRtlLanguage ? -1 : 1;
}
mStripVisibilityGroup.setLayoutDirection(layoutDirection);
}
public void setSuggestions(final SuggestedWords suggestedWords, final boolean isRtlLanguage) {