change: Increase compileSdk and targetSdk to 34 (#150)

Associated changes:

- Handle new null/non-null type signatures in overriden methods
- Configure Robolectric to use SDK 33 (current highest supported
version)
This commit is contained in:
Nik Clayton 2023-10-11 12:28:45 +02:00 committed by GitHub
parent 8fd536b77f
commit 53e7842439
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
24 changed files with 153 additions and 56 deletions

View File

@ -27,13 +27,13 @@ final def CUSTOM_INSTANCE = ""
final def SUPPORT_ACCOUNT_URL = "https://mastodon.social/@Pachli"
android {
compileSdk 33
compileSdk 34
namespace "app.pachli"
defaultConfig {
applicationId APP_ID
namespace "app.pachli"
minSdk 23
targetSdk 33
targetSdk 34
versionCode 5
versionName "1.2.2"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"

View File

@ -29,17 +29,6 @@
file="$GRADLE_USER_HOME/caches/modules-2/files-2.1/org.pageseeder.diffx/pso-diffx/1.1.1/b655ebc87588a857a4f3d88cf98bcefa87a6105b/pso-diffx-1.1.1.jar"/>
</issue>
<issue
id="OldTargetApi"
message="Not targeting the latest versions of Android; compatibility modes apply. Consider testing and updating this version. Consult the android.os.Build.VERSION_CODES javadoc for details."
errorLine1=" targetSdk 33"
errorLine2=" ~~~~~~~~~~~~">
<location
file="build.gradle"
line="36"
column="9"/>
</issue>
<issue
id="UnusedAttribute"
message="Attribute `appCategory` is only used in API level 26 and higher (current min is 23)"
@ -95,6 +84,17 @@
column="5"/>
</issue>
<issue
id="MissingQuantity"
message="For locale &quot;ca&quot; (Catalan) the following quantity should also be defined: `many`"
errorLine1=" &lt;plurals name=&quot;notification_title_summary&quot;>"
errorLine2=" ^">
<location
file="src/main/res/values-ca/strings.xml"
line="155"
column="5"/>
</issue>
<issue
id="MissingQuantity"
message="For locale &quot;ta&quot; (Tamil) the following quantity should also be defined: `one` (e.g. &quot;1&quot;)"
@ -194,6 +194,17 @@
column="5"/>
</issue>
<issue
id="MissingQuantity"
message="For locale &quot;ca&quot; (Catalan) the following quantity should also be defined: `many`"
errorLine1=" &lt;plurals name=&quot;hint_describe_for_visually_impaired&quot;>"
errorLine2=" ^">
<location
file="src/main/res/values-ca/strings.xml"
line="286"
column="5"/>
</issue>
<issue
id="MissingQuantity"
message="For locale &quot;cs&quot; (Czech) the following quantity should also be defined: `many` (e.g. &quot;10.0 dne&quot;)"
@ -238,6 +249,28 @@
column="5"/>
</issue>
<issue
id="MissingQuantity"
message="For locale &quot;ca&quot; (Catalan) the following quantity should also be defined: `many`"
errorLine1=" &lt;plurals name=&quot;favs&quot;>"
errorLine2=" ^">
<location
file="src/main/res/values-ca/strings.xml"
line="329"
column="5"/>
</issue>
<issue
id="MissingQuantity"
message="For locale &quot;ca&quot; (Catalan) the following quantity should also be defined: `many`"
errorLine1=" &lt;plurals name=&quot;reblogs&quot;>"
errorLine2=" ^">
<location
file="src/main/res/values-ca/strings.xml"
line="333"
column="5"/>
</issue>
<issue
id="MissingQuantity"
message="For locale &quot;cs&quot; (Czech) the following quantity should also be defined: `many` (e.g. &quot;10.0 dne&quot;)"
@ -260,6 +293,17 @@
column="5"/>
</issue>
<issue
id="MissingQuantity"
message="For locale &quot;ca&quot; (Catalan) the following quantity should also be defined: `many`"
errorLine1=" &lt;plurals name=&quot;poll_info_votes&quot;>"
errorLine2=" ^">
<location
file="src/main/res/values-ca/strings.xml"
line="359"
column="5"/>
</issue>
<issue
id="MissingQuantity"
message="For locale &quot;cs&quot; (Czech) the following quantity should also be defined: `many` (e.g. &quot;10.0 dne&quot;)"
@ -315,6 +359,61 @@
column="5"/>
</issue>
<issue
id="MissingQuantity"
message="For locale &quot;ca&quot; (Catalan) the following quantity should also be defined: `many`"
errorLine1=" &lt;plurals name=&quot;poll_info_people&quot;>"
errorLine2=" ^">
<location
file="src/main/res/values-ca/strings.xml"
line="430"
column="5"/>
</issue>
<issue
id="MissingQuantity"
message="For locale &quot;ca&quot; (Catalan) the following quantity should also be defined: `many`"
errorLine1=" &lt;plurals name=&quot;poll_timespan_seconds&quot;>"
errorLine2=" ^">
<location
file="src/main/res/values-ca/strings.xml"
line="458"
column="5"/>
</issue>
<issue
id="MissingQuantity"
message="For locale &quot;ca&quot; (Catalan) the following quantity should also be defined: `many`"
errorLine1=" &lt;plurals name=&quot;poll_timespan_minutes&quot;>"
errorLine2=" ^">
<location
file="src/main/res/values-ca/strings.xml"
line="462"
column="5"/>
</issue>
<issue
id="MissingQuantity"
message="For locale &quot;ca&quot; (Catalan) the following quantity should also be defined: `many`"
errorLine1=" &lt;plurals name=&quot;poll_timespan_hours&quot;>"
errorLine2=" ^">
<location
file="src/main/res/values-ca/strings.xml"
line="466"
column="5"/>
</issue>
<issue
id="MissingQuantity"
message="For locale &quot;ca&quot; (Catalan) the following quantity should also be defined: `many`"
errorLine1=" &lt;plurals name=&quot;poll_timespan_days&quot;>"
errorLine2=" ^">
<location
file="src/main/res/values-ca/strings.xml"
line="470"
column="5"/>
</issue>
<issue
id="MissingQuantity"
message="For locale &quot;cs&quot; (Czech) the following quantity should also be defined: `many` (e.g. &quot;10.0 dne&quot;)"
@ -337,6 +436,17 @@
column="5"/>
</issue>
<issue
id="MissingQuantity"
message="For locale &quot;ca&quot; (Catalan) the following quantity should also be defined: `many`"
errorLine1=" &lt;plurals name=&quot;error_upload_max_media_reached&quot;>"
errorLine2=" ^">
<location
file="src/main/res/values-ca/strings.xml"
line="487"
column="5"/>
</issue>
<issue
id="MissingQuantity"
message="For locale &quot;cs&quot; (Czech) the following quantity should also be defined: `many` (e.g. &quot;10.0 dne&quot;)"

View File

@ -140,7 +140,8 @@ class PreferencesActivity :
super.onSaveInstanceState(outState)
}
override fun onSharedPreferenceChanged(sharedPreferences: SharedPreferences, key: String) {
override fun onSharedPreferenceChanged(sharedPreferences: SharedPreferences, key: String?) {
key ?: return
when (key) {
APP_THEME -> {
val theme = sharedPreferences.getNonNullString(APP_THEME, APP_THEME_DEFAULT)

View File

@ -156,7 +156,7 @@ class ViewVideoFragment : ViewMediaFragment() {
/** A fling up/down should dismiss the fragment */
override fun onFling(
e1: MotionEvent,
e1: MotionEvent?,
e2: MotionEvent,
velocityX: Float,
velocityY: Float,

View File

@ -347,21 +347,21 @@ class ClickableSpanTextView @JvmOverloads constructor(
return firstDiff < secondDiff
}
override fun onDraw(canvas: Canvas?) {
override fun onDraw(canvas: Canvas) {
super.onDraw(canvas)
// Paint span boundaries. Optimised out on release builds, or debug builds where
// showSpanBoundaries is false.
if (BuildConfig.DEBUG && showSpanBoundaries) {
canvas?.save()
canvas.save()
for (entry in delegateRects) {
canvas?.drawRect(entry.key, paddingDebugPaint)
canvas.drawRect(entry.key, paddingDebugPaint)
}
for (entry in spanRects) {
canvas?.drawRect(entry.key, spanDebugPaint)
canvas.drawRect(entry.key, spanDebugPaint)
}
canvas?.restore()
canvas.restore()
}
}

View File

@ -265,14 +265,14 @@ class GraphView @JvmOverloads constructor(
private fun dataSpacing(data: List<Any>) = width.toFloat() / max(data.size - 1, 1).toFloat()
override fun onDraw(canvas: Canvas?) {
override fun onDraw(canvas: Canvas) {
super.onDraw(canvas)
if (primaryLinePath.isEmpty && width > 0) {
initializeVertices()
}
canvas?.apply {
canvas.apply {
drawRect(sizeRect, graphPaint)
val pointDistance = dataSpacing(primaryLineData)

View File

@ -31,11 +31,9 @@ import org.junit.Before
import org.junit.Test
import org.junit.runner.RunWith
import org.mockito.kotlin.mock
import org.robolectric.annotation.Config
import java.time.Instant
import java.util.Date
@Config(sdk = [28])
@RunWith(AndroidJUnit4::class)
class FilterV1Test {

View File

@ -8,9 +8,7 @@ import org.junit.Assert.assertEquals
import org.junit.Assert.assertNotEquals
import org.junit.Test
import org.junit.runner.RunWith
import org.robolectric.annotation.Config
@Config(sdk = [28])
@RunWith(AndroidJUnit4::class)
class StatusComparisonTest {

View File

@ -32,10 +32,8 @@ import org.mockito.kotlin.any
import org.mockito.kotlin.anyOrNull
import org.mockito.kotlin.doReturn
import org.mockito.kotlin.mock
import org.robolectric.annotation.Config
import retrofit2.Response
@Config(sdk = [28])
@RunWith(AndroidJUnit4::class)
class NotificationsPagingSourceTest {
@Test

View File

@ -38,11 +38,9 @@ import org.mockito.kotlin.doAnswer
import org.mockito.kotlin.doReturn
import org.mockito.kotlin.mock
import org.robolectric.Shadows.shadowOf
import org.robolectric.annotation.Config
import retrofit2.HttpException
import retrofit2.Response
@Config(sdk = [28])
@RunWith(AndroidJUnit4::class)
abstract class NotificationsViewModelTestBase {
protected lateinit var notificationsRepository: NotificationsRepository

View File

@ -39,12 +39,10 @@ import org.mockito.kotlin.doReturn
import org.mockito.kotlin.doThrow
import org.mockito.kotlin.mock
import org.robolectric.Shadows.shadowOf
import org.robolectric.annotation.Config
import retrofit2.HttpException
import retrofit2.Response
import java.io.IOException
@Config(sdk = [28])
@RunWith(AndroidJUnit4::class)
class CachedTimelineRemoteMediatorTest {

View File

@ -44,11 +44,9 @@ import org.mockito.kotlin.doAnswer
import org.mockito.kotlin.doReturn
import org.mockito.kotlin.mock
import org.robolectric.Shadows.shadowOf
import org.robolectric.annotation.Config
import retrofit2.HttpException
import retrofit2.Response
@Config(sdk = [28])
@RunWith(AndroidJUnit4::class)
abstract class CachedTimelineViewModelTestBase {
protected lateinit var cachedTimelineRepository: CachedTimelineRepository

View File

@ -28,9 +28,7 @@ import com.google.common.truth.Truth.assertThat
import kotlinx.coroutines.test.runTest
import org.junit.Test
import org.junit.runner.RunWith
import org.robolectric.annotation.Config
@Config(sdk = [28])
@RunWith(AndroidJUnit4::class)
class NetworkTimelinePagingSourceTest {
@Test

View File

@ -43,11 +43,9 @@ import org.mockito.kotlin.doAnswer
import org.mockito.kotlin.doReturn
import org.mockito.kotlin.mock
import org.robolectric.Shadows.shadowOf
import org.robolectric.annotation.Config
import retrofit2.HttpException
import retrofit2.Response
@Config(sdk = [28])
@RunWith(AndroidJUnit4::class)
abstract class NetworkTimelineViewModelTestBase {
protected lateinit var networkTimelineRepository: NetworkTimelineRepository

View File

@ -35,10 +35,8 @@ import org.mockito.kotlin.doReturn
import org.mockito.kotlin.mock
import org.mockito.kotlin.stub
import org.robolectric.Shadows.shadowOf
import org.robolectric.annotation.Config
import java.io.IOException
@Config(sdk = [28])
@RunWith(AndroidJUnit4::class)
class ViewThreadViewModelTest {

View File

@ -12,9 +12,7 @@ import org.junit.Assert.assertEquals
import org.junit.Before
import org.junit.Test
import org.junit.runner.RunWith
import org.robolectric.annotation.Config
@Config(sdk = [28])
@RunWith(AndroidJUnit4::class)
class TimelineDaoTest {
private lateinit var timelineDao: TimelineDao

View File

@ -16,12 +16,10 @@ import org.junit.runner.RunWith
import org.mockito.kotlin.doReturn
import org.mockito.kotlin.mock
import org.mockito.kotlin.stub
import org.robolectric.annotation.Config
import retrofit2.HttpException
import retrofit2.Response
import java.util.Date
@Config(sdk = [28])
@RunWith(AndroidJUnit4::class)
class TimelineCasesTest {

View File

@ -21,9 +21,7 @@ import androidx.test.ext.junit.runners.AndroidJUnit4
import org.junit.Assert.assertEquals
import org.junit.Test
import org.junit.runner.RunWith
import org.robolectric.annotation.Config
@Config(sdk = [28])
@RunWith(AndroidJUnit4::class)
class HttpHeaderLinkTest {
data class TestData(val name: String, val input: String, val want: List<HttpHeaderLink>)

View File

@ -13,9 +13,7 @@ import org.junit.Assert
import org.junit.Test
import org.junit.runner.RunWith
import org.junit.runners.Parameterized
import org.robolectric.annotation.Config
@Config(sdk = [28])
@RunWith(AndroidJUnit4::class)
class LinkHelperTest {
private val listener = object : LinkListener {

View File

@ -8,9 +8,7 @@ import org.junit.Assert
import org.junit.Test
import org.junit.runner.RunWith
import org.mockito.Mockito
import org.robolectric.annotation.Config
@Config(sdk = [28])
@RunWith(AndroidJUnit4::class)
class LocaleUtilsTest {
@Test

View File

@ -8,9 +8,7 @@ import org.junit.Before
import org.junit.Test
import org.junit.runner.RunWith
import org.robolectric.Robolectric
import org.robolectric.annotation.Config
@Config(sdk = [28])
@RunWith(AndroidJUnit4::class)
class RickRollTest {
private lateinit var activity: Activity

View File

@ -6,9 +6,7 @@ import org.junit.Assert.assertFalse
import org.junit.Assert.assertTrue
import org.junit.Test
import org.junit.runner.RunWith
import org.robolectric.annotation.Config
@Config(sdk = [28])
@RunWith(AndroidJUnit4::class)
class SmartLengthInputFilterTest {

View File

@ -8,11 +8,9 @@ import org.junit.Test
import org.junit.runner.RunWith
import org.mockito.kotlin.doReturn
import org.mockito.kotlin.mock
import org.robolectric.annotation.Config
private const val STATUS_CREATED_AT_NOW = "test"
@Config(sdk = [28])
@RunWith(AndroidJUnit4::class)
class TimestampUtilsTest {
private val ctx: Context = mock {

View File

@ -0,0 +1,20 @@
#
# Copyright 2023 Pachli Association
#
# This file is a part of Pachli.
#
# This program is free software; you can redistribute it and/or modify it under the terms of the
# GNU General Public License as published by the Free Software Foundation; either version 3 of the
# License, or (at your option) any later version.
#
# Pachli is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even
# the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
# Public License for more details.
#
# You should have received a copy of the GNU General Public License along with Pachli; if not,
# see <http://www.gnu.org/licenses>.
#
# Robolectric does not support SDK 34 yet
# https://github.com/robolectric/robolectric/issues/8404
sdk=33