Skip to content

Commit

Permalink
formart code after ktlint installation
Browse files Browse the repository at this point in the history
  • Loading branch information
mrcsxsiq committed Jul 25, 2021
1 parent d1bfde7 commit b02f0ac
Show file tree
Hide file tree
Showing 21 changed files with 37 additions and 65 deletions.
1 change: 1 addition & 0 deletions .idea/gradle.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

This file was deleted.

3 changes: 1 addition & 2 deletions app/src/main/java/dev/marcos/droidnotes/MainActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -118,4 +117,4 @@ class MainActivity : ComponentActivity() {
}
}
}
}
}
5 changes: 2 additions & 3 deletions app/src/main/java/dev/marcos/droidnotes/NotesApplication.kt
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ class NotesApplication : Application() {
}

val repository by lazy {
NotesRepository( dataSource )
NotesRepository(dataSource)
}

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ class NotesDataSource(
}

fun get(note: Note) {

}

suspend fun insert(note: Note) {
Expand Down Expand Up @@ -51,4 +50,4 @@ class NotesDataSource(
// }
// }
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@ class GrpcService(private val host: String, private val port: Int) {
.usePlaintext()
.build()
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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.",
Expand All @@ -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."
)
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,4 @@ interface NotesDao {

@Delete
suspend fun deleteAll(vararg users: Note)
}
}
2 changes: 1 addition & 1 deletion app/src/main/java/dev/marcos/droidnotes/di/Injector.kt
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,4 @@ object Injector {
// )
// )
// )
}
}
3 changes: 1 addition & 2 deletions app/src/main/java/dev/marcos/droidnotes/domain/Note.kt
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ data class Note(
val height: Int? = 200
)


fun getNotesHeightsValues() = listOf(180, 145, 200, 240)

fun getNotesColorsValues() = (0..5)
fun getNotesColorsValues() = (0..5)
6 changes: 4 additions & 2 deletions app/src/main/java/dev/marcos/droidnotes/ui/view/ListLayout.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
17 changes: 9 additions & 8 deletions app/src/main/java/dev/marcos/droidnotes/ui/view/SheetLayout.kt
Original file line number Diff line number Diff line change
Expand Up @@ -85,24 +85,25 @@ fun SheetLayout(
viewModel.selectedNote.value = null
viewModel.viewModelScope.launch {
delay(250L)
currentColor.value = getNotesColorsValues().random()
currentColor.value = getNotesColorsValues().random()
}
}

if (openDeleteDialog.value) {
DialogDelete {
if (it) {
selectedNote?.let {
note -> viewModel.delete(note)
note ->
viewModel.delete(note)
}
clearScreen()
}
openDeleteDialog.value = false
}
}

if (openWarningDialog.value){
DialogWarning{
if (openWarningDialog.value) {
DialogWarning {
openWarningDialog.value = it.not()
}
}
Expand Down Expand Up @@ -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(
Expand Down Expand Up @@ -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))
}
}
)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,11 @@ class NotesViewModel(
}
}


fun insertOrUpdate(note: Note) {
if (note.id == 0) {
insert(note = note)
} else {
update(note = note)
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,4 @@ class NotesViewModelFactory(
override fun <T : ViewModel?> create(modelClass: Class<T>): T {
return NotesViewModel(repository) as T
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -37,4 +37,4 @@ fun BottomSheetWithCloseDialog(
Icon(Icons.Filled.Close, tint = closeButtonColor, contentDescription = null)
}
}
}
}
7 changes: 3 additions & 4 deletions app/src/main/java/dev/marcos/droidnotes/widgets/Chips.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -48,6 +48,5 @@ fun Chip(
},
modifier = Modifier.padding(8.dp).requiredWidth(48.dp)
)

}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,4 @@ fun MainFloatingActionButton(onClick: () -> Unit) {
) {
Icon(imageVector = Icons.Filled.Add, contentDescription = null, tint = Color.White)
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down Expand Up @@ -59,4 +59,4 @@ private fun shortestColumn(colHeights: IntArray): Int {
}
}
return column
}
}
2 changes: 1 addition & 1 deletion app/src/main/java/dev/marcos/droidnotes/widgets/Tags.kt
Original file line number Diff line number Diff line change
Expand Up @@ -43,4 +43,4 @@ fun Tags(snackbarVisibleState: MutableState<Boolean>) {
}
}
}
}
}
5 changes: 2 additions & 3 deletions app/src/test/java/dev/marcos/droidnotes/ExampleUnitTest.kt
Original file line number Diff line number Diff line change
@@ -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).
*
Expand All @@ -14,4 +13,4 @@ class ExampleUnitTest {
fun addition_isCorrect() {
assertEquals(4, 2 + 2)
}
}
}

0 comments on commit b02f0ac

Please sign in to comment.