diff --git a/app/src/main/java/com/malopieds/innertune/ui/screens/settings/ContentSettings.kt b/app/src/main/java/com/malopieds/innertune/ui/screens/settings/ContentSettings.kt index 5379bae82..8294853eb 100644 --- a/app/src/main/java/com/malopieds/innertune/ui/screens/settings/ContentSettings.kt +++ b/app/src/main/java/com/malopieds/innertune/ui/screens/settings/ContentSettings.kt @@ -1,5 +1,11 @@ package com.malopieds.innertune.ui.screens.settings +import android.content.ActivityNotFoundException +import android.content.Intent +import android.net.Uri +import android.os.Build +import android.provider.Settings +import android.widget.Toast import androidx.compose.animation.AnimatedVisibility import androidx.compose.foundation.layout.Column import androidx.compose.foundation.layout.Spacer @@ -17,6 +23,7 @@ import androidx.compose.runtime.Composable import androidx.compose.runtime.getValue import androidx.compose.runtime.remember import androidx.compose.ui.Modifier +import androidx.compose.ui.platform.LocalContext import androidx.compose.ui.res.painterResource import androidx.compose.ui.res.stringResource import androidx.navigation.NavController @@ -60,6 +67,7 @@ fun ContentSettings( navController: NavController, scrollBehavior: TopAppBarScrollBehavior, ) { + val context = LocalContext.current val accountName by rememberPreference(AccountNameKey, "") val accountEmail by rememberPreference(AccountEmailKey, "") val accountChannelHandle by rememberPreference(AccountChannelHandleKey, "") @@ -98,6 +106,7 @@ fun ContentSettings( icon = { Icon(painterResource(R.drawable.person), null) }, onClick = { navController.navigate("login") }, ) + ListPreference( title = { Text(stringResource(R.string.content_language)) }, icon = { Icon(painterResource(R.drawable.language), null) }, @@ -123,6 +132,23 @@ fun ContentSettings( onValueSelected = onContentCountryChange, ) + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) { + PreferenceEntry( + title = { Text(stringResource(R.string.app_language)) }, + description = stringResource(R.string.configure_app_language), + icon = { Icon(painterResource(R.drawable.language), null) }, + onClick = { + try { + context.startActivity( + Intent(Settings.ACTION_APPLICATION_SETTINGS, Uri.parse("package:${context.packageName}")), + ) + } catch (e: ActivityNotFoundException) { + Toast.makeText(context, R.string.intent_app_language_not_found, Toast.LENGTH_LONG).show() + } + }, + ) + } + SwitchPreference( title = { Text(stringResource(R.string.hide_explicit)) }, icon = { Icon(painterResource(R.drawable.explicit), null) }, diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 58ac575a6..3deff27fb 100755 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -267,6 +267,9 @@ Set Quick Picks Based on last song listened Restart to take effect + App language + Configure app languages + Couldn\'t find app language settings, please configure them manually Player and audio Audio quality