|
|
|
@ -27,6 +27,7 @@ import coil.decode.BitmapFactoryDecoder |
|
|
|
|
import coil.request.ImageRequest |
|
|
|
|
import com.dfsek.feldspar.AppState |
|
|
|
|
import com.dfsek.feldspar.ui.RoomActivity |
|
|
|
|
import com.dfsek.feldspar.util.DynamicContent |
|
|
|
|
import com.dfsek.feldspar.util.compose_fixes.FixedDefaultFlingBehavior |
|
|
|
|
import com.dfsek.feldspar.util.getAvatarUrl |
|
|
|
|
import com.dfsek.feldspar.util.getPreviewText |
|
|
|
@ -72,11 +73,13 @@ fun Avatar(mxUrl: String?, size: Int, clip: Shape = CircleShape, name: String? = |
|
|
|
|
contentAlignment = Alignment.Center |
|
|
|
|
) { |
|
|
|
|
name?.let { |
|
|
|
|
Text(it.substring(0, 1), |
|
|
|
|
Text( |
|
|
|
|
it.substring(0, 1), |
|
|
|
|
modifier = Modifier.align(Alignment.Center), |
|
|
|
|
fontSize = (floor(size * 0.75).sp), |
|
|
|
|
textAlign = TextAlign.Center, |
|
|
|
|
color = Color.White) |
|
|
|
|
color = Color.White |
|
|
|
|
) |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
@ -106,21 +109,16 @@ fun Activity.RoomList( |
|
|
|
|
filter: (List<RoomSummary>) -> List<RoomSummary> |
|
|
|
|
) { |
|
|
|
|
AppState.session?.let { session -> |
|
|
|
|
val lifecycleOwner = LocalLifecycleOwner.current |
|
|
|
|
var rooms: List<RoomSummary> by remember { mutableStateOf(emptyList()) } |
|
|
|
|
LaunchedEffect(session) { |
|
|
|
|
session.roomService().getRoomSummariesLive(queryParams) |
|
|
|
|
.observe(lifecycleOwner) { |
|
|
|
|
rooms = filter(it) |
|
|
|
|
DynamicContent(session, { session.roomService().getRoomSummariesLive(queryParams) }) { |
|
|
|
|
val rooms = filter(it) |
|
|
|
|
val fling = FixedDefaultFlingBehavior.fixedFlingBehavior() |
|
|
|
|
LazyColumn(flingBehavior = fling) { |
|
|
|
|
items(rooms, key = { |
|
|
|
|
it.roomId |
|
|
|
|
}) { |
|
|
|
|
Log.d("ROOM", it.roomId) |
|
|
|
|
RoomEntry(it) |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
val fling = FixedDefaultFlingBehavior.fixedFlingBehavior() |
|
|
|
|
LazyColumn(flingBehavior = fling) { |
|
|
|
|
items(rooms, key = { |
|
|
|
|
it.roomId |
|
|
|
|
}) { |
|
|
|
|
Log.d("ROOM", it.roomId) |
|
|
|
|
RoomEntry(it) |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|