wuapnjie / StickerView

[No more support] A view which can add sticker and zoom,drag,delete it
MIT License
1.27k stars 311 forks source link

can we add animated sticker (gif) #76

Open pawaom opened 6 years ago

pawaom commented 6 years ago

can we add animated sticker (gif)

tried it but the sticker is not animated how can that be done

vishrut2207 commented 6 years ago

@pawaom have you got any solution for GIF Sticker?

xiandanin commented 5 years ago

I looked at the Drawable source code,found the solution.

try {
    Drawable drawable = new GifDrawable(getResources(), R.drawable.test);
    drawable.setCallback(new Drawable.Callback() {
        @Override
        public void invalidateDrawable( Drawable who) {
            stickerView.invalidate();
        }

        @Override
        public void scheduleDrawable(Drawable who,  Runnable what, long when) {
            stickerView.invalidate();
        }

        @Override
        public void unscheduleDrawable(Drawable who,  Runnable what) {
            stickerView.invalidate();
        }
    });
    stickerView.addSticker(new DrawableSticker(drawable));
} catch (IOException e) {
    e.printStackTrace();
}
Mouadabdelghafouraitali commented 5 years ago

@dengyuhan thank you so much, but how about saving StickerViewas GIF file?

xiandanin commented 5 years ago

@Mouadabdelghafouraitali StickerView cannot save gif. a dedicated encoder is required to save gif, for example gifencoder or android-ndk-gif.