Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#2: Voice notes #42

Merged
merged 46 commits into from
Feb 1, 2024
Merged
Changes from 1 commit
Commits
Show all changes
46 commits
Select commit Hold shift + click to select a range
b800474
SVG commands
shubertm Oct 1, 2023
c4624e9
SVG creating + parsing
shubertm Oct 5, 2023
39febc4
Merge remote-tracking branch 'origin/main' into graphic-notes
shubertm Oct 25, 2023
07c404e
Fix svg read/write + some refactors
shubertm Oct 26, 2023
a783848
Refactor repos and notes models
shubertm Oct 30, 2023
1b7bf94
Merge branch 'main' into graphic-notes
shubertm Oct 30, 2023
4679884
Improving graphic notes
shubertm Nov 8, 2023
6be6aea
Fix gradle build
shubertm Nov 8, 2023
8ae4e43
Merge main
shubertm Nov 9, 2023
39018e6
Fix build errors + deprecated API
shubertm Nov 16, 2023
211a347
Minor fixes + refactor
shubertm Nov 21, 2023
bd1dce5
Fix svg parsing
shubertm Nov 23, 2023
2feb09a
Merge branch 'main' into graphic-notes
shubertm Nov 23, 2023
9ab8c0d
Fix SVG to use proper data structure for commands
shubertm Nov 24, 2023
b1e0ff0
Refactor SVG command
shubertm Nov 25, 2023
9a038ac
Minor refactoring
kirillt Nov 27, 2023
9d08558
Update app/src/main/res/values/strings.xml
shubertm Nov 28, 2023
51edfda
Refactor SVG viewbox
shubertm Nov 29, 2023
964df38
Replace Stack with ArrayDeque
shubertm Nov 29, 2023
b32f933
Add type annotations to public SVG functions
shubertm Nov 29, 2023
77c66a8
Refactor SVG commands
shubertm Nov 29, 2023
4eac79d
Move local texts to string resource file
shubertm Nov 29, 2023
3858f14
Remove non-null assertions in NotesListAdapter
shubertm Nov 29, 2023
56e0e5f
Remove non-null assertions in MemoPreferencesImpl
shubertm Nov 29, 2023
a3bb1a5
Minor refactor
shubertm Nov 30, 2023
80fd06d
Check svg paths size
shubertm Dec 1, 2023
50a7117
Generalize file listing function
shubertm Dec 3, 2023
b433636
Refactor repos
shubertm Dec 3, 2023
a709241
Minor refactors
shubertm Dec 4, 2023
2de93c3
Fix extra line feed in text content
shubertm Dec 4, 2023
17d5097
Minor refactor
shubertm Dec 5, 2023
e41726d
Add extended fab
shubertm Dec 6, 2023
f6139b7
Minor refacotrs
shubertm Dec 6, 2023
e77fb6a
Voice notes impl
shubertm Dec 18, 2023
c0994a9
SVG creating + parsing
shubertm Oct 5, 2023
21b5490
Refactor repos and notes models
shubertm Oct 30, 2023
39168a1
Improving graphic notes
shubertm Nov 8, 2023
e393e8f
Fix build errors + deprecated API
shubertm Nov 16, 2023
505fc6e
Fix svg parsing
shubertm Nov 23, 2023
0643661
Fix SVG to use proper data structure for commands
shubertm Nov 24, 2023
04fdcd5
Voice notes impl
shubertm Dec 18, 2023
f727ddd
Some fixes
shubertm Dec 21, 2023
2986176
Some fixes
shubertm Dec 21, 2023
4486fb7
Merge remote-tracking branch 'origin/feature/voice-notes' into featur…
shubertm Dec 21, 2023
0b8c4a2
Improvements
shubertm Dec 23, 2023
8c2b75e
Merge main
shubertm Jan 29, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Refactor SVG commands
  • Loading branch information
shubertm committed Nov 29, 2023
commit 77c66a8468e2d5922d6c362b406447e4cba01747
16 changes: 8 additions & 8 deletions app/src/main/java/dev/arkbuilders/arkmemo/graphics/SVG.kt
Original file line number Diff line number Diff line change
@@ -42,7 +42,7 @@ class SVG {
fun generate(path: Path) {
if (commands.isNotEmpty()) {
val xmlSerializer = Xml.newSerializer()
val pathData = commands.joinToString(COMMA)
val pathData = commands.joinToString()
xmlSerializer.apply {
setOutput(path.writer())
startDocument("utf-8", false)
@@ -128,7 +128,7 @@ class SVG {


pathData.split(COMMA).forEach {
when (it.first()) {
when (it.trim().first()) {
SVGCommand.MoveTo.CODE -> {
commands.addLast(SVGCommand.MoveTo.fromString(it))
}
@@ -186,13 +186,13 @@ sealed class SVGCommand {
val x: Float,
val y: Float
) : SVGCommand() {
override fun toString(): String = "$CODE$x $y"
override fun toString(): String = "$CODE $x $y"

companion object {
const val CODE = 'M'

fun fromString(string: String): SVGCommand {
val coords = string.removePrefix("$CODE").split(" ")
val coords = string.removePrefix("$CODE").trim().split(" ")
val x = coords[0].toFloat()
val y = coords[1].toFloat()
return MoveTo(x, y)
@@ -204,13 +204,13 @@ sealed class SVGCommand {
val x: Float,
val y: Float
) : SVGCommand() {
override fun toString(): String = "$CODE$x $y"
override fun toString(): String = "$CODE $x $y"

companion object {
const val CODE = 'L'

fun fromString(string: String): SVGCommand {
val coords = string.removePrefix("$CODE").split(" ")
val coords = string.removePrefix("$CODE").trim().split(" ")
val x = coords[0].toFloat()
val y = coords[1].toFloat()
return AbsLineTo(x, y)
@@ -224,13 +224,13 @@ sealed class SVGCommand {
val x2: Float,
val y2: Float
) : SVGCommand() {
override fun toString(): String = "$CODE$x1 $y1 $x2 $y2"
override fun toString(): String = "$CODE $x1 $y1 $x2 $y2"

companion object {
const val CODE = 'Q'

fun fromString(string: String): SVGCommand {
val coords = string.removePrefix("$CODE").split(" ")
val coords = string.removePrefix("$CODE").trim().split(" ")
val x1 = coords[0].toFloat()
val y1 = coords[1].toFloat()
val x2 = coords[2].toFloat()