mirror of
https://github.com/commons-app/apps-android-commons.git
synced 2025-10-27 04:43:54 +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
|
val uriHandle = LocalUriHandler.current
|
||||||
|
|
||||||
Column(modifier = modifier) {
|
Column(modifier = modifier) {
|
||||||
|
|
||||||
Row(
|
Row(
|
||||||
modifier = Modifier.fillMaxWidth(),
|
modifier = Modifier.fillMaxWidth(),
|
||||||
verticalAlignment = Alignment.CenterVertically,
|
verticalAlignment = Alignment.CenterVertically,
|
||||||
horizontalArrangement = Arrangement.SpaceBetween
|
horizontalArrangement = Arrangement.SpaceBetween
|
||||||
) {
|
) {
|
||||||
|
|
||||||
Text(
|
Text(
|
||||||
text = stringResource(R.string.usages_on_commons_heading),
|
text = stringResource(R.string.usages_on_commons_heading),
|
||||||
textAlign = TextAlign.Center,
|
textAlign = TextAlign.Center,
|
||||||
style = MaterialTheme.typography.titleSmall
|
style = MaterialTheme.typography.titleSmall
|
||||||
)
|
)
|
||||||
|
IconButton(onClick = { isCommonsListExpanded = !isCommonsListExpanded }) {
|
||||||
IconButton(onClick = {
|
|
||||||
isCommonsListExpanded = !isCommonsListExpanded
|
|
||||||
}) {
|
|
||||||
Icon(
|
Icon(
|
||||||
imageVector = if (isCommonsListExpanded) Icons.Default.KeyboardArrowUp
|
imageVector = if (isCommonsListExpanded) Icons.Default.KeyboardArrowUp
|
||||||
else Icons.Default.KeyboardArrowDown,
|
else Icons.Default.KeyboardArrowDown,
|
||||||
|
|
@ -2157,11 +2152,8 @@ fun FileUsagesContainer(
|
||||||
MediaDetailViewModel.FileUsagesContainerState.Loading -> {
|
MediaDetailViewModel.FileUsagesContainerState.Loading -> {
|
||||||
LinearProgressIndicator()
|
LinearProgressIndicator()
|
||||||
}
|
}
|
||||||
|
|
||||||
is MediaDetailViewModel.FileUsagesContainerState.Success -> {
|
is MediaDetailViewModel.FileUsagesContainerState.Success -> {
|
||||||
|
|
||||||
val data = commonsContainerState.data
|
val data = commonsContainerState.data
|
||||||
|
|
||||||
if (data.isNullOrEmpty()) {
|
if (data.isNullOrEmpty()) {
|
||||||
ListItem(headlineContent = {
|
ListItem(headlineContent = {
|
||||||
Text(
|
Text(
|
||||||
|
|
@ -2181,7 +2173,7 @@ fun FileUsagesContainer(
|
||||||
headlineContent = {
|
headlineContent = {
|
||||||
Text(
|
Text(
|
||||||
modifier = Modifier.clickable {
|
modifier = Modifier.clickable {
|
||||||
uriHandle.openUri(usage.link!!)
|
usage.link?.let { uriHandle.openUri(it) }
|
||||||
},
|
},
|
||||||
text = usage.title,
|
text = usage.title,
|
||||||
style = MaterialTheme.typography.titleSmall.copy(
|
style = MaterialTheme.typography.titleSmall.copy(
|
||||||
|
|
@ -2189,11 +2181,11 @@ fun FileUsagesContainer(
|
||||||
textDecoration = TextDecoration.Underline
|
textDecoration = TextDecoration.Underline
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
})
|
}
|
||||||
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
is MediaDetailViewModel.FileUsagesContainerState.Error -> {
|
is MediaDetailViewModel.FileUsagesContainerState.Error -> {
|
||||||
ListItem(headlineContent = {
|
ListItem(headlineContent = {
|
||||||
Text(
|
Text(
|
||||||
|
|
@ -2203,12 +2195,10 @@ fun FileUsagesContainer(
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
MediaDetailViewModel.FileUsagesContainerState.Initial -> {}
|
MediaDetailViewModel.FileUsagesContainerState.Initial -> {}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Row(
|
Row(
|
||||||
modifier = Modifier.fillMaxWidth(),
|
modifier = Modifier.fillMaxWidth(),
|
||||||
verticalAlignment = Alignment.CenterVertically,
|
verticalAlignment = Alignment.CenterVertically,
|
||||||
|
|
@ -2219,10 +2209,7 @@ fun FileUsagesContainer(
|
||||||
textAlign = TextAlign.Center,
|
textAlign = TextAlign.Center,
|
||||||
style = MaterialTheme.typography.titleSmall
|
style = MaterialTheme.typography.titleSmall
|
||||||
)
|
)
|
||||||
|
IconButton(onClick = { isOtherWikisListExpanded = !isOtherWikisListExpanded }) {
|
||||||
IconButton(onClick = {
|
|
||||||
isOtherWikisListExpanded = !isOtherWikisListExpanded
|
|
||||||
}) {
|
|
||||||
Icon(
|
Icon(
|
||||||
imageVector = if (isOtherWikisListExpanded) Icons.Default.KeyboardArrowUp
|
imageVector = if (isOtherWikisListExpanded) Icons.Default.KeyboardArrowUp
|
||||||
else Icons.Default.KeyboardArrowDown,
|
else Icons.Default.KeyboardArrowDown,
|
||||||
|
|
@ -2236,11 +2223,8 @@ fun FileUsagesContainer(
|
||||||
MediaDetailViewModel.FileUsagesContainerState.Loading -> {
|
MediaDetailViewModel.FileUsagesContainerState.Loading -> {
|
||||||
LinearProgressIndicator()
|
LinearProgressIndicator()
|
||||||
}
|
}
|
||||||
|
|
||||||
is MediaDetailViewModel.FileUsagesContainerState.Success -> {
|
is MediaDetailViewModel.FileUsagesContainerState.Success -> {
|
||||||
|
|
||||||
val data = globalContainerState.data
|
val data = globalContainerState.data
|
||||||
|
|
||||||
if (data.isNullOrEmpty()) {
|
if (data.isNullOrEmpty()) {
|
||||||
ListItem(headlineContent = {
|
ListItem(headlineContent = {
|
||||||
Text(
|
Text(
|
||||||
|
|
@ -2259,16 +2243,20 @@ fun FileUsagesContainer(
|
||||||
},
|
},
|
||||||
headlineContent = {
|
headlineContent = {
|
||||||
Text(
|
Text(
|
||||||
|
modifier = Modifier.clickable {
|
||||||
|
usage.link?.let { uriHandle.openUri(it) }
|
||||||
|
},
|
||||||
text = usage.title,
|
text = usage.title,
|
||||||
style = MaterialTheme.typography.titleSmall.copy(
|
style = MaterialTheme.typography.titleSmall.copy(
|
||||||
|
color = Color(0xFF5A6AEC),
|
||||||
textDecoration = TextDecoration.Underline
|
textDecoration = TextDecoration.Underline
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
})
|
}
|
||||||
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
is MediaDetailViewModel.FileUsagesContainerState.Error -> {
|
is MediaDetailViewModel.FileUsagesContainerState.Error -> {
|
||||||
ListItem(headlineContent = {
|
ListItem(headlineContent = {
|
||||||
Text(
|
Text(
|
||||||
|
|
@ -2278,10 +2266,8 @@ fun FileUsagesContainer(
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
MediaDetailViewModel.FileUsagesContainerState.Initial -> {}
|
MediaDetailViewModel.FileUsagesContainerState.Initial -> {}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Loading…
Add table
Add a link
Reference in a new issue