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
Merge branch 'main' into graphic-notes
# Conflicts:
#	app/src/main/java/dev/arkbuilders/arkmemo/data/repositories/TextNotesRepo.kt
#	app/src/main/java/dev/arkbuilders/arkmemo/data/repositories/TextNotesRepoImpl.kt
#	app/src/main/java/dev/arkbuilders/arkmemo/ui/fragments/EditTextNotesFragment.kt
#	app/src/main/java/dev/arkbuilders/arkmemo/ui/viewmodels/NotesViewModel.kt
#	app/src/main/res/values/strings.xml
  • Loading branch information
shubertm committed Nov 23, 2023
commit 2feb09ac1acfe736cb565428324ff288b7276d6a
Empty file.
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
package dev.arkbuilders.arkmemo.models

enum class SaveNoteResult {
SUCCESS,
ERROR_EXISTING
}
Original file line number Diff line number Diff line change
@@ -34,6 +34,7 @@ class EditTextNotesFragment: Fragment(R.layout.fragment_edit_notes) {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
notesViewModel.init {}
subscribeLiveData()
if(arguments != null) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU)
requireArguments().getParcelable(NOTE_KEY, TextNote::class.java)?.let {
@@ -68,7 +69,6 @@ class EditTextNotesFragment: Fragment(R.layout.fragment_edit_notes) {

override fun onTextChanged(s: CharSequence?, start: Int, before: Int, count: Int) {
title = s?.toString() ?: ""
saveNoteButton.isEnabled = !s.isNullOrEmpty()
}

override fun afterTextChanged(s: Editable?) {}
@@ -101,6 +101,22 @@ class EditTextNotesFragment: Fragment(R.layout.fragment_edit_notes) {
}
}

private fun subscribeLiveData() {
notesViewModel.getSaveNoteResultLiveData().observe(this) {
if (!isResumed) return@observe

if (it == SaveNoteResult.SUCCESS) {
Toast.makeText(requireContext(), getString(R.string.ark_memo_note_saved),
Toast.LENGTH_SHORT)
.show()
activity.onBackPressedDispatcher.onBackPressed()
} else {
Toast.makeText(requireContext(), getString(R.string.ark_memo_note_existing),
Toast.LENGTH_SHORT)
.show()
}
}
}

companion object{
const val TAG = "Edit Text Notes"
Original file line number Diff line number Diff line change
@@ -1,13 +1,18 @@
package dev.arkbuilders.arkmemo.ui.viewmodels

import androidx.lifecycle.LiveData
import androidx.lifecycle.MutableLiveData
import androidx.lifecycle.ViewModel
import androidx.lifecycle.viewModelScope
import dagger.hilt.android.lifecycle.HiltViewModel
import kotlinx.coroutines.CoroutineDispatcher
import dev.arkbuilders.arkmemo.data.repositories.SaveNoteCallback
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.flow.MutableStateFlow
import kotlinx.coroutines.launch
import kotlinx.coroutines.withContext
import dev.arkbuilders.arkmemo.data.repositories.TextNotesRepo
import dev.arkbuilders.arkmemo.models.SaveNoteResult
import dev.arkbuilders.arkmemo.data.repositories.NotesRepo
import dev.arkbuilders.arkmemo.di.IO_DISPATCHER
import dev.arkbuilders.arkmemo.models.GraphicNote
@@ -27,6 +32,7 @@ class NotesViewModel @Inject constructor(
) : ViewModel() {

private val notes = MutableStateFlow(listOf<Note>())
private val mSaveNoteResultLiveData = MutableLiveData<SaveNoteResult>()

fun init(read: () -> Unit) {
val initJob = viewModelScope.launch(iODispatcher) {
@@ -52,13 +58,21 @@ class NotesViewModel @Inject constructor(
}
when (note) {
is TextNote -> {
textNotesRepo.save(note)
textNotesRepo.save(note, object : SaveNoteCallback {
override fun onSaveNote(result: SaveNoteResult) {
if (result == SaveNoteResult.SUCCESS) {
add(note)
}
mSaveNoteResultLiveData.postValue(result)
}

})
}
is GraphicNote -> {
graphicNotesRepo.save(note)
add(note)
}
}
add(note)
withContext(Dispatchers.Main) {
showProgress(false)
}
@@ -99,4 +113,8 @@ class NotesViewModel @Inject constructor(
notes.remove(note)
this.notes.value = notes
}

fun getSaveNoteResultLiveData(): LiveData<SaveNoteResult> {
return mSaveNoteResultLiveData
}
}
1 change: 1 addition & 0 deletions app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
@@ -25,6 +25,7 @@
<string name="ark_memo_ok">OK</string>
<string name="ark_memo_cancel">Cancel</string>
<string name="ark_memo_delete_warn">Are you sure to delete note?</string>
<string name="ark_memo_note_existing">Note already exist</string>
<string name="ark_memo_note_saved">Note saved successfully</string>
<string name="note_title">Title</string>

You are viewing a condensed version of this merge commit. You can view the full changes here.