Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make the press reaction more visible #244

Merged
merged 3 commits into from
Oct 30, 2023
Merged
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
4 changes: 2 additions & 2 deletions chai/src/main/java/com/droidconke/chai/colors/ChaiColors.kt
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ data class ChaiColors(
val activeBottomNavIconColor: Color = Color.Unspecified,
val inactiveBottomNavIconColor: Color = Color.Unspecified,
val titleTextColorPrimary: Color = Color.Unspecified,
val linkTextColorPrimary: Color = Color.Unspecified,
val linkTextColorPrimary: Color = Color.Unspecified
)

val LocalChaiColorsPalette = staticCompositionLocalOf { ChaiColors() }
Expand All @@ -61,4 +61,4 @@ val ChaiDarkColorPalette = ChaiColors(
inactiveBottomNavIconColor = ChaiWhite,
titleTextColorPrimary = ChaiWhite,
linkTextColorPrimary = ChaiLightGrey
)
)
Original file line number Diff line number Diff line change
@@ -1,6 +1,21 @@
/*
* Copyright 2023 DroidconKE
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.android254.domain.models

data class SessionsInformationDomainModel(
val sessions: List<Session>,
val eventDays: List<String>
)
)
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,17 @@
*/
package com.android254.presentation.common.bottomnav

import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.padding
import androidx.compose.material3.*
import androidx.compose.runtime.Composable
import androidx.compose.runtime.getValue
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.res.painterResource
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.dp
import androidx.navigation.NavDestination.Companion.hierarchy
import androidx.navigation.NavHostController
import androidx.navigation.compose.currentBackStackEntryAsState
Expand All @@ -30,23 +36,34 @@ import com.android254.presentation.common.theme.DroidconKE2023Theme

