StickerView icon indicating copy to clipboard operation
StickerView copied to clipboard

Stop showing BitmapStickerIcon once clicked outside any sticker view

Open pawaom opened this issue 8 years ago • 8 comments

Stop showing BitmapStickerIcon once clicked outside any sticker view

when we select a sticker we see the BitmapStickerIcon for that sticker and if we select a different sticker it shows BitmapStickerIcon for that sticker (and it keeps on showing it), there is no fuctionality , if we click outside all or any sticker the BitmapStickerIcon should not be shown.

this is an example

https://raw.githubusercontent.com/nimengbo/StickerView/master/stickerGIF.gif

https://camo.githubusercontent.com/e29f051d1c2767eb631746f50acbf286b610a8a3/687474703a2f2f692e67697068792e636f6d2f336f37544b4a68425a69696d4165364a44472e676966

and also can we change font and fontcolor after a textsticker is set like in the gif

pawaom avatar Jun 30 '17 11:06 pawaom

Hey, you can write yourr custom hideControllIcons() method. just write in StickerView something like: public void hideControlIcons(boolean hide) { showIcons = hide; invalidate(); } When you need to hide controll (click on stickerView), just call this method (same to show) and dont forget to delete finalforshowIcons`. Hope it will help u. P.S. Sorry for bad English

ext452 avatar Jun 30 '17 18:06 ext452

@ext452 I have similar issue. I also tried your solution. But it doesn't working.

Thanks.

AnkurJagani avatar Jul 05 '17 12:07 AnkurJagani

@AnkurJagani Hi. Are u add this library as module? U need write ur custom StickerView class, or import library as module and change source code of StickerView. I have write my custom StickerView, and now I can change control icons in runtime, hide/show control icons in onClick listener of stickerView object, move my controll icons (when sticker is frame, controll icons need to be inside screen).

ext452 avatar Jul 05 '17 18:07 ext452

@ext452 Excellent. It solved my problem. It would be better if its more robust method for hide/show icons.

here it is:

for (int i = 0; i < stickers.size(); i++) { Sticker sticker = stickers.get(i); if (sticker != null) { sticker.draw(canvas); } }

in drawStickers Method.

Suppose i have 50 stickers in StickerView and doing hide/show, it will redraw all the stickers again. better if we can hide only lastSelected sticker.

Thanks.

AnkurJagani avatar Jul 07 '17 08:07 AnkurJagani

@AnkurJagani In any case you will redraw all stickers (move, resize, scale ... )

ext452 avatar Jul 07 '17 18:07 ext452

Hey! everyone. Just put/replace the code like below in function drawStickers () in Stickerview class, and this problem will be solved. for (int i = 0; i < stickers.size(); i++) { Sticker sticker = stickers.get(i); if (sticker != null) { setLocked(true); sticker.draw(canvas); setLocked(false); } }

Ziaxp avatar Jul 28 '17 07:07 Ziaxp

@Ziaxp Did you see source code of setLocked() ? This method call invalidate(), this mean u will redraw whole screen, and u want call setLocked() twice per one loop ?? For example, you have 5 stickers, then you will redraw every sticker 15 times. This so stupid

But if i want different icons for different stickers? Here, your solution no working ;) I`m already modify Sticker code for my demands (unique control icons for stickers, hide control icons when clicking on canvas, or if i click on sticker again ... ) And these problems are not solved by 2 lines of code

ext452 avatar Jul 28 '17 07:07 ext452

@ext452 Thanks dude! for mentioning this point, but what will be the effect, if the screen drawn multiple times? will it effect the performance and the the App become slow, or memory leakage ... whats?

And 2nd is, you told you have another solution for this purpose, so please share it with code here so that we adopt your solution. thanks.

Ziaxp avatar Aug 12 '18 07:08 Ziaxp