Comments (10)
I really don't know much about what this app is doing, but if you need a bunch of icons to choose from maybe the material icon font? Only downside is that you have to create a list with all names. And I don't know if it even works in apps.
from home-assistant-android.
That would surely be a possibility, but I don't think that how the Web UI does it.. There must be a better way 😄
from home-assistant-android.
I assume you are targetting API 21+, so you can focus only on vector icons. If so, there are 2 ways to get these....
- Call API to get icon list as JSON: https://materialdesignicons.com/api/package/38EF63D0-4744-11E4-B3CF-842B2B6CFE1B
For each result in the array, you end up with the following data:
{
id:"4F013652-22DE-48CF-886B-A0FB995E8B41",
name:"access-point"
}
Iterate for each of those results, downloading each Andoid vector XML file (pass ID in URL) such as:
https://materialdesignicons.com/api/download/icon/vectordrawable/4F013652-22DE-48CF-886B-A0FB995E8B41
URL above results in a download called "access_point.xml" with the following content:
<!-- drawable/access_point.xml -->
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:height="24dp"
android:width="24dp"
android:viewportWidth="24"
android:viewportHeight="24">
<path android:fillColor="#000" android:pathData="M4.93,4.93C3.12,6.74 2,9.24 2,12C2,14.76 3.12,17.26 4.93,19.07L6.34,17.66C4.89,16.22 4,14.22 4,12C4,9.79 4.89,7.78 6.34,6.34L4.93,4.93M19.07,4.93L17.66,6.34C19.11,7.78 20,9.79 20,12C20,14.22 19.11,16.22 17.66,17.66L19.07,19.07C20.88,17.26 22,14.76 22,12C22,9.24 20.88,6.74 19.07,4.93M7.76,7.76C6.67,8.85 6,10.35 6,12C6,13.65 6.67,15.15 7.76,16.24L9.17,14.83C8.45,14.11 8,13.11 8,12C8,10.89 8.45,9.89 9.17,9.17L7.76,7.76M16.24,7.76L14.83,9.17C15.55,9.89 16,10.89 16,12C16,13.11 15.55,14.11 14.83,14.83L16.24,16.24C17.33,15.15 18,13.65 18,12C18,10.35 17.33,8.85 16.24,7.76M12,10A2,2 0 0,0 10,12A2,2 0 0,0 12,14A2,2 0 0,0 14,12A2,2 0 0,0 12,10Z" />
</vector>
Put these assets into the project (or another library we can reference).
OR
- Material icons are also in Google's project here: https://github.com/google/material-design-icons
Pull this project down, and then copy the vector files from all the categoried subfolders:
*/drawable-anydpi-v21/ic_{{name}}_black_24dp.xml
Scott
from home-assistant-android.
Oh, really nice 👌👌
Where did you find the API endpoint?
I am going to take a look at it, not sure I want to add all icons to project, maybe I just can download and reference them on demand.
from home-assistant-android.
True. If you can download the vector XML on-demand for icons in use and then save them to application cache, that would be ideal.
from home-assistant-android.
I'll take a look at that ;)
from home-assistant-android.
Ok, I found out that Android can only load drawables from a compiled resource file. That either means we cannot load the vectors dynamically OR we would have to compile them with aapt on the device on-the-fly and load them via an XMLResourceParser from storage, which would be a huge overkill, but exceptionally cool 😎
from home-assistant-android.
Well, my idea doesn't work. But we can still download png images from the server, and that's what I will do.
from home-assistant-android.
What idea did you try?
You mean download the PNG icons from the materialdesignicons.com on demand?
from home-assistant-android.
I tried to download vector images, compile them with aapt on the device and display them. Didn't work, as Android's parser system isn't built for this. And now I'll just download and display PNG files, which will definitely work.
from home-assistant-android.
Related Issues (20)
- Support Android < 5.0 (API-21) HOT 4
- Use data binding HOT 1
- Add quicksettings tile HOT 6
- Conversion Error HOT 5
- Support HTTP basic auth HOT 2
- Gradle wrapper is missing HOT 3
- App is showing a white screen with no way to get front end back HOT 14
- Provide pure-floss build flavor HOT 2
- Invalid password on current master branch HOT 15
- Usage of location and battery tracking HOT 5
- Translate button is not working HOT 7
- How about hostnames? HOT 1
- Toggle button for switches HOT 1
- Using self signed certificate only shows "Connection errror: Invalid IP, or is the server offline?" HOT 7
- Better indicate that this app is unofficial HOT 9
- Find a better name HOT 4
- Nested groups not supported? HOT 3
- Build new Version HOT 1
- Dark theme / Tasker integration / certificates
- Clarify the "Home Assistant URL/IP" login field HOT 10
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from home-assistant-android.