Fix incorect usage of one regex in the detail page.
This commit is contained in:
parent
5ccc5dc882
commit
e28a93da5c
3 changed files with 16 additions and 28 deletions
|
|
@ -17,7 +17,6 @@ import androidx.lifecycle.AndroidViewModel
|
||||||
import com.google.android.gms.auth.api.identity.GetSignInIntentRequest
|
import com.google.android.gms.auth.api.identity.GetSignInIntentRequest
|
||||||
import com.google.android.gms.auth.api.identity.Identity
|
import com.google.android.gms.auth.api.identity.Identity
|
||||||
import com.google.android.gms.auth.api.identity.SignInCredential
|
import com.google.android.gms.auth.api.identity.SignInCredential
|
||||||
import com.google.android.gms.auth.api.signin.GoogleSignInAccount
|
|
||||||
import com.pixelized.rplexicon.R
|
import com.pixelized.rplexicon.R
|
||||||
import com.pixelized.rplexicon.repository.AuthenticationRepository
|
import com.pixelized.rplexicon.repository.AuthenticationRepository
|
||||||
import dagger.hilt.android.lifecycle.HiltViewModel
|
import dagger.hilt.android.lifecycle.HiltViewModel
|
||||||
|
|
|
||||||
|
|
@ -64,8 +64,6 @@ import com.pixelized.rplexicon.ui.theme.LexiconTheme
|
||||||
import com.pixelized.rplexicon.utilitary.composable.stringResource
|
import com.pixelized.rplexicon.utilitary.composable.stringResource
|
||||||
import com.pixelized.rplexicon.utilitary.extentions.annotatedSpan
|
import com.pixelized.rplexicon.utilitary.extentions.annotatedSpan
|
||||||
import com.pixelized.rplexicon.utilitary.extentions.annotatedString
|
import com.pixelized.rplexicon.utilitary.extentions.annotatedString
|
||||||
import com.pixelized.rplexicon.utilitary.extentions.finderRegex
|
|
||||||
import com.pixelized.rplexicon.utilitary.extentions.foldAll
|
|
||||||
import com.pixelized.rplexicon.utilitary.extentions.highlightRegex
|
import com.pixelized.rplexicon.utilitary.extentions.highlightRegex
|
||||||
import com.pixelized.rplexicon.utilitary.rememberLoadingTransition
|
import com.pixelized.rplexicon.utilitary.rememberLoadingTransition
|
||||||
import com.skydoves.landscapist.ImageOptions
|
import com.skydoves.landscapist.ImageOptions
|
||||||
|
|
@ -103,7 +101,6 @@ fun CharacterDetailUio.annotated(): AnnotatedCharacterDetailUio {
|
||||||
val colorScheme = MaterialTheme.colorScheme
|
val colorScheme = MaterialTheme.colorScheme
|
||||||
val highlight = remember { SpanStyle(color = colorScheme.primary) }
|
val highlight = remember { SpanStyle(color = colorScheme.primary) }
|
||||||
val highlightRegex = remember(search) { search.highlightRegex }
|
val highlightRegex = remember(search) { search.highlightRegex }
|
||||||
val finderRegex = remember(search) { search.finderRegex }
|
|
||||||
val gender = stringResource(id = gender, short = true)
|
val gender = stringResource(id = gender, short = true)
|
||||||
val race = stringResource(id = race)
|
val race = stringResource(id = race)
|
||||||
|
|
||||||
|
|
@ -115,32 +112,25 @@ fun CharacterDetailUio.annotated(): AnnotatedCharacterDetailUio {
|
||||||
spanStyle = highlight,
|
spanStyle = highlight,
|
||||||
) ?: emptyList()
|
) ?: emptyList()
|
||||||
),
|
),
|
||||||
diminutive = highlightRegex?.annotatedString(
|
diminutive = diminutive?.let { highlightRegex?.annotatedString(it, spanStyle = highlight) },
|
||||||
input = diminutive ?: "",
|
gender = AnnotatedString(
|
||||||
spanStyle = highlight
|
text = gender,
|
||||||
|
spanStyles = when (highlightGender) {
|
||||||
|
true -> listOf(AnnotatedString.Range(highlight, 0, gender.length))
|
||||||
|
else -> emptyList()
|
||||||
|
}
|
||||||
),
|
),
|
||||||
gender = gender.let {
|
race = AnnotatedString(
|
||||||
AnnotatedString(
|
text = race,
|
||||||
text = it,
|
spanStyles = when (highlightRace) {
|
||||||
spanStyles = when (highlightGender) {
|
true -> listOf(AnnotatedString.Range(highlight, 0, race.length))
|
||||||
true -> listOf(AnnotatedString.Range(highlight, 0, it.length))
|
else -> emptyList()
|
||||||
else -> emptyList()
|
}
|
||||||
}
|
),
|
||||||
)
|
description = description?.let { description ->
|
||||||
},
|
|
||||||
race = race.let {
|
|
||||||
AnnotatedString(
|
|
||||||
text = it,
|
|
||||||
spanStyles = when (highlightRace) {
|
|
||||||
true -> listOf(AnnotatedString.Range(highlight, 0, it.length))
|
|
||||||
else -> emptyList()
|
|
||||||
}
|
|
||||||
)
|
|
||||||
},
|
|
||||||
description = finderRegex?.foldAll(description)?.let { description ->
|
|
||||||
highlightRegex?.annotatedString(description, spanStyle = highlight)
|
highlightRegex?.annotatedString(description, spanStyle = highlight)
|
||||||
},
|
},
|
||||||
history = finderRegex?.foldAll(history)?.let { history ->
|
history = history?.let { history ->
|
||||||
highlightRegex?.annotatedString(history, spanStyle = highlight)
|
highlightRegex?.annotatedString(history, spanStyle = highlight)
|
||||||
},
|
},
|
||||||
portrait = portrait,
|
portrait = portrait,
|
||||||
|
|
|
||||||
|
|
@ -32,7 +32,6 @@ import androidx.compose.runtime.Stable
|
||||||
import androidx.compose.runtime.State
|
import androidx.compose.runtime.State
|
||||||
import androidx.compose.runtime.mutableStateOf
|
import androidx.compose.runtime.mutableStateOf
|
||||||
import androidx.compose.runtime.remember
|
import androidx.compose.runtime.remember
|
||||||
import androidx.compose.ui.ExperimentalComposeUiApi
|
|
||||||
import androidx.compose.ui.Modifier
|
import androidx.compose.ui.Modifier
|
||||||
import androidx.compose.ui.graphics.Color
|
import androidx.compose.ui.graphics.Color
|
||||||
import androidx.compose.ui.platform.LocalContext
|
import androidx.compose.ui.platform.LocalContext
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue