upgrade dependencies (#1990)

* upgrade dependencies

* fix tests
This commit is contained in:
Konrad Pozniak 2020-11-22 19:02:54 +01:00 committed by GitHub
parent f917a5aa4b
commit 34fb546200
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 28 additions and 28 deletions

View File

@ -98,31 +98,31 @@ project.tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile).all {
ext.lifecycleVersion = "2.2.0" ext.lifecycleVersion = "2.2.0"
ext.roomVersion = '2.2.5' ext.roomVersion = '2.2.5'
ext.retrofitVersion = '2.9.0' ext.retrofitVersion = '2.9.0'
ext.okhttpVersion = '4.8.1' ext.okhttpVersion = '4.9.0'
ext.glideVersion = '4.11.0' ext.glideVersion = '4.11.0'
ext.daggerVersion = '2.28.3' ext.daggerVersion = '2.29.1'
ext.materialdrawerVersion = '8.1.8' ext.materialdrawerVersion = '8.1.8'
// if libraries are changed here, they should also be changed in LicenseActivity // if libraries are changed here, they should also be changed in LicenseActivity
dependencies { dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version" implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version"
implementation "androidx.core:core-ktx:1.3.1" implementation "androidx.core:core-ktx:1.3.2"
implementation "androidx.appcompat:appcompat:1.2.0" implementation "androidx.appcompat:appcompat:1.2.0"
implementation "androidx.fragment:fragment-ktx:1.2.5" implementation "androidx.fragment:fragment-ktx:1.2.5"
implementation "androidx.browser:browser:1.2.0" implementation "androidx.browser:browser:1.2.0"
implementation "androidx.swiperefreshlayout:swiperefreshlayout:1.1.0" implementation "androidx.swiperefreshlayout:swiperefreshlayout:1.1.0"
implementation "androidx.recyclerview:recyclerview:1.1.0" implementation "androidx.recyclerview:recyclerview:1.1.0"
implementation "androidx.exifinterface:exifinterface:1.2.0" implementation "androidx.exifinterface:exifinterface:1.3.1"
implementation "androidx.cardview:cardview:1.0.0" implementation "androidx.cardview:cardview:1.0.0"
implementation "androidx.preference:preference:1.1.1" implementation "androidx.preference:preference-ktx:1.1.1"
implementation "androidx.sharetarget:sharetarget:1.0.0" implementation "androidx.sharetarget:sharetarget:1.0.0"
implementation "androidx.emoji:emoji:1.1.0" implementation "androidx.emoji:emoji:1.1.0"
implementation "androidx.emoji:emoji-appcompat:1.1.0" implementation "androidx.emoji:emoji-appcompat:1.1.0"
implementation "androidx.lifecycle:lifecycle-viewmodel-ktx:$lifecycleVersion" implementation "androidx.lifecycle:lifecycle-viewmodel-ktx:$lifecycleVersion"
implementation "androidx.lifecycle:lifecycle-livedata-ktx:$lifecycleVersion" implementation "androidx.lifecycle:lifecycle-livedata-ktx:$lifecycleVersion"
implementation "androidx.lifecycle:lifecycle-reactivestreams-ktx:$lifecycleVersion" implementation "androidx.lifecycle:lifecycle-reactivestreams-ktx:$lifecycleVersion"
implementation "androidx.constraintlayout:constraintlayout:1.1.3" implementation "androidx.constraintlayout:constraintlayout:2.0.4"
implementation "androidx.paging:paging-runtime-ktx:2.1.2" implementation "androidx.paging:paging-runtime-ktx:2.1.2"
implementation "androidx.viewpager2:viewpager2:1.0.0" implementation "androidx.viewpager2:viewpager2:1.0.0"
implementation "androidx.work:work-runtime:2.4.0" implementation "androidx.work:work-runtime:2.4.0"
@ -144,7 +144,7 @@ dependencies {
implementation "com.github.bumptech.glide:glide:$glideVersion" implementation "com.github.bumptech.glide:glide:$glideVersion"
implementation "com.github.bumptech.glide:okhttp3-integration:$glideVersion" implementation "com.github.bumptech.glide:okhttp3-integration:$glideVersion"
implementation "io.reactivex.rxjava2:rxjava:2.2.19" implementation "io.reactivex.rxjava2:rxjava:2.2.20"
implementation "io.reactivex.rxjava2:rxandroid:2.1.1" implementation "io.reactivex.rxjava2:rxandroid:2.1.1"
implementation "io.reactivex.rxjava2:rxkotlin:2.4.0" implementation "io.reactivex.rxjava2:rxkotlin:2.4.0"
@ -169,12 +169,12 @@ dependencies {
implementation "de.c1710:filemojicompat:1.0.17" implementation "de.c1710:filemojicompat:1.0.17"
testImplementation "androidx.test.ext:junit:1.1.1" testImplementation "androidx.test.ext:junit:1.1.2"
testImplementation "org.robolectric:robolectric:4.3.1" testImplementation "org.robolectric:robolectric:4.4"
testImplementation "org.mockito:mockito-inline:3.3.3" testImplementation "org.mockito:mockito-inline:3.6.0"
testImplementation "com.nhaarman.mockitokotlin2:mockito-kotlin:2.2.0" testImplementation "com.nhaarman.mockitokotlin2:mockito-kotlin:2.2.0"
androidTestImplementation "androidx.test.espresso:espresso-core:3.2.0" androidTestImplementation "androidx.test.espresso:espresso-core:3.3.0"
androidTestImplementation "androidx.room:room-testing:$roomVersion" androidTestImplementation "androidx.room:room-testing:$roomVersion"
androidTestImplementation "androidx.test.ext:junit:1.1.1" androidTestImplementation "androidx.test.ext:junit:1.1.2"
} }

View File

@ -79,7 +79,7 @@ class AnnouncementsActivity : BaseActivity(), AnnouncementActionListener, OnEmoj
announcementsList.addItemDecoration(divider) announcementsList.addItemDecoration(divider)
announcementsList.adapter = adapter announcementsList.adapter = adapter
viewModel.announcements.observe(this, Observer { viewModel.announcements.observe(this) {
when (it) { when (it) {
is Success -> { is Success -> {
progressBar.hide() progressBar.hide()
@ -104,11 +104,11 @@ class AnnouncementsActivity : BaseActivity(), AnnouncementActionListener, OnEmoj
errorMessageView.show() errorMessageView.show()
} }
} }
}) }
viewModel.emojis.observe(this, Observer { viewModel.emojis.observe(this) {
picker.adapter = EmojiAdapter(it, this) picker.adapter = EmojiAdapter(it, this)
}) }
viewModel.load() viewModel.load()
progressBar.show() progressBar.show()

View File

@ -51,7 +51,7 @@ class AnnouncementsViewModel @Inject constructor(
.map<Either<InstanceEntity, Instance>> { Either.Left(it) } .map<Either<InstanceEntity, Instance>> { Either.Left(it) }
.onErrorResumeNext( .onErrorResumeNext(
mastodonApi.getInstance() mastodonApi.getInstance()
.map { Either.Right<InstanceEntity, Instance>(it) } .map { Either.Right(it) }
) )
) { emojis, either -> ) { emojis, either ->
either.asLeftOrNull()?.copy(emojiList = emojis) either.asLeftOrNull()?.copy(emojiList = emojis)

View File

@ -19,10 +19,8 @@ import android.net.Uri
import android.util.Log import android.util.Log
import androidx.core.net.toUri import androidx.core.net.toUri
import androidx.lifecycle.LiveData import androidx.lifecycle.LiveData
import androidx.lifecycle.MediatorLiveData
import androidx.lifecycle.MutableLiveData import androidx.lifecycle.MutableLiveData
import androidx.lifecycle.Observer import androidx.lifecycle.Observer
import androidx.work.impl.utils.LiveDataUtils
import com.keylesspalace.tusky.adapter.ComposeAutoCompleteAdapter import com.keylesspalace.tusky.adapter.ComposeAutoCompleteAdapter
import com.keylesspalace.tusky.components.compose.ComposeActivity.QueuedMedia import com.keylesspalace.tusky.components.compose.ComposeActivity.QueuedMedia
import com.keylesspalace.tusky.components.search.SearchType import com.keylesspalace.tusky.components.search.SearchType
@ -35,7 +33,6 @@ import com.keylesspalace.tusky.network.MastodonApi
import com.keylesspalace.tusky.service.ServiceClient import com.keylesspalace.tusky.service.ServiceClient
import com.keylesspalace.tusky.service.TootToSend import com.keylesspalace.tusky.service.TootToSend
import com.keylesspalace.tusky.util.* import com.keylesspalace.tusky.util.*
import io.reactivex.Observable.empty
import io.reactivex.Observable.just import io.reactivex.Observable.just
import io.reactivex.disposables.Disposable import io.reactivex.disposables.Disposable
import io.reactivex.rxkotlin.Singles import io.reactivex.rxkotlin.Singles

View File

@ -62,7 +62,7 @@ class AccountManager @Inject constructor(db: AppDatabase) {
accountDao.insertOrReplace(it) accountDao.insertOrReplace(it)
} }
val maxAccountId = accounts.maxBy { it.id }?.id ?: 0 val maxAccountId = accounts.maxByOrNull { it.id }?.id ?: 0
val newAccountId = maxAccountId + 1 val newAccountId = maxAccountId + 1
activeAccount = AccountEntity(id = newAccountId, domain = domain.toLowerCase(Locale.ROOT), accessToken = accessToken, isActive = true) activeAccount = AccountEntity(id = newAccountId, domain = domain.toLowerCase(Locale.ROOT), accessToken = accessToken, isActive = true)

View File

@ -54,7 +54,7 @@ fun CharSequence.emojify(emojis: List<Emoji>?, view: View) : CharSequence {
while(matcher.find()) { while(matcher.find()) {
val span = EmojiSpan(WeakReference(view)) val span = EmojiSpan(WeakReference(view))
builder.setSpan(span, matcher.start(), matcher.end(), 0); builder.setSpan(span, matcher.start(), matcher.end(), 0)
Glide.with(view) Glide.with(view)
.asBitmap() .asBitmap()
.load(url) .load(url)
@ -89,7 +89,7 @@ class EmojiSpan(val viewWeakReference: WeakReference<View>) : ReplacementSpan()
drawable.setBounds(0, 0, emojiSize, emojiSize) drawable.setBounds(0, 0, emojiSize, emojiSize)
var transY = bottom - drawable.bounds.bottom var transY = bottom - drawable.bounds.bottom
transY -= paint.fontMetricsInt.descent / 2; transY -= paint.fontMetricsInt.descent / 2
canvas.translate(x, transY.toFloat()) canvas.translate(x, transY.toFloat())
drawable.draw(canvas) drawable.draw(canvas)

View File

@ -17,6 +17,7 @@
package com.keylesspalace.tusky package com.keylesspalace.tusky
import android.content.Intent import android.content.Intent
import android.os.Looper.getMainLooper
import android.text.SpannedString import android.text.SpannedString
import android.widget.EditText import android.widget.EditText
import androidx.test.ext.junit.runners.AndroidJUnit4 import androidx.test.ext.junit.runners.AndroidJUnit4
@ -41,6 +42,7 @@ import org.junit.runner.RunWith
import org.mockito.Mockito.`when` import org.mockito.Mockito.`when`
import org.mockito.Mockito.mock import org.mockito.Mockito.mock
import org.robolectric.Robolectric import org.robolectric.Robolectric
import org.robolectric.Shadows.shadowOf
import org.robolectric.annotation.Config import org.robolectric.annotation.Config
import org.robolectric.fakes.RoboMenuItem import org.robolectric.fakes.RoboMenuItem
@ -76,8 +78,8 @@ class ComposeActivityTest {
notificationVibration = true, notificationVibration = true,
notificationLight = true notificationLight = true
) )
var instanceResponseCallback: (()->Instance)? = null private var instanceResponseCallback: (()->Instance)? = null
var composeOptions: ComposeActivity.ComposeOptions? = null private var composeOptions: ComposeActivity.ComposeOptions? = null
@Before @Before
fun setupActivity() { fun setupActivity() {
@ -185,6 +187,7 @@ class ComposeActivityTest {
val customMaximum = 1000 val customMaximum = 1000
instanceResponseCallback = { getInstanceWithMaximumTootCharacters(customMaximum) } instanceResponseCallback = { getInstanceWithMaximumTootCharacters(customMaximum) }
setupActivity() setupActivity()
shadowOf(getMainLooper()).idle()
assertEquals(customMaximum, activity.maximumTootCharacters) assertEquals(customMaximum, activity.maximumTootCharacters)
} }
@ -230,7 +233,7 @@ class ComposeActivityTest {
editor.setSelection(caretIndex) editor.setSelection(caretIndex)
activity.prependSelectedWordsWith(insertText) activity.prependSelectedWordsWith(insertText)
// Text should be inserted at caret // Text should be inserted at caret
assertEquals("Unexpected value at ${caretIndex}", insertText, editor.text.substring(caretIndex, caretIndex + insertText.length)) assertEquals("Unexpected value at $caretIndex", insertText, editor.text.substring(caretIndex, caretIndex + insertText.length))
// Caret should be placed after inserted text // Caret should be placed after inserted text
assertEquals(caretIndex + insertText.length, editor.selectionStart) assertEquals(caretIndex + insertText.length, editor.selectionStart)

View File

@ -1,11 +1,11 @@
buildscript { buildscript {
ext.kotlin_version = '1.4.10' ext.kotlin_version = '1.4.20'
repositories { repositories {
google() google()
jcenter() jcenter()
} }
dependencies { dependencies {
classpath 'com.android.tools.build:gradle:4.1.0' classpath 'com.android.tools.build:gradle:4.1.1'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
} }
} }