Skip to content

Commit

Permalink
Merge branch '02_05e'
Browse files Browse the repository at this point in the history
# Conflicts:
#	app/src/main/java/com/example/plainolnotes4/MainViewModel.kt
#	app/src/main/java/com/example/plainolnotes4/data/SampleDataProvider.kt
  • Loading branch information
davidgassner committed Jul 20, 2020
2 parents 479109b + 9557a0a commit ea0b93c
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 6 deletions.
6 changes: 6 additions & 0 deletions app/src/main/java/com/example/plainolnotes4/MainFragment.kt
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
package com.example.plainolnotes4

import android.os.Bundle
import android.util.Log
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import androidx.fragment.app.Fragment
import androidx.lifecycle.Observer
import androidx.lifecycle.ViewModelProvider
import androidx.recyclerview.widget.DividerItemDecoration
import androidx.recyclerview.widget.LinearLayoutManager
Expand All @@ -30,6 +32,10 @@ class MainFragment : Fragment() {
addItemDecoration(divider)
}

viewModel.notesList.observe(viewLifecycleOwner, Observer {
Log.i("noteLogging", it.toString())
})

return binding.root
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import com.example.plainolnotes4.data.SampleDataProvider
class MainViewModel : ViewModel() {

val notesList = MutableLiveData<List<NoteEntity>>()

init {
notesList.value = SampleDataProvider.getNotes()
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@ import java.util.*

class SampleDataProvider {

companion object{
companion object {
private val sampleText1 = "A simple note"
private val sampleText2 = "A note with\nline feed"
private val sampleText2 = "A note a\nline feed"
private val sampleText3 = """
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Quisque convallis magna in dolor sodales, tristique efficitur nisl placerat. Proin ultricies pulvinar mauris id imperdiet. Quisque molestie luctus suscipit. Vestibulum suscipit, erat a efficitur imperdiet, erat enim aliquet tortor, ac commodo massa elit convallis sem. Curabitur posuere risus id orci volutpat cursus. Nulla facilisi. Sed eleifend auctor eros, condimentum blandit dolor. In ac viverra metus. Nulla non vestibulum dui. Integer blandit metus nec ipsum venenatis malesuada. Nam sit amet egestas neque. Praesent urna est, lobortis sit amet tincidunt vel, porta sit amet orci. Lorem ipsum dolor sit amet, consectetur adipiscing elit.
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Quisque finibus, magna eget ullamcorper eleifend, neque justo cursus nibh, sit amet fermentum nisi dui sed justo. Nulla ac nisl ut nulla euismod mollis. Aenean ullamcorper eu odio a rutrum. Mauris eu augue tortor. Pellentesque erat justo, gravida sed maximus eu, faucibus at justo. Aliquam ut nulla consectetur odio vestibulum vulputate vel id est. Aliquam erat volutpat.
Suspendisse potenti. Maecenas mattis tempor magna vitae convallis. Sed arcu neque, suscipit blandit finibus at, finibus in odio. Sed a velit vitae purus rhoncus pharetra. Etiam iaculis arcu non purus tristique, ac viverra dui mattis. Morbi scelerisque libero pretium viverra dictum. Duis vestibulum metus venenatis, rutrum augue sit amet, porttitor felis. Etiam viverra ipsum turpis. Sed consequat, nulla vitae sollicitudin condimentum, magna tortor mollis augue, non feugiat erat libero ut magna. Aenean gravida massa vel odio lobortis posuere. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia curae; Fusce sed vestibulum eros, quis mollis sapien. Duis mollis vestibulum ullamcorper.
Fusce maximus sagittis dolor in tempor. Duis vehicula congue lectus eu lobortis. Integer placerat fermentum sapien, vel feugiat sapien pellentesque non. Integer nec nibh sit amet ex lacinia pretium sed et eros. Nam id consequat erat, eleifend mollis quam. In dictum lobortis quam vel tincidunt. Vestibulum non lobortis neque. Phasellus pharetra malesuada mauris eget blandit. Sed ornare nisl id nisl tristique placerat.
""".trimIndent()

private fun getDate(diff: Long): Date {
Expand All @@ -19,8 +19,9 @@ class SampleDataProvider {

fun getNotes() = arrayListOf(
NoteEntity(1, getDate(0), sampleText1),
NoteEntity(2, getDate(1), sampleText1),
NoteEntity(3, getDate(2), sampleText1)
NoteEntity(2, getDate(1), sampleText2),
NoteEntity(3, getDate(2), sampleText3)
)

}
}

0 comments on commit ea0b93c

Please sign in to comment.