Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ class NoiseControlWidgetConfigurationActivity: ComponentActivity() {
)
} ?: run {
Text(
text = "Service not available. Please ensure LibrePods is running and try again.",
text = stringResource(R.string.widget_service_not_available),
style = MaterialTheme.typography.bodyMedium,
color = MaterialTheme.colorScheme.onSurface
)
Expand Down Expand Up @@ -179,7 +179,7 @@ private fun WidgetDevicePickerContent(
Spacer(modifier = Modifier.size(topPadding))
if (devices.isEmpty()) {
Text(
text = "No devices found. Please ensure a compatible device is paired with your phone and try again.",
text = stringResource(R.string.widget_no_devices_found),
style = MaterialTheme.typography.bodyMedium,
color = MaterialTheme.colorScheme.onSurface
)
Expand All @@ -188,7 +188,7 @@ private fun WidgetDevicePickerContent(
onClick = onCancelClicked
) {
Text(
text = "Cancel",
text = stringResource(R.string.cancel),
style = MaterialTheme.typography.bodyMedium,
)
}
Expand Down Expand Up @@ -232,7 +232,7 @@ private fun WidgetDevicePickerContent(
enabled = pickedDevice != null
) {
Text(
text = "Done",
text = stringResource(R.string.done),
style = MaterialTheme.typography.bodyMedium,
)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ fun BatteryView(
) {
Image(
bitmap = ImageBitmap.imageResource(primaryImageRes),
contentDescription = "Headset",
contentDescription = stringResource(R.string.headset),
modifier = Modifier.fillMaxWidth()
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,13 @@ fun PressAndHoldSettings(
) {
val leftActionText = when (leftAction) {
StemAction.CYCLE_listening_mode_MODES -> stringResource(R.string.listening_mode)
StemAction.DIGITAL_ASSISTANT -> "Digital Assistant"
StemAction.DIGITAL_ASSISTANT -> stringResource(R.string.digital_assistant)
else -> "INVALID!!"
}

val rightActionText = when (rightAction) {
StemAction.CYCLE_listening_mode_MODES -> stringResource(R.string.listening_mode)
StemAction.DIGITAL_ASSISTANT -> "Digital Assistant"
StemAction.DIGITAL_ASSISTANT -> stringResource(R.string.digital_assistant)
else -> "INVALID!!"
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ import androidx.compose.ui.Modifier
import androidx.compose.ui.draw.clip
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.graphics.luminance
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.text.style.TextAlign
import androidx.compose.ui.unit.dp
import androidx.compose.ui.window.DialogProperties
Expand All @@ -57,6 +58,7 @@ import com.kyant.backdrop.drawBackdrop
import com.kyant.backdrop.effects.blur
import com.kyant.backdrop.effects.lens
import com.kyant.backdrop.effects.vibrancy
import me.kavishdevar.librepods.R
import me.kavishdevar.librepods.data.app.DesignSystem
import me.kavishdevar.librepods.presentation.design.LocalDesign

Expand All @@ -66,8 +68,8 @@ fun StyledConfirmationDialog(
showDialog: MutableState<Boolean>,
title: String,
message: String,
confirmText: String = "Enable",
dismissText: String = "Cancel",
confirmText: String = stringResource(R.string.enable),
dismissText: String = stringResource(R.string.cancel),
onConfirm: () -> Unit,
onDismiss: () -> Unit = { showDialog.value = false },
backdrop: LayerBackdrop,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,10 @@ import androidx.compose.ui.focus.focusRequester
import androidx.compose.ui.graphics.SolidColor
import androidx.compose.ui.input.pointer.pointerInput
import androidx.compose.ui.platform.LocalDensity
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.unit.dp
import androidx.compose.ui.unit.sp
import me.kavishdevar.librepods.R
import me.kavishdevar.librepods.data.app.DesignSystem
import me.kavishdevar.librepods.presentation.design.LocalDesign
import me.kavishdevar.librepods.presentation.icons.LocalIcons
Expand Down Expand Up @@ -148,7 +150,7 @@ fun StyledInputField(
) {
Icon(
imageVector = LocalIcons.current.CloseCircle,
contentDescription = "Clear text",
contentDescription = stringResource(R.string.clear_text),
tint = MaterialTheme.colorScheme.onBackground.copy(alpha = 0.6f),
modifier = Modifier.size(16.dp)
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ import androidx.compose.ui.platform.LocalDensity
import androidx.compose.ui.platform.LocalLayoutDirection
import androidx.compose.ui.platform.LocalView
import androidx.compose.ui.platform.LocalWindowInfo
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.text.style.TextAlign
import androidx.compose.ui.text.style.TextOverflow
import androidx.compose.ui.unit.Dp
Expand All @@ -86,6 +87,7 @@ import dev.chrisbanes.haze.HazeInput
import dev.chrisbanes.haze.blur.hazeBlur
import dev.chrisbanes.haze.hazeSource
import dev.chrisbanes.haze.rememberHazeState
import me.kavishdevar.librepods.R
import me.kavishdevar.librepods.data.app.ColorStyle
import me.kavishdevar.librepods.data.app.DesignSystem
import me.kavishdevar.librepods.presentation.design.LocalDesign
Expand Down Expand Up @@ -343,7 +345,7 @@ fun StyledScaffold(
) {
Icon(
imageVector = LocalIcons.current.ArrowBack,
contentDescription = "Back",
contentDescription = stringResource(R.string.back),
modifier = Modifier.size(16.dp),
tint = MaterialTheme.colorScheme.onBackground,
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ fun DeviceListScreen(
) {
Icon(
imageVector = Icons.Outlined.Settings,
contentDescription = "settings",
contentDescription = stringResource(R.string.settings),
modifier = Modifier.size(IconButtonDefaults.mediumIconSize),
)
}
Expand All @@ -121,7 +121,7 @@ fun DeviceListScreen(
) {
Icon(
imageVector = LocalIcons.current.Settings,
contentDescription = "Settings",
contentDescription = stringResource(R.string.settings),
tint = MaterialTheme.colorScheme.onBackground,
modifier = Modifier.size(IconButtonDefaults.mediumIconSize)
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ fun HeadTrackingScreen(
) {
Icon(
imageVector = if (state.headTrackingState == BuddyState.ACTIVE) MaterialIcons.Pause else Icons.Default.PlayArrow,
contentDescription = "Play/Pause",
contentDescription = stringResource(R.string.play_pause),
modifier = Modifier.size(IconButtonDefaults.mediumIconSize),
)
}
Expand All @@ -151,7 +151,7 @@ fun HeadTrackingScreen(
) {
Icon(
imageVector = if (state.headTrackingState == BuddyState.ACTIVE) LocalIcons.current.Pause else LocalIcons.current.Play,
contentDescription = "Play/Pause",
contentDescription = stringResource(R.string.play_pause),
modifier = Modifier.size(16.dp),
tint = MaterialTheme.colorScheme.onBackground
)
Expand Down Expand Up @@ -194,7 +194,7 @@ fun HeadTrackingScreen(
}

StyledToggle(
label = "Head Gestures",
label = stringResource(R.string.head_gestures),
checked = settings.headGesturesEnabled,
onCheckedChange = { viewModel.setHeadGesturesEnabled(it) },
enabled = uiState.isPremium || settings.headGesturesEnabled,
Expand All @@ -204,7 +204,7 @@ fun HeadTrackingScreen(

Spacer(modifier = Modifier.height(16.dp))
Text(
"Velocity",
stringResource(R.string.velocity),
style = MaterialTheme.typography.labelSmallEmphasized,
modifier = Modifier.padding(vertical = 8.dp)
)
Expand All @@ -224,11 +224,13 @@ fun HeadTrackingScreen(
}
}
val gestureTextValue = stringResource(R.string.shake_your_head_or_nod)
val yesDetectedText = stringResource(R.string.head_gesture_yes_detected)
val noDetectedText = stringResource(R.string.head_gesture_no_detected)
StyledButton(
onClick = {
gestureText = gestureTextValue
coroutineScope.launch {
viewModel.detectHeadGestures { gestureText = if (it) "\"Yes\" gesture detected." else "\"No\" gesture detected." }
viewModel.detectHeadGestures { gestureText = if (it) yesDetectedText else noDetectedText }
}
},
backdrop = backdrop,
Expand All @@ -238,7 +240,7 @@ fun HeadTrackingScreen(
materialButtonStyle = MaterialButtonStyle.Outlined
) {
Text(
"Test Head Gestures",
stringResource(R.string.test_head_gestures),
style = MaterialTheme.typography.labelMedium,
color = MaterialTheme.colorScheme.primary
)
Expand Down Expand Up @@ -340,6 +342,9 @@ private fun Plot() {
.padding(16.dp)
) {
val onBackground = MaterialTheme.colorScheme.onBackground
// the Canvas draw scope is not composable, so resolve the legend labels here

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
// the Canvas draw scope is not composable, so resolve the legend labels here

val horizontalLabel = stringResource(R.string.horizontal)
val verticalLabel = stringResource(R.string.vertical)
Canvas(
modifier = Modifier.fillMaxSize()
) {
Expand Down Expand Up @@ -422,7 +427,7 @@ private fun Plot() {
textSize = 12.sp.toPx()
textAlign = Paint.Align.LEFT
}
drawText("Horizontal", width - 140.dp.toPx(), textOffsetY, paint)
drawText(horizontalLabel, width - 140.dp.toPx(), textOffsetY, paint)
}

drawCircle(verticalColor, 5.dp.toPx(), Offset(width - 70.dp.toPx(), legendY))
Expand All @@ -432,7 +437,7 @@ private fun Plot() {
textSize = 12.sp.toPx()
textAlign = Paint.Align.LEFT
}
drawText("Vertical", width - 60.dp.toPx(), textOffsetY, paint)
drawText(verticalLabel, width - 60.dp.toPx(), textOffsetY, paint)
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -189,10 +189,10 @@ fun HearingAidScreen(

StyledConfirmationDialog(
showDialog = showDialog,
title = "Enable Hearing Aid",
message = "Enabling Hearing Aid will disable Headphone Accommodation and Customized Transparency Mode.",
confirmText = "Enable",
dismissText = "Cancel",
title = stringResource(R.string.enable_hearing_aid),
message = stringResource(R.string.enable_hearing_aid_description),
confirmText = stringResource(R.string.enable),
dismissText = stringResource(R.string.cancel),
onConfirm = {
showDialog.value = false
val enrolled = state.controlStates[ControlCommandIdentifier.HEARING_AID]?.getOrNull(0) == 0x01.toByte()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ fun HeartRateScreen(
) {
Icon(
imageVector = it,
contentDescription = "Start/Stop",
contentDescription = stringResource(R.string.start_stop),
modifier = Modifier.size(IconButtonDefaults.mediumIconSize),
)
}
Expand All @@ -139,7 +139,7 @@ fun HeartRateScreen(
) {
Icon(
imageVector = it,
contentDescription = "Start/Stop",
contentDescription = stringResource(R.string.start_stop),
modifier = Modifier.size(16.dp),
tint = MaterialTheme.colorScheme.onBackground
)
Expand Down Expand Up @@ -257,7 +257,7 @@ fun HeartRateScreen(
) {
Icon(
imageVector = LocalIcons.current.VitalSigns,
contentDescription = "vital signs",
contentDescription = stringResource(R.string.heart_rate),
modifier = Modifier.size(24.dp),
tint = MaterialTheme.colorScheme.onPrimaryContainer
)
Expand Down Expand Up @@ -287,7 +287,7 @@ fun HeartRateScreen(
) {
Icon(
imageVector = LocalIcons.current.VitalSigns,
contentDescription = "vital signs",
contentDescription = stringResource(R.string.heart_rate),
modifier = Modifier.size(24.dp),
tint = MaterialTheme.colorScheme.onSurface
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -254,8 +254,8 @@ fun RecordingScreen(
) {
Text(
text = if (state.recordingState.isRecording) {
"Stop Recording"
} else "Start Recording",
stringResource(R.string.stop_recording)
} else stringResource(R.string.start_recording),
style = MaterialTheme.typography.labelMedium
)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -303,8 +303,11 @@ fun TransparencySettingsScreen(
newEQ[i] = eqValue.floatValue
eq.value = newEQ
},
// weight, not fillMaxWidth(0.9f): the band label after the slider
// only got the leftover width and was clipped in wider scripts
Comment on lines +306 to +307

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
// weight, not fillMaxWidth(0.9f): the band label after the slider
// only got the leftover width and was clipped in wider scripts

modifier = Modifier
.fillMaxWidth(0.9f)
.weight(1f)
.padding(horizontal = 8.dp)
.height(36.dp),
colors = SliderDefaults.colors(
thumbColor = thumbColor,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ fun OnboardingScreen(
) {
Icon(
Icons.AutoMirrored.Default.ArrowForward,
contentDescription = "forward",
contentDescription = stringResource(R.string.next),
modifier = Modifier.size(IconButtonDefaults.largeIconSize),
)
}
Expand Down
Loading