android: fix transparency and noise cancellation flags

huh... was it always like this?
This commit is contained in:
Kavish Devar
2025-10-01 01:50:38 +05:30
parent d9469c2d62
commit 37313fbb1c

View File

@@ -110,8 +110,8 @@ fun LongPress(navController: NavController, name: String) {
if (modesByte != null) { if (modesByte != null) {
Log.d("PressAndHoldSettingsScreen", "Current modes state: ${modesByte.toString(2)}") Log.d("PressAndHoldSettingsScreen", "Current modes state: ${modesByte.toString(2)}")
Log.d("PressAndHoldSettingsScreen", "Off mode: ${(modesByte and 0x01) != 0.toByte()}") Log.d("PressAndHoldSettingsScreen", "Off mode: ${(modesByte and 0x01) != 0.toByte()}")
Log.d("PressAndHoldSettingsScreen", "Transparency mode: ${(modesByte and 0x02) != 0.toByte()}") Log.d("PressAndHoldSettingsScreen", "Transparency mode: ${(modesByte and 0x04) != 0.toByte()}")
Log.d("PressAndHoldSettingsScreen", "Noise Cancellation mode: ${(modesByte and 0x04) != 0.toByte()}") Log.d("PressAndHoldSettingsScreen", "Noise Cancellation mode: ${(modesByte and 0x02) != 0.toByte()}")
Log.d("PressAndHoldSettingsScreen", "Adaptive mode: ${(modesByte and 0x08) != 0.toByte()}") Log.d("PressAndHoldSettingsScreen", "Adaptive mode: ${(modesByte and 0x08) != 0.toByte()}")
} }
val context = LocalContext.current val context = LocalContext.current
@@ -222,9 +222,9 @@ fun LongPress(navController: NavController, name: String) {
name = stringResource(R.string.transparency), name = stringResource(R.string.transparency),
description = "Lets in external sounds", description = "Lets in external sounds",
iconRes = R.drawable.transparency, iconRes = R.drawable.transparency,
selected = (currentByte and 0x02) != 0, selected = (currentByte and 0x04) != 0,
onClick = { onClick = {
val bit = 0x02 val bit = 0x04
val newValue = if ((currentByte and bit) != 0) { val newValue = if ((currentByte and bit) != 0) {
val temp = currentByte and bit.inv() val temp = currentByte and bit.inv()
if (countEnabledModes(temp) >= 2) temp else currentByte if (countEnabledModes(temp) >= 2) temp else currentByte
@@ -268,9 +268,9 @@ fun LongPress(navController: NavController, name: String) {
name = stringResource(R.string.noise_cancellation), name = stringResource(R.string.noise_cancellation),
description = "Blocks out external sounds", description = "Blocks out external sounds",
iconRes = R.drawable.noise_cancellation, iconRes = R.drawable.noise_cancellation,
selected = (currentByte and 0x04) != 0, selected = (currentByte and 0x02) != 0,
onClick = { onClick = {
val bit = 0x04 val bit = 0x02
val newValue = if ((currentByte and bit) != 0) { val newValue = if ((currentByte and bit) != 0) {
val temp = currentByte and bit.inv() val temp = currentByte and bit.inv()
if (countEnabledModes(temp) >= 2) temp else currentByte if (countEnabledModes(temp) >= 2) temp else currentByte