Skip to content

Commit f88fbb3

Browse files
authored
Merge pull request #60 from NeoUtils/develop
Release v2.3.0
2 parents 374d405 + 0d63b6d commit f88fbb3

File tree

37 files changed

+1108
-258
lines changed

37 files changed

+1108
-258
lines changed

.idea/deploymentTargetSelector.xml

Lines changed: 10 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/inspectionProfiles/Project_Default.xml

Lines changed: 24 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

application/build.gradle.kts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,10 @@
1616
* along with this program. If not, see <https://www.gnu.org/licenses/>.
1717
*/
1818

19-
import extension.*
19+
import extension.catalog
20+
import extension.config
21+
import extension.distribution
22+
import extension.name
2023

2124
plugins {
2225
alias(libs.plugins.neoutils.neoregex.android)

application/installation/com.neoutils.NeoRegex.metainfo.xml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@
1010

1111
<description>
1212
<p>
13-
Visualize the functioning of your regular expressions in real-time with a useful and intuitive tool. With support for capture groups, undo, and redo.
13+
Visualize the functioning of your regular expressions in real-time with a useful and intuitive tool. With
14+
support for capture groups, undo, and redo.
1415
</p>
1516
</description>
1617

@@ -50,10 +51,9 @@
5051
<description>
5152
<p>Improvements in user experience.</p>
5253
<ul>
53-
<li>Small improvements across the application.</li>
5454
<li>Customized window for a personalized experience.</li>
55-
<li>Enhanced touchscreen support for better usability on touch devices.</li>
5655
<li>Improved theme detection.</li>
56+
<li>Small improvements.</li>
5757
</ul>
5858
</description>
5959
</release>

application/src/androidMain/kotlin/com/neoutils/neoregex/Main.android.kt

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@ import androidx.activity.compose.setContent
2626
import androidx.activity.enableEdgeToEdge
2727
import androidx.compose.foundation.layout.safeDrawingPadding
2828
import androidx.compose.ui.Modifier
29-
import com.neoutils.neoregex.core.common.util.UiMode
30-
import com.neoutils.neoregex.core.common.util.resolve
29+
import com.neoutils.neoregex.core.common.util.ColorTheme
30+
import com.neoutils.neoregex.core.common.util.colorTheme
3131
import com.neoutils.neoregex.core.designsystem.theme.NeoTheme
3232

3333
class MainActivity : ComponentActivity() {
@@ -38,6 +38,7 @@ class MainActivity : ComponentActivity() {
3838
setupSystemBars()
3939

4040
setContent {
41+
4142
NeoTheme {
4243
App(Modifier.safeDrawingPadding())
4344
}
@@ -46,14 +47,14 @@ class MainActivity : ComponentActivity() {
4647

4748
private fun setupSystemBars() {
4849

49-
val style = when (UiMode.resolve(context = this)) {
50-
UiMode.DARK -> {
50+
val style = when (colorTheme) {
51+
ColorTheme.DARK -> {
5152
SystemBarStyle.dark(
5253
Color.BLACK,
5354
)
5455
}
5556

56-
UiMode.LIGHT -> {
57+
ColorTheme.LIGHT -> {
5758
SystemBarStyle.light(
5859
Color.WHITE,
5960
Color.BLACK,

application/src/desktopMain/kotlin/com/neoutils/neoregex/Main.desktop.kt

Lines changed: 60 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -16,80 +16,95 @@
1616
* along with this program. If not, see <https://www.gnu.org/licenses/>.
1717
*/
1818

19+
@file:OptIn(ExperimentalComposeUiApi::class)
20+
1921
package com.neoutils.neoregex
2022

2123
import androidx.compose.foundation.clickable
24+
import androidx.compose.foundation.layout.Row
2225
import androidx.compose.foundation.layout.aspectRatio
23-
import androidx.compose.foundation.layout.height
2426
import androidx.compose.foundation.layout.padding
2527
import androidx.compose.foundation.shape.CircleShape
2628
import androidx.compose.material3.Icon
2729
import androidx.compose.material3.MaterialTheme.colorScheme
30+
import androidx.compose.material3.Text
2831
import androidx.compose.runtime.Composable
29-
import androidx.compose.runtime.remember
32+
import androidx.compose.ui.Alignment
33+
import androidx.compose.ui.ExperimentalComposeUiApi
3034
import androidx.compose.ui.Modifier
3135
import androidx.compose.ui.draw.clip
3236
import androidx.compose.ui.platform.LocalUriHandler
33-
import androidx.compose.ui.unit.dp
3437
import androidx.compose.ui.window.FrameWindowScope
35-
import androidx.compose.ui.window.application
36-
import com.neoutils.neoregex.core.common.util.UiMode
37-
import com.neoutils.neoregex.core.common.util.isDark
38-
import com.neoutils.neoregex.core.common.util.resolve
38+
import androidx.compose.ui.window.launchApplication
39+
import com.neoutils.neoregex.core.common.util.ColorTheme
40+
import com.neoutils.neoregex.core.common.util.rememberColorTheme
3941
import com.neoutils.neoregex.core.designsystem.theme.NeoTheme
4042
import com.neoutils.neoregex.core.designsystem.theme.NeoTheme.dimensions
4143
import com.neoutils.neoregex.core.resources.Res
4244
import com.neoutils.neoregex.core.resources.app_name
4345
import com.neoutils.neoregex.core.resources.github
44-
import com.neoutils.neoregex.core.sharedui.component.DefaultHeader
46+
import com.neoutils.neoregex.core.sharedui.component.NeoHeader
4547
import com.neoutils.neoregex.core.sharedui.component.NeoWindow
48+
import kotlinx.coroutines.CoroutineScope
4649
import org.jetbrains.compose.resources.painterResource
4750
import org.jetbrains.compose.resources.stringResource
51+
import org.jetbrains.skiko.MainUIDispatcher
4852

49-
fun main() = application {
50-
51-
val uiMode = remember { UiMode.resolve() }
52-
53-
NeoTheme(uiMode.isDark) {
54-
NeoWindow(
55-
header = {
56-
TitleBar()
53+
fun main() {
54+
with(CoroutineScope(MainUIDispatcher)) {
55+
launchApplication {
56+
NeoTheme {
57+
NeoWindow(
58+
header = {
59+
Header()
60+
}
61+
) {
62+
App()
63+
}
5764
}
58-
) {
59-
App()
6065
}
6166
}
6267
}
6368

6469
@Composable
65-
private fun FrameWindowScope.TitleBar(
70+
private fun FrameWindowScope.Header(
6671
title: String = stringResource(Res.string.app_name),
67-
uiMode: UiMode = remember { UiMode.resolve() }
68-
) {
69-
DefaultHeader(
70-
title = title,
71-
options = {
72-
val uriHandler = LocalUriHandler.current
72+
colorTheme: ColorTheme = rememberColorTheme()
73+
) = NeoHeader { padding ->
7374

74-
Icon(
75-
painter = painterResource(Res.drawable.github),
76-
contentDescription = null,
77-
tint = when (uiMode) {
78-
UiMode.LIGHT -> colorScheme.onSurface
79-
UiMode.DARK -> colorScheme.onSurface
80-
},
81-
modifier = Modifier
82-
.clip(CircleShape)
83-
.clickable(
84-
onClick = {
85-
uriHandler.openUri(
86-
uri = "https://github.com/NeoUtils/NeoRegex"
87-
)
88-
}
89-
)
90-
.padding(dimensions.medium)
91-
.aspectRatio(ratio = 1f)
92-
)
93-
}
75+
Text(
76+
text = title,
77+
modifier = Modifier.align(
78+
Alignment.Center
79+
)
9480
)
81+
82+
Row(
83+
modifier = Modifier
84+
.padding(padding)
85+
.padding(horizontal = dimensions.medium)
86+
.align(Alignment.CenterEnd)
87+
) {
88+
val uriHandler = LocalUriHandler.current
89+
90+
Icon(
91+
painter = painterResource(Res.drawable.github),
92+
contentDescription = null,
93+
tint = when (colorTheme) {
94+
ColorTheme.LIGHT -> colorScheme.onSurface
95+
ColorTheme.DARK -> colorScheme.onSurface
96+
},
97+
modifier = Modifier
98+
.clip(CircleShape)
99+
.clickable(
100+
onClick = {
101+
uriHandler.openUri(
102+
uri = "https://github.com/NeoUtils/NeoRegex"
103+
)
104+
}
105+
)
106+
.padding(dimensions.medium)
107+
.aspectRatio(ratio = 1f)
108+
)
109+
}
95110
}

build-logic/src/main/kotlin/extension/Project.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@ import org.gradle.kotlin.dsl.the
2626
val config = Config(
2727
version = Config.Version(
2828
major = 2,
29-
minor = 2,
30-
patch = 1,
29+
minor = 3,
30+
patch = 0,
3131
phase = Config.Phase.RELEASE
3232
),
3333
android = Config.Android(

core/common/src/androidMain/kotlin/com/neoutils/neoregex/core/common/platform/Platform.android.kt

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,4 @@
1818

1919
package com.neoutils.neoregex.core.common.platform
2020

21-
import com.neoutils.neoregex.core.common.platform.Platform
22-
23-
actual val Platform.Companion.Current: Platform
24-
get() = Platform.ANDROID
21+
actual val platform: Platform = Platform.Android

core/common/src/androidMain/kotlin/com/neoutils/neoregex/core/common/util/UiMode.android.kt renamed to core/common/src/androidMain/kotlin/com/neoutils/neoregex/core/common/util/ColorTheme.android.kt

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,17 +21,26 @@ package com.neoutils.neoregex.core.common.util
2121
import android.content.Context
2222
import android.content.res.Configuration.UI_MODE_NIGHT_MASK
2323
import android.content.res.Configuration.UI_MODE_NIGHT_YES
24-
import com.neoutils.neoregex.core.common.util.UiMode
24+
import androidx.compose.foundation.isSystemInDarkTheme
25+
import androidx.compose.runtime.Composable
2526

26-
fun UiMode.Companion.resolve(context: Context): UiMode {
27+
@Composable
28+
actual fun rememberColorTheme(): ColorTheme {
2729

28-
return when (context.resources.configuration.uiMode and UI_MODE_NIGHT_MASK) {
30+
return if (isSystemInDarkTheme()) {
31+
ColorTheme.DARK
32+
} else {
33+
ColorTheme.LIGHT
34+
}
35+
}
36+
37+
val Context.colorTheme
38+
get() = when (resources.configuration.uiMode and UI_MODE_NIGHT_MASK) {
2939
UI_MODE_NIGHT_YES -> {
30-
UiMode.DARK
40+
ColorTheme.DARK
3141
}
3242

3343
else -> {
34-
UiMode.LIGHT
44+
ColorTheme.LIGHT
3545
}
3646
}
37-
}

core/common/src/commonMain/kotlin/com/neoutils/neoregex/core/common/platform/Platform.kt

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,18 @@
1818

1919
package com.neoutils.neoregex.core.common.platform
2020

21-
enum class Platform {
22-
DESKTOP,
23-
ANDROID,
24-
WEB;
21+
sealed class Platform {
2522

26-
companion object
23+
sealed class Desktop : Platform() {
24+
data object Windows : Desktop()
25+
data object Linux : Desktop()
26+
data object MacOS : Desktop()
27+
}
28+
29+
data object Android : Platform()
30+
31+
// Experimental
32+
data object Web : Platform()
2733
}
2834

29-
expect val Platform.Companion.Current: Platform
35+
expect val platform: Platform

0 commit comments

Comments
 (0)