Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
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
2 changes: 2 additions & 0 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ androidxAnnotations = "1.9.1"
androidxAppcompat = "1.7.0"
androidxComposeBom = "2025.08.01"
androidxComposeConstraintLayout = "1.1.0"
androidxCoreSplashScreen = "1.2.0"
androidxCoreTest = "2.2.0"
androidxFragment = "1.8.5"
androidxKtx = "1.15.0"
Expand Down Expand Up @@ -111,6 +112,7 @@ androidx-compose-ui-test-junit4 = { module = "androidx.compose.ui:ui-test-junit4
androidx-compose-ui-tooling = { module = "androidx.compose.ui:ui-tooling" }
androidx-constraintlayout = { module = "androidx.constraintlayout:constraintlayout", version.ref = "constraintLayout"}
androidx-core-ktx = { module = "androidx.core:core-ktx", version.ref = "androidxKtx"}
androidx-core-splashscreen = { module = "androidx.core:core-splashscreen", version.ref = "androidxCoreSplashScreen"}
androidx-core-testing = { module = "androidx.arch.core:core-testing", version.ref = "androidxCoreTest"}
androidx-fragment-ktx = { module = "androidx.fragment:fragment-ktx", version.ref = "androidxFragment"}
androidx-fragment-testing = { module = "androidx.fragment:fragment-testing", version.ref = "androidxFragment"}
Expand Down
1 change: 1 addition & 0 deletions stream-chat-android-compose-sample/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,7 @@ dependencies {
implementation(project(":stream-chat-android-compose"))

implementation(libs.androidx.core.ktx)
implementation(libs.androidx.core.splashscreen)
implementation(libs.androidx.appcompat)
implementation(libs.android.material)
implementation(libs.stream.log)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import android.content.Intent
import android.os.Bundle
import androidx.appcompat.app.AppCompatActivity
import androidx.core.app.TaskStackBuilder
import androidx.core.splashscreen.SplashScreen.Companion.installSplashScreen
import androidx.lifecycle.lifecycleScope
import io.getstream.chat.android.client.ChatClient
import io.getstream.chat.android.compose.sample.BuildConfig
Expand All @@ -46,6 +47,7 @@ class StartupActivity : AppCompatActivity() {
private val settings by lazy { customSettings() }

override fun onCreate(savedInstanceState: Bundle?) {
installSplashScreen()
super.onCreate(savedInstanceState)

lifecycleScope.launch {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,15 @@ import android.content.Context
import android.content.Intent
import android.os.Bundle
import androidx.appcompat.app.AppCompatActivity
import androidx.core.splashscreen.SplashScreen.Companion.installSplashScreen
import io.getstream.chat.android.compose.sample.ChatHelper
import io.getstream.chat.android.compose.sample.data.PredefinedUserCredentials
import io.getstream.chat.android.compose.sample.data.customSettings

class StartupActivity : AppCompatActivity() {

override fun onCreate(savedInstanceState: Bundle?) {
installSplashScreen()
super.onCreate(savedInstanceState)
ChatHelper.initializeSdk(applicationContext, PredefinedUserCredentials.API_KEY, intent.getStringExtra("BASE_URL"))
customSettings().isComposerLinkPreviewEnabled = true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@
android:name=".ui.StartupActivity"
android:exported="true"
android:launchMode="singleInstance"
android:theme="@style/Theme.App.Splash"
>
<intent-filter>
<action android:name="android.intent.action.MAIN" />
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ package io.getstream.chat.android.compose.sample.feature.channel.list
import android.content.Context
import android.content.Intent
import android.os.Bundle
import android.widget.Toast
import androidx.activity.ComponentActivity
import androidx.activity.compose.setContent
import androidx.activity.viewModels
Expand All @@ -37,7 +36,6 @@ import androidx.compose.foundation.layout.wrapContentHeight
import androidx.compose.foundation.lazy.LazyItemScope
import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.material3.DrawerValue
import androidx.compose.material3.ExperimentalMaterial3Api
import androidx.compose.material3.ModalDrawerSheet
import androidx.compose.material3.ModalNavigationDrawer
import androidx.compose.material3.Scaffold
Expand Down Expand Up @@ -83,16 +81,13 @@ import io.getstream.chat.android.compose.ui.channels.list.ChannelItem
import io.getstream.chat.android.compose.ui.channels.list.ChannelList
import io.getstream.chat.android.compose.ui.components.SearchInput
import io.getstream.chat.android.compose.ui.components.channels.buildDefaultChannelActions
import io.getstream.chat.android.compose.ui.mentions.MentionList
import io.getstream.chat.android.compose.ui.theme.ChannelListDividerItemParams
import io.getstream.chat.android.compose.ui.theme.ChannelListItemContentParams
import io.getstream.chat.android.compose.ui.theme.ChatComponentFactory
import io.getstream.chat.android.compose.ui.theme.ChatTheme
import io.getstream.chat.android.compose.ui.threads.ThreadsScreen
import io.getstream.chat.android.compose.viewmodel.channels.ChannelListViewModel
import io.getstream.chat.android.compose.viewmodel.channels.ChannelListViewModelFactory
import io.getstream.chat.android.compose.viewmodel.mentions.MentionListViewModel
import io.getstream.chat.android.compose.viewmodel.mentions.MentionListViewModelFactory
import io.getstream.chat.android.compose.viewmodel.threads.ThreadsViewModelFactory
import io.getstream.chat.android.models.Channel
import io.getstream.chat.android.models.Filters
Expand Down Expand Up @@ -125,7 +120,6 @@ class ChannelsActivity : ComponentActivity() {
}

private val channelsViewModel: ChannelListViewModel by viewModels { channelsViewModelFactory }
private val mentionListViewModel: MentionListViewModel by viewModels { MentionListViewModelFactory() }
private val threadsViewModelFactory = ThreadsViewModelFactory(query = QueryThreadsRequest())

@Suppress("LongMethod")
Expand Down Expand Up @@ -204,7 +198,6 @@ class ChannelsActivity : ComponentActivity() {
},
)

AppBottomBarOption.MENTIONS -> MentionsContent()
AppBottomBarOption.THREADS -> ThreadsContent(
onHeaderAvatarClick = {
coroutineScope.launch {
Expand Down Expand Up @@ -238,17 +231,6 @@ class ChannelsActivity : ComponentActivity() {
// MyCustomUi()
}

@OptIn(ExperimentalMaterial3Api::class)
@Composable
private fun MentionsContent() {
MentionList(
viewModel = mentionListViewModel,
modifier = Modifier.fillMaxSize(),
onItemClick = ::openMessages,
onEvent = { Toast.makeText(this, "Error", Toast.LENGTH_SHORT).show() },
)
}

@Composable
private fun ThreadsContent(onHeaderAvatarClick: () -> Unit) {
ThreadsScreen(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,6 @@ class ChatsActivity : ComponentActivity() {
onOptionSelected = { option ->
listContentMode = when (option) {
AppBottomBarOption.CHATS -> ChatListContentMode.Channels
AppBottomBarOption.MENTIONS -> ChatListContentMode.Mentions
AppBottomBarOption.THREADS -> ChatListContentMode.Threads
}
},
Expand All @@ -240,8 +239,9 @@ class ChatsActivity : ComponentActivity() {
val unreadThreadsCount by remember { globalStateFlow.flatMapLatest { it.unreadThreadsCount } }
.collectAsStateWithLifecycle(0)
val selectedOption = when (listContentMode) {
ChatListContentMode.Channels -> AppBottomBarOption.CHATS
ChatListContentMode.Mentions -> AppBottomBarOption.MENTIONS
ChatListContentMode.Channels,
ChatListContentMode.Mentions,
-> AppBottomBarOption.CHATS
ChatListContentMode.Threads -> AppBottomBarOption.THREADS
}
AppBottomBar(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.height
import androidx.compose.foundation.layout.padding
import androidx.compose.material3.HorizontalDivider
import androidx.compose.material3.Icon
import androidx.compose.material3.Text
import androidx.compose.material3.ripple
Expand Down Expand Up @@ -60,41 +61,40 @@ fun AppBottomBar(
selectedOption: AppBottomBarOption,
onOptionSelected: (AppBottomBarOption) -> Unit,
) {
Row(
modifier = Modifier
.fillMaxWidth()
.background(ChatTheme.colors.backgroundCoreElevation1),
verticalAlignment = Alignment.CenterVertically,
horizontalArrangement = Arrangement.SpaceEvenly,
) {
AppBottomBarOptionTile(
icon = ComposeR.drawable.stream_design_ic_message_bubble_fill,
text = R.string.app_bottom_bar_chats,
isSelected = selectedOption == AppBottomBarOption.CHATS,
onClick = { onOptionSelected(AppBottomBarOption.CHATS) },
decorationBadge = {
if (unreadChannelsCount > 0) {
UnreadCountIndicator(unreadChannelsCount)
}
},
)
AppBottomBarOptionTile(
icon = ComposeR.drawable.stream_design_ic_mention,
text = R.string.app_bottom_bar_mentions,
isSelected = selectedOption == AppBottomBarOption.MENTIONS,
onClick = { onOptionSelected(AppBottomBarOption.MENTIONS) },
)
AppBottomBarOptionTile(
icon = ComposeR.drawable.stream_design_ic_thread,
text = R.string.app_bottom_bar_threads,
isSelected = selectedOption == AppBottomBarOption.THREADS,
onClick = { onOptionSelected(AppBottomBarOption.THREADS) },
decorationBadge = {
if (unreadThreadsCount > 0) {
UnreadCountIndicator(unreadThreadsCount)
}
},
)
Column(modifier = Modifier.fillMaxWidth()) {
HorizontalDivider(thickness = 1.dp, color = ChatTheme.colors.borderCoreSubtle)
Row(
modifier = Modifier
.fillMaxWidth()
.background(ChatTheme.colors.backgroundCoreElevation1),
verticalAlignment = Alignment.CenterVertically,
horizontalArrangement = Arrangement.SpaceEvenly,
) {
AppBottomBarOptionTile(
selectedIcon = ComposeR.drawable.stream_design_ic_message_bubble_fill,
unselectedIcon = ComposeR.drawable.stream_design_ic_message_bubble,
text = R.string.app_bottom_bar_chats,
isSelected = selectedOption == AppBottomBarOption.CHATS,
onClick = { onOptionSelected(AppBottomBarOption.CHATS) },
decorationBadge = {
if (unreadChannelsCount > 0) {
UnreadCountIndicator(unreadChannelsCount)
}
},
)
AppBottomBarOptionTile(
selectedIcon = ComposeR.drawable.stream_design_ic_thread_fill,
unselectedIcon = ComposeR.drawable.stream_design_ic_thread,
text = R.string.app_bottom_bar_threads,
isSelected = selectedOption == AppBottomBarOption.THREADS,
onClick = { onOptionSelected(AppBottomBarOption.THREADS) },
decorationBadge = {
if (unreadThreadsCount > 0) {
UnreadCountIndicator(unreadThreadsCount)
}
},
)
}
}
}

Expand All @@ -103,13 +103,13 @@ fun AppBottomBar(
*/
enum class AppBottomBarOption {
CHATS,
MENTIONS,
THREADS,
}

@Composable
private fun AppBottomBarOptionTile(
@DrawableRes icon: Int,
@DrawableRes selectedIcon: Int,
@DrawableRes unselectedIcon: Int,
@StringRes text: Int,
isSelected: Boolean,
onClick: () -> Unit,
Expand All @@ -133,7 +133,7 @@ private fun AppBottomBarOptionTile(
horizontalAlignment = Alignment.CenterHorizontally,
) {
Icon(
painter = painterResource(icon),
painter = painterResource(if (isSelected) selectedIcon else unselectedIcon),
contentDescription = null,
tint = contentColor,
)
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,5 @@
-->
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
<background android:drawable="@color/ic_launcher_background"/>
<foreground android:drawable="@drawable/ic_launcher_foreground"/>
</adaptive-icon>
<foreground android:drawable="@mipmap/ic_launcher_foreground"/>
</adaptive-icon>
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,5 @@
-->
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
<background android:drawable="@color/ic_launcher_background"/>
<foreground android:drawable="@drawable/ic_launcher_foreground"/>
</adaptive-icon>
<foreground android:drawable="@mipmap/ic_launcher_foreground"/>
</adaptive-icon>
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,5 @@
limitations under the License.
-->
<resources>
<color name="ic_launcher_background">#005FFF</color>
</resources>
<color name="ic_launcher_background">#000000</color>
</resources>
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,6 @@

<!-- App Bottom Bar -->
<string name="app_bottom_bar_chats">Chats</string>
<string name="app_bottom_bar_mentions">Mentions</string>
<string name="app_bottom_bar_threads">Threads</string>

<!-- Draft Channel -->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,10 @@
<item name="android:windowBackground">#FFFFFF</item>
<item name="android:statusBarColor">@android:color/transparent</item>
</style>

<style name="Theme.App.Splash" parent="Theme.SplashScreen">
<item name="windowSplashScreenBackground">@color/ic_launcher_background</item>
<item name="windowSplashScreenAnimatedIcon">@mipmap/ic_launcher_foreground</item>
<item name="postSplashScreenTheme">@style/AppTheme</item>
</style>
</resources>
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,7 @@ dependencies {
implementation(libs.androidx.activity.ktx)
implementation(libs.androidx.appcompat)
implementation(libs.androidx.core.ktx)
implementation(libs.androidx.core.splashscreen)
implementation(libs.androidx.lifecycle.livedata.ktx)
implementation(libs.androidx.preference)
implementation(libs.androidx.constraintlayout)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@
<activity
android:name="io.getstream.chat.ui.sample.feature.HostActivity"
android:exported="true"
android:theme="@style/Theme.App.Splash"
android:windowSoftInputMode="adjustResize"
>
<intent-filter>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import android.content.Intent
import android.os.Bundle
import android.view.View
import androidx.appcompat.app.AppCompatActivity
import androidx.core.splashscreen.SplashScreen.Companion.installSplashScreen
import androidx.core.view.ViewCompat
import androidx.core.view.WindowInsetsCompat
import androidx.core.view.updatePadding
Expand All @@ -34,6 +35,7 @@ const val EXTRA_PARENT_MESSAGE_ID = "extra_parent_message_id"
class HostActivity : AppCompatActivity(R.layout.activity_main) {

override fun onCreate(savedInstanceState: Bundle?) {
installSplashScreen()
super.onCreate(savedInstanceState)
setupEdgeToEdge()
if (savedInstanceState != null && lastNonConfigurationInstance == null) {
Expand Down
Loading
Loading