mirror of
https://github.com/Myzel394/Alibi.git
synced 2025-06-18 23:05:26 +02:00
feat: Show better splitted path
This commit is contained in:
parent
703e783193
commit
d0701868cf
@ -2,6 +2,7 @@ package app.myzel394.alibi.ui.components.SettingsScreen.atoms
|
|||||||
|
|
||||||
import android.content.Intent
|
import android.content.Intent
|
||||||
import android.net.Uri
|
import android.net.Uri
|
||||||
|
import android.text.TextUtils.split
|
||||||
import androidx.compose.foundation.layout.Arrangement
|
import androidx.compose.foundation.layout.Arrangement
|
||||||
import androidx.compose.foundation.layout.Column
|
import androidx.compose.foundation.layout.Column
|
||||||
import androidx.compose.foundation.layout.Spacer
|
import androidx.compose.foundation.layout.Spacer
|
||||||
@ -38,6 +39,7 @@ import app.myzel394.alibi.db.AppSettings
|
|||||||
import app.myzel394.alibi.ui.components.atoms.SettingsTile
|
import app.myzel394.alibi.ui.components.atoms.SettingsTile
|
||||||
import app.myzel394.alibi.ui.utils.rememberFolderSelectorDialog
|
import app.myzel394.alibi.ui.utils.rememberFolderSelectorDialog
|
||||||
import kotlinx.coroutines.launch
|
import kotlinx.coroutines.launch
|
||||||
|
import java.net.URLDecoder
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
fun SaveFolderTile(
|
fun SaveFolderTile(
|
||||||
@ -165,6 +167,7 @@ fun SaveFolderTile(
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
extra = {
|
extra = {
|
||||||
|
println(settings.audioRecorderSettings.saveFolder)
|
||||||
Column(
|
Column(
|
||||||
modifier = Modifier.fillMaxWidth(),
|
modifier = Modifier.fillMaxWidth(),
|
||||||
horizontalAlignment = Alignment.CenterHorizontally,
|
horizontalAlignment = Alignment.CenterHorizontally,
|
||||||
@ -174,11 +177,7 @@ fun SaveFolderTile(
|
|||||||
Text(
|
Text(
|
||||||
text = stringResource(
|
text = stringResource(
|
||||||
R.string.form_value_selected,
|
R.string.form_value_selected,
|
||||||
settings
|
splitPath(settings.audioRecorderSettings.saveFolder).joinToString(" > ")
|
||||||
.audioRecorderSettings
|
|
||||||
.saveFolder
|
|
||||||
.split(":")[1]
|
|
||||||
.replace("/", " > ")
|
|
||||||
),
|
),
|
||||||
style = MaterialTheme.typography.bodySmall,
|
style = MaterialTheme.typography.bodySmall,
|
||||||
color = MaterialTheme.colorScheme.onSurfaceVariant,
|
color = MaterialTheme.colorScheme.onSurfaceVariant,
|
||||||
@ -220,3 +219,14 @@ fun SaveFolderTile(
|
|||||||
}
|
}
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fun splitPath(path: String): List<String> {
|
||||||
|
return try {
|
||||||
|
URLDecoder
|
||||||
|
.decode(path, "UTF-8")
|
||||||
|
.split(":", limit = 3)[2]
|
||||||
|
.split("/")
|
||||||
|
} catch (e: Exception) {
|
||||||
|
listOf(path)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user