joanzapata / android-iconify Goto Github PK
View Code? Open in Web Editor NEWAndroid integration of multiple icon providers such as FontAwesome, Entypo, Typicons,...
Home Page: http://joanzapata.com/android-iconify
License: Other
Android integration of multiple icon providers such as FontAwesome, Entypo, Typicons,...
Home Page: http://joanzapata.com/android-iconify
License: Other
Expand the {icon_**} pattern to encapsulate more info like
{icon_thumbs_up #99 0.8f} for a blue small icon
or
{icon_twitter #999999} for a gray normal sized icon
or
{icon_globe #990000 5.0f} for a red large icon
I have implemented this (check the forked repo) but still need to figure out how we can
Maybe you want to take a look at it? =D
Thanks for the nice project, really like your approach on embedding the icon in the text.
This is somewhat of a question/feature request as I'm not sure if this is already possible. But what I would like to achieve in the first instance would be to have something like:
Where the drawableLeft could be taken from font awesome, alternatively a programmatic way would suffice. I tried using:
loginId.setCompoundDrawablesWithIntrinsicBounds(new IconDrawable(getActivity(), Iconify.IconValue.fa_adjust),0,0,0);
but it expects a drawable resource id.
Cheers
I was wondering how do i use spinning icons.
I tried with {fa-spinner fa-spin}
and {fa-spinner} {fa-spin}
but none of them worked.
So, am I going wrong somewhere or iconify doesn't support spinning icons?
hy,
im trade to do this..
< Button
android:id="@+id/BtnAceptar"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@id/descripcion_app"
android:layout_alignParentRight="true"
android:text="{fa-android}"
/>
but this render "{fa-android}" like button text, instead the icon
can someone help me please?
Hi there!
I would like to extend your project to allow the addition/usage of more TTF files. How can I open the library project on eclipse, edit it and then generate a new .jar file?
The icon "fa-group" is an alias for "fa-users", as seen here:
http://fortawesome.github.io/Font-Awesome/icon/users/
I understand that android-iconify will not support aliases for now. (+1 for that feature request, though!)
The problem is, the current version of android-iconify supports "fa-group" (the alias) and does NOT support "fa-users" (the actual non-alias icon). This causes me to need to support that one icon as an exception to the rule.
Is the IconTextView able to handle italic and bold styles?
This is not an issue but rather a small silly doubt.
I want the text to appear below the icon and not on the left or right of the icon, how do i achieve this?
The README should highlight
I all the time got error "Multiple dex files define Landroid/widget/IconButton"
when i rebuild the project - everything works, but when i try to run second time, it fails.
I use gradle dependency:
compile 'com.joanzapata.android:android-iconify:1.0.6'
Any idea what can make this problem?
I am wondering if assigning a new Drawable resource on each OnCreateOptionsMenu() in activity would lead to a new instance of the same Drawable being created (and the previous one floating around somewhere and causing memory leak). Is it better to create a Drawable myDrawable = new IconDrawable() in the activity constructor and re-use it?
menu.findItem(R.id.action_notification).setIcon(
new IconDrawable(this, Iconify.IconValue.fa_bell)
.colorRes(R.color.em_active_green)
.actionBarSize());
This is more a question then any other thing.
Can't see the icons rendered on the Graphics Preview, keep getting the following error:
The following classes could not be found:
Is this the right thing? I'm doing something terrible wrong?
Eclipse ADT and Android Studio shows the same message error.
thanks
Is there any way to set the text from strings.xml
?
For example,
<IconTextView
android:text="{fa-android} @string/string_name"
... />
I've created a string resource file that can be included in your android project to make the icon values easy to reference reference. I know you can use the enum within the library, but I needed an easy way to be able to alias the icon names.
https://gist.github.com/keannan5390/9487918
Then you can use it like this:
TextView icon = (TextView)findViewById(R.id.icon_name);
icon.setText(R.string.icon_user);
Iconify.addIcons(icon);
or this:
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="12sp"
android:id="@+id/icon_name"
android:text="@string/icon_user"/>
One should be able to provide his own .ttf file and mapping to use it with the lib.
Currently the user has to call Iconify.addIcons()
after each setText().
While this is fine for standard TextView
, it should be implicit on IconTextView
and IconButton
.
Maybe I should add a listener on the provided TextView, but then I should provide a removeIcons()
just in case.
In the sample, all icons are listed into a single category. It makes hard to discover.
I see in http://fortawesome.github.io/Font-Awesome/icons/, all icons are classify into smaller categories. Could you do this?
Icons before 4.2 are working perfectly, but new icons in 4.2, such as fa-plug and fa-newspaper-o, don't show up.
Cut out some words when I use IconTextView, if I use TextView works perfectly
XML
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginEnd="5dp"
android:layout_marginRight="5dp"
android:orientation="horizontal"
android:padding="10sp" >
<android.widget.IconTextView
android:id="@+id/iconTextView1"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
</LinearLayout>
tested on Android 4.4.4 Moto G
What is the minimum Android SDK Version for this to work? Will work with ActionBarCompact?
This method could be useful in some case where developer want to set himself some configuration to Paint
class, like setAntiAlias
.
Of course you could provide a fluent API for each of Paint
methods, but... I'm not sure it's a good solution :)
There are few new icons in awesome fonts - it would be fine to release new version of library.
Is there any way to set the icon color different from text color and I would even like to know whether icon size can also be different from text size.
no IconValue.fa_edit
I've been working on an application that uses android-iconify recently and was using IconButton and IconTextView which worked a few days ago. I noticed a new commit was made 2 hours ago and I believe is the cause of the issue. It looks like the Font was moved but the name was not updated and causes the following exception.
10-21 18:06:49.410 1741-1741/net.codesector.Mileage E/AndroidRuntime﹕ FATAL EXCEPTION: main
Process: net.codesector.Mileage, PID: 1741
java.lang.RuntimeException: Unable to start activity ComponentInfo{net.codesector.Mileage/net.codesector.Mileage.LoginActivity}: android.view.InflateException: Binary XML file line #36: Error inflating class android.widget.IconTextView
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2195)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2245)
at android.app.ActivityThread.access$800(ActivityThread.java:135)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1196)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:136)
at android.app.ActivityThread.main(ActivityThread.java:5017)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:779)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:595)
at dalvik.system.NativeStart.main(Native Method)
Caused by: android.view.InflateException: Binary XML file line #36: Error inflating class android.widget.IconTextView
at android.view.LayoutInflater.createView(LayoutInflater.java:621)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:697)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:756)
at android.view.LayoutInflater.inflate(LayoutInflater.java:492)
at android.view.LayoutInflater.inflate(LayoutInflater.java:397)
at android.view.LayoutInflater.inflate(LayoutInflater.java:353)
at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:290)
at android.app.Activity.setContentView(Activity.java:1929)
at net.codesector.Mileage.LoginActivity.onCreate(LoginActivity.java:14)
at android.app.Activity.performCreate(Activity.java:5231)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1087)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2159)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2245)
at android.app.ActivityThread.access$800(ActivityThread.java:135)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1196)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:136)
at android.app.ActivityThread.main(ActivityThread.java:5017)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:779)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:595)
at dalvik.system.NativeStart.main(Native Method)
Caused by: java.lang.reflect.InvocationTargetException
at java.lang.reflect.Constructor.constructNative(Native Method)
at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
at android.view.LayoutInflater.createView(LayoutInflater.java:595)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:697)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:756)
at android.view.LayoutInflater.inflate(LayoutInflater.java:492)
at android.view.LayoutInflater.inflate(LayoutInflater.java:397)
at android.view.LayoutInflater.inflate(LayoutInflater.java:353)
at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:290)
at android.app.Activity.setContentView(Activity.java:1929)
at net.codesector.Mileage.LoginActivity.onCreate(LoginActivity.java:14)
at android.app.Activity.performCreate(Activity.java:5231)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1087)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2159)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2245)
at android.app.ActivityThread.access$800(ActivityThread.java:135)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1196)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:136)
at android.app.ActivityThread.main(ActivityThread.java:5017)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:779)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:595)
at dalvik.system.NativeStart.main(Native Method)
Caused by: java.lang.RuntimeException: native typeface cannot be made
at android.graphics.Typeface.(Typeface.java:175)
at android.graphics.Typeface.createFromFile(Typeface.java:159)
at com.joanzapata.android.iconify.Iconify.getTypeface(Iconify.java:80)
at com.joanzapata.android.iconify.Iconify.addIcons(Iconify.java:53)
at android.widget.IconTextView.init(IconTextView.java:46)
at android.widget.IconTextView.(IconTextView.java:36)
at java.lang.reflect.Constructor.constructNative(Native Method)
at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
at android.view.LayoutInflater.createView(LayoutInflater.java:595)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:697)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:756)
at android.view.LayoutInflater.inflate(LayoutInflater.java:492)
at android.view.LayoutInflater.inflate(LayoutInflater.java:397)
at android.view.LayoutInflater.inflate(LayoutInflater.java:353)
at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:290)
at android.app.Activity.setContentView(Activity.java:1929)
at net.codesector.Mileage.LoginActivity.onCreate(LoginActivity.java:14)
at android.app.Activity.performCreate(Activity.java:5231)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1087)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2159)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2245)
at android.app.ActivityThread.access$800(ActivityThread.java:135)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1196)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:136)
at android.app.ActivityThread.main(ActivityThread.java:5017)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:779)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:595)
at dalvik.system.NativeStart.main(Native Method)
fa-warning is missing...
I use the IconButton to display a button with text and an icon. Works well, but font-awesome tends to be a little smaller than the actual text. Therefore it would be nice to change the size of the icon only.
Something like
<android.widget.IconButton
android:text="{fa-icon} text"
android:textSize="22sp"
android:iconSize="30sp"
... />
I dont know why, but android Studio dont render the preview when I`m using IconTextView.
Hi Joan,
What should be the best practice when trying to use your icons in a ListView?
Avoid to make the compute
method directly visible in the API.
Is it in the roadmap?
Would be nice if we can add it just like fonts in the text attribute.
i.e. android:text={fa-spin fa-spinner};
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.