You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hey guys! I just wanted to know if listing all the available material icons is possible, I wanted to do a desktop app for listing them just to practice with Compose but I guess there are no list with the icons, so I made my own implementation listing all the classes in the package but now I don't really know how to continue xD
My current implementation gives me the icon class name, for example androidx.compose.material.icons.rounded.SearchKt, but I can't cast this into the icon, any ideas to conitnue?
Icon List Implementation
funlistIcons(): List<String> {
val list = mutableListOf<String>()
val codeSource =Icons.Rounded.javaClass.protectionDomain.codeSource
val location = codeSource.location
val zip =ZipInputStream(location.openStream())
while(true){
val entry = zip.nextEntry ?:breakif(entry.name.endsWith("Kt.class") && entry.name.replace("/",".").contains("androidx.compose.material.icons.rounded")){
list.add(entry.name.replace("/",".").replace("Kt.class",""))
}
}
return list
}
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Hey guys! I just wanted to know if listing all the available material icons is possible, I wanted to do a desktop app for listing them just to practice with Compose but I guess there are no list with the icons, so I made my own implementation listing all the classes in the package but now I don't really know how to continue xD
My current implementation gives me the icon class name, for example
androidx.compose.material.icons.rounded.SearchKt
, but I can't cast this into the icon, any ideas to conitnue?Icon List Implementation
Beta Was this translation helpful? Give feedback.
All reactions