-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
gif not animated #260
Comments
I also log the method invalidateDrawable,and find it does not execute when listview nofitydataInvalidate. I am trying to execute drawable.invalidateSelf() to make it animate,but failed. |
Does it animate after calling |
Hi koral, where should I place gifTextView.setLayerType(View.LAYER_TYPE_SOFTWARE, I placed above "return ssb",no work; some item animated,some item does not, they have the same emotion. thanks |
I attach the gif here,maybe it could do some help for excluding error. On Thu, Mar 17, 2016 at 10:35 AM, justin chen [email protected] wrote:
|
|
I tested in two devices,with the same result,one is samsung S5 with android 5.0 ,the other is samsung A5 with android 4.4.4. git does not accept rar attachment,so I mail you with gmail attachment,maybe you can find the attachment at gmail.If need further infomation,please let me know. |
Hi @koral-- |
Assuming that |
yeah,parseEmotion() is called on each item instantiation. And every textview cached by convertview cache. I will try unset callback to release memory.Do you have any idea about "it works most of the Gif emotion,but some still no animate,and sometimes the not animated gifs animate when I scroll the listView"? |
Without debugging I don't know yet what is the reason. I think we have to first determine if callback methods (those from gifDrawable.setCallback(
new Drawable.Callback() {
@Override
public void invalidateDrawable(Drawable drawable) {
gifTextView.invalidate();
//log item index to logcat, set breakpoint with log or something similar here
}
@Override
public void scheduleDrawable(Drawable who, Runnable what, long when) {
gifTextView.postDelayed(what, when);
}
@Override
public void unscheduleDrawable(Drawable who, Runnable what) {
gifTextView.removeCallbacks(what);
}
}
); After we know if callbacks are called we can decide what should be next steps. |
hi @koral--
|
How exactly are you using |
in listview adapter getView() method using the parseEmotion, here are the details:
I don't find any pattern which items not animateing, it seems like randomly happens,but can reproduce. all the gifs by android-gif-drawable are visible except some not animate. |
OK, I'll try to reproduce that. |
thank you. Look forward to your solution. On Tue, Mar 22, 2016 at 2:11 AM, Karol Wrótniak [email protected]
|
I've managed to reproduce that and will fix it ASAP. |
@ourgit it seems that in your case the problem is that callback is garbage collected, because TL;DR |
thank you. I will try your solution and see if it works. |
I am using android-gif-drawable for animate emotion. However it only shows still frame,the gif can not animate.I am sure the gif file is correct,it can animate when using Glide.
Here is the snippet:
public static SpannableStringBuilder parseEmotion(Context context, String content, final TextView gifTextView) {
SpannableStringBuilder ssb = new SpannableStringBuilder(content);
Pattern pattern = Pattern.compile(FACE_PATTERN, Pattern.CASE_INSENSITIVE);
Log.i(TAG, "before parse:" + content);
if (null == content || content.length() < 1) return null;
Matcher matcher = pattern.matcher(content);
if (matcher.groupCount() > 0) {
gifCallback = new Drawable.Callback() {
@OverRide
public void invalidateDrawable(Drawable drawable) {
gifTextView.invalidate();
}
hope guys help me out.thanks in advance
The text was updated successfully, but these errors were encountered: