-
-
Notifications
You must be signed in to change notification settings - Fork 30
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
UI Improvements #104
Merged
Merged
UI Improvements #104
Changes from 5 commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
bef4e94
- Added corner radius to alarm card
M00NJ f82dce6
Forgot to change this line
M00NJ 222f0ee
Fixed floating action button sitting higher in stopwatch tab
M00NJ a516900
UI fixes and improvements
M00NJ d19196a
Merge remote-tracking branch 'origin/main'
M00NJ 87f619e
Add material colors to keypad the right way
M00NJ 8c478e2
Merge pull request #1 from M00NJ/ui-changes
M00NJ 6026a1e
Merge branch 'Bnyro:main' into main
M00NJ File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -10,9 +10,11 @@ import androidx.compose.material.icons.filled.Backspace | |||||
import androidx.compose.material3.Icon | ||||||
import androidx.compose.material3.MaterialTheme | ||||||
import androidx.compose.material3.Text | ||||||
import androidx.compose.material3.surfaceColorAtElevation | ||||||
import androidx.compose.runtime.Composable | ||||||
import androidx.compose.runtime.rememberCoroutineScope | ||||||
import androidx.compose.ui.Modifier | ||||||
import androidx.compose.ui.graphics.Color | ||||||
import androidx.compose.ui.platform.LocalConfiguration | ||||||
import androidx.compose.ui.platform.LocalView | ||||||
import androidx.compose.ui.res.stringResource | ||||||
|
@@ -32,36 +34,37 @@ fun NumberKeypad( | |||||
|
||||||
val buttonSize = (screenHeight / 8).dp | ||||||
val buttonSpacing = 6.dp | ||||||
val buttonColor = MaterialTheme.colorScheme.surfaceColorAtElevation(1.dp) | ||||||
|
||||||
Column( | ||||||
verticalArrangement = Arrangement.spacedBy(buttonSpacing) | ||||||
) { | ||||||
Row( | ||||||
horizontalArrangement = Arrangement.spacedBy(buttonSpacing) | ||||||
) { | ||||||
Button(number = "1", buttonSize, onOperation) | ||||||
Button(number = "2", buttonSize, onOperation) | ||||||
Button(number = "3", buttonSize, onOperation) | ||||||
Button(number = "1", buttonSize, buttonColor, onOperation) | ||||||
Button(number = "2", buttonSize, buttonColor, onOperation) | ||||||
Button(number = "3", buttonSize, buttonColor, onOperation) | ||||||
} | ||||||
Row( | ||||||
horizontalArrangement = Arrangement.spacedBy(buttonSpacing) | ||||||
) { | ||||||
Button(number = "4", buttonSize, onOperation) | ||||||
Button(number = "5", buttonSize, onOperation) | ||||||
Button(number = "6", buttonSize, onOperation) | ||||||
Button(number = "4", buttonSize, buttonColor, onOperation) | ||||||
Button(number = "5", buttonSize, buttonColor, onOperation) | ||||||
Button(number = "6", buttonSize, buttonColor, onOperation) | ||||||
} | ||||||
Row( | ||||||
horizontalArrangement = Arrangement.spacedBy(buttonSpacing) | ||||||
) { | ||||||
Button(number = "7", buttonSize, onOperation) | ||||||
Button(number = "8", buttonSize, onOperation) | ||||||
Button(number = "9", buttonSize, onOperation) | ||||||
Button(number = "7", buttonSize, buttonColor, onOperation) | ||||||
Button(number = "8", buttonSize, buttonColor, onOperation) | ||||||
Button(number = "9", buttonSize, buttonColor, onOperation) | ||||||
} | ||||||
Row( | ||||||
horizontalArrangement = Arrangement.spacedBy(buttonSpacing) | ||||||
) { | ||||||
Button(number = "00", buttonSize, onOperation) | ||||||
Button(number = "0", buttonSize, onOperation) | ||||||
Button(number = "00", buttonSize, buttonColor, onOperation) | ||||||
Button(number = "0", buttonSize, buttonColor, onOperation) | ||||||
SingleElementButton( | ||||||
onClick = { | ||||||
coroutineScope.launch { | ||||||
|
@@ -77,13 +80,13 @@ fun NumberKeypad( | |||||
|
||||||
onOperation(NumberKeypadOperation.Clear) | ||||||
}, | ||||||
color = MaterialTheme.colorScheme.primaryContainer, | ||||||
color = MaterialTheme.colorScheme.secondaryContainer, | ||||||
modifier = Modifier.size(buttonSize) | ||||||
) { | ||||||
Icon( | ||||||
imageVector = Icons.Default.Backspace, | ||||||
contentDescription = stringResource(R.string.delete), | ||||||
tint = MaterialTheme.colorScheme.onPrimaryContainer | ||||||
tint = MaterialTheme.colorScheme.onSecondaryContainer | ||||||
) | ||||||
} | ||||||
} | ||||||
|
@@ -94,6 +97,7 @@ fun NumberKeypad( | |||||
fun Button( | ||||||
number: String, | ||||||
buttonSize: Dp, | ||||||
buttonColor: Color, | ||||||
onOperation: (NumberKeypadOperation) -> Unit | ||||||
) { | ||||||
val view = LocalView.current | ||||||
|
@@ -107,12 +111,13 @@ fun Button( | |||||
|
||||||
onOperation(NumberKeypadOperation.AddNumber(number)) | ||||||
}, | ||||||
modifier = Modifier.size(buttonSize) | ||||||
modifier = Modifier.size(buttonSize), | ||||||
color = buttonColor | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
) { | ||||||
Text( | ||||||
text = number, | ||||||
color = MaterialTheme.colorScheme.onSurface, | ||||||
fontSize = MaterialTheme.typography.headlineLarge.fontSize | ||||||
fontSize = MaterialTheme.typography.displaySmall.fontSize | ||||||
) | ||||||
} | ||||||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please remove the buttonColor arguments everywhere here.