Skip to content

Commit

Permalink
Fix UiPrefsFragmentTest failure by removing redundant languages at pr…
Browse files Browse the repository at this point in the history
…eference

At ContextLocaleExt.kt, remove conflicting locales API 24 or above
  • Loading branch information
TranceLove committed Feb 19, 2024
1 parent 4f39602 commit e7eb3d8
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@
package com.amaze.filemanager.utils

import android.content.Context
import android.os.Build
import android.os.Build.VERSION_CODES.N
import androidx.appcompat.app.AppCompatDelegate
import androidx.core.os.LocaleListCompat
import com.amaze.filemanager.R
Expand Down Expand Up @@ -50,6 +52,12 @@ fun Context.getLocaleListFromXml(): LocaleListCompat {
e.printStackTrace()
}

// Remove locale tags that would produce same locale on Android N or above
if (Build.VERSION.SDK_INT >= N) {
tagsList.remove("id")
tagsList.remove("he")
}

return LocaleListCompat.forLanguageTags(tagsList.joinToString(","))
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,12 @@ import kotlin.random.Random
* Tests for [UiPrefsFragment].
*/
@Config(
sdk = [Build.VERSION_CODES.KITKAT, Build.VERSION_CODES.P, Build.VERSION_CODES.R],
sdk = [
Build.VERSION_CODES.KITKAT,
Build.VERSION_CODES.N,
Build.VERSION_CODES.P,
Build.VERSION_CODES.R
],
shadows = [
ShadowMultiDex::class,
ShadowStorageManager::class,
Expand Down

0 comments on commit e7eb3d8

Please sign in to comment.