Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Some fixes
Change-Id: Idaa57d259b4eead690c1b48de51fd33b8bf23bb1
  • Loading branch information
JoseAlcerreca committed Nov 6, 2020
commit b4e038698c940add7a626c6967be6852ceb0843b
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ import androidx.compose.foundation.rememberScrollState
import androidx.compose.foundation.shape.CircleShape
import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.material.AmbientContentAlpha
import androidx.compose.material.AmbientContentColor
import androidx.compose.material.ContentAlpha
import androidx.compose.material.Divider
import androidx.compose.material.Icon
Expand Down Expand Up @@ -397,7 +398,7 @@ fun ClickableMessage(message: Message) {

ClickableText(
text = styledMessage,
style = MaterialTheme.typography.body1,
style = MaterialTheme.typography.body1.copy(color = AmbientContentColor.current),
modifier = Modifier.padding(8.dp),
onClick = {
styledMessage
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ package com.example.compose.jetchat.profile
import androidx.compose.foundation.Image
import androidx.compose.foundation.ScrollState
import androidx.compose.foundation.ScrollableColumn
import androidx.compose.foundation.background
import androidx.compose.foundation.clickable
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.Column
Expand Down Expand Up @@ -49,7 +48,6 @@ import androidx.compose.runtime.Providers
import androidx.compose.runtime.key
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.layout.ContentScale
import androidx.compose.ui.layout.WithConstraints
import androidx.compose.ui.platform.DensityAmbient
Expand All @@ -62,7 +60,7 @@ import com.example.compose.jetchat.R
import com.example.compose.jetchat.components.AnimatingFabContent
import com.example.compose.jetchat.components.JetchatAppBar
import com.example.compose.jetchat.components.baselineHeight
import com.example.compose.jetchat.data.colleagueProfile
import com.example.compose.jetchat.data.meProfile
import com.example.compose.jetchat.theme.JetchatTheme

@Composable
Expand Down Expand Up @@ -181,24 +179,17 @@ private fun ProfileHeader(

data.photo?.let {
val asset = imageResource(id = it)
val ratioAsset = asset.width / asset.height.toFloat()
val ratioAsset = (asset.width / asset.height.toFloat()).coerceAtLeast(1f)

Box(
// TODO: Fix landscape
Image(
modifier = Modifier
.fillMaxWidth()
// Allow for landscape and portrait ratios
.preferredHeightIn(max = 320.dp)
.aspectRatio(ratioAsset)
.background(Color.LightGray)
) {
Image(
modifier = Modifier
.fillMaxSize()
.padding(top = offsetDp),
asset = asset,
contentScale = ContentScale.Crop
)
}
.preferredHeightIn(max = 320.dp)
.padding(top = offsetDp),
asset = asset,
contentScale = ContentScale.FillWidth
)
}
}

Expand Down Expand Up @@ -267,7 +258,7 @@ fun ProfileFab(extended: Boolean, userIsMe: Boolean, modifier: Modifier = Modifi
@Composable
fun ConvPreview480MeDefault() {
JetchatTheme {
ProfileScreen(colleagueProfile)
ProfileScreen(meProfile)
}
}

Expand Down
5 changes: 0 additions & 5 deletions Jetchat/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -71,11 +71,6 @@ subprojects {
freeCompilerArgs += '-Xopt-in=kotlin.Experimental'
freeCompilerArgs += '-Xallow-jvm-ir-dependencies'

freeCompilerArgs += [
'-P',
'plugin:androidx.compose.compiler.plugins.kotlin:intrinsicRemember=true'
]

// Set JVM target to 1.8
jvmTarget = "1.8"
}
Expand Down