File tree Expand file tree Collapse file tree 3 files changed +20
-23
lines changed
application/src/androidMain/kotlin/com/neoutils/neoregex
saved/src/commonMain/kotlin/com/neoutils/neoregex/feature/saved
validator/src/commonMain/kotlin/com/neoutils/neoregex/feature/validator/usecase Expand file tree Collapse file tree 3 files changed +20
-23
lines changed Original file line number Diff line number Diff line change 19
19
package com.neoutils.neoregex
20
20
21
21
import android.app.Application
22
- import android.content.Context
23
22
import com.neoutils.neoregex.core.common.di.commonModule
24
23
import com.neoutils.neoregex.core.database.di.databaseModule
25
24
import com.neoutils.neoregex.core.datasource.di.dataSourceModule
@@ -28,21 +27,17 @@ import com.neoutils.neoregex.core.repository.di.repositoryModule
28
27
import com.neoutils.neoregex.feature.matcher.di.matcherModule
29
28
import com.neoutils.neoregex.feature.saved.di.savedModule
30
29
import com.neoutils.neoregex.feature.validator.di.validatorModule
30
+ import org.koin.android.ext.koin.androidContext
31
31
import org.koin.core.context.GlobalContext.startKoin
32
- import org.koin.dsl.module
33
32
34
33
class NeoAndroidApp : Application () {
35
34
36
- private val module = module {
37
- single<Context > { applicationContext }
38
- }
39
-
40
35
override fun onCreate () {
41
36
super .onCreate()
42
37
43
38
startKoin {
39
+ androidContext(this @NeoAndroidApp)
44
40
modules(
45
- module,
46
41
commonModule,
47
42
managerModule,
48
43
dataSourceModule,
Original file line number Diff line number Diff line change @@ -32,12 +32,9 @@ import androidx.compose.material.icons.automirrored.outlined.OpenInNew
32
32
import androidx.compose.material.icons.outlined.ContentCopy
33
33
import androidx.compose.material.icons.outlined.Delete
34
34
import androidx.compose.material.icons.outlined.Edit
35
- import androidx.compose.material3.HorizontalDivider
36
- import androidx.compose.material3.Icon
35
+ import androidx.compose.material3.*
37
36
import androidx.compose.material3.MaterialTheme.colorScheme
38
37
import androidx.compose.material3.MaterialTheme.typography
39
- import androidx.compose.material3.Surface
40
- import androidx.compose.material3.Text
41
38
import androidx.compose.runtime.*
42
39
import androidx.compose.ui.Alignment
43
40
import androidx.compose.ui.Modifier
@@ -226,6 +223,9 @@ private fun Pattern(
226
223
Icon (
227
224
imageVector = Icons .AutoMirrored .Outlined .OpenInNew ,
228
225
contentDescription = null ,
226
+ tint = LocalContentColor .current.copy(
227
+ alpha = if (pattern.opened) 0.5f else 1f
228
+ ),
229
229
modifier = Modifier
230
230
.clip(CircleShape )
231
231
.clickable(
Original file line number Diff line number Diff line change @@ -21,25 +21,27 @@ package com.neoutils.neoregex.feature.validator.usecase
21
21
import com.neoutils.neoregex.core.common.model.Match
22
22
import com.neoutils.neoregex.core.common.model.TestCase
23
23
import com.neoutils.neoregex.feature.validator.model.TestCaseValidation
24
+ import kotlinx.coroutines.Dispatchers
25
+ import kotlinx.coroutines.withContext
24
26
25
27
class ValidateUseCase {
26
28
27
- operator fun invoke (
29
+ suspend operator fun invoke (
28
30
testCase : TestCase ,
29
31
regex : Regex
30
32
): TestCaseValidation {
31
33
32
- val results = regex.findAll(testCase.text)
33
-
34
- val matches = mutableListOf< Match >( )
35
-
36
- results.mapIndexedTo(matches) { index, match ->
37
- Match (
38
- text = match.value ,
39
- range = match.range ,
40
- groups = match.groupValues.drop(n = 1 ),
41
- number = index.inc(),
42
- )
34
+ val matches = withContext( Dispatchers . Default ) {
35
+ regex
36
+ .findAll(testCase.text )
37
+ .mapIndexedTo( mutableListOf ()) { index, match ->
38
+ Match (
39
+ text = match.value,
40
+ range = match.range ,
41
+ groups = match.groupValues.drop(n = 1 ) ,
42
+ number = index.inc( ),
43
+ )
44
+ }
43
45
}
44
46
45
47
return when (testCase.case) {
You can’t perform that action at this time.
0 commit comments