mirror of
https://github.com/signalapp/Signal-Android.git
synced 2026-04-26 03:40:56 +01:00
Do not use View.getLayoutDirection().
This value doesn't populate until after the first layout pass. Instead, it appears to be safer to just read it from the Configuration.
This commit is contained in:
@@ -1084,8 +1084,8 @@ public class ConversationFragment extends LoggingFragment {
|
||||
|
||||
private void maybeShowSwipeToReplyTooltip() {
|
||||
if (!TextSecurePreferences.hasSeenSwipeToReplyTooltip(requireContext())) {
|
||||
int text = getResources().getConfiguration().getLayoutDirection() == View.LAYOUT_DIRECTION_LTR ? R.string.ConversationFragment_you_can_swipe_to_the_right_reply
|
||||
: R.string.ConversationFragment_you_can_swipe_to_the_left_reply;
|
||||
int text = ViewUtil.isLtr(requireContext()) ? R.string.ConversationFragment_you_can_swipe_to_the_right_reply
|
||||
: R.string.ConversationFragment_you_can_swipe_to_the_left_reply;
|
||||
TooltipPopup.forTarget(requireActivity().findViewById(R.id.menu_context_reply))
|
||||
.setText(text)
|
||||
.setTextColor(getResources().getColor(R.color.core_white))
|
||||
|
||||
@@ -176,10 +176,10 @@ public final class ConversationReactionOverlay extends RelativeLayout {
|
||||
|
||||
final float halfWidth = scrubberWidth / 2f + scrubberHorizontalMargin;
|
||||
final float screenWidth = getResources().getDisplayMetrics().widthPixels;
|
||||
final float downX = getLayoutDirection() == LAYOUT_DIRECTION_LTR ? lastSeenDownPoint.x : screenWidth - lastSeenDownPoint.x;
|
||||
final float downX = ViewUtil.isLtr(this) ? lastSeenDownPoint.x : screenWidth - lastSeenDownPoint.x;
|
||||
final float scrubberTranslationX = Util.clamp(downX - halfWidth,
|
||||
scrubberHorizontalMargin,
|
||||
screenWidth + scrubberHorizontalMargin - halfWidth * 2) * (getLayoutDirection() == LAYOUT_DIRECTION_LTR ? 1 : -1);
|
||||
screenWidth + scrubberHorizontalMargin - halfWidth * 2) * (ViewUtil.isLtr(this) ? 1 : -1);
|
||||
|
||||
backgroundView.setTranslationX(scrubberTranslationX);
|
||||
backgroundView.setTranslationY(scrubberTranslationY);
|
||||
@@ -275,7 +275,7 @@ public final class ConversationReactionOverlay extends RelativeLayout {
|
||||
}
|
||||
|
||||
private int getStart(@NonNull Rect rect) {
|
||||
if (getLayoutDirection() == LAYOUT_DIRECTION_LTR) {
|
||||
if (ViewUtil.isLtr(this)) {
|
||||
return rect.left;
|
||||
} else {
|
||||
return rect.right;
|
||||
@@ -283,7 +283,7 @@ public final class ConversationReactionOverlay extends RelativeLayout {
|
||||
}
|
||||
|
||||
private int getEnd(@NonNull Rect rect) {
|
||||
if (getLayoutDirection() == LAYOUT_DIRECTION_LTR) {
|
||||
if (ViewUtil.isLtr(this)) {
|
||||
return rect.right;
|
||||
} else {
|
||||
return rect.left;
|
||||
|
||||
Reference in New Issue
Block a user