Skip to content

Instantly share code, notes, and snippets.

@Raiden18
Last active June 2, 2022 10:18
Show Gist options
  • Save Raiden18/999f83aa5784a7c457908f748f287410 to your computer and use it in GitHub Desktop.
Save Raiden18/999f83aa5784a7c457908f748f287410 to your computer and use it in GitHub Desktop.
Closer look
private fun ButtonSize.getButtonHeight(): Dp {
return when (this) { // Useless checking type
ButtonSize.Small -> 16.dp // code duplication
ButtonSize.Medium -> 24.dp // code duplication
ButtonSize.Large -> 32.dp // code duplication
ButtonSize.Huge -> 40.dp // code duplication
is ButtonSize.Custom -> this.heightDpInt.dp // code duplication
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment