misc: remove the redundant `Companion` added due to refactoring

This commit is contained in:
Han Yin 2025-08-29 19:30:00 -07:00
parent 5794d7ae6c
commit 50cea70de3
6 changed files with 24 additions and 24 deletions

View File

@ -48,21 +48,21 @@ fun ConversationBottomBar(
val placeholder = if (isReady) "Type your message here" else "AI is generating the response..." val placeholder = if (isReady) "Type your message here" else "AI is generating the response..."
Column( Column(
modifier = Modifier.Companion.fillMaxWidth() modifier = Modifier.fillMaxWidth()
) { ) {
Surface( Surface(
modifier = Modifier.Companion.fillMaxWidth(), modifier = Modifier.fillMaxWidth(),
color = BottomAppBarDefaults.containerColor, color = BottomAppBarDefaults.containerColor,
tonalElevation = BottomAppBarDefaults.ContainerElevation, tonalElevation = BottomAppBarDefaults.ContainerElevation,
shape = RoundedCornerShape(topStart = 32.dp, topEnd = 32.dp) shape = RoundedCornerShape(topStart = 32.dp, topEnd = 32.dp)
) { ) {
Box( Box(
modifier = Modifier.Companion.fillMaxWidth() modifier = Modifier.fillMaxWidth()
.padding(start = 16.dp, top = 16.dp, end = 16.dp), .padding(start = 16.dp, top = 16.dp, end = 16.dp),
) { ) {
OutlinedTextField( OutlinedTextField(
state = textFieldState, state = textFieldState,
modifier = Modifier.Companion.fillMaxWidth(), modifier = Modifier.fillMaxWidth(),
enabled = isReady, enabled = isReady,
placeholder = { Text(placeholder) }, placeholder = { Text(placeholder) },
lineLimits = TextFieldLineLimits.MultiLine(maxHeightInLines = 5), lineLimits = TextFieldLineLimits.MultiLine(maxHeightInLines = 5),
@ -74,7 +74,7 @@ fun ConversationBottomBar(
disabledContainerColor = MaterialTheme.colorScheme.surfaceDim, disabledContainerColor = MaterialTheme.colorScheme.surfaceDim,
), ),
shape = androidx.compose.foundation.shape.RoundedCornerShape(16.dp), shape = androidx.compose.foundation.shape.RoundedCornerShape(16.dp),
keyboardOptions = KeyboardOptions(imeAction = ImeAction.Companion.Send), keyboardOptions = KeyboardOptions(imeAction = ImeAction.Send),
onKeyboardAction = { onKeyboardAction = {
if (isReady) { if (isReady) {
onSendClick() onSendClick()
@ -136,8 +136,8 @@ fun ConversationBottomBar(
) )
} else { } else {
CircularProgressIndicator( CircularProgressIndicator(
modifier = Modifier.Companion.size(24.dp), modifier = Modifier.size(24.dp),
strokeCap = StrokeCap.Companion.Round, strokeCap = StrokeCap.Round,
color = MaterialTheme.colorScheme.onPrimary, color = MaterialTheme.colorScheme.onPrimary,
) )
} }

View File

@ -136,7 +136,7 @@ fun ModelSelectionBottomBar(
Text( Text(
text = "Filter by", text = "Filter by",
style = MaterialTheme.typography.labelMedium, style = MaterialTheme.typography.labelMedium,
modifier = Modifier.Companion.padding(horizontal = 16.dp, vertical = 8.dp) modifier = Modifier.padding(horizontal = 16.dp, vertical = 8.dp)
) )
filtering.filters.forEach { (filter, isEnabled) -> filtering.filters.forEach { (filter, isEnabled) ->

View File

@ -152,7 +152,7 @@ fun ModelsManagementBottomBar(
Text( Text(
text = "Filter by", text = "Filter by",
style = MaterialTheme.typography.labelMedium, style = MaterialTheme.typography.labelMedium,
modifier = Modifier.Companion.padding(horizontal = 16.dp, vertical = 8.dp) modifier = Modifier.padding(horizontal = 16.dp, vertical = 8.dp)
) )
filtering.filters.forEach { (filter, isEnabled) -> filtering.filters.forEach { (filter, isEnabled) ->
@ -222,8 +222,8 @@ fun ModelsManagementBottomBar(
Icon( Icon(
painter = painterResource(id = R.drawable.logo_huggingface), painter = painterResource(id = R.drawable.logo_huggingface),
contentDescription = "Browse and download a model from HuggingFace", contentDescription = "Browse and download a model from HuggingFace",
modifier = Modifier.Companion.size(24.dp), modifier = Modifier.size(24.dp),
tint = Color.Companion.Unspecified, tint = Color.Unspecified,
) )
}, },
onClick = importing.importFromHuggingFace onClick = importing.importFromHuggingFace

View File

@ -66,7 +66,7 @@ fun PerformanceTopBar(
useFahrenheit = useFahrenheit useFahrenheit = useFahrenheit
) )
Spacer(modifier = Modifier.Companion.width(8.dp)) Spacer(modifier = Modifier.width(8.dp))
} }
// Memory indicator // Memory indicator
@ -84,8 +84,8 @@ fun PerformanceTopBar(
@Composable @Composable
private fun MemoryIndicator(memoryUsage: MemoryMetrics) { private fun MemoryIndicator(memoryUsage: MemoryMetrics) {
Row( Row(
modifier = Modifier.Companion.padding(end = 8.dp), modifier = Modifier.padding(end = 8.dp),
verticalAlignment = Alignment.Companion.CenterVertically verticalAlignment = Alignment.CenterVertically,
) { ) {
Icon( Icon(
imageVector = Icons.Default.Memory, imageVector = Icons.Default.Memory,
@ -100,7 +100,7 @@ private fun MemoryIndicator(memoryUsage: MemoryMetrics) {
Spacer(modifier = Modifier.width(4.dp)) Spacer(modifier = Modifier.width(4.dp))
Text( Text(
text = String.Companion.format( text = String.format(
Locale.getDefault(), "%.1f / %.1f GB", memoryUsage.availableGb, memoryUsage.totalGb Locale.getDefault(), "%.1f / %.1f GB", memoryUsage.availableGb, memoryUsage.totalGb
), ),
style = MaterialTheme.typography.bodySmall, style = MaterialTheme.typography.bodySmall,

View File

@ -58,8 +58,8 @@ private fun StorageIndicator(storageMetrics: StorageMetrics) {
val availableGb = storageMetrics.availableGB val availableGb = storageMetrics.availableGB
Row( Row(
modifier = Modifier.Companion.padding(end = 8.dp), modifier = Modifier.padding(end = 8.dp),
verticalAlignment = Alignment.Companion.CenterVertically verticalAlignment = Alignment.CenterVertically
) { ) {
Icon( Icon(
imageVector = Icons.Default.SdStorage, imageVector = Icons.Default.SdStorage,
@ -71,10 +71,10 @@ private fun StorageIndicator(storageMetrics: StorageMetrics) {
} }
) )
Spacer(modifier = Modifier.Companion.width(2.dp)) Spacer(modifier = Modifier.width(2.dp))
Text( Text(
text = String.Companion.format( text = String.format(
Locale.getDefault(), Locale.getDefault(),
"%.1f / %.1f GB", "%.1f / %.1f GB",
usedGb, usedGb,

View File

@ -64,15 +64,15 @@ private fun round2(v: Double): Double = round(v * 100) / 100
fun formatFileByteSize(sizeInBytes: Long) = when { fun formatFileByteSize(sizeInBytes: Long) = when {
sizeInBytes >= 1_000_000_000 -> { sizeInBytes >= 1_000_000_000 -> {
val sizeInGb = sizeInBytes / 1_000_000_000.0 val sizeInGb = sizeInBytes / 1_000_000_000.0
String.Companion.format(Locale.getDefault(), "%.1f GB", sizeInGb) String.format(Locale.getDefault(), "%.1f GB", sizeInGb)
} }
sizeInBytes >= 1_000_000 -> { sizeInBytes >= 1_000_000 -> {
val sizeInMb = sizeInBytes / 1_000_000.0 val sizeInMb = sizeInBytes / 1_000_000.0
String.Companion.format(Locale.getDefault(), "%.0f MB", sizeInMb) String.format(Locale.getDefault(), "%.0f MB", sizeInMb)
} }
else -> { else -> {
val sizeInKb = sizeInBytes / 1_000.0 val sizeInKb = sizeInBytes / 1_000.0
String.Companion.format(Locale.getDefault(), "%.0f KB", sizeInKb) String.format(Locale.getDefault(), "%.0f KB", sizeInKb)
} }
} }
@ -81,8 +81,8 @@ fun formatFileByteSize(sizeInBytes: Long) = when {
*/ */
fun formatContextLength(contextLength: Int): String { fun formatContextLength(contextLength: Int): String {
return when { return when {
contextLength >= 1_000_000 -> String.Companion.format(Locale.getDefault(), "%.1fM", contextLength / 1_000_000.0) contextLength >= 1_000_000 -> String.format(Locale.getDefault(), "%.1fM", contextLength / 1_000_000.0)
contextLength >= 1_000 -> String.Companion.format(Locale.getDefault(), "%.0fK", contextLength / 1_000.0) contextLength >= 1_000 -> String.format(Locale.getDefault(), "%.0fK", contextLength / 1_000.0)
else -> contextLength.toString() else -> contextLength.toString()
} }
} }