Skip to content

Commit d957961

Browse files
Demo-app-improvements (#1333)
* Show avatar in lobby * Add close button for Share dialog * Rename shared prefs file based on version * Improve closed captions * Revert startClosedCaptions call --------- Co-authored-by: Aleksandar Apostolov <[email protected]>
1 parent 6cb0c7c commit d957961

File tree

3 files changed

+56
-12
lines changed

3 files changed

+56
-12
lines changed

demo-app/src/main/kotlin/io/getstream/video/android/ui/call/CallScreen.kt

Lines changed: 32 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ import androidx.activity.result.contract.ActivityResultContracts
2929
import androidx.compose.animation.Crossfade
3030
import androidx.compose.foundation.background
3131
import androidx.compose.foundation.layout.Arrangement
32+
import androidx.compose.foundation.layout.Box
3233
import androidx.compose.foundation.layout.BoxWithConstraints
3334
import androidx.compose.foundation.layout.PaddingValues
3435
import androidx.compose.foundation.layout.Row
@@ -38,10 +39,13 @@ import androidx.compose.foundation.layout.fillMaxWidth
3839
import androidx.compose.foundation.layout.padding
3940
import androidx.compose.foundation.layout.size
4041
import androidx.compose.material.ExperimentalMaterialApi
42+
import androidx.compose.material.Icon
43+
import androidx.compose.material.IconButton
4144
import androidx.compose.material.ModalBottomSheetValue
4245
import androidx.compose.material.Snackbar
4346
import androidx.compose.material.Text
4447
import androidx.compose.material.icons.Icons
48+
import androidx.compose.material.icons.filled.Close
4549
import androidx.compose.material.icons.filled.MoreVert
4650
import androidx.compose.material.icons.filled.People
4751
import androidx.compose.material.rememberModalBottomSheetState
@@ -58,6 +62,7 @@ import androidx.compose.runtime.setValue
5862
import androidx.compose.ui.Alignment
5963
import androidx.compose.ui.Modifier
6064
import androidx.compose.ui.draw.clip
65+
import androidx.compose.ui.graphics.Color
6166
import androidx.compose.ui.graphics.vector.ImageVector
6267
import androidx.compose.ui.platform.LocalConfiguration
6368
import androidx.compose.ui.platform.LocalContext
@@ -140,6 +145,7 @@ fun CallScreen(
140145
var isShowingStats by remember { mutableStateOf(false) }
141146
var layout by remember { mutableStateOf(LayoutType.DYNAMIC) }
142147
var unreadCount by remember { mutableIntStateOf(0) }
148+
var showShareDialog by remember { mutableStateOf(true) }
143149
var showParticipants by remember { mutableStateOf(false) }
144150
val chatState = rememberModalBottomSheetState(
145151
initialValue = ModalBottomSheetValue.Hidden,
@@ -495,7 +501,7 @@ fun CallScreen(
495501
ClosedCaptionsContainer(
496502
call,
497503
ClosedCaptionsDefaults.streamThemeConfig().copy(
498-
yOffset = (-80).dp,
504+
yOffset = (-100).dp,
499505
),
500506
closedCaptionUiState,
501507
)
@@ -546,7 +552,8 @@ fun CallScreen(
546552

547553
val isPictureInPictureMode = rememberIsInPipMode()
548554
if (!isPictureInPictureMode) {
549-
if (participantsSize.size == 1 &&
555+
if (showShareDialog &&
556+
participantsSize.size == 1 &&
550557
!chatState.isVisible &&
551558
orientation == Configuration.ORIENTATION_PORTRAIT
552559
) {
@@ -558,17 +565,31 @@ fun CallScreen(
558565
alignment = Alignment.BottomCenter,
559566
offset = IntOffset(
560567
0,
561-
-(VideoTheme.dimens.componentHeightL + VideoTheme.dimens.spacingS).toPx()
562-
.toInt(),
568+
-(VideoTheme.dimens.componentHeightL + VideoTheme.dimens.spacingS).toPx().toInt(),
563569
),
564570
) {
565-
ShareCallWithOthers(
566-
modifier = Modifier.fillMaxWidth(),
567-
call = call,
568-
clipboardManager = clipboardManager,
569-
env = env,
570-
context = context,
571-
)
571+
Box {
572+
ShareCallWithOthers(
573+
modifier = Modifier.fillMaxWidth(),
574+
call = call,
575+
clipboardManager = clipboardManager,
576+
env = env,
577+
context = context,
578+
)
579+
580+
IconButton(
581+
modifier = Modifier
582+
.align(Alignment.TopEnd)
583+
.padding(top = 10.dp, end = 10.dp),
584+
onClick = { showShareDialog = false },
585+
) {
586+
Icon(
587+
tint = Color.White,
588+
imageVector = Icons.Default.Close,
589+
contentDescription = Icons.Default.Close.name,
590+
)
591+
}
592+
}
572593
}
573594
}
574595
}

demo-app/src/main/kotlin/io/getstream/video/android/ui/lobby/CallLobbyScreen.kt

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,8 +68,11 @@ import io.getstream.video.android.CallActivity
6868
import io.getstream.video.android.R
6969
import io.getstream.video.android.compose.theme.VideoTheme
7070
import io.getstream.video.android.compose.ui.components.avatar.UserAvatar
71+
import io.getstream.video.android.compose.ui.components.avatar.UserAvatarBackground
7172
import io.getstream.video.android.compose.ui.components.base.StreamButton
7273
import io.getstream.video.android.compose.ui.components.call.lobby.CallLobby
74+
import io.getstream.video.android.compose.ui.components.video.VideoRenderer
75+
import io.getstream.video.android.compose.ui.components.video.config.videoRenderConfig
7376
import io.getstream.video.android.core.Call
7477
import io.getstream.video.android.core.call.state.ToggleCamera
7578
import io.getstream.video.android.core.call.state.ToggleMicrophone
@@ -252,6 +255,26 @@ private fun CallLobbyBody(
252255
.padding(VideoTheme.dimens.spacingM),
253256
isCameraEnabled = isCameraEnabled,
254257
isMicrophoneEnabled = isMicrophoneEnabled,
258+
onRenderedContent = {
259+
val videoRendererConfig = remember {
260+
videoRenderConfig {
261+
this.fallbackContent = {
262+
val userName = it.user.userNameOrId
263+
val userImage = it.user.image
264+
UserAvatarBackground(userImage = userImage, userName = userName)
265+
}
266+
}
267+
}
268+
VideoRenderer(
269+
modifier = Modifier
270+
.fillMaxSize()
271+
.background(VideoTheme.colors.baseSheetTertiary)
272+
.testTag("on_rendered_content"),
273+
call = call,
274+
video = it,
275+
videoRendererConfig = videoRendererConfig,
276+
)
277+
},
255278
onCallAction = { action ->
256279
when (action) {
257280
is ToggleCamera -> onToggleCamera(action.isEnabled)

demo-app/src/main/kotlin/io/getstream/video/android/util/config/AppConfig.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ import kotlinx.coroutines.flow.MutableStateFlow
4141
object AppConfig {
4242
// Constants
4343
private val logger by taggedLogger("RemoteConfig")
44-
private const val SHARED_PREF_NAME = "stream_demo_app"
44+
private const val SHARED_PREF_NAME = "stream_demo_app_${BuildConfig.VERSION_CODE}"
4545
private const val SELECTED_ENV = "selected_env_v2"
4646

4747
// Data

0 commit comments

Comments
 (0)