From 6506c84eeb1bdc30c52151823ea9672aac0f7716 Mon Sep 17 00:00:00 2001 From: Stefan Date: Tue, 1 Dec 2020 16:24:12 +0100 Subject: [PATCH] Project Updated. --- .idea/compiler.xml | 6 ++++++ .idea/gradle.xml | 1 + .idea/misc.xml | 2 +- app/build.gradle | 20 +++++++++---------- .../com/example/todoapp/data/ToDoDatabase.kt | 3 +-- .../todoapp/fragments/SharedViewModel.kt | 1 - .../todoapp/fragments/list/ListFragment.kt | 10 +++++----- .../fragments/update/UpdateFragment.kt | 3 +-- build.gradle | 11 +++------- gradle/wrapper/gradle-wrapper.properties | 4 ++-- 10 files changed, 30 insertions(+), 31 deletions(-) create mode 100644 .idea/compiler.xml diff --git a/.idea/compiler.xml b/.idea/compiler.xml new file mode 100644 index 0000000..61a9130 --- /dev/null +++ b/.idea/compiler.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/.idea/gradle.xml b/.idea/gradle.xml index ac6b0ae..23a89bb 100644 --- a/.idea/gradle.xml +++ b/.idea/gradle.xml @@ -15,6 +15,7 @@ diff --git a/.idea/misc.xml b/.idea/misc.xml index 7bfef59..d5d35ec 100644 --- a/.idea/misc.xml +++ b/.idea/misc.xml @@ -1,6 +1,6 @@ - + diff --git a/app/build.gradle b/app/build.gradle index d6936d0..fc81c06 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -41,18 +41,18 @@ android { dependencies { implementation fileTree(dir: "libs", include: ["*.jar"]) - implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version" - implementation 'androidx.core:core-ktx:1.3.1' + implementation "org.jetbrains.kotlin:kotlin-stdlib:1.4.20" + implementation 'androidx.core:core-ktx:1.3.2' implementation 'androidx.appcompat:appcompat:1.2.0' - implementation 'androidx.constraintlayout:constraintlayout:1.1.3' + implementation 'androidx.constraintlayout:constraintlayout:2.0.4' implementation 'androidx.legacy:legacy-support-v4:1.0.0' - testImplementation 'junit:junit:4.13' - androidTestImplementation 'androidx.test.ext:junit:1.1.1' - androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0' + testImplementation 'junit:junit:4.13.1' + androidTestImplementation 'androidx.test.ext:junit:1.1.2' + androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0' // Navigation Component - implementation 'androidx.navigation:navigation-fragment-ktx:2.3.0' - implementation 'androidx.navigation:navigation-ui-ktx:2.3.0' + implementation 'androidx.navigation:navigation-fragment-ktx:2.3.1' + implementation 'androidx.navigation:navigation-ui-ktx:2.3.1' // Room components implementation "androidx.room:room-runtime:2.2.5" @@ -68,11 +68,11 @@ dependencies { // Kotlin components implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.3.72" api "org.jetbrains.kotlinx:kotlinx-coroutines-core:1.3.7" - api "org.jetbrains.kotlinx:kotlinx-coroutines-android:1.3.7" + api "org.jetbrains.kotlinx:kotlinx-coroutines-android:1.3.9" // DataBinding kapt "com.android.databinding:compiler:3.2.0-alpha10" - kapt "androidx.databinding:databinding-common:4.0.1" + kapt "androidx.databinding:databinding-common:4.1.1" // RecyclerView Animator implementation 'jp.wasabeef:recyclerview-animators:3.0.0' diff --git a/app/src/main/java/com/example/todoapp/data/ToDoDatabase.kt b/app/src/main/java/com/example/todoapp/data/ToDoDatabase.kt index 9c31cd9..1309046 100644 --- a/app/src/main/java/com/example/todoapp/data/ToDoDatabase.kt +++ b/app/src/main/java/com/example/todoapp/data/ToDoDatabase.kt @@ -48,8 +48,7 @@ abstract class ToDoDatabase : RoomDatabase() { Room.databaseBuilder( context.applicationContext, ToDoDatabase::class.java, "todo_database" - ) - .build() + ).build() } } \ No newline at end of file diff --git a/app/src/main/java/com/example/todoapp/fragments/SharedViewModel.kt b/app/src/main/java/com/example/todoapp/fragments/SharedViewModel.kt index e68d8ce..df73b63 100644 --- a/app/src/main/java/com/example/todoapp/fragments/SharedViewModel.kt +++ b/app/src/main/java/com/example/todoapp/fragments/SharedViewModel.kt @@ -1,7 +1,6 @@ package com.example.todoapp.fragments import android.app.Application -import android.text.TextUtils import android.view.View import android.widget.AdapterView import android.widget.TextView diff --git a/app/src/main/java/com/example/todoapp/fragments/list/ListFragment.kt b/app/src/main/java/com/example/todoapp/fragments/list/ListFragment.kt index e138145..7679896 100644 --- a/app/src/main/java/com/example/todoapp/fragments/list/ListFragment.kt +++ b/app/src/main/java/com/example/todoapp/fragments/list/ListFragment.kt @@ -32,7 +32,7 @@ class ListFragment : Fragment(), SearchView.OnQueryTextListener { override fun onCreateView( inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle? - ): View? { + ): View { // Data binding _binding = FragmentListBinding.inflate(inflater, container, false) binding.lifecycleOwner = this @@ -42,7 +42,7 @@ class ListFragment : Fragment(), SearchView.OnQueryTextListener { setupRecyclerview() // Observe LiveData - mToDoViewModel.getAllData.observe(viewLifecycleOwner, Observer { data -> + mToDoViewModel.getAllData.observe(viewLifecycleOwner, { data -> mSharedViewModel.checkIfDatabaseEmpty(data) adapter.setData(data) }) @@ -106,8 +106,8 @@ class ListFragment : Fragment(), SearchView.OnQueryTextListener { override fun onOptionsItemSelected(item: MenuItem): Boolean { when (item.itemId) { R.id.menu_delete_all -> confirmRemoval() - R.id.menu_priority_high -> mToDoViewModel.sortByHighPriority.observe(this, Observer { adapter.setData(it) }) - R.id.menu_priority_low -> mToDoViewModel.sortByLowPriority.observe(this, Observer { adapter.setData(it) }) + R.id.menu_priority_high -> mToDoViewModel.sortByHighPriority.observe(this, { adapter.setData(it) }) + R.id.menu_priority_low -> mToDoViewModel.sortByLowPriority.observe(this, { adapter.setData(it) }) } return super.onOptionsItemSelected(item) } @@ -129,7 +129,7 @@ class ListFragment : Fragment(), SearchView.OnQueryTextListener { private fun searchThroughDatabase(query: String) { val searchQuery = "%$query%" - mToDoViewModel.searchDatabase(searchQuery).observe(this, Observer { list -> + mToDoViewModel.searchDatabase(searchQuery).observe(this, { list -> list?.let { adapter.setData(it) } diff --git a/app/src/main/java/com/example/todoapp/fragments/update/UpdateFragment.kt b/app/src/main/java/com/example/todoapp/fragments/update/UpdateFragment.kt index 6e1d523..3aafdbd 100644 --- a/app/src/main/java/com/example/todoapp/fragments/update/UpdateFragment.kt +++ b/app/src/main/java/com/example/todoapp/fragments/update/UpdateFragment.kt @@ -14,7 +14,6 @@ import com.example.todoapp.data.viewmodel.ToDoViewModel import com.example.todoapp.databinding.FragmentUpdateBinding import com.example.todoapp.fragments.SharedViewModel import kotlinx.android.synthetic.main.fragment_update.* -import kotlinx.android.synthetic.main.fragment_update.view.* class UpdateFragment : Fragment() { @@ -29,7 +28,7 @@ class UpdateFragment : Fragment() { override fun onCreateView( inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle? - ): View? { + ): View { // Data binding _binding = FragmentUpdateBinding.inflate(inflater, container, false) binding.args = args diff --git a/build.gradle b/build.gradle index 5d3b372..7790a9f 100644 --- a/build.gradle +++ b/build.gradle @@ -1,20 +1,15 @@ // Top-level build file where you can add configuration options common to all sub-projects/modules. buildscript { - ext { - kotlin_version = '1.3.72' - nav_version = "2.3.0-beta01" - } - repositories { google() jcenter() } dependencies { - classpath 'com.android.tools.build:gradle:4.0.1' + classpath 'com.android.tools.build:gradle:4.1.1' - classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" - classpath "androidx.navigation:navigation-safe-args-gradle-plugin:$nav_version" + classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.4.20" + classpath "androidx.navigation:navigation-safe-args-gradle-plugin:2.3.1" // NOTE: Do not place your application dependencies here; they belong // in the individual module build.gradle files } diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 04e4006..0b86994 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ -#Fri Jun 26 09:49:12 CEST 2020 +#Mon Oct 19 08:56:52 CEST 2020 distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-6.1.1-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-6.5-bin.zip