From 8e2c042da865c873e6030d145925cea6286da991 Mon Sep 17 00:00:00 2001 From: himalia416 Date: Fri, 26 Sep 2025 16:40:45 +0200 Subject: [PATCH] Removed unused files --- .../RangingSessionCloseReason.kt | 28 ---- .../RangingSessionFailedReason.kt | 27 ---- .../view/channelSounding/RangingChartView.kt | 125 ------------------ 3 files changed, 180 deletions(-) delete mode 100644 profile/src/main/java/no/nordicsemi/android/toolbox/profile/repository/channelSounding/RangingSessionCloseReason.kt delete mode 100644 profile/src/main/java/no/nordicsemi/android/toolbox/profile/repository/channelSounding/RangingSessionFailedReason.kt delete mode 100644 profile/src/main/java/no/nordicsemi/android/toolbox/profile/view/channelSounding/RangingChartView.kt diff --git a/profile/src/main/java/no/nordicsemi/android/toolbox/profile/repository/channelSounding/RangingSessionCloseReason.kt b/profile/src/main/java/no/nordicsemi/android/toolbox/profile/repository/channelSounding/RangingSessionCloseReason.kt deleted file mode 100644 index aec2de18..00000000 --- a/profile/src/main/java/no/nordicsemi/android/toolbox/profile/repository/channelSounding/RangingSessionCloseReason.kt +++ /dev/null @@ -1,28 +0,0 @@ -package no.nordicsemi.android.toolbox.profile.repository.channelSounding - -enum class RangingSessionCloseReason(val reason: Int) { - REASON_UNKNOWN(0), - REASON_LOCAL_REQUEST(1), - REASON_REMOTE_REQUEST(2), - REASON_UNSUPPORTED(3), - REASON_SYSTEM_POLICY(4), - REASON_NO_PEERS_FOUND(5), ; - - override fun toString(): String { - return when (this) { - REASON_UNKNOWN -> "" - REASON_LOCAL_REQUEST -> "local request" // Indicates that the session was closed because AutoCloseable.close() or RangingSession.stop() was called. - REASON_REMOTE_REQUEST -> "request of a remote peer" // Indicates that the session was closed at the request of a remote peer. - REASON_UNSUPPORTED -> "provided session parameters were not supported" - REASON_SYSTEM_POLICY -> "local system policy forced the session to close" // Indicates that the local system policy forced the session to close, such as power management policy, airplane mode etc. - REASON_NO_PEERS_FOUND -> "none of the specified peers were found" // Indicates that the session was closed because none of the specified peers were found. - - } - } - - companion object { - fun getReason(reason: Int): String { - return entries.firstOrNull { it.reason == reason }.toString() - } - } -} \ No newline at end of file diff --git a/profile/src/main/java/no/nordicsemi/android/toolbox/profile/repository/channelSounding/RangingSessionFailedReason.kt b/profile/src/main/java/no/nordicsemi/android/toolbox/profile/repository/channelSounding/RangingSessionFailedReason.kt deleted file mode 100644 index d3bdf80e..00000000 --- a/profile/src/main/java/no/nordicsemi/android/toolbox/profile/repository/channelSounding/RangingSessionFailedReason.kt +++ /dev/null @@ -1,27 +0,0 @@ -package no.nordicsemi.android.toolbox.profile.repository.channelSounding - -enum class RangingSessionFailedReason(val reason: Int) { - UNKNOWN(0), - LOCAL_REQUEST(1), - REMOTE_REQUEST(2), - UNSUPPORTED(3), - SYSTEM_POLICY(4), - NO_PEERS_FOUND(5), ; - - override fun toString(): String { - return when (this) { - UNKNOWN -> "" - LOCAL_REQUEST -> "local request" // Indicates that the session was closed because AutoCloseable.close() or RangingSession.stop() was called. - REMOTE_REQUEST -> "request of a remote peer" // Indicates that the session was closed at the request of a remote peer. - UNSUPPORTED -> "provided session parameters were not supported" - SYSTEM_POLICY -> "local system policy forced the session to close" // Indicates that the local system policy forced the session to close, such as power management policy, airplane mode etc. - NO_PEERS_FOUND -> "none of the specified peers were found" // Indicates that the session was closed because none of the specified peers were found. - } - } - - companion object { - fun getReason(value: Int): String { - return entries.firstOrNull { it.reason == value }.toString() - } - } -} \ No newline at end of file diff --git a/profile/src/main/java/no/nordicsemi/android/toolbox/profile/view/channelSounding/RangingChartView.kt b/profile/src/main/java/no/nordicsemi/android/toolbox/profile/view/channelSounding/RangingChartView.kt deleted file mode 100644 index 0600c356..00000000 --- a/profile/src/main/java/no/nordicsemi/android/toolbox/profile/view/channelSounding/RangingChartView.kt +++ /dev/null @@ -1,125 +0,0 @@ -package no.nordicsemi.android.toolbox.profile.view.channelSounding - -import androidx.compose.foundation.Canvas -import androidx.compose.foundation.border -import androidx.compose.foundation.combinedClickable -import androidx.compose.foundation.interaction.MutableInteractionSource -import androidx.compose.foundation.layout.Arrangement -import androidx.compose.foundation.layout.BoxWithConstraints -import androidx.compose.foundation.layout.Column -import androidx.compose.foundation.layout.Row -import androidx.compose.foundation.layout.Spacer -import androidx.compose.foundation.layout.fillMaxWidth -import androidx.compose.foundation.layout.height -import androidx.compose.foundation.shape.RoundedCornerShape -import androidx.compose.material3.Text -import androidx.compose.runtime.Composable -import androidx.compose.runtime.mutableStateOf -import androidx.compose.runtime.remember -import androidx.compose.runtime.saveable.rememberSaveable -import androidx.compose.ui.Alignment -import androidx.compose.ui.Modifier -import androidx.compose.ui.geometry.CornerRadius -import androidx.compose.ui.geometry.Size -import androidx.compose.ui.tooling.preview.Preview -import androidx.compose.ui.unit.dp -import androidx.compose.ui.unit.sp -import no.nordicsemi.android.ui.view.createLinearTransition -import java.util.Locale - -@Composable -internal fun RangingChartView(measurement: Float) { - val duration = 1000 - val isInAccessibilityMode = rememberSaveable { mutableStateOf(false) } - val transition = createLinearTransition(isInAccessibilityMode.value, duration) - - val rangeMax = - if (measurement < 5) 5 - else if (measurement < 10) 10 - else if (measurement < 20) 20 - else if (measurement < 50) 50 - else if (measurement < 100) 100 - else if (measurement < 200) 200 - else if (measurement < 500) 500 - else 1000 - - - BoxWithConstraints( - modifier = Modifier.fillMaxWidth() - ) { - val chartWidth = maxWidth - val min = 0 - val max = rangeMax - val diff = max - min - val step = diff / 4f - - Column( - horizontalAlignment = Alignment.CenterHorizontally - ) { - // Chart itself - Canvas( - modifier = Modifier - .height(transition.height.value) - .fillMaxWidth() - .border( - transition.border.value, - transition.color.value, - RoundedCornerShape(transition.radius.value) - ) - .combinedClickable( - indication = null, - interactionSource = remember { MutableInteractionSource() }, - onClick = {}, - onLongClick = { isInAccessibilityMode.value = !isInAccessibilityMode.value } - ) - ) { - // background bar - drawRoundRect( - color = transition.inactiveColor.value, - size = Size(chartWidth.toPx(), transition.height.value.toPx()), - cornerRadius = CornerRadius( - transition.radius.value.toPx(), - transition.radius.value.toPx() - ) - ) - - // progress bar - val progressWidth = when { - measurement <= min -> 0f - measurement >= max -> 1f - else -> (measurement - min) / (max - min).toFloat() - } - drawRoundRect( - color = transition.color.value, - size = Size(progressWidth * size.width, transition.height.value.toPx()), - cornerRadius = CornerRadius( - transition.radius.value.toPx(), - transition.radius.value.toPx() - ) - ) - } - - Spacer(Modifier.height(4.dp)) - - // Labels row - Row( - modifier = Modifier.fillMaxWidth(), - horizontalArrangement = Arrangement.SpaceBetween - ) { - for (i in 0..4) { - val labelValue = min + i * step - Text( - text = String.format(Locale.US, "%d m", labelValue.toInt()), - fontSize = 12.sp - ) - } - } - } - } -} - -@Preview -@Composable -private fun RangingChartViewPreview() { - RangingChartView(25f) -} \ No newline at end of file