Skip to content

Commit

Permalink
experiment
Browse files Browse the repository at this point in the history
  • Loading branch information
avently committed Jan 31, 2024
1 parent b1e76c1 commit b334459
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 20 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,16 +18,12 @@ import chat.simplex.common.platform.*
import chat.simplex.common.ui.theme.*
import chat.simplex.common.views.call.*
import chat.simplex.common.views.helpers.*
import chat.simplex.res.MR
import dev.icerock.moko.resources.compose.painterResource
import dev.icerock.moko.resources.compose.stringResource
import kotlinx.coroutines.delay
import kotlinx.coroutines.flow.MutableStateFlow
import kotlinx.datetime.Clock

@Composable
actual fun ActiveCallInteractiveArea(call: Call, newChatSheetState: MutableStateFlow<AnimatedViewState>) {
val media = call.peerMedia ?: call.localMedia
Row(
Modifier
.fillMaxSize()
Expand All @@ -39,14 +35,6 @@ actual fun ActiveCallInteractiveArea(call: Call, newChatSheetState: MutableState
verticalAlignment = Alignment.CenterVertically,
horizontalArrangement = Arrangement.Center
) {
if (chatModel.users.size > 1) {
ProfileImage(size = 30.dp, image = call.user.image, color = MaterialTheme.colors.secondaryVariant)
Spacer(Modifier.width(4.dp))
}
if (media == CallMediaType.Video) CallIcon(painterResource(MR.images.ic_videocam_filled), stringResource(MR.strings.icon_descr_video_call))
else CallIcon(painterResource(MR.images.ic_call_filled), stringResource(MR.strings.icon_descr_audio_call))
Spacer(Modifier.width(4.dp))
ProfileImage(size = 30.dp, image = call.contact.profile.image)
Spacer(Modifier.weight(1f))
CallDuration(call)
}
Expand All @@ -62,9 +50,6 @@ actual fun ActiveCallInteractiveArea(call: Call, newChatSheetState: MutableState
}
}

@Composable
private fun CallIcon(icon: Painter, descr: String) = Icon(icon, descr, Modifier.size(20.dp), tint = Color.White)

@Composable
private fun CallDuration(call: Call) {
val connectedAt = call.connectedAt
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,14 @@ import androidx.compose.foundation.background
import androidx.compose.foundation.clickable
import androidx.compose.foundation.interaction.MutableInteractionSource
import androidx.compose.foundation.layout.*
import androidx.compose.foundation.shape.CircleShape
import androidx.compose.material.*
import androidx.compose.runtime.*
import androidx.compose.runtime.saveable.rememberSaveable
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.draw.clipToBounds
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.graphics.graphicsLayer
import androidx.compose.ui.unit.dp
import chat.simplex.common.views.usersettings.SetDeliveryReceiptsView
Expand Down Expand Up @@ -218,11 +220,6 @@ fun AndroidScreen(settingsState: SettingsViewState) {
BoxWithConstraints {
val call = remember { chatModel.activeCall} .value
val showCallArea = call != null && call.callState != CallState.WaitCapabilities
if (call != null && showCallArea) {
Box(Modifier.height(CALL_INTERACTIVE_AREA_HEIGHT)) {
ActiveCallInteractiveArea(call, remember { MutableStateFlow(AnimatedViewState.GONE) })
}
}
var currentChatId by rememberSaveable { mutableStateOf(chatModel.chatId.value) }
val offset = remember { Animatable(if (chatModel.chatId.value == null) 0f else maxWidth.value) }
Box(
Expand Down Expand Up @@ -265,6 +262,17 @@ fun AndroidScreen(settingsState: SettingsViewState) {
ChatView(it, chatModel, onComposed)
}
}
if (call != null && showCallArea) {
Box(Modifier.height(CALL_INTERACTIVE_AREA_HEIGHT + 10.dp)) {
Box(Modifier.height(CALL_INTERACTIVE_AREA_HEIGHT)) {
ActiveCallInteractiveArea(call, remember { MutableStateFlow(AnimatedViewState.GONE) })
}
Box(Modifier.size(50.dp).background(SimplexGreen, CircleShape).align(Alignment.BottomCenter), contentAlignment = Alignment.Center) {
val media = call.peerMedia ?: call.localMedia
Icon(painterResource(if (media == CallMediaType.Video) MR.images.ic_videocam_filled else MR.images.ic_call_filled), null, Modifier.size(30.dp), tint = Color.White)
}
}
}
}
}

Expand Down

0 comments on commit b334459

Please sign in to comment.