Skip to content

Commit

Permalink
Build packages for Android and Windows
Browse files Browse the repository at this point in the history
  • Loading branch information
Yorick-Ryu committed Jan 12, 2023
1 parent 2773a08 commit 64c5b60
Show file tree
Hide file tree
Showing 16 changed files with 91 additions and 13 deletions.
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2023 Ruiyu
Copyright (c) 2023 Rui Yu

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ categories and tags (not implemented) is supplied by Categories and Tags.
```
MIT License
Copyright (c) 2023 Ruiyu
Copyright (c) 2023 Rui Yu
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,15 @@ package com.yorick.sharednotes.ui.screen

import androidx.compose.foundation.layout.*
import androidx.compose.foundation.lazy.rememberLazyListState
import androidx.compose.foundation.rememberScrollState
import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.filled.Edit
import androidx.compose.material3.FloatingActionButton
import androidx.compose.material3.Icon
import androidx.compose.material3.MaterialTheme
import androidx.compose.runtime.Composable
import androidx.compose.runtime.LaunchedEffect
import androidx.compose.runtime.rememberCoroutineScope
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.res.stringResource
Expand All @@ -23,6 +25,7 @@ import com.yorick.sharednotes.ui.note.NoteListScreen
import com.yorick.sharednotes.ui.note.NotesSinglePaneContent
import com.yorick.sharednotes.ui.utils.SharedNotesContentType
import com.yorick.sharednotes.ui.utils.SharedNotesNavigationType
import kotlinx.coroutines.launch

@Composable
fun NoteScreen(
Expand All @@ -41,7 +44,8 @@ fun NoteScreen(
closeDetailScreen()
}
}

val stateVertical = rememberScrollState()
val scope = rememberCoroutineScope()
val noteLazyListState = rememberLazyListState()

if (contentType == SharedNotesContentType.DUAL_PANE) {
Expand All @@ -50,15 +54,21 @@ fun NoteScreen(
NoteListScreen(
notes = notesUIState.notes,
noteLazyListState = noteLazyListState,
navigateToDetail = navigateToDetail,
navigateToDetail = { id, type ->
scope.launch {
stateVertical.animateScrollTo(0)
}
navigateToDetail(id, type)
},
tagsGrid = tagsGrid
)
},
second = {
NoteDetailScreen(
note = notesUIState.selectedNote ?: notesUIState.notes.first(),
isFullScreen = false,
addNote = addNote
addNote = addNote,
stateVertical = stateVertical
)
},
strategy = HorizontalTwoPaneStrategy(splitFraction = 0.5f, gapWidth = 0.dp),
Expand All @@ -71,8 +81,14 @@ fun NoteScreen(
noteLazyListState = noteLazyListState,
modifier = Modifier.fillMaxSize(),
closeDetailScreen = closeDetailScreen,
navigateToDetail = navigateToDetail,
navigateToDetail = { id, type ->
scope.launch {
stateVertical.animateScrollTo(0)
}
navigateToDetail(id, type)
},
addNote = addNote,
stateVertical = stateVertical,
tagsGrid = tagsGrid
)
if (navigationType == SharedNotesNavigationType.BOTTOM_NAVIGATION) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ fun NoteDetailScreen(
}
NoteContent(
noteBody = note.body,
stateVertical = stateVertical
stateVertical = stateVertical,
)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import androidx.compose.foundation.rememberScrollState
import androidx.compose.foundation.rememberScrollbarAdapter
import androidx.compose.material3.MaterialTheme
import androidx.compose.runtime.Composable
import androidx.compose.runtime.rememberCoroutineScope
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.unit.dp
Expand All @@ -25,6 +26,7 @@ import com.yorick.sharednotes.ui.note.NoteDetailScreen
import com.yorick.sharednotes.ui.note.NoteListScreen
import com.yorick.sharednotes.ui.note.NotesSinglePaneContent
import com.yorick.sharednotes.ui.utils.SharedNotesContentType
import kotlinx.coroutines.launch

@Composable
fun NotesScreen(
Expand All @@ -39,6 +41,7 @@ fun NotesScreen(
val noteLazyListState = rememberLazyListState()
val isTwoPane: Boolean = windowState.size.width > 850.dp
val stateVertical = rememberScrollState()
val scope = rememberCoroutineScope()
AnimatedVisibility(
visible = isTwoPane,
enter = expandHorizontally(initialWidth = { it * 5 / 13 }),
Expand All @@ -50,7 +53,12 @@ fun NotesScreen(
NoteListScreen(
notes = notesUIState.notes,
noteLazyListState = noteLazyListState,
navigateToDetail = navigateToDetail,
navigateToDetail = { id, type ->
scope.launch {
stateVertical.animateScrollTo(0)
}
navigateToDetail(id, type)
},
tagsGrid = tagsGrid
)
},
Expand Down Expand Up @@ -99,13 +107,16 @@ fun NotesScreen(
notesUIState = notesUIState,
noteLazyListState = noteLazyListState,
closeDetailScreen = closeDetailScreen,
navigateToDetail = navigateToDetail,
navigateToDetail = { id, type ->
scope.launch {
stateVertical.animateScrollTo(0)
}
navigateToDetail(id, type)
},
addNote = addNote,
tagsGrid = tagsGrid,
stateVertical = stateVertical
)
}
}


}
21 changes: 21 additions & 0 deletions desktop/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2023 Rui Yu

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
34 changes: 32 additions & 2 deletions desktop/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

import org.jetbrains.compose.desktop.application.dsl.TargetFormat

plugins {
Expand Down Expand Up @@ -30,11 +29,42 @@ kotlin {

compose.desktop {
application {
javaHome = System.getenv("JDK_17")
mainClass = "com.yorick.sharednotes.MainKt"
nativeDistributions {
targetFormats(TargetFormat.Dmg, TargetFormat.Msi, TargetFormat.Deb)
targetFormats(TargetFormat.Dmg, TargetFormat.Msi, TargetFormat.Deb,TargetFormat.Exe)
packageName = "SharedNotes"
packageVersion = "1.0.0"
description = "SharedNotes"
copyright = "© 2023 Rui yu. All rights reserved."
vendor = "yorick.love"
licenseFile.set(project.file("LICENSE"))

windows {
packageVersion = "1.0.0"
msiPackageVersion = "1.0.0"
exePackageVersion = "1.0.0"
iconFile.set(File("img/ic_launcher.ico"))
}

linux {
packageVersion = "1.0.0"
debPackageVersion = "1.0.0"
rpmPackageVersion = "1.0.0"
iconFile.set(File("img/ic_launcher.png"))
}

macOS{
packageVersion = "1.0.0"
dmgPackageVersion = "1.0.0"
pkgPackageVersion = "1.0.0"
dockName = "SharedNotes"

packageBuildVersion = "1.0.0"
dmgPackageBuildVersion = "1.0.0"
pkgPackageBuildVersion = "1.0.0"
iconFile.set(File("img/ic_launcher.icns"))
}
}
}
}
Binary file added desktop/img/ic_launcher.icns
Binary file not shown.
Binary file added desktop/img/ic_launcher.ico
Binary file not shown.
Binary file added desktop/img/ic_launcher.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Binary file added desktop/src/jvmMain/resources/img/ic_launcher.ico
Binary file not shown.
Binary file added desktop/src/jvmMain/resources/img/ic_launcher.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added img/ic_launcher.icns
Binary file not shown.
Binary file added img/ic_launcher.ico
Binary file not shown.
Binary file added img/ic_launcher.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 64c5b60

Please sign in to comment.