Skip to content

Commit 2454051

Browse files
authored
Merge pull request #63 from NeoUtils/develop
Release v2.4.0 - Pattern highlighting
2 parents b0dba32 + 93a5920 commit 2454051

File tree

62 files changed

+1437
-249
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

62 files changed

+1437
-249
lines changed

.idea/deploymentTargetSelector.xml

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/gradle.xml

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

.idea/misc.xml

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

README.md

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,12 @@ A cross-platform app to validate regular expressions.
99
</p>
1010

1111
<p align="center">
12-
<img src="images/linux-dark-mode.png" alt="NeoRegex desktop app"/>
12+
<img src="images/linux_dark_mode.png" alt="NeoRegex desktop app"/>
1313
</p>
1414

15-
<p align="center">
16-
<a href="https://flathub.org/apps/com.neoutils.NeoRegex"><img height="80px" alt="Download on Flathub" src="https://flathub.org/assets/badges/flathub-badge-en.svg"/></a>
17-
<a href="https://play.google.com/store/apps/details?id=com.neo.regex"><img height="80px" alt="Get it on Google Play" src="images/playstore_badge.webp"/></a>
15+
<p align="center">
16+
<a href="https://flathub.org/apps/com.neoutils.NeoRegex"><img height="80px" alt="Download on Flathub" src="https://flathub.org/assets/badges/flathub-badge-en.svg"/></a>
17+
<a href="https://play.google.com/store/apps/details?id=com.neo.regex"><img height="80px" alt="Get it on Google Play" src="images/playstore_badge.webp"/></a>
1818
</p>
1919

2020
<p align="center">
@@ -34,15 +34,22 @@ A cross-platform app to validate regular expressions.
3434

3535
## Build
3636

