diff --git a/.idea/gradle.xml b/.idea/gradle.xml index 526b4c2..e9969a1 100644 --- a/.idea/gradle.xml +++ b/.idea/gradle.xml @@ -7,6 +7,7 @@ + diff --git a/app/src/androidTest/java/dev/marcos/droidnotes/ExampleInstrumentedTest.kt b/app/src/androidTest/java/dev/marcos/droidnotes/ExampleInstrumentedTest.kt deleted file mode 100644 index d409c1a..0000000 --- a/app/src/androidTest/java/dev/marcos/droidnotes/ExampleInstrumentedTest.kt +++ /dev/null @@ -1,24 +0,0 @@ -package dev.marcos.droidnotes - -import androidx.test.platform.app.InstrumentationRegistry -import androidx.test.ext.junit.runners.AndroidJUnit4 - -import org.junit.Test -import org.junit.runner.RunWith - -import org.junit.Assert.* - -/** - * Instrumented test, which will execute on an Android device. - * - * See [testing documentation](http://d.android.com/tools/testing). - */ -@RunWith(AndroidJUnit4::class) -class ExampleInstrumentedTest { - @Test - fun useAppContext() { - // Context of the app under test. - val appContext = InstrumentationRegistry.getInstrumentation().targetContext - assertEquals("dev.marcos.droidnotes", appContext.packageName) - } -} \ No newline at end of file diff --git a/app/src/main/java/dev/marcos/droidnotes/MainActivity.kt b/app/src/main/java/dev/marcos/droidnotes/MainActivity.kt index 989852b..ea976ab 100644 --- a/app/src/main/java/dev/marcos/droidnotes/MainActivity.kt +++ b/app/src/main/java/dev/marcos/droidnotes/MainActivity.kt @@ -24,7 +24,6 @@ import androidx.compose.ui.Alignment import androidx.compose.ui.ExperimentalComposeUiApi import androidx.compose.ui.Modifier import androidx.compose.ui.unit.dp -import dev.marcos.droidnotes.domain.Note import dev.marcos.droidnotes.ui.view.ListLayout import dev.marcos.droidnotes.ui.view.SheetLayout import dev.marcos.droidnotes.ui.viewmodel.NotesViewModel @@ -118,4 +117,4 @@ class MainActivity : ComponentActivity() { } } } -} \ No newline at end of file +} diff --git a/app/src/main/java/dev/marcos/droidnotes/NotesApplication.kt b/app/src/main/java/dev/marcos/droidnotes/NotesApplication.kt index 267c223..fe3f703 100644 --- a/app/src/main/java/dev/marcos/droidnotes/NotesApplication.kt +++ b/app/src/main/java/dev/marcos/droidnotes/NotesApplication.kt @@ -21,7 +21,6 @@ class NotesApplication : Application() { } val repository by lazy { - NotesRepository( dataSource ) + NotesRepository(dataSource) } - -} \ No newline at end of file +} diff --git a/app/src/main/java/dev/marcos/droidnotes/data/NotesDataSource.kt b/app/src/main/java/dev/marcos/droidnotes/data/NotesDataSource.kt index bed113c..55090a7 100644 --- a/app/src/main/java/dev/marcos/droidnotes/data/NotesDataSource.kt +++ b/app/src/main/java/dev/marcos/droidnotes/data/NotesDataSource.kt @@ -18,7 +18,6 @@ class NotesDataSource( } fun get(note: Note) { - } suspend fun insert(note: Note) { @@ -51,4 +50,4 @@ class NotesDataSource( // } // } } -} \ No newline at end of file +} diff --git a/app/src/main/java/dev/marcos/droidnotes/data/NotesRepository.kt b/app/src/main/java/dev/marcos/droidnotes/data/NotesRepository.kt index 1009b17..1ea380e 100644 --- a/app/src/main/java/dev/marcos/droidnotes/data/NotesRepository.kt +++ b/app/src/main/java/dev/marcos/droidnotes/data/NotesRepository.kt @@ -8,4 +8,4 @@ class NotesRepository(private val dataSource: NotesDataSource) { suspend fun insert(note: Note) = dataSource.insert(note) suspend fun update(note: Note) = dataSource.update(note) suspend fun delete(note: Note) = dataSource.delete(note) -} \ No newline at end of file +} diff --git a/app/src/main/java/dev/marcos/droidnotes/data/network/GrpcService.kt b/app/src/main/java/dev/marcos/droidnotes/data/network/GrpcService.kt index e453b9d..7274921 100644 --- a/app/src/main/java/dev/marcos/droidnotes/data/network/GrpcService.kt +++ b/app/src/main/java/dev/marcos/droidnotes/data/network/GrpcService.kt @@ -13,4 +13,4 @@ class GrpcService(private val host: String, private val port: Int) { .usePlaintext() .build() } -} \ No newline at end of file +} diff --git a/app/src/main/java/dev/marcos/droidnotes/data/storage/AppDatabase.kt b/app/src/main/java/dev/marcos/droidnotes/data/storage/AppDatabase.kt index ec59c71..01f1cf4 100644 --- a/app/src/main/java/dev/marcos/droidnotes/data/storage/AppDatabase.kt +++ b/app/src/main/java/dev/marcos/droidnotes/data/storage/AppDatabase.kt @@ -26,7 +26,7 @@ abstract class AppDatabase : RoomDatabase() { context.applicationContext, AppDatabase::class.java, "notes_database" - ) .addCallback(NotesDatabaseCallback(scope)) + ).addCallback(NotesDatabaseCallback(scope)) .build() INSTANCE = instance instance @@ -69,7 +69,7 @@ abstract class AppDatabase : RoomDatabase() { ) val loremContent = listOf( - "A bearing, forth Us deep saw night. Fifth also our moved saying. Him one firmament, after life subdue sea bring day, after. Seasons beast there greater a air replenish of, him fly abundantly he isn't. Own. Stars tree seasons fruitful herb cattle beast waters wherein them. The is sixth of. All kind the they're you'll given gathering from. Own two said blessed. Two. Every fifth. Day dominion isn't, appear also there seed sixth set bearing moved face likeness." , + "A bearing, forth Us deep saw night. Fifth also our moved saying. Him one firmament, after life subdue sea bring day, after. Seasons beast there greater a air replenish of, him fly abundantly he isn't. Own. Stars tree seasons fruitful herb cattle beast waters wherein them. The is sixth of. All kind the they're you'll given gathering from. Own two said blessed. Two. Every fifth. Day dominion isn't, appear also there seed sixth set bearing moved face likeness.", "Kind. Saying Isn't is. Which two the greater. Days you're which have make let don't was make one signs fish unto seed own day is fill lesser you're stars don't signs fifth morning. Light two without moveth their lesser air is. Rule great in their days likeness had fruit of life doesn't you'll sixth whales years every isn't tree fifth fourth bring you're. You're. Bring him own. Itself given spirit darkness can't earth evening meat over face greater together face i itself face herb very air moved face.", "Sea tree. Sixth life upon beast was together. Void which. Place saw fowl grass gathering dominion brought divide every thing after. Given first have female greater fill of evening. Replenish Seas bearing to midst firmament greater fifth green moving one them spirit She'd creeping rule from above wherein unto signs he Be set. Form Fish. Multiply great first darkness seed second darkness sixth whales make saying lesser kind unto. A creeping, you'll whose beast creepeth divide make let blessed have dry forth thing. Spirit female. First deep let first. Years divided.", "Unto. Fourth forth replenish given very subdue tree their. Beginning together all You he. Sixth winged moveth void have form behold thing appear may hath god moving he green man life. Fly she'd appear without had doesn't. Gathered for. Isn't yielding day thing likeness for. Signs meat. Living yielding bring. You'll herb she'd.", @@ -80,5 +80,4 @@ abstract class AppDatabase : RoomDatabase() { "Fill. Great divided very moveth. Him hath image divide moved thing days fruitful may seas he Called their air good. Upon. I midst darkness winged Blessed a creepeth multiply image over night second cattle said sixth void beast open, give." ) } - } diff --git a/app/src/main/java/dev/marcos/droidnotes/data/storage/NotesDao.kt b/app/src/main/java/dev/marcos/droidnotes/data/storage/NotesDao.kt index 457ac6f..a187f12 100644 --- a/app/src/main/java/dev/marcos/droidnotes/data/storage/NotesDao.kt +++ b/app/src/main/java/dev/marcos/droidnotes/data/storage/NotesDao.kt @@ -25,4 +25,4 @@ interface NotesDao { @Delete suspend fun deleteAll(vararg users: Note) -} \ No newline at end of file +} diff --git a/app/src/main/java/dev/marcos/droidnotes/di/Injector.kt b/app/src/main/java/dev/marcos/droidnotes/di/Injector.kt index 4572c7e..8e67cb6 100644 --- a/app/src/main/java/dev/marcos/droidnotes/di/Injector.kt +++ b/app/src/main/java/dev/marcos/droidnotes/di/Injector.kt @@ -20,4 +20,4 @@ object Injector { // ) // ) // ) -} \ No newline at end of file +} diff --git a/app/src/main/java/dev/marcos/droidnotes/domain/Note.kt b/app/src/main/java/dev/marcos/droidnotes/domain/Note.kt index 7fcb45b..73298b5 100644 --- a/app/src/main/java/dev/marcos/droidnotes/domain/Note.kt +++ b/app/src/main/java/dev/marcos/droidnotes/domain/Note.kt @@ -22,7 +22,6 @@ data class Note( val height: Int? = 200 ) - fun getNotesHeightsValues() = listOf(180, 145, 200, 240) -fun getNotesColorsValues() = (0..5) \ No newline at end of file +fun getNotesColorsValues() = (0..5) diff --git a/app/src/main/java/dev/marcos/droidnotes/ui/view/ListLayout.kt b/app/src/main/java/dev/marcos/droidnotes/ui/view/ListLayout.kt index d75bd1f..ccf4168 100644 --- a/app/src/main/java/dev/marcos/droidnotes/ui/view/ListLayout.kt +++ b/app/src/main/java/dev/marcos/droidnotes/ui/view/ListLayout.kt @@ -130,8 +130,10 @@ fun ListLayout( .padding(8.dp), elevation = 2.dp, backgroundColor = colorResource( - id = backgroundColors[it.color - ?: getNotesColorsValues().random()] + id = backgroundColors[ + it.color + ?: getNotesColorsValues().random() + ] ), ) { Column { diff --git a/app/src/main/java/dev/marcos/droidnotes/ui/view/SheetLayout.kt b/app/src/main/java/dev/marcos/droidnotes/ui/view/SheetLayout.kt index 743b61d..e10f652 100644 --- a/app/src/main/java/dev/marcos/droidnotes/ui/view/SheetLayout.kt +++ b/app/src/main/java/dev/marcos/droidnotes/ui/view/SheetLayout.kt @@ -85,7 +85,7 @@ fun SheetLayout( viewModel.selectedNote.value = null viewModel.viewModelScope.launch { delay(250L) - currentColor.value = getNotesColorsValues().random() + currentColor.value = getNotesColorsValues().random() } } @@ -93,7 +93,8 @@ fun SheetLayout( DialogDelete { if (it) { selectedNote?.let { - note -> viewModel.delete(note) + note -> + viewModel.delete(note) } clearScreen() } @@ -101,8 +102,8 @@ fun SheetLayout( } } - if (openWarningDialog.value){ - DialogWarning{ + if (openWarningDialog.value) { + DialogWarning { openWarningDialog.value = it.not() } } @@ -175,8 +176,8 @@ fun SheetLayout( Spacer(modifier = Modifier.padding(8.dp)) Button( onClick = { - if (title.value.text.isBlank() or content.value.text.isBlank()){ - openWarningDialog.value = true + if (title.value.text.isBlank() or content.value.text.isBlank()) { + openWarningDialog.value = true } else { viewModel.insertOrUpdate( Note( @@ -236,10 +237,10 @@ fun DialogWarning(confirm: (Boolean) -> Unit) { text = { Text(stringResource(id = R.string.dialog_warning_content)) }, confirmButton = { Button( - onClick = { confirm(true) } + onClick = { confirm(true) } ) { Text(stringResource(id = R.string.dialog_warning_confirm_button)) } } ) -} \ No newline at end of file +} diff --git a/app/src/main/java/dev/marcos/droidnotes/ui/viewmodel/NotesViewModel.kt b/app/src/main/java/dev/marcos/droidnotes/ui/viewmodel/NotesViewModel.kt index 725ea0c..16e4c71 100644 --- a/app/src/main/java/dev/marcos/droidnotes/ui/viewmodel/NotesViewModel.kt +++ b/app/src/main/java/dev/marcos/droidnotes/ui/viewmodel/NotesViewModel.kt @@ -35,7 +35,6 @@ class NotesViewModel( } } - fun insertOrUpdate(note: Note) { if (note.id == 0) { insert(note = note) @@ -43,4 +42,4 @@ class NotesViewModel( update(note = note) } } -} \ No newline at end of file +} diff --git a/app/src/main/java/dev/marcos/droidnotes/ui/viewmodel/NotesViewModelFactory.kt b/app/src/main/java/dev/marcos/droidnotes/ui/viewmodel/NotesViewModelFactory.kt index 8591c5c..b8f6ff2 100644 --- a/app/src/main/java/dev/marcos/droidnotes/ui/viewmodel/NotesViewModelFactory.kt +++ b/app/src/main/java/dev/marcos/droidnotes/ui/viewmodel/NotesViewModelFactory.kt @@ -11,4 +11,4 @@ class NotesViewModelFactory( override fun create(modelClass: Class): T { return NotesViewModel(repository) as T } -} \ No newline at end of file +} diff --git a/app/src/main/java/dev/marcos/droidnotes/widgets/BottomSheetWithCloseDialog.kt b/app/src/main/java/dev/marcos/droidnotes/widgets/BottomSheetWithCloseDialog.kt index 6a361db..9610f8a 100644 --- a/app/src/main/java/dev/marcos/droidnotes/widgets/BottomSheetWithCloseDialog.kt +++ b/app/src/main/java/dev/marcos/droidnotes/widgets/BottomSheetWithCloseDialog.kt @@ -37,4 +37,4 @@ fun BottomSheetWithCloseDialog( Icon(Icons.Filled.Close, tint = closeButtonColor, contentDescription = null) } } -} \ No newline at end of file +} diff --git a/app/src/main/java/dev/marcos/droidnotes/widgets/Chips.kt b/app/src/main/java/dev/marcos/droidnotes/widgets/Chips.kt index 9c4a9b7..faf7bb8 100644 --- a/app/src/main/java/dev/marcos/droidnotes/widgets/Chips.kt +++ b/app/src/main/java/dev/marcos/droidnotes/widgets/Chips.kt @@ -35,9 +35,9 @@ fun Chip( else -> Color.LightGray }, shape = CircleShape, - modifier = modifier.clickable { selectedIndex(index) }, + modifier = modifier.clickable { selectedIndex(index) }, ) { - Text( + Text( text = text, textAlign = TextAlign.Center, style = MaterialTheme.typography.body2, @@ -48,6 +48,5 @@ fun Chip( }, modifier = Modifier.padding(8.dp).requiredWidth(48.dp) ) - } -} \ No newline at end of file +} diff --git a/app/src/main/java/dev/marcos/droidnotes/widgets/MainFloatingActionButton.kt b/app/src/main/java/dev/marcos/droidnotes/widgets/MainFloatingActionButton.kt index c28e67b..c28320c 100644 --- a/app/src/main/java/dev/marcos/droidnotes/widgets/MainFloatingActionButton.kt +++ b/app/src/main/java/dev/marcos/droidnotes/widgets/MainFloatingActionButton.kt @@ -17,4 +17,4 @@ fun MainFloatingActionButton(onClick: () -> Unit) { ) { Icon(imageVector = Icons.Filled.Add, contentDescription = null, tint = Color.White) } -} \ No newline at end of file +} diff --git a/app/src/main/java/dev/marcos/droidnotes/widgets/StaggeredVerticalGrid.kt b/app/src/main/java/dev/marcos/droidnotes/widgets/StaggeredVerticalGrid.kt index 433c22d..01076bf 100644 --- a/app/src/main/java/dev/marcos/droidnotes/widgets/StaggeredVerticalGrid.kt +++ b/app/src/main/java/dev/marcos/droidnotes/widgets/StaggeredVerticalGrid.kt @@ -2,9 +2,9 @@ package dev.marcos.droidnotes.widgets import androidx.compose.runtime.Composable import androidx.compose.ui.Modifier +import androidx.compose.ui.layout.Layout import androidx.compose.ui.unit.Dp import kotlin.math.ceil -import androidx.compose.ui.layout.Layout @Composable fun StaggeredVerticalGrid( @@ -59,4 +59,4 @@ private fun shortestColumn(colHeights: IntArray): Int { } } return column -} \ No newline at end of file +} diff --git a/app/src/main/java/dev/marcos/droidnotes/widgets/Tags.kt b/app/src/main/java/dev/marcos/droidnotes/widgets/Tags.kt index 31257a0..85d20b0 100644 --- a/app/src/main/java/dev/marcos/droidnotes/widgets/Tags.kt +++ b/app/src/main/java/dev/marcos/droidnotes/widgets/Tags.kt @@ -43,4 +43,4 @@ fun Tags(snackbarVisibleState: MutableState) { } } } -} \ No newline at end of file +} diff --git a/app/src/test/java/dev/marcos/droidnotes/ExampleUnitTest.kt b/app/src/test/java/dev/marcos/droidnotes/ExampleUnitTest.kt index 6b1f21b..9b63d40 100644 --- a/app/src/test/java/dev/marcos/droidnotes/ExampleUnitTest.kt +++ b/app/src/test/java/dev/marcos/droidnotes/ExampleUnitTest.kt @@ -1,9 +1,8 @@ package dev.marcos.droidnotes +import org.junit.Assert.assertEquals import org.junit.Test -import org.junit.Assert.* - /** * Example local unit test, which will execute on the development machine (host). * @@ -14,4 +13,4 @@ class ExampleUnitTest { fun addition_isCorrect() { assertEquals(4, 2 + 2) } -} \ No newline at end of file +}