update kotlin plugin and some deps

This commit is contained in:
dece 2022-02-02 16:26:10 +01:00
parent 636a096d6f
commit f45c3facfd
7 changed files with 12 additions and 13 deletions

View file

@ -45,18 +45,18 @@ android {
} }
dependencies { dependencies {
def nav_version = "2.3.5" def nav_version = "2.4.0"
def room_version = "2.4.1" def room_version = "2.4.1"
implementation 'androidx.appcompat:appcompat:1.4.1' implementation 'androidx.appcompat:appcompat:1.4.1'
implementation "androidx.cardview:cardview:1.0.0" implementation "androidx.cardview:cardview:1.0.0"
implementation 'androidx.constraintlayout:constraintlayout:2.1.3' implementation 'androidx.constraintlayout:constraintlayout:2.1.3'
implementation 'androidx.core:core-ktx:1.7.0' 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.lifecycle:lifecycle-viewmodel-ktx:2.4.0'
implementation 'androidx.legacy:legacy-support-v4:1.0.0' implementation 'androidx.legacy:legacy-support-v4:1.0.0'
implementation "androidx.navigation:navigation-fragment-ktx:$nav_version" implementation "androidx.navigation:navigation-fragment-ktx:$nav_version"
implementation "androidx.navigation:navigation-ui-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.recyclerview:recyclerview:1.2.1'
implementation "androidx.room:room-runtime:$room_version" implementation "androidx.room:room-runtime:$room_version"
implementation "androidx.room:room-ktx:$room_version" implementation "androidx.room:room-ktx:$room_version"

View file

@ -1,7 +1,6 @@
package dev.lowrespalmtree.comet package dev.lowrespalmtree.comet
import android.content.Context import android.content.Context
import androidx.room.AutoMigration
import androidx.room.Database import androidx.room.Database
import androidx.room.Room import androidx.room.Room
import androidx.room.RoomDatabase import androidx.room.RoomDatabase

View file

@ -40,7 +40,7 @@ class HistoryFragment : Fragment(), HistoryItemAdapterListener {
binding.list.layoutManager = LinearLayoutManager(requireContext()) binding.list.layoutManager = LinearLayoutManager(requireContext())
binding.list.adapter = adapter binding.list.adapter = adapter
vm.items.observe(viewLifecycleOwner, { adapter.setItems(it) }) vm.items.observe(viewLifecycleOwner) { adapter.setItems(it) }
vm.refreshHistory() vm.refreshHistory()
} }

View file

@ -153,7 +153,7 @@ class PageAdapter(private val listener: ContentAdapterListener) :
} }
} }
is ContentBlock.Link -> { 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 as ContentViewHolder.Link).binding.textView.text = label
holder.binding.root.setOnClickListener { listener.onLinkClick(block.url) } holder.binding.root.setOnClickListener { listener.onLinkClick(block.url) }
} }

View file

@ -52,9 +52,9 @@ class PageFragment : Fragment(), ContentAdapterListener {
binding.contentSwipeLayout.setOnRefreshListener { openUrl(vm.currentUrl) } binding.contentSwipeLayout.setOnRefreshListener { openUrl(vm.currentUrl) }
vm.state.observe(viewLifecycleOwner, { updateState(it) }) vm.state.observe(viewLifecycleOwner) { updateState(it) }
vm.lines.observe(viewLifecycleOwner, { updateLines(it) }) vm.lines.observe(viewLifecycleOwner) { updateLines(it) }
vm.event.observe(viewLifecycleOwner, { handleEvent(it) }) vm.event.observe(viewLifecycleOwner) { handleEvent(it) }
activity?.onBackPressedDispatcher?.addCallback(viewLifecycleOwner) { onBackPressed() } activity?.onBackPressedDispatcher?.addCallback(viewLifecycleOwner) { onBackPressed() }
@ -71,7 +71,7 @@ class PageFragment : Fragment(), ContentAdapterListener {
} }
override fun onLinkClick(url: String) { 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() { private fun onBackPressed() {
@ -208,7 +208,7 @@ class PageFragment : Fragment(), ContentAdapterListener {
}) })
} }
AlertDialog.Builder(requireContext()) AlertDialog.Builder(requireContext())
.setMessage(if (prompt.isNotEmpty()) prompt else "Input required") .setMessage(prompt.ifEmpty { "Input required" })
.setView(inputView) .setView(inputView)
.setPositiveButton(android.R.string.ok) { _, _ -> .setPositiveButton(android.R.string.ok) { _, _ ->
val newUri = uri.buildUpon().query(editText.text.toString()).build() val newUri = uri.buildUpon().query(editText.text.toString()).build()

View file

@ -6,7 +6,7 @@ buildscript {
mavenCentral() mavenCentral()
} }
dependencies { 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 'org.jetbrains.kotlin:kotlin-gradle-plugin:1.6.10'
classpath "androidx.navigation:navigation-safe-args-gradle-plugin:2.3.5" classpath "androidx.navigation:navigation-safe-args-gradle-plugin:2.3.5"
} }

View file

@ -1,6 +1,6 @@
#Mon Nov 29 12:01:36 CET 2021 #Mon Nov 29 12:01:36 CET 2021
distributionBase=GRADLE_USER_HOME 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 distributionPath=wrapper/dists
zipStorePath=wrapper/dists zipStorePath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME zipStoreBase=GRADLE_USER_HOME