@Composable
fun BottomNavigationBar(navController: NavHostController) {
BottomAppBar(containerColor = MaterialTheme.colorScheme.background) {
BottomAppBar(
containerColor = MaterialTheme.colorScheme.background
) {
val navBackStackEntry by navController.currentBackStackEntryAsState()
val currentDestination = navBackStackEntry?.destination

bottomNavigationDestinations.forEach { destination ->
val selected =
currentDestination?.hierarchy?.any { it.route == destination.route } == true
val selected = currentDestination?.hierarchy?.any { it.route == destination.route } == true
NavigationBarItem(
selected = selected,
icon = {
Icon(
painter = painterResource(id = destination.icon),
contentDescription = destination.title
)
Column(
horizontalAlignment = Alignment.CenterHorizontally,
verticalArrangement = Arrangement.Center
) {
Icon(
painter = painterResource(id = destination.icon),
contentDescription = destination.title
)
Text(
modifier = Modifier.padding(top = 8.dp),
text = destination.title,
color = if (selected) MaterialTheme.colorScheme.secondary else MaterialTheme.colorScheme.onBackground,
fontSize = MaterialTheme.typography.labelMedium.fontSize
)
}
},
label = { Text(text = destination.title) },
alwaysShowLabel = true,
alwaysShowLabel = false,
onClick = {
navController.navigate(destination.route) {
launchSingleTop = true
Expand All @@ -57,8 +74,6 @@ fun BottomNavigationBar(navController: NavHostController) {
colors = NavigationBarItemDefaults.colors(
selectedIconColor = MaterialTheme.colorScheme.primary,
unselectedIconColor = MaterialTheme.colorScheme.onBackground,
selectedTextColor = MaterialTheme.colorScheme.secondary,
unselectedTextColor = MaterialTheme.colorScheme.onBackground,
indicatorColor = MaterialTheme.colorScheme.background.copy(alpha = 0f)
)
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ fun FeedComponent(
.wrapContentHeight(),
shape = RoundedCornerShape(5),
elevation = CardDefaults.cardElevation(defaultElevation = 2.dp),
colors = CardDefaults.cardColors(containerColor = MaterialTheme.colorScheme.onPrimary),
colors = CardDefaults.cardColors(containerColor = MaterialTheme.colorScheme.onPrimary)
) {
Column(
modifier = Modifier.padding(vertical = 8.dp, horizontal = 16.dp),
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,18 @@
/*
* Copyright 2023 DroidconKE
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.android254.presentation.home.components

import androidx.compose.material3.Text
Expand All @@ -23,7 +38,7 @@ fun HomeHeaderSectionComponent() {

@ChaiLightAndDarkComposePreview
@Composable
private fun HomeHeaderSectionComponentPreview(){
private fun HomeHeaderSectionComponentPreview() {
ChaiDCKE22Theme {
HomeHeaderSectionComponent()
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,18 @@
/*
* Copyright 2023 DroidconKE
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.android254.presentation.home.components

import android.content.res.Configuration
Expand Down Expand Up @@ -83,7 +98,7 @@ fun HomeSectionHeaderComponent(
.width(34.dp)
.background(
color = MaterialTheme.chaiColorsPalette.linkTextColorPrimary.copy(alpha = 0.11f),
shape = RoundedCornerShape(14.dp),
shape = RoundedCornerShape(14.dp)
)
) {
Text(
Expand All @@ -102,11 +117,11 @@ fun HomeSectionHeaderComponent(

@Preview(
name = "Light",
uiMode = Configuration.UI_MODE_NIGHT_NO,
uiMode = Configuration.UI_MODE_NIGHT_NO
)
@Preview(
name = "Dark",
uiMode = Configuration.UI_MODE_NIGHT_YES,
uiMode = Configuration.UI_MODE_NIGHT_YES
)
@Composable
private fun HomeSectionHeaderComponentPreview() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,6 @@ fun HomeSessionSection(
}
}


@Composable
fun HomeSessionContent(
session: SessionPresentationModel,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,8 @@ fun HomeSpeakerComponent(speaker: SpeakerUI, onClick: () -> Unit = {}) {
)
.border(
border = BorderStroke(
2.dp, color = colorResource(id = R.color.cyan)
2.dp,
color = colorResource(id = R.color.cyan)
),
shape = RoundedCornerShape(12.dp)
)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,18 @@
/*
* Copyright 2023 DroidconKE
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.android254.presentation.home.components

import androidx.compose.runtime.Composable
Expand Down Expand Up @@ -26,7 +41,6 @@ fun HomeToolbarComponent(
}
}


@ChaiLightAndDarkComposePreview
@Composable
private fun HomeToolbarComponentPreview() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ fun HomeRoute(
navigateToFeedbackScreen: () -> Unit = {},
navigateToSessionScreen: () -> Unit = {},
onActionClicked: () -> Unit = {},
onSessionClicked: (sessionId: String) -> Unit = {},
onSessionClicked: (sessionId: String) -> Unit = {}
) {
val homeViewState by homeViewModel.viewState.collectAsStateWithLifecycle()
val isSyncing by homeViewModel.isSyncing.collectAsStateWithLifecycle()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,18 @@
/*
* Copyright 2023 DroidconKE
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.android254.presentation.sessions.components

import androidx.compose.animation.core.animateFloatAsState
Expand Down Expand Up @@ -29,7 +44,6 @@ import androidx.compose.ui.unit.dp
import com.android254.presentation.utils.ChaiLightAndDarkComposePreview
import com.droidconke.chai.ChaiDCKE22Theme


@Composable
fun CustomSwitch(
width: Dp = 72.dp,
Expand Down Expand Up @@ -107,7 +121,6 @@ private fun animateAlignmentAsState(
}
}


@ChaiLightAndDarkComposePreview
@Composable
private fun CustomSwitchPreview() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,11 +59,11 @@ fun SessionsStateComponent(
) {
val swipeRefreshState = rememberSwipeRefreshState(isRefreshing = isRefreshing)

if (sessionsUiState.isLoading){
if (sessionsUiState.isLoading) {
SessionLoadingComponent()
}

if (sessionsUiState.isEmpty){
if (sessionsUiState.isEmpty) {
Column(
modifier = Modifier
.fillMaxSize(),
Expand All @@ -89,11 +89,11 @@ fun SessionsStateComponent(
}
}

if (sessionsUiState.isError){
if (sessionsUiState.isError) {
SessionsErrorComponent(errorMessage = sessionsUiState.errorMessage, retry = retry)
}

if (!sessionsUiState.isEmpty){
if (!sessionsUiState.isEmpty) {
SessionListComponent(
swipeRefreshState = swipeRefreshState,
sessions = sessionsUiState.sessions,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ fun SpeakersRoute(
navigateToSpeaker = navigateToSpeaker
)
}

@Composable
private fun SpeakersScreen(
uiState: SpeakersScreenUiState,
Expand All @@ -82,7 +83,7 @@ private fun SpeakersScreen(
text = stringResource(id = R.string.speakers_label),
fontSize = 24.sp,
fontFamily = FontFamily(Font(R.font.montserrat_regular)),
color = MaterialTheme.chaiColorsPalette.textColorPrimary,
color = MaterialTheme.chaiColorsPalette.textColorPrimary
)
},
navigationIcon = {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,18 @@
/*
* Copyright 2023 DroidconKE
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.android254.presentation.utils

import android.content.res.Configuration
Expand All @@ -11,4 +26,4 @@ import androidx.compose.ui.tooling.preview.Preview
name = "Dark",
uiMode = Configuration.UI_MODE_NIGHT_YES
)
annotation class ChaiLightAndDarkComposePreview
annotation class ChaiLightAndDarkComposePreview
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@ class SessionScreenTest {

@Test
fun hasExpectedButtons() = runTest {

composeTestRule.setContent {
DroidconKE2023Theme {
SessionsScreen(
Expand Down Expand Up @@ -78,7 +77,6 @@ class SessionScreenTest {

@Test
fun `should show topBar`() = runTest {

composeTestRule.setContent {
DroidconKE2023Theme() {
SessionsScreen(
Expand Down
Loading