Move to automatic generation of locales_config

This commit is contained in:
Matthieu 2023-08-05 17:04:22 +02:00
parent db3da57b7b
commit eb014290ff
6 changed files with 24 additions and 47 deletions

View File

@ -21,13 +21,17 @@ android {
namespace 'org.pixeldroid.app'
compileSdkVersion 33
buildToolsVersion '33.0.0'
buildToolsVersion '33.0.1'
compileOptions {
coreLibraryDesugaringEnabled true
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
androidResources {
generateLocaleConfig true
}
kotlinOptions {
jvmTarget = JavaVersion.VERSION_1_8
freeCompilerArgs += ["-opt-in=kotlin.RequiresOptIn"]
@ -141,14 +145,14 @@ dependencies {
implementation 'androidx.core:core-ktx:1.10.1'
implementation 'androidx.preference:preference-ktx:1.2.0'
implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
implementation 'androidx.navigation:navigation-fragment-ktx:2.5.3'
implementation 'androidx.navigation:navigation-ui-ktx:2.5.3'
implementation 'androidx.navigation:navigation-fragment-ktx:2.6.0'
implementation 'androidx.navigation:navigation-ui-ktx:2.6.0'
implementation "androidx.browser:browser:1.5.0"
implementation 'androidx.recyclerview:recyclerview:1.3.0'
implementation 'androidx.recyclerview:recyclerview:1.3.1'
implementation "androidx.swiperefreshlayout:swiperefreshlayout:1.1.0"
implementation 'androidx.navigation:navigation-fragment-ktx:2.5.3'
implementation 'androidx.navigation:navigation-ui-ktx:2.5.3'
implementation 'androidx.paging:paging-runtime-ktx:3.1.1'
implementation 'androidx.navigation:navigation-fragment-ktx:2.6.0'
implementation 'androidx.navigation:navigation-ui-ktx:2.6.0'
implementation 'androidx.paging:paging-runtime-ktx:3.2.0'
implementation 'androidx.lifecycle:lifecycle-livedata-ktx:2.6.1'
implementation 'androidx.lifecycle:lifecycle-viewmodel-ktx:2.6.1'
implementation 'androidx.lifecycle:lifecycle-viewmodel-savedstate:2.6.1'
@ -156,15 +160,15 @@ dependencies {
implementation "androidx.lifecycle:lifecycle-common-java8:2.6.1"
implementation "androidx.annotation:annotation:1.6.0"
implementation 'androidx.gridlayout:gridlayout:1.0.0'
implementation "androidx.activity:activity-ktx:1.7.1"
implementation 'androidx.fragment:fragment-ktx:1.5.7'
implementation "androidx.activity:activity-ktx:1.7.2"
implementation 'androidx.fragment:fragment-ktx:1.6.1'
implementation 'androidx.work:work-runtime-ktx:2.8.1'
implementation 'androidx.media2:media2-widget:1.2.1'
implementation 'androidx.media2:media2-player:1.2.1'
// Use the most recent version of CameraX
def cameraX_version = '1.2.2'
def cameraX_version = '1.2.3'
implementation "androidx.camera:camera-core:$cameraX_version"
implementation "androidx.camera:camera-camera2:$cameraX_version"
// CameraX Lifecycle library
@ -173,7 +177,7 @@ dependencies {
// CameraX View class
implementation "androidx.camera:camera-view:$cameraX_version"
def room_version = "2.5.1"
def room_version = "2.5.2"
implementation "androidx.room:room-runtime:$room_version"
kapt "androidx.room:room-compiler:$room_version"
implementation "androidx.room:room-ktx:$room_version"
@ -193,9 +197,9 @@ dependencies {
implementation 'com.google.dagger:dagger-android-support:2.44'
// if you use the support libraries
kapt 'com.google.dagger:dagger-android-processor:2.44'
kapt 'com.google.dagger:dagger-compiler:2.44'
kapt 'com.google.dagger:dagger-compiler:2.47'
implementation 'com.squareup.okhttp3:okhttp:4.9.3'
implementation 'com.squareup.okhttp3:okhttp:4.11.0'
implementation 'com.squareup.retrofit2:retrofit:2.9.0'
implementation 'com.squareup.retrofit2:converter-gson:2.9.0'
implementation 'com.squareup.retrofit2:adapter-rxjava3:2.9.0'
@ -271,7 +275,7 @@ dependencies {
}
tasks.withType(Test) {
tasks.withType(Test).configureEach {
jacoco.includeNoLocationClasses = true
jacoco.excludes = ['jdk.internal.*']
}

View File

@ -26,7 +26,6 @@
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:localeConfig="@xml/locales_config"
android:theme="@style/BaseAppTheme">
<service
android:name="androidx.appcompat.app.AppLocalesMetadataHolderService"

View File

@ -125,7 +125,8 @@ class SettingsActivity : BaseThemedWithBarActivity(), SharedPreferences.OnShared
class LanguageSettingFragment : DialogFragment() {
override fun onCreateDialog(savedInstanceState: Bundle?): Dialog {
val list: MutableList<String> = mutableListOf()
resources.getXml(R.xml.locales_config).use {
// IDE doesn't find it, but compiling works apparently?
resources.getXml(R.xml._generated_res_locale_config).use {
var eventType = it.eventType
while (eventType != XmlResourceParser.END_DOCUMENT) {
when (eventType) {

View File

@ -0,0 +1 @@
unqualifiedResLocale=en-US

View File

@ -1,29 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<locale-config xmlns:android="http://schemas.android.com/apk/res/android">
<locale android:name="en"/>
<locale android:name="ar"/>
<locale android:name="bn-bd"/>
<locale android:name="ca"/>
<locale android:name="cs"/>
<locale android:name="de"/>
<locale android:name="da"/>
<locale android:name="es"/>
<locale android:name="eu"/>
<locale android:name="fa"/>
<locale android:name="fi"/>
<locale android:name="fr"/>
<locale android:name="gl"/>
<locale android:name="hu"/>
<locale android:name="id"/>
<locale android:name="it"/>
<locale android:name="ja"/>
<locale android:name="ml"/>
<locale android:name="nl"/>
<locale android:name="pl"/>
<locale android:name="pt"/>
<locale android:name="pt-br"/>
<locale android:name="ru"/>
<locale android:name="sv"/>
<locale android:name="uk"/>
<locale android:name="zh-CN"/>
</locale-config>

View File

@ -7,7 +7,7 @@ buildscript {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:8.0.2'
classpath 'com.android.tools.build:gradle:8.1.0'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
// NOTE: Do not place your application dependencies here; they belong
@ -20,6 +20,7 @@ allprojects {
google()
mavenCentral()
maven { url "https://jitpack.io" }
//noinspection JcenterRepositoryObsolete
jcenter {
content {
// info.androidhive:imagefilters is only available in JCenter
@ -31,6 +32,6 @@ allprojects {
}
}
task clean(type: Delete) {
tasks.register('clean', Delete) {
delete rootProject.buildDir
}