Commit f339c333 authored by Jeff Boek's avatar Jeff Boek
Browse files

For #6833 - Adds Android 8.1 to the check inside `setLayoutDirectionIfNeeded`

parent 31b8f8ee
Loading
Loading
Loading
Loading
+5 −1
Original line number Diff line number Diff line
@@ -29,9 +29,13 @@ open class LocaleAwareAppCompatActivity : AppCompatActivity() {
     * https://github.com/mozilla-mobile/fenix/issues/9413
     * https://stackoverflow.com/questions/46296202/rtl-layout-bug-in-android-oreo#comment98890942_46298101
     */
    @SuppressWarnings("VariableNaming")
    @VisibleForTesting(otherwise = VisibleForTesting.PRIVATE)
    fun setLayoutDirectionIfNeeded() {
        if (Build.VERSION.SDK_INT == Build.VERSION_CODES.O) {
        val isAndroid8 = Build.VERSION.SDK_INT == Build.VERSION_CODES.O
        val isAndroid8_1 = Build.VERSION.SDK_INT == Build.VERSION_CODES.O_MR1

        if (isAndroid8 || isAndroid8_1) {
            window.decorView.layoutDirection = resources.configuration.layoutDirection
        }
    }
+1 −1
Original line number Diff line number Diff line
@@ -26,7 +26,7 @@ class LocaleAwareAppCompatActivityTest {
    }

    @Test
    @Config(sdk = [Build.VERSION_CODES.O])
    @Config(sdk = [Build.VERSION_CODES.O, Build.VERSION_CODES.O_MR1])
    fun `when version is Android 8 set layoutDirection`() {
        val activity = spy(Robolectric.buildActivity(LocaleAwareAppCompatActivity::class.java).get())
        activity.setLayoutDirectionIfNeeded()
+3 −0
Original line number Diff line number Diff line
@@ -12,6 +12,9 @@ permalink: /changelog/
* [Gecko](https://github.com/mozilla-mobile/android-components/blob/master/buildSrc/src/main/java/Gecko.kt)
* [Configuration](https://github.com/mozilla-mobile/android-components/blob/master/buildSrc/src/main/java/Config.kt)

* **support-locale**
  * Adds Android 8.1 to the check in `setLayoutDirectionIfNeeded` inside `LocaleAwareAppCompatActivity`

* **feature-top-sites**
  * ⚠️ **This is a breaking change**: Added `isDefault` to the top site entity, which allows application to specify a default top site that is added by the application. This is called through `TopSiteStorage.addTopSite`.
    * If your application is using Nightly Snapshots of v40.0.0, please test that the Top Sites feature still works and update to the latest v40.0.0 if any schema errors are encountered.