Skip to content
This repository has been archived by the owner on Feb 20, 2023. It is now read-only.

Commit

Permalink
Closes #28342: change the ui direction after a locale change
Browse files Browse the repository at this point in the history
  • Loading branch information
mike a authored and mergify[bot] committed Jan 20, 2023
1 parent fbf3c43 commit 26551b6
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions app/src/main/java/org/mozilla/fenix/HomeActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import android.os.Build
import android.os.Bundle
import android.os.StrictMode
import android.os.SystemClock
import android.text.TextUtils
import android.text.format.DateUtils
import android.util.AttributeSet
import android.view.ActionMode
Expand Down Expand Up @@ -143,6 +144,7 @@ import org.mozilla.fenix.trackingprotection.TrackingProtectionPanelDialogFragmen
import org.mozilla.fenix.utils.BrowsersCache
import org.mozilla.fenix.utils.Settings
import java.lang.ref.WeakReference
import java.util.Locale

/**
* The main activity of the application. The application is primarily a single Activity (this one)
Expand Down Expand Up @@ -238,6 +240,10 @@ open class HomeActivity : LocaleAwareAppCompatActivity(), NavHostActivity {

components.publicSuffixList.prefetch()

// Changing a language on the Language screen restarts the activity, but the activity keeps
// the old layout direction. We have to update the direction manually.
window.decorView.layoutDirection = TextUtils.getLayoutDirectionFromLocale(Locale.getDefault())

binding = ActivityHomeBinding.inflate(layoutInflater)
setContentView(binding.root)
ProfilerMarkers.addListenerForOnGlobalLayout(components.core.engine, this, binding.root)
Expand Down

0 comments on commit 26551b6

Please sign in to comment.