mirror of
https://github.com/amir1376/ab-download-manager.git
synced 2025-02-20 11:43:24 +08:00
add external link icon
This commit is contained in:
parent
2fa4faa483
commit
8aab43f062
@ -11,16 +11,26 @@ import com.abdownloadmanager.desktop.utils.AppInfo
|
||||
import com.abdownloadmanager.desktop.ui.WithContentAlpha
|
||||
import androidx.compose.foundation.Image
|
||||
import androidx.compose.foundation.clickable
|
||||
import androidx.compose.foundation.hoverable
|
||||
import androidx.compose.foundation.interaction.MutableInteractionSource
|
||||
import androidx.compose.foundation.interaction.collectIsHoveredAsState
|
||||
import androidx.compose.foundation.layout.*
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.runtime.getValue
|
||||
import androidx.compose.runtime.remember
|
||||
import androidx.compose.ui.Alignment
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.draw.alpha
|
||||
import androidx.compose.ui.input.pointer.PointerIcon
|
||||
import androidx.compose.ui.input.pointer.pointerHoverIcon
|
||||
import androidx.compose.ui.platform.LocalUriHandler
|
||||
import androidx.compose.ui.text.*
|
||||
import androidx.compose.ui.text.font.FontWeight
|
||||
import androidx.compose.ui.text.style.TextDecoration
|
||||
import androidx.compose.ui.text.style.TextOverflow
|
||||
import androidx.compose.ui.unit.dp
|
||||
import com.abdownloadmanager.desktop.ui.icon.MyIcon
|
||||
import com.abdownloadmanager.desktop.ui.util.ifThen
|
||||
|
||||
@Composable
|
||||
fun AboutPage(
|
||||
@ -109,15 +119,40 @@ fun LinkText(
|
||||
overflow: TextOverflow = TextOverflow.Clip,
|
||||
) {
|
||||
val handler = LocalUriHandler.current
|
||||
Text(
|
||||
text = text,
|
||||
style = LocalTextStyle.current.merge(LinkStyle),
|
||||
modifier = modifier.clickable {
|
||||
handler.openUri(link)
|
||||
},
|
||||
overflow = overflow,
|
||||
maxLines = maxLines,
|
||||
)
|
||||
val interactionSource = remember { MutableInteractionSource() }
|
||||
val isHovered by interactionSource.collectIsHoveredAsState()
|
||||
Row(
|
||||
modifier
|
||||
.pointerHoverIcon(PointerIcon.Hand)
|
||||
.hoverable(interactionSource)
|
||||
.clickable(
|
||||
interactionSource = interactionSource,
|
||||
indication = null
|
||||
) {
|
||||
handler.openUri(link)
|
||||
}
|
||||
) {
|
||||
Text(
|
||||
text = text,
|
||||
style = LocalTextStyle.current
|
||||
.merge(LinkStyle).ifThen(isHovered){
|
||||
copy(
|
||||
textDecoration = TextDecoration.Underline
|
||||
)
|
||||
}
|
||||
,
|
||||
overflow = overflow,
|
||||
maxLines = maxLines,
|
||||
)
|
||||
MyIcon(
|
||||
MyIcons.externalLink,
|
||||
null,
|
||||
Modifier.size(10.dp).alpha(
|
||||
if (isHovered) 0.75f
|
||||
else 0.5f
|
||||
)
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
@Composable
|
||||
|
@ -117,4 +117,5 @@ interface IMyIcons {
|
||||
val downloadEngine: IconSource
|
||||
val browserIntegration: IconSource
|
||||
val network: IconSource
|
||||
val externalLink: IconSource
|
||||
}
|
@ -75,4 +75,6 @@ object MyIcons : IMyIcons {
|
||||
override val appearance: IconSource get() = "icons/color.svg".asIconSource()
|
||||
override val downloadEngine: IconSource get() = "icons/down_speed.svg".asIconSource()
|
||||
override val network: IconSource get() = "icons/network.svg".asIconSource()
|
||||
|
||||
override val externalLink: IconSource get() = "icons/external_link.svg".asIconSource()
|
||||
}
|
||||
|
3
desktop/app/src/main/resources/icons/external_link.svg
Normal file
3
desktop/app/src/main/resources/icons/external_link.svg
Normal file
@ -0,0 +1,3 @@
|
||||
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<path d="M12 6H6C5.46957 6 4.96086 6.21071 4.58579 6.58579C4.21071 6.96086 4 7.46957 4 8V18C4 18.5304 4.21071 19.0391 4.58579 19.4142C4.96086 19.7893 5.46957 20 6 20H16C16.5304 20 17.0391 19.7893 17.4142 19.4142C17.7893 19.0391 18 18.5304 18 18V12M11 13L20 4M20 4H15M20 4V9" stroke="white" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
|
||||
</svg>
|
After Width: | Height: | Size: 463 B |
Loading…
x
Reference in New Issue
Block a user