Skip to content
Merged
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
10 changes: 9 additions & 1 deletion app/src/main/java/com/android/xrayfa/ui/component/NodeCard.kt
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import android.os.Build
import android.view.View
import androidx.annotation.RequiresApi
import androidx.compose.animation.core.LinearEasing
import androidx.compose.animation.core.animateDpAsState
import androidx.compose.animation.core.animateFloat
import androidx.compose.animation.core.infiniteRepeatable
import androidx.compose.animation.core.rememberInfiniteTransition
Expand Down Expand Up @@ -51,12 +52,14 @@ import androidx.compose.runtime.getValue
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember
import androidx.compose.runtime.setValue
import androidx.compose.ui.draw.drawBehind
import androidx.compose.ui.draw.rotate
import androidx.compose.ui.geometry.Offset
import androidx.compose.ui.graphics.RectangleShape
import androidx.compose.ui.layout.onGloballyPositioned
import androidx.compose.ui.layout.positionInWindow
import androidx.compose.ui.platform.LocalView
import androidx.compose.ui.unit.Dp
import androidx.compose.ui.unit.IntSize
import com.android.xrayfa.model.protocol.protocolPrefixMap
import com.android.xrayfa.utils.ColorMap
Expand Down Expand Up @@ -92,15 +95,20 @@ fun NodeCard(
else -> Color.Red
}
var itemCoordinates by remember { mutableStateOf<Pair<Offset, IntSize>?>(null) }
val elevation by animateDpAsState(
targetValue = if (selected) 8.dp else 0.dp,
label = "elevationAnimation"
)
Surface(
color = backgroundColor,
modifier = modifier.fillMaxWidth()
.onGloballyPositioned { layoutCoordinates ->
itemCoordinates = layoutCoordinates.positionInWindow() to layoutCoordinates.size
},
tonalElevation = elevation,
shape = if (roundCorner) roundCornerShape else RectangleShape,
onClick = {onChoose()},
border = if (selected) BorderStroke(width = 2.dp, color = Color(0xFF00BFFF)) else null
//border = if (selected) BorderStroke(width = 2.dp, color = Color(0xFF00BFFF)) else null
) {
Row(
modifier = Modifier.fillMaxWidth()
Expand Down
3 changes: 1 addition & 2 deletions app/src/main/java/com/android/xrayfa/utils/IdToColor.kt
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,4 @@ val ColorMap = mapOf(
7 to Color.Gray.copy(alpha = 0.3f),
8 to Color.Black.copy(alpha = 0.1f),
9 to Color.White.copy(alpha = 0.4f),
10 to Color.LightGray.copy(alpha = 0.3f)
).withDefault { key-> Color.Transparent }
).withDefault { key-> Color.LightGray.copy(alpha = 0.3f)}
6 changes: 3 additions & 3 deletions app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
<string name="stop_vpn">stop VPN</string>
<string name="connecting">connecting</string>
<string name="connected">connected</string>
<string name="home">home</string>
<string name="config">config</string>
<string name="logcat">logcat</string>
<string name="home">Home</string>
<string name="config">Config</string>
<string name="logcat">Logcat</string>
<string name="add_config">add config</string>
<string name="clipboard_import">Clipboard import</string>
<string name="no_configuration">No configuration file</string>
Expand Down
Loading