Comments (13)
I don't believe it is supported just yet. I agree it would be great for feature parity. :)
from android-iconify.
Cool! Will wait for it 👍
from android-iconify.
I don't think this can be done with the current implementation.
If someone got an idea how to implement such behavior please submit a pull-request.
from android-iconify.
So it seems it eventually got implemented (as per the README.md).
So I was wondering: Is it possible to make an IconDrawable spin (programatically)?
from android-iconify.
Spin only works in IconTextView
, IconButton
and IconToggleButton
for now.
I guess it wouldn't be very complicated to make a SpinningIconDrawable
, but I'm concerned about memory leaks: I'm not sure a Drawable
can know when it's not displayed anymore, so the refresh-loop wouldn't know when to stop. Could be based on the context, but that's not accurate. I'll see what I can do.
I'm opening a new issue for this.
from android-iconify.
That's great, man. And thanks for the response!
I don't really know the inner workings of rendering drawables, but maybe there's another approach that could work. If there's a way to force a drawable to be rendered continuously while it is within viewport bounds, maybe you could keep state on it's current rotation and on every draw step, increase it just a bit before rendering it. Then I'd try evolving from there (so that the rotation is smooth / not dependent on the "clock"/draw steps / happening at a stable pace).
from android-iconify.
That's actually how {fa-cog spin}
works inside an IconTextView
. It's continuously invalidated and redrawn, and stops when the IconTextView
is detached from the window.
But I don't think there's a way to know when a Drawable
is not anymore displayed on the screen, so there's no way no know when to stop continuously rendering it. If it's attached to an ImageView
then it depends on this ImageView
, but a Drawable
can be used (and reused) in many other ways.
What is your usecase? ImageView
?
from android-iconify.
I understand… thanks. Yeah, it's tricky if it depends heavily on where the
Drawable's used.
I'm using it alongside/attached to an EditText
, as its drawableEnd
drawable.
On Aug 20, 2015 12:46 PM, "Joan Zapata" [email protected] wrote:
That's actually how {fa-cog spin} works inside a IconTextView. It's
continuously invalidated and redrawn, and stops when the IconTextView is
detached from the window.But I don't think there's a way to know when a Drawable is not anymore
displayed on the screen, so there's no way no know when to stop
continuously rendering it. If it's attached to an ImageView then it
depends on this ImageView, but a Drawable can be used (and reused) in
many other ways.What is your usecase? ImageView?
—
Reply to this email directly or view it on GitHub
#56 (comment)
.
from android-iconify.
Can't you just use IconEditText
and put {fa-something spin}
at the end of the text?
from android-iconify.
Yeah, that's the other approach I considered taking but was too lazy to go ahead and build it myself last night, as I think I'd have to perform a major copy-and-pasting of the EditText
's source and have this new class extend IconTextView
, and I really hate copy-and-pasting. I couldn't think of a better approach for building it but maybe later I could sit down and start learning from IconTextView
and make a new class that simply extends EditText
and then does the same things that IconTextView
does.
(And I actually don't need a spinning IconDrawable - I'm just experimenting with this library to see how powerful it just for curiosity's sake right now, I plan on using it in future projects. Thanks for this, it's really convenient!)
EDIT: Oops, just noticed it's rather easy to implement IconEditText
by extending EditText
. Almost just a matter of overriding setText
.
@Override
public void setText(CharSequence text, BufferType type) {
super.setText(Iconify.compute(getContext(), text, this), type);
}
I'm sorry for being so lazy and actually not reading through IconTextView
's source until now. :(
I was thinking that maybe it could be a good PR in the future but... not really haha
from android-iconify.
Oh my bad, I just realized you were talking about an EditText
and not a TextView
!
There's actually a convenient lib based on Iconify which does just that!
https://github.com/DayS/EnhancedEditText/
from android-iconify.
That's cool, and thanks for referring me to that library! In the meanwhile I attempted building IconEditText
. That approach I mentioned above works great (spinning doesn't work maybe EditText doesn't allow the invalidation approach) unless you want to apply icons to hint
's as well (my case). Unfortunatelly setHint
is final and thus cannot be overriden.
I need that because I want to use EditText
in conjunction with TextInputLayout
. Apparently it's not supported by EnhancedEditText as well, at least from what I could tell by quickly skimming through the source. So that's potentially a cool PR I could try sending them, thanks! :)
from android-iconify.
@JoanZapata can I change spinning speed?
from android-iconify.
Related Issues (20)
- Expose TextPaint in IconDrawable
- Spinning drawables HOT 2
- Notification builder - setSmallIcon is it possible?
- Google Material Update? HOT 1
- Parser fails on } { sequence
- Font Awesome Not Update
- is it possible to do animate on these icon
- How to preview the effect in the development period?
- iconify about android8.0
- Couldn't working java 8. FontAwesomeIcons.values() unable to resolve static method
- Importing Iconify into Android to Use as a Dependency
- can not support com.android.support:appcompat-v7:27.1.1 HOT 2
- Cut off part of the icon - fa_taxi
- Crashed when redering incomplete bracket.
- Wrong with WeathericonsIcons.java:527
- can not support com.android.support:appcompat-v7:28.0.0 HOT 2
- Android app not available anymore
- The font awesome names aren't consistent with the standard name identifiers.
- Duplicate classes when importing this project into mine HOT 5
- Shemul
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 android-iconify.