Skip to content
This repository has been archived by the owner on Apr 14, 2024. It is now read-only.

Commit

Permalink
Merge pull request #94 from dluvian/v0.17.5-dev
Browse files Browse the repository at this point in the history
V0.17.5 dev
  • Loading branch information
dluvian authored Feb 28, 2024
2 parents ea1f0dd + 4351366 commit 1149576
Show file tree
Hide file tree
Showing 10 changed files with 46 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ fun BaseHint(text: String) {
) {
Icon(
modifier = Modifier
.size(sizing.largeItem)
.size(sizing.extraLargeItem)
.aspectRatio(1f),
imageVector = SearchIcon,
contentDescription = text,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,14 @@ import androidx.compose.ui.Modifier
import com.dluvian.nozzle.ui.theme.AddIcon

@Composable
fun AddIconButton(onAdd: () -> Unit, description: String, modifier: Modifier = Modifier) {
fun AddIconButton(
onAdd: () -> Unit, description: String,
modifier: Modifier = Modifier,
iconModifier: Modifier = Modifier,
) {
BaseIconButton(
modifier = modifier,
iconModifier = iconModifier,
imageVector = AddIcon,
description = description,
onClick = onAdd
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,10 @@ fun BaseIconButton(
imageVector: ImageVector,
description: String,
onClick: () -> Unit,
modifier: Modifier = Modifier
modifier: Modifier = Modifier,
iconModifier: Modifier = Modifier
) {
IconButton(modifier = modifier, onClick = onClick) {
Icon(imageVector = imageVector, contentDescription = description)
Icon(modifier = iconModifier, imageVector = imageVector, contentDescription = description)
}
}
Original file line number Diff line number Diff line change
@@ -1,10 +1,19 @@
package com.dluvian.nozzle.ui.components.iconButtons

import androidx.compose.foundation.layout.size
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import com.dluvian.nozzle.ui.theme.CopyIcon
import com.dluvian.nozzle.ui.theme.sizing


@Composable
fun CopyIconButton(onCopy: () -> Unit, description: String) {
BaseIconButton(imageVector = CopyIcon, description = description, onClick = onCopy)
BaseIconButton(
modifier = Modifier.size(sizing.largeItem),
iconModifier = Modifier.size(sizing.smallItem),
imageVector = CopyIcon,
description = description,
onClick = onCopy
)
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,12 @@ import com.dluvian.nozzle.ui.theme.QuoteIcon
fun QuoteIconButton(
onQuote: () -> Unit,
description: String,
modifier: Modifier = Modifier
modifier: Modifier = Modifier,
iconModifier: Modifier = Modifier,
) {
BaseIconButton(
modifier = modifier,
iconModifier = iconModifier,
imageVector = QuoteIcon,
description = description,
onClick = onQuote
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,12 @@ import com.dluvian.nozzle.ui.theme.ReplyIcon
fun ReplyIconButton(
onReply: () -> Unit,
description: String,
modifier: Modifier = Modifier
modifier: Modifier = Modifier,
iconModifier: Modifier = Modifier,
) {
BaseIconButton(
modifier = modifier,
iconModifier = iconModifier,
imageVector = ReplyIcon,
description = description,
onClick = onReply
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,16 +16,19 @@ fun LikeToggleIconButton(
isLiked: Boolean,
onToggleLike: () -> Unit,
modifier: Modifier = Modifier,
iconModifier: Modifier = Modifier,
) {
IconButton(modifier = modifier, onClick = onToggleLike) {
if (isLiked) {
Icon(
modifier = iconModifier,
imageVector = LikedIcon,
tint = Color.Red,
contentDescription = stringResource(id = R.string.remove_like),
)
} else {
Icon(
modifier = iconModifier,
imageVector = NotLikedIcon,
tint = MaterialTheme.colorScheme.onSurface,
contentDescription = stringResource(id = R.string.like)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,23 +1,28 @@
package com.dluvian.nozzle.ui.components.iconButtons.toggle

import androidx.compose.foundation.layout.size
import androidx.compose.material3.Icon
import androidx.compose.material3.IconButton
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.res.stringResource
import com.dluvian.nozzle.R
import com.dluvian.nozzle.ui.theme.VisibilityOffIcon
import com.dluvian.nozzle.ui.theme.VisibilityOnIcon
import com.dluvian.nozzle.ui.theme.sizing

@Composable
fun VisibilityToggleIconButton(isVisible: Boolean, onToggleVisibility: () -> Unit) {
IconButton(onClick = onToggleVisibility) {
IconButton(modifier = Modifier.size(sizing.largeItem), onClick = onToggleVisibility) {
if (isVisible) {
Icon(
modifier = Modifier.size(sizing.smallItem),
imageVector = VisibilityOffIcon,
contentDescription = stringResource(id = R.string.turn_visibility_off)
)
} else {
Icon(
modifier = Modifier.size(sizing.smallItem),
imageVector = VisibilityOnIcon,
contentDescription = stringResource(id = R.string.turn_visibility_on)
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,8 @@ private fun ReplyAction(
) {
Row(modifier = modifier, verticalAlignment = Alignment.CenterVertically) {
ReplyIconButton(
modifier = Modifier.size(sizing.smallItem),
modifier = Modifier.size(sizing.largeItem),
iconModifier = Modifier.size(sizing.smallItem),
onReply = {
onPrepareReply(postToReplyTo)
onNavigateToReply()
Expand All @@ -102,7 +103,8 @@ private fun QuoteAction(
verticalAlignment = Alignment.CenterVertically
) {
QuoteIconButton(
modifier = Modifier.size(sizing.smallItem),
modifier = Modifier.size(sizing.largeItem),
iconModifier = Modifier.size(sizing.smallItem),
onQuote = onNavigateToQuote,
description = stringResource(R.string.quote)
)
Expand All @@ -124,7 +126,8 @@ private fun LikeAction(
verticalAlignment = Alignment.CenterVertically
) {
LikeToggleIconButton(
modifier = Modifier.size(sizing.smallItem),
modifier = Modifier.size(sizing.largeItem),
iconModifier = Modifier.size(sizing.smallItem),
isLiked = isLiked.value,
onToggleLike = {
if (isLiked.value) showDeletePopup.value = true
Expand Down
6 changes: 5 additions & 1 deletion app/src/main/java/com/dluvian/nozzle/ui/theme/Sizing.kt
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,14 @@ data class Sizing(
* 24 dp
*/
val mediumItem: Dp = 24.dp,
/**
* 32 dp
*/
val largeItem: Dp = 32.dp,
/**
* 48 dp
*/
val largeItem: Dp = 48.dp,
val extraLargeItem: Dp = 48.dp,
/**
* 32 dp
*/
Expand Down

0 comments on commit 1149576

Please sign in to comment.