lifting out the android sdk version

This commit is contained in:
Adam Brown 2022-03-06 15:24:19 +00:00
parent 5485ec3b84
commit 88cc7e823a
5 changed files with 24 additions and 8 deletions

View File

@ -52,9 +52,11 @@ ext.applyLibraryPlugins = { project ->
project.apply plugin: 'kotlin-android' project.apply plugin: 'kotlin-android'
} }
ext.androidSdkVersion = 31
ext.applyCommonAndroidParameters = { project -> ext.applyCommonAndroidParameters = { project ->
def android = project.android def android = project.android
android.compileSdk 31 android.compileSdk androidSdkVersion
android.compileOptions { android.compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8 sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8 targetCompatibility JavaVersion.VERSION_1_8
@ -62,7 +64,7 @@ ext.applyCommonAndroidParameters = { project ->
} }
android.defaultConfig { android.defaultConfig {
minSdkVersion 29 minSdkVersion 29
targetSdkVersion 31 targetSdkVersion androidSdkVersion
} }
android.buildFeatures.compose = true android.buildFeatures.compose = true

View File

@ -24,6 +24,8 @@ private val DARK_EXTENDED = ExtendedColors(
onSelfBubble = DARK_COLOURS.onPrimary, onSelfBubble = DARK_COLOURS.onPrimary,
othersBubble = Color(0x20EDEDED), othersBubble = Color(0x20EDEDED),
onOthersBubble = Color(0xFF000000), onOthersBubble = Color(0xFF000000),
selfBubbleReplyBackground = Color(0x40EAEAEA),
otherBubbleReplyBackground = Color(0x20EAEAEA),
missingImageColors = listOf( missingImageColors = listOf(
Color(0xFFf7c7f7) to Color(0xFFdf20de), Color(0xFFf7c7f7) to Color(0xFFdf20de),
Color(0xFFe5d7f6) to Color(0xFF7b30cf), Color(0xFFe5d7f6) to Color(0xFF7b30cf),
@ -38,6 +40,8 @@ data class ExtendedColors(
val onSelfBubble: Color, val onSelfBubble: Color,
val othersBubble: Color, val othersBubble: Color,
val onOthersBubble: Color, val onOthersBubble: Color,
val selfBubbleReplyBackground: Color,
val otherBubbleReplyBackground: Color,
val missingImageColors: List<Pair<Color, Color>>, val missingImageColors: List<Pair<Color, Color>>,
) { ) {
fun getMissingImageColor(key: String): Pair<Color, Color> { fun getMissingImageColor(key: String): Pair<Color, Color> {

View File

@ -12,9 +12,8 @@ if (localProperties.exists()) {
} }
dependencies { dependencies {
def androidVer = 31 def androidVer = androidSdkVersion
kotlinFixtures(it) kotlinFixtures(it)
testFixturesImplementation testFixtures(project(":core")) testFixturesImplementation testFixtures(project(":core"))
testFixturesImplementation files("${properties.getProperty("sdk.dir")}/platforms/android-${androidVer}/android.jar") testFixturesImplementation files("${properties.getProperty("sdk.dir")}/platforms/android-${androidVer}/android.jar")
} }

View File

@ -1,5 +1,4 @@
@file:JvmName("SnapshotStateKt") @file:JvmName("SnapshotStateKt")
@file:JvmMultifileClass
package androidx.compose.runtime package androidx.compose.runtime
@ -20,4 +19,16 @@ operator fun <T> MutableState<T>.setValue(thisObj: Any?, property: KProperty<*>,
throw RuntimeException("stub") throw RuntimeException("stub")
} }
fun <T> mutableStateOf(value: T): MutableState<T> = throw RuntimeException("stub") fun <T> mutableStateOf(
value: T,
policy: SnapshotMutationPolicy<T> = object : SnapshotMutationPolicy<T> {
override fun equivalent(a: T, b: T): Boolean {
throw RuntimeException("stub")
}
}
): MutableState<T> = throw RuntimeException("stub")
interface SnapshotMutationPolicy<T> {
fun equivalent(a: T, b: T): Boolean
fun merge(previous: T, current: T, applied: T): T? = null
}

View File

@ -336,10 +336,10 @@ private fun ReplyBubbleContent(shape: RoundedCornerShape, background: Color, isN
) { ) {
Column( Column(
Modifier Modifier
.background(Color.Blue) .background(if (isNotSelf) SmallTalkTheme.extendedColors.otherBubbleReplyBackground else SmallTalkTheme.extendedColors.selfBubbleReplyBackground)
.padding(4.dp) .padding(4.dp)
) { ) {
val replyName = if (!isNotSelf && reply.replyingToSelf) "You" else reply.message.author.displayName ?: reply.message.author.id.value val replyName = if (!isNotSelf && reply.replyingToSelf) "You" else reply.replyingTo.author.displayName ?: reply.replyingTo.author.id.value
Text( Text(
fontSize = 11.sp, fontSize = 11.sp,
text = replyName, text = replyName,