Skip to content

Commit bf0bc63

Browse files
author
Fabrice Di Meglio
committed
Improve Toast RTL support
- use Locale from Context Change-Id: Ic93bb6e3f9310d54d879c20754c9310154940565
1 parent d395ea1 commit bf0bc63

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

core/java/android/widget/Toast.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -376,8 +376,8 @@ public void handleShow() {
376376
mWM = WindowManagerImpl.getDefault();
377377
// We can resolve the Gravity here by using the Locale for getting
378378
// the layout direction
379-
final int layoutDirection = LocaleUtil.getLayoutDirectionFromLocale(
380-
Locale.getDefault());
379+
final Locale locale = mView.getContext().getResources().getConfiguration().locale;
380+
final int layoutDirection = LocaleUtil.getLayoutDirectionFromLocale(locale);
381381
final int gravity = Gravity.getAbsoluteGravity(mGravity, layoutDirection);
382382
mParams.gravity = gravity;
383383
if ((gravity & Gravity.HORIZONTAL_GRAVITY_MASK) == Gravity.FILL_HORIZONTAL) {

0 commit comments

Comments
 (0)