Skip to content

Commit

Permalink
fix: status bar height
Browse files Browse the repository at this point in the history
  • Loading branch information
RugerMcCarthy committed Mar 15, 2021
1 parent 81ba144 commit f3163ef
Show file tree
Hide file tree
Showing 10 changed files with 67 additions and 69 deletions.
43 changes: 19 additions & 24 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,27 +1,22 @@
# Template repository

Template repository for the Jetpack Compose [#AndroidDevChallenge](https://developer.android.com/dev-challenge).

## Getting started
Copy this repository by pressing the "Use this template" button in Github.
Clone your repository and open it in the latest [Android Studio (Canary build)](https://developer.android.com/studio/preview).

## Submission requirements
- Follow the challenge description on the project website: [developer.android.com/dev-challenge](https://developer.android.com/dev-challenge)
- All UI should be written using Jetpack Compose
- The Github Actions workflow should complete successfully
- Include two screenshots of your submission in the [results](results) folder. The names should be
screenshot_1.png and screenshot_2.png.
- Include a screen record of your submission in the [results](results) folder. The name should be
video.mp4
- Replace the contents of [README.md](README.md) with the contents of [README-template.md](README-template.md) and fill out the template.

## Code formatting
The CI uses [Spotless](https://github.com/diffplug/spotless) to check if your code is formatted correctly and contains the right licenses.
Internally, Spotless uses [ktlint](https://github.com/pinterest/ktlint) to check the formatting of your code.
To set up ktlint correctly with Android Studio, follow one of the [listed setup options](https://github.com/pinterest/ktlint#-with-intellij-idea).

Before committing your code, run `./gradlew app:spotlessApply` to automatically format your code.
# Put title of your app here
BloomCompose
<!--- Replace <OWNER> with your Github Username and <REPOSITORY> with the name of your repository. -->
<!--- You can find both of these in the url bar when you open your repository in github. -->
![Workflow result](https://github.com/RugerMcCarthy/BloomCompose/workflows/Check/badge.svg)


## :scroll: Description
<!--- Describe your app in one or two sentences -->
Draw UI according to design blueprint

## :bulb: Motivation and Context
<!--- Optionally point readers to interesting parts of your submission. -->
<!--- What are you especially proud of? -->


## :camera_flash: Screenshots
<!-- You can add more screenshots here if you like -->
<img src="/results/screenshot_1.png" width="260">&emsp;<img src="/results/screenshot_2.png" width="260">&emsp;<img src="/results/screenshot_3.png" width="260">

## License
```
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,28 +18,16 @@ package com.example.androiddevchallenge
import android.os.Bundle
import androidx.activity.compose.setContent
import androidx.appcompat.app.AppCompatActivity
import androidx.compose.runtime.Composable
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.tooling.preview.Preview
import com.example.androiddevchallenge.ui.NavGraph
import com.example.androiddevchallenge.ui.theme.BloomTheme

class MainActivity : AppCompatActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
getWindow().setStatusBarColor(Color.Transparent.value.toInt())
setContent {
BloomTheme(false) {
NavGraph()
NavGraph(window)
}
}
}
}

@Preview
@Composable
fun AppPreview() {
BloomTheme(false) {
NavGraph()
}
}
47 changes: 24 additions & 23 deletions app/src/main/java/com/example/androiddevchallenge/ui/HomePage.kt
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ fun HomePage() {
value = "",
onValueChange = {},
modifier = Modifier
.padding(top = 40.dp, start = 16.dp, end = 16.dp)
.padding(top = 16.dp, start = 16.dp, end = 16.dp)
.fillMaxWidth()
.height(56.dp)
.clip(RoundedCornerShape(4.dp)),
Expand Down Expand Up @@ -288,29 +288,30 @@ fun BottomBar() {
}
}
}
@Preview
@Composable
fun BottomBarPreview() {
BloomTheme(false) {
BottomBar()
}
}

@Preview
@Composable
fun DesignCardPreview() {
BloomTheme(false) {
DesignCard(designList[0])
}
}

@Preview
@Composable
fun PlantCardPreview() {
BloomTheme(false) {
PlantCard(plantList[0])
}
}
// @Preview
// @Composable
// fun BottomBarPreview() {
// BloomTheme(false) {
// BottomBar()
// }
// }
//
// @Preview
// @Composable
// fun DesignCardPreview() {
// BloomTheme(false) {
// DesignCard(designList[0])
// }
// }
//
// @Preview
// @Composable
// fun PlantCardPreview() {
// BloomTheme(false) {
// PlantCard(plantList[0])
// }
// }

@Preview
@Composable
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ fun LoginPage() {
text = "Log in with email",
modifier = Modifier
.fillMaxWidth()
.paddingFromBaseline(top = 184.dp, bottom = 16.dp),
.paddingFromBaseline(top = 160.dp, bottom = 16.dp),
style = MaterialTheme.typography.h1,
color = MaterialTheme.colors.onPrimary,
textAlign = TextAlign.Center
Expand Down Expand Up @@ -115,16 +115,16 @@ fun LoginPage() {

@Composable
@Preview
fun LoginPageDarkPreview() {
BloomTheme(true) {
fun LoginPageLightPreview() {
BloomTheme(false) {
LoginPage()
}
}

@Composable
@Preview
fun LoginPageLightPreview() {
BloomTheme(false) {
fun LoginPageDarkPreview() {
BloomTheme(true) {
LoginPage()
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,10 @@
*/
package com.example.androiddevchallenge.ui

import android.view.Window
import androidx.compose.material.MaterialTheme
import androidx.compose.runtime.Composable
import androidx.compose.ui.graphics.toArgb
import androidx.navigation.NavHostController
import androidx.navigation.compose.NavHost
import androidx.navigation.compose.composable
Expand Down Expand Up @@ -62,18 +65,21 @@ private object RouterPath {
}

@Composable
fun NavGraph() {
fun NavGraph(window: Window) {
val navHostController = rememberNavController()
TouristGuide.navController = navHostController

NavHost(navController = navHostController, startDestination = RouterPath.WELCOME) {
composable(RouterPath.WELCOME) {
window.statusBarColor = MaterialTheme.colors.primary.toArgb()
WelcomePage()
}
composable(RouterPath.LOGIN) {
window.statusBarColor = MaterialTheme.colors.background.toArgb()
LoginPage()
}
composable(RouterPath.HOME) {
window.statusBarColor = MaterialTheme.colors.background.toArgb()
HomePage()
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ fun WelcomePage() {
contentDescription = "weclome_illos",
modifier = Modifier
.wrapContentSize()
.padding(top = 72.dp, start = 88.dp)
.padding(top = 48.dp, start = 88.dp)
)
Column(
modifier = Modifier
Expand Down Expand Up @@ -120,9 +120,17 @@ fun WelcomePage() {
}
}

@Preview(showBackground = true)
@Preview
@Composable
fun WelcomePagePreview() {
fun WelcomePageLightPreview() {
BloomTheme(false) {
WelcomePage()
}
}

@Preview
@Composable
fun WelcomePageDarkPreview() {
BloomTheme(true) {
WelcomePage()
}
Expand Down
Binary file modified results/screenshot_1.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 modified results/screenshot_2.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 results/screenshot_3.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 modified results/video.mp4
Binary file not shown.

0 comments on commit f3163ef

Please sign in to comment.