37-
To build this project, the JDK (Java Development Kit) and the Android SDK are required.
38-
I recommend using [Intellij IDEA](https://www.jetbrains.com/idea/download) as the IDE, with the **Android**, **Jetpack
39-
Compose** and **Compose Multiplatform** plugins installed.
37+
To build this project, the JDK 17 and the Android SDK are required.
38+
I recommend using [Intellij IDEA](https://www.jetbrains.com/idea/download) as the IDE, with the **Android**, **Jetpack Compose** and **Compose Multiplatform** plugins installed.
4039

4140
> [!TIP]
4241
> - You can obtain the **JDK** and **Android SDK** directly from **IntelliJ IDEA**.
4342
> - Use **JBR** (JetBrains Runtime) for better window integration.
4443
> - Use run configurations to get started.
4544
45+
## Acknowledgments
46+
47+
NeoRegex utilizes several open-source libraries that greatly enhance its functionality. We would like to thank the authors and contributors of the following projects for their amazing work:
48+
49+
- [**Highlight**](https://github.com/NeoUtils/Highlight): This library provides essential syntax highlighting features, making the pattern more readable and visually appealing.
50+
- [**multiplatform-settings**](https://github.com/russhwolf/multiplatform-settings): A useful library for managing settings across multiple platforms, allowing us to easily persist user preferences.
51+
- [**dbus-java**](https://github.com/hypfvieh/dbus-java): This library enables integration with D-Bus, providing important desktop interprocess communication capabilities for Linux systems.
52+
4653
## License
4754

4855
<a href="https://www.gnu.org/licenses/gpl-3.0.html">
@@ -56,3 +63,4 @@ license, in order to maintain its free software nature.
5663

5764
You can find a copy of the license in the [LICENSE](/LICENSE)
5865
file of this project or access the original version at https://www.gnu.org/licenses/gpl-3.0.html.
66+

application/build.gradle.kts

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

19-
import com.android.utils.jvmArchitecture
19+
@file:Suppress("UnstableApiUsage")
20+
2021
import com.android.utils.osArchitecture
2122
import extension.catalog
2223
import extension.config
@@ -34,11 +35,6 @@ version = config.version.name()
3435

3536
kotlin {
3637

37-
jvmToolchain {
38-
languageVersion.set(JavaLanguageVersion.of(17))
39-
vendor.set(JvmVendorSpec.ORACLE) // Oracle OpenJDK
40-
}
41-
4238
sourceSets {
4339
commonMain.dependencies {
4440

@@ -48,18 +44,26 @@ kotlin {
4844
implementation(projects.core.resources)
4945
implementation(projects.core.common)
5046
implementation(projects.core.sharedUi)
47+
implementation(projects.core.datasource)
5148

5249
// voyager
5350
implementation(catalog.voyager.navigator)
5451
implementation(catalog.voyager.transitions)
5552

53+
// lifecycle
54+
implementation(catalog.androidx.multplatform.lifecycle.runtime.compose)
55+
5656
// compose
5757
implementation(compose.runtime)
5858
implementation(compose.foundation)
5959
implementation(compose.ui)
6060
implementation(compose.material3)
6161
implementation(compose.materialIconsExtended)
6262
implementation(compose.components.resources)
63+
64+
// koin
65+
implementation(libs.koin.core)
66+
implementation(libs.koin.compose)
6367
}
6468
}
6569
}

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

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,20 +33,31 @@
3333
<screenshots>
3434
<screenshot type="default">
3535
<image>
36-
https://raw.githubusercontent.com/NeoUtils/NeoRegex/521b95a1943408573ad782a2efcada1d79f78b60/images/linux-dark-mode.png
36+
https://raw.githubusercontent.com/NeoUtils/NeoRegex/bf49347b87902115592e1f3899a0735f5df27903/images/linux_dark_mode.png
3737
</image>
3838
<caption>NeoRegex in Dark Mode</caption>
3939
</screenshot>
4040

4141
<screenshot>
4242
<image>
43-
https://raw.githubusercontent.com/NeoUtils/NeoRegex/521b95a1943408573ad782a2efcada1d79f78b60/images/linux-light-mode.png
43+
https://raw.githubusercontent.com/NeoUtils/NeoRegex/bf49347b87902115592e1f3899a0735f5df27903/images/linux_light_mode.png
4444
</image>
4545
<caption>NeoRegex in Light Mode</caption>
4646
</screenshot>
4747
</screenshots>
4848

4949
<releases>
50+
<release version="2.4.0" date="2024-12-20">
51+
<description>
52+
<p>Improvements in user experience.</p>
53+
<ul>
54+
<li>Change theme manually</li>
55+
<li>Persistence of preferences</li>
56+
<li>Syntax highlighting in pattern</li>
57+
</ul>
58+
</description>
59+
</release>
60+
5061
<release version="2.3.0" date="2024-11-09">
5162
<description>
5263
<p>Small improvements</p>
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
/*
2+
* NeoRegex.
3+
*
4+
* Copyright (C) 2024 Irineu A. Silva.
5+
*
6+
* This program is free software: you can redistribute it and/or modify
7+
* it under the terms of the GNU General Public License as published by
8+
* the Free Software Foundation, either version 3 of the License.
9+
*
10+
* This program is distributed in the hope that it will be useful,
11+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
12+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13+
* GNU General Public License for more details.
14+
*
15+
* You should have received a copy of the GNU General Public License
16+
* along with this program. If not, see <https://www.gnu.org/licenses/>.
17+
*/
18+
19+
package com.neoutils.neoregex
20+
21+
import androidx.compose.foundation.layout.safeDrawingPadding
22+
import androidx.compose.runtime.Composable
23+
import androidx.compose.ui.Modifier
24+
import com.neoutils.neoregex.core.designsystem.theme.NeoTheme
25+
import com.neoutils.neoregex.core.sharedui.di.WithKoin
26+
27+
@Composable
28+
fun AndroidApp() = WithKoin {
29+
NeoTheme {
30+
App(Modifier.safeDrawingPadding())
31+
}
32+
}

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

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,8 @@ import androidx.activity.ComponentActivity
2424
import androidx.activity.SystemBarStyle
2525
import androidx.activity.compose.setContent
2626
import androidx.activity.enableEdgeToEdge
27-
import androidx.compose.foundation.layout.safeDrawingPadding
28-
import androidx.compose.ui.Modifier
2927
import com.neoutils.neoregex.core.common.util.ColorTheme
3028
import com.neoutils.neoregex.core.common.util.colorTheme
31-
import com.neoutils.neoregex.core.designsystem.theme.NeoTheme
3229

3330
class MainActivity : ComponentActivity() {
3431

@@ -38,23 +35,20 @@ class MainActivity : ComponentActivity() {
3835
setupSystemBars()
3936

4037
setContent {
41-
42-
NeoTheme {
43-
App(Modifier.safeDrawingPadding())
44-
}
38+
AndroidApp()
4539
}
4640
}
4741

4842
private fun setupSystemBars() {
4943

5044
val style = when (colorTheme) {
51-
ColorTheme.DARK -> {
45+
ColorTheme.DARK, ColorTheme.DARK_SYSTEM -> {
5246
SystemBarStyle.dark(
5347
Color.BLACK,
5448
)
5549
}
5650

57-
ColorTheme.LIGHT -> {
51+
ColorTheme.LIGHT, ColorTheme.LIGHT_SYSTEM -> {
5852
SystemBarStyle.light(
5953
Color.WHITE,
6054
Color.BLACK,
Lines changed: 162 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,162 @@
1+
/*
2+
* NeoRegex.
3+
*
4+
* Copyright (C) 2024 Irineu A. Silva.
5+
*
6+
* This program is free software: you can redistribute it and/or modify
7+
* it under the terms of the GNU General Public License as published by
8+
* the Free Software Foundation, either version 3 of the License.
9+
*
10+
* This program is distributed in the hope that it will be useful,
11+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
12+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13+
* GNU General Public License for more details.
14+
*
15+
* You should have received a copy of the GNU General Public License
16+
* along with this program. If not, see <https://www.gnu.org/licenses/>.
17+
*/
18+
19+
@file:OptIn(ExperimentalComposeUiApi::class)
20+
21+
package com.neoutils.neoregex
22+
23+
import androidx.compose.foundation.clickable
24+
import androidx.compose.foundation.layout.Arrangement
25+
import androidx.compose.foundation.layout.Row
26+
import androidx.compose.foundation.layout.aspectRatio
27+
import androidx.compose.foundation.layout.padding
28+
import androidx.compose.foundation.shape.CircleShape
29+
import androidx.compose.material3.Icon
30+
import androidx.compose.material3.MaterialTheme.colorScheme
31+
import androidx.compose.material3.Text
32+
import androidx.compose.runtime.Composable
33+
import androidx.compose.runtime.collectAsState
34+
import androidx.compose.runtime.getValue
35+
import androidx.compose.ui.Alignment
36+
import androidx.compose.ui.ExperimentalComposeUiApi
37+
import androidx.compose.ui.Modifier
38+
import androidx.compose.ui.draw.clip
39+
import androidx.compose.ui.platform.LocalUriHandler
40+
import androidx.compose.ui.window.ApplicationScope
41+
import androidx.compose.ui.window.FrameWindowScope
42+
import androidx.lifecycle.compose.collectAsStateWithLifecycle
43+
import com.neoutils.neoregex.core.common.util.ColorTheme
44+
import com.neoutils.neoregex.core.common.util.rememberColorTheme
45+
import com.neoutils.neoregex.core.datasource.PreferencesDataSource
46+
import com.neoutils.neoregex.core.datasource.WindowStateDataSource
47+
import com.neoutils.neoregex.core.datasource.extension.observe
48+
import com.neoutils.neoregex.core.datasource.model.Preferences
49+
import com.neoutils.neoregex.core.datasource.remember.rememberWindowState
50+
import com.neoutils.neoregex.core.designsystem.theme.NeoTheme
51+
import com.neoutils.neoregex.core.designsystem.theme.NeoTheme.dimensions
52+
import com.neoutils.neoregex.core.resources.*
53+
import com.neoutils.neoregex.core.sharedui.component.NeoHeader
54+
import com.neoutils.neoregex.core.sharedui.component.NeoWindow
55+
import com.neoutils.neoregex.core.sharedui.di.WithKoin
56+
import org.jetbrains.compose.resources.painterResource
57+
import org.jetbrains.compose.resources.stringResource
58+
import org.koin.compose.koinInject
59+
60+
@Composable
61+
fun ApplicationScope.DesktopApp() = WithKoin {
62+
63+
val preferencesDataSource = koinInject<PreferencesDataSource>()
64+
val preferences by preferencesDataSource.flow.collectAsState()
65+
66+
val windowStateDataSource = koinInject<WindowStateDataSource>()
67+
val windowState by windowStateDataSource.flow.collectAsState()
68+
69+
NeoTheme(
70+
colorTheme = when (preferences.colorTheme) {
71+
Preferences.ColorTheme.SYSTEM -> rememberColorTheme()
72+
Preferences.ColorTheme.LIGHT -> ColorTheme.LIGHT
73+
Preferences.ColorTheme.DARK -> ColorTheme.DARK
74+
}
75+
) {
76+
NeoWindow(
77+
header = { HeaderImpl() },
78+
windowState = rememberWindowState(windowState)
79+
) {
80+
81+
windowStateDataSource.observe(window)
82+
83+
App()
84+
}
85+
}
86+
}
87+
88+
@Composable
89+
private fun FrameWindowScope.HeaderImpl() {
90+
91+
val preferencesDataSource = koinInject<PreferencesDataSource>()
92+
val preferences by preferencesDataSource.flow.collectAsStateWithLifecycle()
93+
94+
NeoHeader(
95+
colorTheme = when (preferences.colorTheme) {
96+
Preferences.ColorTheme.SYSTEM -> rememberColorTheme()
97+
Preferences.ColorTheme.LIGHT -> ColorTheme.LIGHT
98+
Preferences.ColorTheme.DARK -> ColorTheme.DARK
99+
}
100+
) { padding ->
101+
102+
Text(
103+
text = stringResource(Res.string.app_name),
104+
modifier = Modifier.align(
105+
Alignment.Center
106+
)
107+
)
108+
109+
Row(
110+
modifier = Modifier
111+
.padding(padding)
112+
.padding(horizontal = dimensions.medium)
113+
.align(Alignment.CenterEnd),
114+
horizontalArrangement = Arrangement.spacedBy(dimensions.medium)
115+
) {
116+
val uriHandler = LocalUriHandler.current
117+
118+
Icon(
119+
painter = painterResource(Res.drawable.github),
120+
contentDescription = null,
121+
tint = colorScheme.onSurface,
122+
modifier = Modifier
123+
.clip(CircleShape)
124+
.clickable(
125+
onClick = {
126+
uriHandler.openUri(
127+
uri = "https://github.com/NeoUtils/NeoRegex"
128+
)
129+
}
130+
)
131+
.padding(dimensions.medium)
132+
.aspectRatio(ratio = 1f)
133+
)
134+
135+
Icon(
136+
painter = when (preferences.colorTheme) {
137+
Preferences.ColorTheme.SYSTEM -> painterResource(Res.drawable.contrast)
138+
Preferences.ColorTheme.LIGHT -> painterResource(Res.drawable.light_theme)
139+
Preferences.ColorTheme.DARK -> painterResource(Res.drawable.dark_theme)
140+
},
141+
contentDescription = null,
142+
modifier = Modifier
143+
.clip(CircleShape)
144+
.clickable(
145+
onClick = {
146+
preferencesDataSource.update {
147+
it.copy(
148+
colorTheme = when (it.colorTheme) {
149+
Preferences.ColorTheme.SYSTEM -> Preferences.ColorTheme.LIGHT
150+
Preferences.ColorTheme.LIGHT -> Preferences.ColorTheme.DARK
151+
Preferences.ColorTheme.DARK -> Preferences.ColorTheme.SYSTEM
152+
}
153+
)
154+
}
155+
}
156+
)
157+
.padding(dimensions.medium)
158+
.aspectRatio(ratio = 1f)
159+
)
160+
}
161+
}
162+
}

0 commit comments

Comments
 (0)