Compare commits

...

5 commits

Author SHA1 Message Date
1ae6f25a45
Opt-in to ExperimentalCoroutinesApi for MarkdownViewModelTest
All checks were successful
Build & Test / Validate (pull_request) Successful in 24s
Build & Test / Run Unit Tests (pull_request) Successful in 12m35s
Build & Test / Run UI Tests (pull_request) Successful in 19m46s
2024-10-01 21:19:35 -06:00
64ab2bf345
Suppress unchecked cast for FakePreferenceHelper#observe
I know it's not great but it works for now
2024-10-01 21:19:15 -06:00
2f5a58c101
Bump Java version to 11 2024-10-01 21:17:34 -06:00
50c181004f
Suppress unchecked cast for PreferenceHelper#observe
I know it's not great but it works for now
2024-10-01 21:17:19 -06:00
e7f0603446
Update HorizontalPager parameters to reflect API changes 2024-10-01 21:16:58 -06:00
8 changed files with 17 additions and 15 deletions

View file

@ -37,11 +37,11 @@ android {
} }
compileSdk = libs.versions.maxSdk.get().toInt() compileSdk = libs.versions.maxSdk.get().toInt()
compileOptions { compileOptions {
sourceCompatibility = JavaVersion.VERSION_1_8 sourceCompatibility = JavaVersion.VERSION_11
targetCompatibility = JavaVersion.VERSION_1_8 targetCompatibility = JavaVersion.VERSION_11
} }
kotlinOptions { kotlinOptions {
jvmTarget = "1.8" jvmTarget = "11"
} }
defaultConfig { defaultConfig {
applicationId = "com.wbrawner.simplemarkdown" applicationId = "com.wbrawner.simplemarkdown"

View file

@ -4,7 +4,6 @@ import android.content.Intent
import android.net.Uri import android.net.Uri
import androidx.activity.compose.rememberLauncherForActivityResult import androidx.activity.compose.rememberLauncherForActivityResult
import androidx.activity.result.contract.ActivityResultContracts import androidx.activity.result.contract.ActivityResultContracts
import androidx.compose.foundation.ExperimentalFoundationApi
import androidx.compose.foundation.background import androidx.compose.foundation.background
import androidx.compose.foundation.layout.Box import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.Column import androidx.compose.foundation.layout.Column
@ -327,7 +326,7 @@ private fun MainScreen(
} }
@Composable @Composable
@OptIn(ExperimentalFoundationApi::class, ExperimentalMaterial3Api::class) @OptIn(ExperimentalMaterial3Api::class)
private fun TabbedMarkdownEditor( private fun TabbedMarkdownEditor(
initialMarkdown: String, initialMarkdown: String,
markdown: String, markdown: String,
@ -349,7 +348,7 @@ private fun TabbedMarkdownEditor(
} }
HorizontalPager( HorizontalPager(
modifier = Modifier.fillMaxSize(1f), state = pagerState, modifier = Modifier.fillMaxSize(1f), state = pagerState,
beyondBoundsPageCount = 1, beyondViewportPageCount = 1,
userScrollEnabled = !lockSwiping userScrollEnabled = !lockSwiping
) { page -> ) { page ->
val keyboardController = LocalSoftwareKeyboardController.current val keyboardController = LocalSoftwareKeyboardController.current

View file

@ -47,6 +47,7 @@ class AndroidPreferenceHelper(context: Context, private val coroutineScope: Coro
} }
} }
@Suppress("UNCHECKED_CAST")
override fun <T> observe(preference: Preference): StateFlow<T> = states[preference]!!.asStateFlow() as StateFlow<T> override fun <T> observe(preference: Preference): StateFlow<T> = states[preference]!!.asStateFlow() as StateFlow<T>
} }

View file

@ -23,6 +23,7 @@ class FakePreferenceHelper: PreferenceHelper {
preferences[preference] = value preferences[preference] = value
} }
@Suppress("UNCHECKED_CAST")
override fun <T> observe(preference: Preference): StateFlow<T> = override fun <T> observe(preference: Preference): StateFlow<T> =
preferenceFlow(preference) as StateFlow<T> preferenceFlow(preference) as StateFlow<T>
} }

View file

@ -23,6 +23,7 @@ import timber.log.Timber
import java.io.File import java.io.File
import java.net.URI import java.net.URI
@OptIn(ExperimentalCoroutinesApi::class)
class MarkdownViewModelTest { class MarkdownViewModelTest {
private lateinit var fileHelper: FakeFileHelper private lateinit var fileHelper: FakeFileHelper
private lateinit var preferenceHelper: FakePreferenceHelper private lateinit var preferenceHelper: FakePreferenceHelper

View file

@ -41,11 +41,11 @@ android {
} }
} }
compileOptions { compileOptions {
sourceCompatibility = JavaVersion.VERSION_1_8 sourceCompatibility = JavaVersion.VERSION_11
targetCompatibility = JavaVersion.VERSION_1_8 targetCompatibility = JavaVersion.VERSION_11
} }
kotlinOptions { kotlinOptions {
jvmTarget = "1.8" jvmTarget = "11"
} }
lint { lint {
disable += listOf("AndroidGradlePluginVersion", "GradleDependency") disable += listOf("AndroidGradlePluginVersion", "GradleDependency")

View file

@ -27,11 +27,11 @@ android {
compose = true compose = true
} }
compileOptions { compileOptions {
sourceCompatibility = JavaVersion.VERSION_1_8 sourceCompatibility = JavaVersion.VERSION_11
targetCompatibility = JavaVersion.VERSION_1_8 targetCompatibility = JavaVersion.VERSION_11
} }
kotlinOptions { kotlinOptions {
jvmTarget = "1.8" jvmTarget = "11"
} }
lint { lint {
disable += listOf("AndroidGradlePluginVersion", "GradleDependency") disable += listOf("AndroidGradlePluginVersion", "GradleDependency")

View file

@ -24,14 +24,14 @@ android {
} }
} }
compileOptions { compileOptions {
sourceCompatibility = JavaVersion.VERSION_1_8 sourceCompatibility = JavaVersion.VERSION_11
targetCompatibility = JavaVersion.VERSION_1_8 targetCompatibility = JavaVersion.VERSION_11
} }
buildFeatures { buildFeatures {
compose = true compose = true
} }
kotlinOptions { kotlinOptions {
jvmTarget = "1.8" jvmTarget = "11"
} }
lint { lint {
disable += listOf("AndroidGradlePluginVersion", "GradleDependency") disable += listOf("AndroidGradlePluginVersion", "GradleDependency")