Skip to content

Commit

Permalink
Update project
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelbel committed Dec 12, 2024
1 parent d6c4ce7 commit b80727b
Show file tree
Hide file tree
Showing 7 changed files with 70 additions and 51 deletions.
Binary file added .github/pics/desktop.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added .github/pics/foldable.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed .github/pics/img.png
Binary file not shown.
Binary file added .github/pics/phone.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added .github/pics/tablet.png
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,6 +19,7 @@ import androidx.compose.foundation.layout.offset
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.size
import androidx.compose.foundation.layout.sizeIn
import androidx.compose.foundation.layout.statusBarsPadding
import androidx.compose.foundation.rememberScrollState
import androidx.compose.foundation.shape.CircleShape
import androidx.compose.foundation.verticalScroll
Expand All @@ -41,6 +42,7 @@ import androidx.compose.material3.NavigationRail
import androidx.compose.material3.NavigationRailItem
import androidx.compose.material3.PermanentDrawerSheet
import androidx.compose.material3.Scaffold
import androidx.compose.material3.SnackbarDuration
import androidx.compose.material3.SnackbarHost
import androidx.compose.material3.SnackbarHostState
import androidx.compose.material3.Text
Expand All @@ -61,9 +63,7 @@ import androidx.compose.ui.layout.Layout
import androidx.compose.ui.layout.Measurable
import androidx.compose.ui.layout.MeasurePolicy
import androidx.compose.ui.layout.layoutId
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.text.font.FontWeight
import androidx.compose.ui.text.style.TextAlign
import androidx.compose.ui.unit.dp
import androidx.compose.ui.unit.offset
import androidx.compose.ui.unit.sp
Expand All @@ -76,7 +76,6 @@ import kotlinx.serialization.Serializable
import org.koin.androidx.compose.koinViewModel
import org.michaelbel.core.ktx.navigationSuiteType
import org.michaelbel.template.MainViewModel
import org.michaelbel.template.R

@Composable
fun MainActivityContent(
Expand Down Expand Up @@ -187,19 +186,28 @@ fun MainActivityContent(
verticalArrangement = Arrangement.spacedBy(4.dp)
) {
FloatingActionButton(
onClick = {},
modifier = Modifier.padding(top = 8.dp, bottom = 32.dp),
onClick = {
coroutineScope.launch {
snackbarHostState.showSnackbar(
message = "Single-line snackbar with action",
actionLabel = "Action",
duration = SnackbarDuration.Short
)
}
},
modifier = Modifier
.statusBarsPadding()
.padding(top = 16.dp),
containerColor = MaterialTheme.colorScheme.tertiaryContainer,
contentColor = MaterialTheme.colorScheme.onTertiaryContainer
) {
Icon(
imageVector = Icons.Default.Edit,
contentDescription = null,
modifier = Modifier.size(18.dp)
contentDescription = null
)
}
Spacer(Modifier.height(8.dp)) // NavigationRailHeaderPadding
Spacer(Modifier.height(4.dp)) // NavigationRailVerticalPadding

Spacer(Modifier.height(16.dp))

NavigationRailItem(
selected = selectedRoute == Navigation.Home,
Expand All @@ -209,11 +217,6 @@ fun MainActivityContent(
imageVector = Icons.Outlined.Home,
contentDescription = null
)
},
label = {
Text(
text = "Home"
)
}
)

Expand Down Expand Up @@ -249,11 +252,6 @@ fun MainActivityContent(
contentDescription = null
)
}
},
label = {
Text(
text = "Chat"
)
}
)

