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.Identity
 | 
			
		||||
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.repository.AuthenticationRepository
 | 
			
		||||
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.extentions.annotatedSpan
 | 
			
		||||
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.rememberLoadingTransition
 | 
			
		||||
import com.skydoves.landscapist.ImageOptions
 | 
			
		||||
| 
						 | 
				
			
			@ -103,7 +101,6 @@ fun CharacterDetailUio.annotated(): AnnotatedCharacterDetailUio {
 | 
			
		|||
    val colorScheme = MaterialTheme.colorScheme
 | 
			
		||||
    val highlight = remember { SpanStyle(color = colorScheme.primary) }
 | 
			
		||||
    val highlightRegex = remember(search) { search.highlightRegex }
 | 
			
		||||
    val finderRegex = remember(search) { search.finderRegex }
 | 
			
		||||
    val gender = stringResource(id = gender, short = true)
 | 
			
		||||
    val race = stringResource(id = race)
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -115,32 +112,25 @@ fun CharacterDetailUio.annotated(): AnnotatedCharacterDetailUio {
 | 
			
		|||
                spanStyle = highlight,
 | 
			
		||||
            ) ?: emptyList()
 | 
			
		||||
        ),
 | 
			
		||||
        diminutive = highlightRegex?.annotatedString(
 | 
			
		||||
            input = diminutive ?: "",
 | 
			
		||||
            spanStyle = highlight
 | 
			
		||||
        diminutive = diminutive?.let { highlightRegex?.annotatedString(it, spanStyle = highlight) },
 | 
			
		||||
        gender = AnnotatedString(
 | 
			
		||||
            text = gender,
 | 
			
		||||
            spanStyles = when (highlightGender) {
 | 
			
		||||
                true -> listOf(AnnotatedString.Range(highlight, 0, gender.length))
 | 
			
		||||
                else -> emptyList()
 | 
			
		||||
            }
 | 
			
		||||
        ),
 | 
			
		||||
        gender = gender.let {
 | 
			
		||||
            AnnotatedString(
 | 
			
		||||
                text = it,
 | 
			
		||||
                spanStyles = when (highlightGender) {
 | 
			
		||||
                    true -> listOf(AnnotatedString.Range(highlight, 0, it.length))
 | 
			
		||||
                    else -> emptyList()
 | 
			
		||||
                }
 | 
			
		||||
            )
 | 
			
		||||
        },
 | 
			
		||||
        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 ->
 | 
			
		||||
        race = AnnotatedString(
 | 
			
		||||
            text = race,
 | 
			
		||||
            spanStyles = when (highlightRace) {
 | 
			
		||||
                true -> listOf(AnnotatedString.Range(highlight, 0, race.length))
 | 
			
		||||
                else -> emptyList()
 | 
			
		||||
            }
 | 
			
		||||
        ),
 | 
			
		||||
        description = description?.let { description ->
 | 
			
		||||
            highlightRegex?.annotatedString(description, spanStyle = highlight)
 | 
			
		||||
        },
 | 
			
		||||
        history = finderRegex?.foldAll(history)?.let { history ->
 | 
			
		||||
        history = history?.let { history ->
 | 
			
		||||
            highlightRegex?.annotatedString(history, spanStyle = highlight)
 | 
			
		||||
        },
 | 
			
		||||
        portrait = portrait,
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -32,7 +32,6 @@ import androidx.compose.runtime.Stable
 | 
			
		|||
import androidx.compose.runtime.State
 | 
			
		||||
import androidx.compose.runtime.mutableStateOf
 | 
			
		||||
import androidx.compose.runtime.remember
 | 
			
		||||
import androidx.compose.ui.ExperimentalComposeUiApi
 | 
			
		||||
import androidx.compose.ui.Modifier
 | 
			
		||||
import androidx.compose.ui.graphics.Color
 | 
			
		||||
import androidx.compose.ui.platform.LocalContext
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue