Skip to content

Commit b4e0386

Browse files
committed
Some fixes
Change-Id: Idaa57d259b4eead690c1b48de51fd33b8bf23bb1
1 parent f05a667 commit b4e0386

File tree

3 files changed

+12
-25
lines changed

3 files changed

+12
-25
lines changed

Jetchat/app/src/main/java/com/example/compose/jetchat/conversation/Conversation.kt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ import androidx.compose.foundation.rememberScrollState
3939
import androidx.compose.foundation.shape.CircleShape
4040
import androidx.compose.foundation.shape.RoundedCornerShape
4141
import androidx.compose.material.AmbientContentAlpha
42+
import androidx.compose.material.AmbientContentColor
4243
import androidx.compose.material.ContentAlpha
4344
import androidx.compose.material.Divider
4445
import androidx.compose.material.Icon
@@ -397,7 +398,7 @@ fun ClickableMessage(message: Message) {
397398

398399
ClickableText(
399400
text = styledMessage,
400-
style = MaterialTheme.typography.body1,
401+
style = MaterialTheme.typography.body1.copy(color = AmbientContentColor.current),
401402
modifier = Modifier.padding(8.dp),
402403
onClick = {
403404
styledMessage

Jetchat/app/src/main/java/com/example/compose/jetchat/profile/Profile.kt

Lines changed: 10 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ package com.example.compose.jetchat.profile
1919
import androidx.compose.foundation.Image
2020
import androidx.compose.foundation.ScrollState
2121
import androidx.compose.foundation.ScrollableColumn
22-
import androidx.compose.foundation.background
2322
import androidx.compose.foundation.clickable
2423
import androidx.compose.foundation.layout.Box
2524
import androidx.compose.foundation.layout.Column
@@ -49,7 +48,6 @@ import androidx.compose.runtime.Providers
4948
import androidx.compose.runtime.key
5049
import androidx.compose.ui.Alignment
5150
import androidx.compose.ui.Modifier
52-
import androidx.compose.ui.graphics.Color
5351
import androidx.compose.ui.layout.ContentScale
5452
import androidx.compose.ui.layout.WithConstraints
5553
import androidx.compose.ui.platform.DensityAmbient
@@ -62,7 +60,7 @@ import com.example.compose.jetchat.R
6260
import com.example.compose.jetchat.components.AnimatingFabContent
6361
import com.example.compose.jetchat.components.JetchatAppBar
6462
import com.example.compose.jetchat.components.baselineHeight
65-
import com.example.compose.jetchat.data.colleagueProfile
63+
import com.example.compose.jetchat.data.meProfile
6664
import com.example.compose.jetchat.theme.JetchatTheme
6765

6866
@Composable
@@ -181,24 +179,17 @@ private fun ProfileHeader(
181179

182180
data.photo?.let {
183181
val asset = imageResource(id = it)
184-
val ratioAsset = asset.width / asset.height.toFloat()
182+
val ratioAsset = (asset.width / asset.height.toFloat()).coerceAtLeast(1f)
185183

186-
Box(
184+
// TODO: Fix landscape
185+
Image(
187186
modifier = Modifier
188-
.fillMaxWidth()
189-
// Allow for landscape and portrait ratios
190-
.preferredHeightIn(max = 320.dp)
191187
.aspectRatio(ratioAsset)
192-
.background(Color.LightGray)
193-
) {
194-
Image(
195-
modifier = Modifier
196-
.fillMaxSize()
197-
.padding(top = offsetDp),
198-
asset = asset,
199-
contentScale = ContentScale.Crop
200-
)
201-
}
188+
.preferredHeightIn(max = 320.dp)
189+
.padding(top = offsetDp),
190+
asset = asset,
191+
contentScale = ContentScale.FillWidth
192+
)
202193
}
203194
}
204195

@@ -267,7 +258,7 @@ fun ProfileFab(extended: Boolean, userIsMe: Boolean, modifier: Modifier = Modifi
267258
@Composable
268259
fun ConvPreview480MeDefault() {
269260
JetchatTheme {
270-
ProfileScreen(colleagueProfile)
261+
ProfileScreen(meProfile)
271262
}
272263
}
273264

Jetchat/build.gradle

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -71,11 +71,6 @@ subprojects {
7171
freeCompilerArgs += '-Xopt-in=kotlin.Experimental'
7272
freeCompilerArgs += '-Xallow-jvm-ir-dependencies'
7373

74-
freeCompilerArgs += [
75-
'-P',
76-
'plugin:androidx.compose.compiler.plugins.kotlin:intrinsicRemember=true'
77-
]
78-
7974
// Set JVM target to 1.8
8075
jvmTarget = "1.8"
8176
}

0 commit comments

Comments
 (0)