Expand All @@ -265,11 +263,6 @@ fun MainActivityContent(
imageVector = Icons.Outlined.Settings,
contentDescription = null
)
},
label = {
Text(
text = "Settings"
)
}
)
}
Expand All @@ -290,18 +283,19 @@ fun MainActivityContent(
horizontalAlignment = Alignment.Start,
verticalArrangement = Arrangement.spacedBy(4.dp)
) {
Text(
modifier = Modifier
.padding(16.dp),
text = stringResource(id = R.string.app_name).uppercase(),
style = MaterialTheme.typography.titleMedium,
color = MaterialTheme.colorScheme.primary
)
ExtendedFloatingActionButton(
onClick = { /*TODO*/ },
onClick = {
coroutineScope.launch {
snackbarHostState.showSnackbar(
message = "Single-line snackbar with action",
actionLabel = "Action",
duration = SnackbarDuration.Short
)
}
},
modifier = Modifier
.fillMaxWidth()
.padding(top = 8.dp, bottom = 40.dp),
.statusBarsPadding(),
containerColor = MaterialTheme.colorScheme.tertiaryContainer,
contentColor = MaterialTheme.colorScheme.onTertiaryContainer
) {
Expand All @@ -310,10 +304,10 @@ fun MainActivityContent(
contentDescription = null,
modifier = Modifier.size(24.dp)
)

Text(
text = "Compose",
modifier = Modifier.weight(1f),
textAlign = TextAlign.Center
modifier = Modifier.padding(start = 8.dp),
)
}
}
Expand Down Expand Up @@ -422,21 +416,31 @@ fun MainActivityContent(
)
},
floatingActionButton = {
FloatingActionButton(
onClick = {
coroutineScope.launch {
snackbarHostState.showSnackbar(
message = "Single-line snackbar with action",
actionLabel = "Action"
)
}
},
modifier = Modifier.offset(y = 16.dp)
) {
Icon(
imageVector = Icons.Outlined.Edit,
contentDescription = null
)
if (navigationSuiteType == NavigationSuiteType.NavigationBar) {
ExtendedFloatingActionButton(
onClick = {
coroutineScope.launch {
snackbarHostState.showSnackbar(
message = "Single-line snackbar with action",
actionLabel = "Action",
duration = SnackbarDuration.Short
)
}
},
modifier = Modifier.offset(y = 16.dp),
containerColor = MaterialTheme.colorScheme.tertiaryContainer,
contentColor = MaterialTheme.colorScheme.onTertiaryContainer
) {
Icon(
imageVector = Icons.Outlined.Edit,
contentDescription = null
)

Text(
text = "Compose",
modifier = Modifier.padding(start = 8.dp)
)
}
}
}
) { innerPadding ->
Expand Down
17 changes: 16 additions & 1 deletion readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,27 @@ Android App Template
This Android app template provides a foundation for quickly starting development across Mobile, Wear, TV, and Auto platforms. It includes pre-configured dependencies, code samples, and project structure, simplifying the creation and setup of new applications. The template helps reduce configuration time and allows developers to focus on implementing functionality, ensuring a smooth start.

[![android-mobile](https://img.shields.io/badge/mobile-000000.svg?style=for-the-badge&logo=android&logoColor=white)](https://github.com/michaelbel/android-template)
[![android-tablet](https://img.shields.io/badge/tablet-000000.svg?style=for-the-badge&logo=android&logoColor=white)](https://github.com/michaelbel/android-template)
[![android-foldable](https://img.shields.io/badge/foldable-000000.svg?style=for-the-badge&logo=android&logoColor=white)](https://github.com/michaelbel/android-template)
[![android-desktop](https://img.shields.io/badge/desktop-000000.svg?style=for-the-badge&logo=android&logoColor=white)](https://github.com/michaelbel/android-template)
[![android-wear](https://img.shields.io/badge/wear-000000.svg?style=for-the-badge&logo=android&logoColor=white)](https://github.com/michaelbel/android-template)
[![android-tv](https://img.shields.io/badge/tv-000000.svg?style=for-the-badge&logo=android&logoColor=white)](https://github.com/michaelbel/android-template)
[![android-auto](https://img.shields.io/badge/auto-000000.svg?style=for-the-badge&logo=android&logoColor=white)](https://github.com/michaelbel/android-template)

<div>
<img src=".github/pics/img.png" width="33%" alt="Project Image">
<img src=".github/pics/phone.png" width="33%" alt="Phone Image">
</div>

<div>
<img src=".github/pics/foldable.png" width="66%" alt="Foldable Image">
</div>

<div>
<img src=".github/pics/tablet.png" width="66%" alt="Tablet Image">
</div>

<div>
<img src=".github/pics/desktop.png" width="99%" alt="Desktop Image">
</div>

## Features
Expand Down

0 comments on commit b80727b

Please sign in to comment.