Skip to content

Commit

Permalink
Merge pull request #90 from DenisGithuku/89-update-iconography
Browse files Browse the repository at this point in the history
89 update iconography
  • Loading branch information
DenisGithuku authored Oct 12, 2024
2 parents c549ea9 + 49dde8e commit 549ac93
Show file tree
Hide file tree
Showing 414 changed files with 1,697 additions and 1,280 deletions.
1 change: 1 addition & 0 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ dependencies {
implementation(project(":core:data"))
implementation(project(":feature:book_detail"))
implementation(project(":feature:books"))
implementation(project(":feature:settings"))
implementation(project(":feature:profile"))
implementation(project(":feature:add_book"))
implementation(project(":feature:my_books"))
Expand Down
108 changes: 62 additions & 46 deletions app/src/main/java/com/githukudenis/comlib/MainActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@ import androidx.activity.ComponentActivity
import androidx.activity.compose.setContent
import androidx.activity.viewModels
import androidx.appcompat.app.AppCompatDelegate
import androidx.compose.animation.AnimatedVisibility
import androidx.compose.animation.slideInVertically
import androidx.compose.animation.slideOutVertically
import androidx.compose.material3.Icon
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.NavigationBar
Expand All @@ -31,6 +34,7 @@ import androidx.compose.material3.Scaffold
import androidx.compose.material3.SnackbarHost
import androidx.compose.material3.Surface
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.runtime.getValue
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.setValue
Expand All @@ -40,6 +44,7 @@ import androidx.core.view.WindowCompat
import androidx.lifecycle.Lifecycle
import androidx.lifecycle.lifecycleScope
import androidx.lifecycle.repeatOnLifecycle
import com.githukudenis.comlib.app.AppState
import com.githukudenis.comlib.app.rememberAppState
import com.githukudenis.comlib.core.designsystem.ui.theme.ComLibTheme
import com.githukudenis.comlib.core.model.ThemeConfig
Expand Down Expand Up @@ -80,52 +85,7 @@ class MainActivity : ComponentActivity() {
Surface {
Scaffold(
snackbarHost = { SnackbarHost(hostState = appState.snackbarHostState) },
bottomBar = {
// Only show bottom bar on routes in home graph
if (
appState.currentDestination?.route == HomeDestination.Home.route ||
appState.currentDestination?.route == HomeDestination.Books.route ||
appState.currentDestination?.route == HomeDestination.Groups.route
) {
NavigationBar(containerColor = MaterialTheme.colorScheme.background) {
val homeGraphDestinations =
listOf(HomeDestination.Home, HomeDestination.Books, HomeDestination.Groups)
homeGraphDestinations.forEach { destination ->
NavigationBarItem(
onClick = {
appState.navigate(destination.route, destination.route, inclusive = true)
},
selected = appState.currentDestination?.route == destination.route,
icon = {
(if (destination.route == appState.currentDestination?.route) {
destination.selectedIcon
} else destination.unselectedIcon)
?.let {
Icon(
painter = painterResource(it),
contentDescription = destination.label
)
}
},
colors =
NavigationBarItemDefaults.colors(
// indicatorColor =
// MaterialTheme.colorScheme.secondaryContainer.copy(0.4f)
),
label = {
destination.label?.let {
Text(
text = it,
style = MaterialTheme.typography.labelMedium,
fontWeight = FontWeight.Medium
)
}
}
)
}
}
}
}
bottomBar = { ComlibBottomNavigationBar(appState) }
) {
ComlibNavGraph(
appState = appState,
Expand Down Expand Up @@ -166,3 +126,59 @@ class MainActivity : ComponentActivity() {
}
}
}

@Composable
fun ComlibBottomNavigationBar(appState: AppState) {
// Only show bottom bar on routes in home graph
AnimatedVisibility(
enter =
slideInVertically(
initialOffsetY = { fullHeight -> fullHeight } // Slide in from bottom
),
exit =
slideOutVertically(
targetOffsetY = { fullHeight -> fullHeight } // Slide out downwards
),
visible =
appState.currentDestination?.route == HomeDestination.Home.route ||
appState.currentDestination?.route == HomeDestination.Books.route ||
appState.currentDestination?.route == HomeDestination.Groups.route ||
appState.currentDestination?.route == HomeDestination.Settings.route
) {
NavigationBar(containerColor = MaterialTheme.colorScheme.background) {
val homeGraphDestinations =
listOf(
HomeDestination.Home,
HomeDestination.Books,
HomeDestination.Groups,
HomeDestination.Settings
)
homeGraphDestinations.forEach { destination ->
NavigationBarItem(
onClick = { appState.navigate(destination.route, destination.route, inclusive = true) },
selected = appState.currentDestination?.route == destination.route,
icon = {
(if (destination.route == appState.currentDestination?.route) {
destination.selectedIcon
} else destination.unselectedIcon)
?.let { Icon(painter = painterResource(it), contentDescription = destination.label) }
},
colors =
NavigationBarItemDefaults.colors(
// indicatorColor =
// MaterialTheme.colorScheme.secondaryContainer.copy(0.4f)
),
label = {
destination.label?.let {
Text(
text = it,
style = MaterialTheme.typography.labelMedium,
fontWeight = FontWeight.Medium
)
}
}
)
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
package com.githukudenis.comlib.navigation

import androidx.annotation.DrawableRes
import androidx.compose.animation.AnimatedContentTransitionScope
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.padding
Expand All @@ -33,6 +34,7 @@ import com.githukudenis.comlib.app.AppState
import com.githukudenis.comlib.core.designsystem.ui.theme.LocalDimens
import com.githukudenis.comlib.feature.books.BooksRoute
import com.githukudenis.comlib.feature.home.HomeRoute
import com.githukudenis.comlib.feature.settings.SettingsRoute

fun NavGraphBuilder.homeNavGraph(
appState: AppState,
Expand Down Expand Up @@ -91,6 +93,26 @@ fun NavGraphBuilder.homeNavGraph(
onNavigateUp = { appState.popBackStack() }
)
}
composable(
enterTransition = {
slideIntoContainer(towards = AnimatedContentTransitionScope.SlideDirection.Left)
},
exitTransition = {
slideOutOfContainer(towards = AnimatedContentTransitionScope.SlideDirection.Right)
},
route = HomeDestination.Settings.route
) {
SettingsRoute(
onNavigateUp = { appState.popBackStack() },
onOpenEditProfile = {
appState.navigate(
route = ComlibDestination.Profile.route,
popUpTo = ComlibDestination.Profile.route,
inclusive = true
)
}
)
}
}
}

Expand Down Expand Up @@ -123,4 +145,12 @@ sealed class HomeDestination(
selectedIcon = R.drawable.people_filled,
unselectedIcon = R.drawable.people_outlined
)

data object Settings :
HomeDestination(
route = "settings",
label = "Settings",
selectedIcon = R.drawable.settings_filled,
unselectedIcon = R.drawable.settings_outlined
)
}
10 changes: 10 additions & 0 deletions app/src/main/res/drawable/settings_filled.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24">
<path
android:pathData="M14.279,2.152C13.908,2 13.439,2 12.5,2C11.561,2 11.092,2 10.721,2.152C10.227,2.355 9.835,2.745 9.631,3.235C9.537,3.458 9.501,3.718 9.486,4.098C9.465,4.656 9.177,5.172 8.69,5.451C8.203,5.73 7.609,5.72 7.111,5.459C6.773,5.281 6.528,5.183 6.286,5.151C5.756,5.082 5.22,5.224 4.796,5.547C4.478,5.789 4.243,6.193 3.774,7C3.304,7.807 3.07,8.21 3.017,8.605C2.948,9.131 3.091,9.663 3.417,10.083C3.565,10.276 3.774,10.437 4.098,10.639C4.574,10.936 4.88,11.442 4.88,12C4.88,12.558 4.574,13.064 4.098,13.361C3.774,13.563 3.565,13.724 3.416,13.917C3.091,14.337 2.947,14.869 3.017,15.395C3.07,15.789 3.304,16.193 3.774,17C4.243,17.807 4.478,18.211 4.796,18.453C5.22,18.776 5.756,18.918 6.286,18.849C6.528,18.817 6.773,18.719 7.111,18.541C7.609,18.28 8.203,18.27 8.69,18.549C9.177,18.828 9.465,19.344 9.486,19.902C9.501,20.281 9.537,20.542 9.631,20.765C9.835,21.255 10.227,21.645 10.721,21.848C11.092,22 11.561,22 12.5,22C13.439,22 13.908,22 14.279,21.848C14.773,21.645 15.165,21.255 15.369,20.765C15.463,20.542 15.499,20.281 15.514,19.902C15.535,19.344 15.823,18.828 16.31,18.549C16.797,18.27 17.391,18.28 17.889,18.541C18.227,18.719 18.472,18.817 18.714,18.849C19.244,18.918 19.78,18.776 20.204,18.453C20.522,18.211 20.757,17.807 21.226,17C21.696,16.193 21.93,15.789 21.983,15.395C22.052,14.869 21.909,14.337 21.583,13.916C21.435,13.724 21.226,13.563 20.902,13.361C20.426,13.064 20.12,12.558 20.12,12C20.12,11.442 20.426,10.936 20.902,10.639C21.226,10.437 21.435,10.276 21.584,10.083C21.909,9.663 22.052,9.131 21.983,8.605C21.93,8.211 21.696,7.807 21.226,7C20.757,6.193 20.522,5.789 20.204,5.547C19.78,5.224 19.244,5.082 18.714,5.151C18.472,5.183 18.227,5.281 17.889,5.459C17.392,5.72 16.797,5.73 16.31,5.451C15.823,5.172 15.535,4.656 15.514,4.098C15.499,3.718 15.463,3.458 15.369,3.235C15.165,2.745 14.773,2.355 14.279,2.152ZM12.5,15C14.17,15 15.523,13.657 15.523,12C15.523,10.343 14.17,9 12.5,9C10.83,9 9.477,10.343 9.477,12C9.477,13.657 10.83,15 12.5,15Z"
android:fillColor="#000000"
android:fillType="evenOdd"/>
</vector>
17 changes: 17 additions & 0 deletions app/src/main/res/drawable/settings_outlined.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24">
<path
android:pathData="M15.5,12C15.5,13.933 13.933,15.5 12,15.5C10.067,15.5 8.5,13.933 8.5,12C8.5,10.067 10.067,8.5 12,8.5C13.933,8.5 15.5,10.067 15.5,12Z"
android:strokeWidth="1.5"
android:fillColor="#00000000"
android:strokeColor="#000000"/>
<path
android:pathData="M21.011,14.097C21.533,13.956 21.794,13.885 21.897,13.751C22,13.616 22,13.4 22,12.967V11.033C22,10.6 22,10.384 21.897,10.249C21.794,10.115 21.533,10.044 21.011,9.904C19.061,9.378 17.84,7.339 18.343,5.401C18.482,4.868 18.551,4.602 18.485,4.445C18.419,4.289 18.229,4.181 17.85,3.966L16.125,2.987C15.753,2.775 15.567,2.67 15.4,2.692C15.233,2.715 15.044,2.903 14.667,3.279C13.208,4.734 10.794,4.734 9.334,3.279C8.957,2.903 8.769,2.715 8.602,2.692C8.435,2.67 8.249,2.775 7.877,2.987L6.152,3.966C5.773,4.181 5.583,4.289 5.517,4.445C5.451,4.601 5.52,4.868 5.658,5.401C6.161,7.339 4.94,9.378 2.989,9.904C2.467,10.044 2.206,10.115 2.103,10.249C2,10.384 2,10.6 2,11.033V12.967C2,13.4 2,13.616 2.103,13.751C2.206,13.885 2.467,13.956 2.989,14.097C4.939,14.623 6.16,16.662 5.657,18.599C5.518,19.132 5.449,19.399 5.515,19.555C5.581,19.711 5.771,19.819 6.15,20.034L7.875,21.013C8.247,21.225 8.433,21.33 8.6,21.308C8.767,21.285 8.956,21.097 9.333,20.721C10.793,19.264 13.209,19.264 14.669,20.721C15.046,21.097 15.234,21.285 15.401,21.308C15.568,21.33 15.754,21.225 16.127,21.013L17.851,20.034C18.231,19.819 18.42,19.711 18.486,19.555C18.552,19.398 18.483,19.132 18.345,18.599C17.841,16.662 19.061,14.623 21.011,14.097Z"
android:strokeWidth="1.5"
android:fillColor="#00000000"
android:strokeColor="#000000"
android:strokeLineCap="round"/>
</vector>

This file was deleted.

This file was deleted.

Loading

0 comments on commit 549ac93

Please sign in to comment.