Skip to content

Commit 64c5b60

Browse files
committed
Build packages for Android and Windows
1 parent 2773a08 commit 64c5b60

File tree

16 files changed

+91
-13
lines changed

16 files changed

+91
-13
lines changed

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
MIT License
22

3-
Copyright (c) 2023 Ruiyu
3+
Copyright (c) 2023 Rui Yu
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ categories and tags (not implemented) is supplied by Categories and Tags.
110110
```
111111
MIT License
112112
113-
Copyright (c) 2023 Ruiyu
113+
Copyright (c) 2023 Rui Yu
114114
115115
Permission is hereby granted, free of charge, to any person obtaining a copy
116116
of this software and associated documentation files (the "Software"), to deal

common/src/androidMain/kotlin/com/yorick/sharednotes/ui/screen/NotesScreen.kt

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,15 @@ package com.yorick.sharednotes.ui.screen
22

33
import androidx.compose.foundation.layout.*
44
import androidx.compose.foundation.lazy.rememberLazyListState
5+
import androidx.compose.foundation.rememberScrollState
56
import androidx.compose.material.icons.Icons
67
import androidx.compose.material.icons.filled.Edit
78
import androidx.compose.material3.FloatingActionButton
89
import androidx.compose.material3.Icon
910
import androidx.compose.material3.MaterialTheme
1011
import androidx.compose.runtime.Composable
1112
import androidx.compose.runtime.LaunchedEffect
13+
import androidx.compose.runtime.rememberCoroutineScope
1214
import androidx.compose.ui.Alignment
1315
import androidx.compose.ui.Modifier
1416
import androidx.compose.ui.res.stringResource
@@ -23,6 +25,7 @@ import com.yorick.sharednotes.ui.note.NoteListScreen
2325
import com.yorick.sharednotes.ui.note.NotesSinglePaneContent
2426
import com.yorick.sharednotes.ui.utils.SharedNotesContentType
2527
import com.yorick.sharednotes.ui.utils.SharedNotesNavigationType
28+
import kotlinx.coroutines.launch
2629

2730
@Composable
2831
fun NoteScreen(
@@ -41,7 +44,8 @@ fun NoteScreen(
4144
closeDetailScreen()
4245
}
4346
}
44-
47+
val stateVertical = rememberScrollState()
48+
val scope = rememberCoroutineScope()
4549
val noteLazyListState = rememberLazyListState()
4650

4751
if (contentType == SharedNotesContentType.DUAL_PANE) {
@@ -50,15 +54,21 @@ fun NoteScreen(
5054
NoteListScreen(
5155
notes = notesUIState.notes,
5256
noteLazyListState = noteLazyListState,
53-
navigateToDetail = navigateToDetail,
57+
navigateToDetail = { id, type ->
58+
scope.launch {
59+
stateVertical.animateScrollTo(0)
60+
}
61+
navigateToDetail(id, type)
62+
},
5463
tagsGrid = tagsGrid
5564
)
5665
},
5766
second = {
5867
NoteDetailScreen(
5968
note = notesUIState.selectedNote ?: notesUIState.notes.first(),
6069
isFullScreen = false,
61-
addNote = addNote
70+
addNote = addNote,
71+
stateVertical = stateVertical
6272
)
6373
},
6474
strategy = HorizontalTwoPaneStrategy(splitFraction = 0.5f, gapWidth = 0.dp),
@@ -71,8 +81,14 @@ fun NoteScreen(
7181
noteLazyListState = noteLazyListState,
7282
modifier = Modifier.fillMaxSize(),
7383
closeDetailScreen = closeDetailScreen,
74-
navigateToDetail = navigateToDetail,
84+
navigateToDetail = { id, type ->
85+
scope.launch {
86+
stateVertical.animateScrollTo(0)
87+
}
88+
navigateToDetail(id, type)
89+
},
7590
addNote = addNote,
91+
stateVertical = stateVertical,
7692
tagsGrid = tagsGrid
7793
)
7894
if (navigationType == SharedNotesNavigationType.BOTTOM_NAVIGATION) {

common/src/commonMain/kotlin/com/yorick/sharednotes/ui/note/NoteListScreen.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ fun NoteDetailScreen(
8181
}
8282
NoteContent(
8383
noteBody = note.body,
84-
stateVertical = stateVertical
84+
stateVertical = stateVertical,
8585
)
8686
}
8787
}

common/src/desktopMain/kotlin/com/yorick/sharednotes/ui/screen/NotesScreen.kt

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ import androidx.compose.foundation.rememberScrollState
1515
import androidx.compose.foundation.rememberScrollbarAdapter
1616
import androidx.compose.material3.MaterialTheme
1717
import androidx.compose.runtime.Composable
18+
import androidx.compose.runtime.rememberCoroutineScope
1819
import androidx.compose.ui.Alignment
1920
import androidx.compose.ui.Modifier
2021
import androidx.compose.ui.unit.dp
@@ -25,6 +26,7 @@ import com.yorick.sharednotes.ui.note.NoteDetailScreen
2526
import com.yorick.sharednotes.ui.note.NoteListScreen
2627
import com.yorick.sharednotes.ui.note.NotesSinglePaneContent
2728
import com.yorick.sharednotes.ui.utils.SharedNotesContentType
29+
import kotlinx.coroutines.launch
2830

2931
@Composable
3032
fun NotesScreen(
@@ -39,6 +41,7 @@ fun NotesScreen(
3941
val noteLazyListState = rememberLazyListState()
4042
val isTwoPane: Boolean = windowState.size.width > 850.dp
4143
val stateVertical = rememberScrollState()
44+
val scope = rememberCoroutineScope()
4245
AnimatedVisibility(
4346
visible = isTwoPane,
4447
enter = expandHorizontally(initialWidth = { it * 5 / 13 }),
@@ -50,7 +53,12 @@ fun NotesScreen(
5053
NoteListScreen(
5154
notes = notesUIState.notes,
5255
noteLazyListState = noteLazyListState,
53-
navigateToDetail = navigateToDetail,
56+
navigateToDetail = { id, type ->
57+
scope.launch {
58+
stateVertical.animateScrollTo(0)
59+
}
60+
navigateToDetail(id, type)
61+
},
5462
tagsGrid = tagsGrid
5563
)
5664
},
@@ -99,13 +107,16 @@ fun NotesScreen(
99107
notesUIState = notesUIState,
100108
noteLazyListState = noteLazyListState,
101109
closeDetailScreen = closeDetailScreen,
102-
navigateToDetail = navigateToDetail,
110+
navigateToDetail = { id, type ->
111+
scope.launch {
112+
stateVertical.animateScrollTo(0)
113+
}
114+
navigateToDetail(id, type)
115+
},
103116
addNote = addNote,
104117
tagsGrid = tagsGrid,
105118
stateVertical = stateVertical
106119
)
107120
}
108121
}
109-
110-
111122
}

desktop/LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2023 Rui Yu
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

desktop/build.gradle.kts

Lines changed: 32 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
21
import org.jetbrains.compose.desktop.application.dsl.TargetFormat
32

43
plugins {
@@ -30,11 +29,42 @@ kotlin {
3029

3130
compose.desktop {
3231
application {
32+
javaHome = System.getenv("JDK_17")
3333
mainClass = "com.yorick.sharednotes.MainKt"
3434
nativeDistributions {
35-
targetFormats(TargetFormat.Dmg, TargetFormat.Msi, TargetFormat.Deb)
35+
targetFormats(TargetFormat.Dmg, TargetFormat.Msi, TargetFormat.Deb,TargetFormat.Exe)
3636
packageName = "SharedNotes"
3737
packageVersion = "1.0.0"
38+
description = "SharedNotes"
39+
copyright = "© 2023 Rui yu. All rights reserved."
40+
vendor = "yorick.love"
41+
licenseFile.set(project.file("LICENSE"))
42+
43+
windows {
44+
packageVersion = "1.0.0"
45+
msiPackageVersion = "1.0.0"
46+
exePackageVersion = "1.0.0"
47+
iconFile.set(File("img/ic_launcher.ico"))
48+
}
49+
50+
linux {
51+
packageVersion = "1.0.0"
52+
debPackageVersion = "1.0.0"
53+
rpmPackageVersion = "1.0.0"
54+
iconFile.set(File("img/ic_launcher.png"))
55+
}
56+
57+
macOS{
58+
packageVersion = "1.0.0"
59+
dmgPackageVersion = "1.0.0"
60+
pkgPackageVersion = "1.0.0"
61+
dockName = "SharedNotes"
62+
63+
packageBuildVersion = "1.0.0"
64+
dmgPackageBuildVersion = "1.0.0"
65+
pkgPackageBuildVersion = "1.0.0"
66+
iconFile.set(File("img/ic_launcher.icns"))
67+
}
3868
}
3969
}
4070
}

desktop/img/ic_launcher.icns

7.17 KB
Binary file not shown.

desktop/img/ic_launcher.ico

68.1 KB
Binary file not shown.

desktop/img/ic_launcher.png

3.65 KB
Loading

0 commit comments

Comments
 (0)