Compare commits
2
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
17ac8d18a3 | ||
|
|
c80958f339 |
@@ -113,7 +113,7 @@ fun SelectIconPage(innerPadding: PaddingValues) {
|
|||||||
queryCleaned = queryCleaned.replace(from, to)
|
queryCleaned = queryCleaned.replace(from, to)
|
||||||
}
|
}
|
||||||
|
|
||||||
val searchResults = iconsData!!.filter { iconData ->
|
val searchResults = iconsData?.filter { iconData ->
|
||||||
if (queryCleaned.isEmpty()) {
|
if (queryCleaned.isEmpty()) {
|
||||||
return@filter true
|
return@filter true
|
||||||
}
|
}
|
||||||
@@ -131,7 +131,7 @@ fun SelectIconPage(innerPadding: PaddingValues) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
return@filter false
|
return@filter false
|
||||||
}
|
} ?: emptyList()
|
||||||
|
|
||||||
Page(context.getString(R.string.choosing_icon), innerPadding) {
|
Page(context.getString(R.string.choosing_icon), innerPadding) {
|
||||||
OutlinedTextField(
|
OutlinedTextField(
|
||||||
@@ -169,65 +169,61 @@ fun SelectIconPage(innerPadding: PaddingValues) {
|
|||||||
Text(stringResource(R.string.icons_not_found))
|
Text(stringResource(R.string.icons_not_found))
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
for (chunk in searchResults.chunked(2)) {
|
for (iconData in searchResults) {
|
||||||
|
val loadedIcon = loadedIcons[iconData.iconId]
|
||||||
|
|
||||||
item {
|
item {
|
||||||
Row(
|
AdaptiveButton(
|
||||||
horizontalArrangement = Arrangement.spacedBy(8.dp)
|
modifier = Modifier
|
||||||
) {
|
.fillMaxWidth()
|
||||||
for (iconData in chunk) {
|
.height(64.dp),
|
||||||
val loadedIcon = loadedIcons[iconData.iconId]
|
contentPadding = PaddingValues(0.dp),
|
||||||
|
onClick = {
|
||||||
|
if (loadedIcon == null && iconData.iconId != null) {
|
||||||
|
Toast.makeText(
|
||||||
|
context,
|
||||||
|
context.getString(R.string.wait_for_icon_load),
|
||||||
|
Toast.LENGTH_SHORT
|
||||||
|
).show()
|
||||||
|
} else {
|
||||||
|
val intent = Intent()
|
||||||
|
|
||||||
AdaptiveButton(
|
if (loadedIcon != null) {
|
||||||
modifier = Modifier.weight(1f).height(64.dp),
|
intent.putExtra(
|
||||||
contentPadding = PaddingValues(0.dp),
|
"icon",
|
||||||
onClick = {
|
imageBitmapToBase64(loadedIcon)
|
||||||
if (loadedIcon == null && iconData.iconId != null) {
|
|
||||||
Toast.makeText(
|
|
||||||
context,
|
|
||||||
context.getString(R.string.wait_for_icon_load),
|
|
||||||
Toast.LENGTH_SHORT
|
|
||||||
).show()
|
|
||||||
} else {
|
|
||||||
val intent = Intent()
|
|
||||||
|
|
||||||
if (loadedIcon != null) {
|
|
||||||
intent.putExtra(
|
|
||||||
"icon",
|
|
||||||
imageBitmapToBase64(loadedIcon)
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
activityContext!!.setResult(
|
|
||||||
Activity.RESULT_OK,
|
|
||||||
intent
|
|
||||||
)
|
|
||||||
activityContext.finish()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
) {
|
|
||||||
Row(
|
|
||||||
modifier = Modifier
|
|
||||||
.fillMaxSize()
|
|
||||||
.background(Color.Transparent)
|
|
||||||
.padding(horizontal = 8.dp),
|
|
||||||
verticalAlignment = Alignment.CenterVertically,
|
|
||||||
horizontalArrangement = Arrangement.spacedBy(8.dp)
|
|
||||||
) {
|
|
||||||
CardIcon(
|
|
||||||
loadedIcon,
|
|
||||||
MaterialTheme.colorScheme.primary,
|
|
||||||
loadedIcon == null && iconData.iconId != null
|
|
||||||
)
|
|
||||||
|
|
||||||
Text(
|
|
||||||
selectItemNameViaLanguage(
|
|
||||||
iconData.names,
|
|
||||||
language
|
|
||||||
)
|
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
activityContext!!.setResult(
|
||||||
|
Activity.RESULT_OK,
|
||||||
|
intent
|
||||||
|
)
|
||||||
|
activityContext.finish()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
) {
|
||||||
|
Row(
|
||||||
|
modifier = Modifier
|
||||||
|
.fillMaxSize()
|
||||||
|
.background(Color.Transparent)
|
||||||
|
.padding(horizontal = 8.dp),
|
||||||
|
verticalAlignment = Alignment.CenterVertically,
|
||||||
|
horizontalArrangement = Arrangement.spacedBy(8.dp)
|
||||||
|
) {
|
||||||
|
CardIcon(
|
||||||
|
loadedIcon,
|
||||||
|
MaterialTheme.colorScheme.primary,
|
||||||
|
loadedIcon == null && iconData.iconId != null
|
||||||
|
)
|
||||||
|
|
||||||
|
Text(
|
||||||
|
selectItemNameViaLanguage(
|
||||||
|
iconData.names,
|
||||||
|
language
|
||||||
|
)
|
||||||
|
)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user