diff --git a/app/build.gradle b/app/build.gradle index bbf6100..6809395 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -45,18 +45,18 @@ android { } dependencies { - def nav_version = "2.3.5" + def nav_version = "2.4.0" def room_version = "2.4.1" implementation 'androidx.appcompat:appcompat:1.4.1' implementation "androidx.cardview:cardview:1.0.0" implementation 'androidx.constraintlayout:constraintlayout:2.1.3' implementation 'androidx.core:core-ktx:1.7.0' - implementation 'androidx.fragment:fragment-ktx:1.4.0' + implementation 'androidx.fragment:fragment-ktx:1.4.1' implementation 'androidx.lifecycle:lifecycle-viewmodel-ktx:2.4.0' implementation 'androidx.legacy:legacy-support-v4:1.0.0' implementation "androidx.navigation:navigation-fragment-ktx:$nav_version" implementation "androidx.navigation:navigation-ui-ktx:$nav_version" - implementation 'androidx.preference:preference-ktx:1.1.1' + implementation 'androidx.preference:preference-ktx:1.2.0' implementation 'androidx.recyclerview:recyclerview:1.2.1' implementation "androidx.room:room-runtime:$room_version" implementation "androidx.room:room-ktx:$room_version" diff --git a/app/src/main/java/dev/lowrespalmtree/comet/Database.kt b/app/src/main/java/dev/lowrespalmtree/comet/Database.kt index 4b111d4..402e362 100644 --- a/app/src/main/java/dev/lowrespalmtree/comet/Database.kt +++ b/app/src/main/java/dev/lowrespalmtree/comet/Database.kt @@ -1,7 +1,6 @@ package dev.lowrespalmtree.comet import android.content.Context -import androidx.room.AutoMigration import androidx.room.Database import androidx.room.Room import androidx.room.RoomDatabase diff --git a/app/src/main/java/dev/lowrespalmtree/comet/HistoryFragment.kt b/app/src/main/java/dev/lowrespalmtree/comet/HistoryFragment.kt index 71df557..1f825f9 100644 --- a/app/src/main/java/dev/lowrespalmtree/comet/HistoryFragment.kt +++ b/app/src/main/java/dev/lowrespalmtree/comet/HistoryFragment.kt @@ -40,7 +40,7 @@ class HistoryFragment : Fragment(), HistoryItemAdapterListener { binding.list.layoutManager = LinearLayoutManager(requireContext()) binding.list.adapter = adapter - vm.items.observe(viewLifecycleOwner, { adapter.setItems(it) }) + vm.items.observe(viewLifecycleOwner) { adapter.setItems(it) } vm.refreshHistory() } diff --git a/app/src/main/java/dev/lowrespalmtree/comet/PageAdapter.kt b/app/src/main/java/dev/lowrespalmtree/comet/PageAdapter.kt index 0e37337..5a66a11 100644 --- a/app/src/main/java/dev/lowrespalmtree/comet/PageAdapter.kt +++ b/app/src/main/java/dev/lowrespalmtree/comet/PageAdapter.kt @@ -153,7 +153,7 @@ class PageAdapter(private val listener: ContentAdapterListener) : } } is ContentBlock.Link -> { - val label = if (block.label.isNotBlank()) block.label else block.url + val label = block.label.ifBlank { block.url } (holder as ContentViewHolder.Link).binding.textView.text = label holder.binding.root.setOnClickListener { listener.onLinkClick(block.url) } } diff --git a/app/src/main/java/dev/lowrespalmtree/comet/PageFragment.kt b/app/src/main/java/dev/lowrespalmtree/comet/PageFragment.kt index 86f9d7a..ab61bf1 100644 --- a/app/src/main/java/dev/lowrespalmtree/comet/PageFragment.kt +++ b/app/src/main/java/dev/lowrespalmtree/comet/PageFragment.kt @@ -52,9 +52,9 @@ class PageFragment : Fragment(), ContentAdapterListener { binding.contentSwipeLayout.setOnRefreshListener { openUrl(vm.currentUrl) } - vm.state.observe(viewLifecycleOwner, { updateState(it) }) - vm.lines.observe(viewLifecycleOwner, { updateLines(it) }) - vm.event.observe(viewLifecycleOwner, { handleEvent(it) }) + vm.state.observe(viewLifecycleOwner) { updateState(it) } + vm.lines.observe(viewLifecycleOwner) { updateLines(it) } + vm.event.observe(viewLifecycleOwner) { handleEvent(it) } activity?.onBackPressedDispatcher?.addCallback(viewLifecycleOwner) { onBackPressed() } @@ -71,7 +71,7 @@ class PageFragment : Fragment(), ContentAdapterListener { } override fun onLinkClick(url: String) { - openUrl(url, base = if (vm.currentUrl.isNotEmpty()) vm.currentUrl else null) + openUrl(url, base = vm.currentUrl.ifEmpty { null }) } private fun onBackPressed() { @@ -208,7 +208,7 @@ class PageFragment : Fragment(), ContentAdapterListener { }) } AlertDialog.Builder(requireContext()) - .setMessage(if (prompt.isNotEmpty()) prompt else "Input required") + .setMessage(prompt.ifEmpty { "Input required" }) .setView(inputView) .setPositiveButton(android.R.string.ok) { _, _ -> val newUri = uri.buildUpon().query(editText.text.toString()).build() diff --git a/build.gradle b/build.gradle index 5f34279..d7baa0f 100644 --- a/build.gradle +++ b/build.gradle @@ -6,7 +6,7 @@ buildscript { mavenCentral() } dependencies { - classpath "com.android.tools.build:gradle:7.0.4" + classpath 'com.android.tools.build:gradle:7.1.0' classpath 'org.jetbrains.kotlin:kotlin-gradle-plugin:1.6.10' classpath "androidx.navigation:navigation-safe-args-gradle-plugin:2.3.5" } diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 6dd359d..689f280 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ #Mon Nov 29 12:01:36 CET 2021 distributionBase=GRADLE_USER_HOME -distributionUrl=https\://services.gradle.org/distributions/gradle-7.0.2-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-7.2-bin.zip distributionPath=wrapper/dists zipStorePath=wrapper/dists zipStoreBase=GRADLE_USER_HOME