@@ -2128,22 +2128,17 @@ fun FileUsagesContainer(
21282128 val uriHandle = LocalUriHandler .current
21292129
21302130 Column (modifier = modifier) {
2131-
21322131 Row (
21332132 modifier = Modifier .fillMaxWidth(),
21342133 verticalAlignment = Alignment .CenterVertically ,
21352134 horizontalArrangement = Arrangement .SpaceBetween
21362135 ) {
2137-
21382136 Text (
21392137 text = stringResource(R .string.usages_on_commons_heading),
21402138 textAlign = TextAlign .Center ,
21412139 style = MaterialTheme .typography.titleSmall
21422140 )
2143-
2144- IconButton (onClick = {
2145- isCommonsListExpanded = ! isCommonsListExpanded
2146- }) {
2141+ IconButton (onClick = { isCommonsListExpanded = ! isCommonsListExpanded }) {
21472142 Icon (
21482143 imageVector = if (isCommonsListExpanded) Icons .Default .KeyboardArrowUp
21492144 else Icons .Default .KeyboardArrowDown ,
@@ -2157,11 +2152,8 @@ fun FileUsagesContainer(
21572152 MediaDetailViewModel .FileUsagesContainerState .Loading -> {
21582153 LinearProgressIndicator ()
21592154 }
2160-
21612155 is MediaDetailViewModel .FileUsagesContainerState .Success -> {
2162-
21632156 val data = commonsContainerState.data
2164-
21652157 if (data.isNullOrEmpty()) {
21662158 ListItem (headlineContent = {
21672159 Text (
@@ -2181,19 +2173,19 @@ fun FileUsagesContainer(
21812173 headlineContent = {
21822174 Text (
21832175 modifier = Modifier .clickable {
2184- uriHandle.openUri(usage.link !! )
2176+ usage.link?. let { uriHandle.openUri(it) }
21852177 },
21862178 text = usage.title,
21872179 style = MaterialTheme .typography.titleSmall.copy(
21882180 color = Color (0xFF5A6AEC ),
21892181 textDecoration = TextDecoration .Underline
21902182 )
21912183 )
2192- })
2184+ }
2185+ )
21932186 }
21942187 }
21952188 }
2196-
21972189 is MediaDetailViewModel .FileUsagesContainerState .Error -> {
21982190 ListItem (headlineContent = {
21992191 Text (
@@ -2203,12 +2195,10 @@ fun FileUsagesContainer(
22032195 )
22042196 })
22052197 }
2206-
22072198 MediaDetailViewModel .FileUsagesContainerState .Initial -> {}
22082199 }
22092200 }
22102201
2211-
22122202 Row (
22132203 modifier = Modifier .fillMaxWidth(),
22142204 verticalAlignment = Alignment .CenterVertically ,
@@ -2219,10 +2209,7 @@ fun FileUsagesContainer(
22192209 textAlign = TextAlign .Center ,
22202210 style = MaterialTheme .typography.titleSmall
22212211 )
2222-
2223- IconButton (onClick = {
2224- isOtherWikisListExpanded = ! isOtherWikisListExpanded
2225- }) {
2212+ IconButton (onClick = { isOtherWikisListExpanded = ! isOtherWikisListExpanded }) {
22262213 Icon (
22272214 imageVector = if (isOtherWikisListExpanded) Icons .Default .KeyboardArrowUp
22282215 else Icons .Default .KeyboardArrowDown ,
@@ -2236,11 +2223,8 @@ fun FileUsagesContainer(
22362223 MediaDetailViewModel .FileUsagesContainerState .Loading -> {
22372224 LinearProgressIndicator ()
22382225 }
2239-
22402226 is MediaDetailViewModel .FileUsagesContainerState .Success -> {
2241-
22422227 val data = globalContainerState.data
2243-
22442228 if (data.isNullOrEmpty()) {
22452229 ListItem (headlineContent = {
22462230 Text (
@@ -2259,16 +2243,20 @@ fun FileUsagesContainer(
22592243 },
22602244 headlineContent = {
22612245 Text (
2246+ modifier = Modifier .clickable {
2247+ usage.link?.let { uriHandle.openUri(it) }
2248+ },
22622249 text = usage.title,
22632250 style = MaterialTheme .typography.titleSmall.copy(
2251+ color = Color (0xFF5A6AEC ),
22642252 textDecoration = TextDecoration .Underline
22652253 )
22662254 )
2267- })
2255+ }
2256+ )
22682257 }
22692258 }
22702259 }
2271-
22722260 is MediaDetailViewModel .FileUsagesContainerState .Error -> {
22732261 ListItem (headlineContent = {
22742262 Text (
@@ -2278,10 +2266,8 @@ fun FileUsagesContainer(
22782266 )
22792267 })
22802268 }
2281-
22822269 MediaDetailViewModel .FileUsagesContainerState .Initial -> {}
22832270 }
22842271 }
2285-
22862272 }
2287- }
2273+ }
0 commit comments