mirror of
https://github.com/commons-app/apps-android-commons.git
synced 2025-10-26 20:33:53 +01:00
Add clickable functionality to 'Usages on Other Wikis' in FileUsagesContainer for issue #6307
This commit is contained in:
parent
2da54b053b
commit
c278753334
1 changed files with 12 additions and 26 deletions
|
|
@ -2128,22 +2128,17 @@ fun FileUsagesContainer(
|
|||
val uriHandle = LocalUriHandler.current
|
||||
|
||||
Column(modifier = modifier) {
|
||||
|
||||
Row(
|
||||
modifier = Modifier.fillMaxWidth(),
|
||||
verticalAlignment = Alignment.CenterVertically,
|
||||
horizontalArrangement = Arrangement.SpaceBetween
|
||||
) {
|
||||
|
||||
Text(
|
||||
text = stringResource(R.string.usages_on_commons_heading),
|
||||
textAlign = TextAlign.Center,
|
||||
style = MaterialTheme.typography.titleSmall
|
||||
)
|
||||
|
||||
IconButton(onClick = {
|
||||
isCommonsListExpanded = !isCommonsListExpanded
|
||||
}) {
|
||||
IconButton(onClick = { isCommonsListExpanded = !isCommonsListExpanded }) {
|
||||
Icon(
|
||||
imageVector = if (isCommonsListExpanded) Icons.Default.KeyboardArrowUp
|
||||
else Icons.Default.KeyboardArrowDown,
|
||||
|
|
@ -2157,11 +2152,8 @@ fun FileUsagesContainer(
|
|||
MediaDetailViewModel.FileUsagesContainerState.Loading -> {
|
||||
LinearProgressIndicator()
|
||||
}
|
||||
|
||||
is MediaDetailViewModel.FileUsagesContainerState.Success -> {
|
||||
|
||||
val data = commonsContainerState.data
|
||||
|
||||
if (data.isNullOrEmpty()) {
|
||||
ListItem(headlineContent = {
|
||||
Text(
|
||||
|
|
@ -2181,7 +2173,7 @@ fun FileUsagesContainer(
|
|||
headlineContent = {
|
||||
Text(
|
||||
modifier = Modifier.clickable {
|
||||
uriHandle.openUri(usage.link!!)
|
||||
usage.link?.let { uriHandle.openUri(it) }
|
||||
},
|
||||
text = usage.title,
|
||||
style = MaterialTheme.typography.titleSmall.copy(
|
||||
|
|
@ -2189,11 +2181,11 @@ fun FileUsagesContainer(
|
|||
textDecoration = TextDecoration.Underline
|
||||
)
|
||||
)
|
||||
})
|
||||
}
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
is MediaDetailViewModel.FileUsagesContainerState.Error -> {
|
||||
ListItem(headlineContent = {
|
||||
Text(
|
||||
|
|
@ -2203,12 +2195,10 @@ fun FileUsagesContainer(
|
|||
)
|
||||
})
|
||||
}
|
||||
|
||||
MediaDetailViewModel.FileUsagesContainerState.Initial -> {}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Row(
|
||||
modifier = Modifier.fillMaxWidth(),
|
||||
verticalAlignment = Alignment.CenterVertically,
|
||||
|
|
@ -2219,10 +2209,7 @@ fun FileUsagesContainer(
|
|||
textAlign = TextAlign.Center,
|
||||
style = MaterialTheme.typography.titleSmall
|
||||
)
|
||||
|
||||
IconButton(onClick = {
|
||||
isOtherWikisListExpanded = !isOtherWikisListExpanded
|
||||
}) {
|
||||
IconButton(onClick = { isOtherWikisListExpanded = !isOtherWikisListExpanded }) {
|
||||
Icon(
|
||||
imageVector = if (isOtherWikisListExpanded) Icons.Default.KeyboardArrowUp
|
||||
else Icons.Default.KeyboardArrowDown,
|
||||
|
|
@ -2236,11 +2223,8 @@ fun FileUsagesContainer(
|
|||
MediaDetailViewModel.FileUsagesContainerState.Loading -> {
|
||||
LinearProgressIndicator()
|
||||
}
|
||||
|
||||
is MediaDetailViewModel.FileUsagesContainerState.Success -> {
|
||||
|
||||
val data = globalContainerState.data
|
||||
|
||||
if (data.isNullOrEmpty()) {
|
||||
ListItem(headlineContent = {
|
||||
Text(
|
||||
|
|
@ -2259,16 +2243,20 @@ fun FileUsagesContainer(
|
|||
},
|
||||
headlineContent = {
|
||||
Text(
|
||||
modifier = Modifier.clickable {
|
||||
usage.link?.let { uriHandle.openUri(it) }
|
||||
},
|
||||
text = usage.title,
|
||||
style = MaterialTheme.typography.titleSmall.copy(
|
||||
color = Color(0xFF5A6AEC),
|
||||
textDecoration = TextDecoration.Underline
|
||||
)
|
||||
)
|
||||
})
|
||||
}
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
is MediaDetailViewModel.FileUsagesContainerState.Error -> {
|
||||
ListItem(headlineContent = {
|
||||
Text(
|
||||
|
|
@ -2278,10 +2266,8 @@ fun FileUsagesContainer(
|
|||
)
|
||||
})
|
||||
}
|
||||
|
||||
MediaDetailViewModel.FileUsagesContainerState.Initial -> {}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue