Skip to content

Commit

Permalink
Offset icon buttons instead of outline text button
Browse files Browse the repository at this point in the history
  • Loading branch information
Lambada10 committed Dec 9, 2024
1 parent 789d961 commit 6d1d99d
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,14 @@ import androidx.compose.foundation.layout.width
import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.foundation.text.selection.SelectionContainer
import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.filled.Add
import androidx.compose.material.icons.filled.Exposure
import androidx.compose.material.icons.filled.Remove
import androidx.compose.material.icons.outlined.ContentCopy
import androidx.compose.material3.Button
import androidx.compose.material3.HorizontalDivider
import androidx.compose.material3.Icon
import androidx.compose.material3.IconButton
import androidx.compose.material3.LocalContentColor
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.OutlinedButton
Expand Down Expand Up @@ -75,37 +78,43 @@ fun LyricsSuccessContent(
modifier = Modifier.padding(start = 6.dp)
)
Spacer(modifier = Modifier.weight(1f))
OutlinedButton(
IconButton(
onClick = { /* handled by repeatingClickable */ },
modifier = Modifier
.clip(RoundedCornerShape(20.dp)) // otherwise square ripple
.repeatingClickable(
interactionSource = remember { MutableInteractionSource() },
enabled = true,
maxDelayMillis = 500,
onClick = { onSetOffset(offset - 100) }
)
) {
Text(text = "-0.1s")
Icon(
imageVector = Icons.Default.Remove,
contentDescription = null,
modifier = Modifier.size(20.dp)
)
}
Spacer(modifier = Modifier.width(10.dp))
Text(
text = (if (offset >= 0) "+" else "") +
"${offset / 1000.0}s",
)
Spacer(modifier = Modifier.width(10.dp))
OutlinedButton(
IconButton(
onClick = { /* handled by repeatingClickable */ },
modifier = Modifier
.clip(RoundedCornerShape(20.dp)) // otherwise square ripple
.repeatingClickable(
interactionSource = remember { MutableInteractionSource() },
enabled = true,
maxDelayMillis = 500,
onClick = { onSetOffset(offset + 100) }
)
) {
Text(text = "+0.1s")
Icon(
imageVector = Icons.Default.Add,
contentDescription = null,
modifier = Modifier.size(20.dp)
)
}
}

Expand Down
5 changes: 1 addition & 4 deletions app/src/main/java/pl/lambada/songsync/util/ext/ComposeExt.kt
Original file line number Diff line number Diff line change
Expand Up @@ -95,9 +95,6 @@ fun Modifier.repeatingClickable(
}
}
}
}.indication(
interactionSource = interactionSource,
indication = ripple()
)
}
}
)

0 comments on commit 6d1d99d

Please sign in to comment.