B4A Library msStickerView V1.0.0

These days a library is posted on Android Arsenal.
StickerView? I looked on the side marked with "how it work". Please note that i´m german and can not read this gravity.... lol
So... WHAT IS THIS? :D
As it is a small library i decided to wrap it. Just out of fun :)

This is the result

Do with it what you want and you can change the source as it is attached to this post too.

msStickerView
Version:
1
  • StickerView
    Events:
    • onDelete ( As )
    Fields:
    • ba As BA
    Methods:
    • AddToParent (Parent As ViewGroup, left As Int, top As Int, width As Int, height As Int)
    • BringToFront
    • DesignerCreateView (base As PanelWrapper, lw As LabelWrapper, props As Map)
    • Initialize (EventName As String)
    • Invalidate
    • Invalidate2 (arg0 As Rect)
    • Invalidate3 (arg0 As Int, arg1 As Int, arg2 As Int, arg3 As Int)
    • IsInitialized As Boolean
    • RemoveView
    • RequestFocus As Boolean
    • SendToBack
    • SetBackgroundImage (arg0 As Bitmap)
    • SetColorAnimated (arg0 As Int, arg1 As Int, arg2 As Int)
    • SetLayout (arg0 As Int, arg1 As Int, arg2 As Int, arg3 As Int)
    • SetLayoutAnimated (arg0 As Int, arg1 As Int, arg2 As Int, arg3 As Int, arg4 As Int)
    • SetVisibleAnimated (arg0 As Int, arg1 As Boolean)
    Properties:
    • Background As Drawable
    • Bitmap As Bitmap [read only]
    • Color As Int [write only]
    • Enabled As Boolean
    • Height As Int
    • Left As Int
    • MarkMatrix As Matrix [read only]
    • ShowDrawController As Boolean [write only]
    • Tag As Object
    • Top As Int
    • Visible As Boolean
    • WaterMark As Bitmap [write only]
    • Width As Int
 

Attachments

  • libmsStickerViewV1.0.0.zip
    9.1 KB · Views: 501
  • msStickerViewEx.zip
    18.8 KB · Views: 507
  • msStickerViewJAVA.zip
    30.5 KB · Views: 456
Last edited:

tuhatinhvn

Active Member
Licensed User
Longtime User
Can you make it can use with two finger to rotate, zoom in , zoom out??
Hope from you, thank you
 

susu

Well-Known Member
Licensed User
Longtime User
@DonManfred How to add another images? I tried to Dim new StickerView2 and add Image2 into it but I can't control StickerView1.
 

DonManfred

Expert
Licensed User
Longtime User
The java source is in post #1
Feel free to add and recompile
 

susu

Well-Known Member
Licensed User
Longtime User
The java source is in post #1
Feel free to add and recompile
Hi @DonManfred , I recompiled new lib base on your wrapper code and it worked. However, the onDelete event never rise because your it's empty code. Could you please guide me how to do it? Thank you so much.
 

DonManfred

Expert
Licensed User
Longtime User
Could you please guide me how to do it?
Replace the following in the wrapper

B4X:
        this.getObject().setOnStickerDeleteListener(new OnStickerDeleteListener(){

            @Override
            public void onDelete() {
                // TODO Auto-generated method stub
               
            }
           
        });

replace with

B4X:
this.getObject().setOnStickerDeleteListener(new OnStickerDeleteListener(){

            @Override
            public void onDelete() {
                // TODO Auto-generated method stub
                 if (ba.subExists(eventName + "_ondelete")) {
                  BA.Log("lib:Raising.. "+eventName + "_ondelete()");                               
                  //app.raiseEvent(app.context, eventName+"_pagerendered", i, pageCount, filename+"-" + i + ".png");
                  ba.raiseEventFromDifferentThread(this, null, 0, eventName + "_ondelete", true, new Object[] {});
              }else {
                  BA.Log("lib: NOTFOUND '"+eventName + "_ondelete");
              }
               
            }
           
        });
 

susu

Well-Known Member
Licensed User
Longtime User
Thank you @DonManfred but I can not compile library. The error below

B4X:
 error: local variable ba is accessed from within inner class; needs to be declared final
                 if (ba.subExists(eventName + "_ondelete")) {
                     ^
 

DonManfred

Expert
Licensed User
Longtime User
The error below
B4X:
    /*
     * Initialize the HTML-TextView
     */     
    public void Initialize(final BA ba, String EventName) {
        _initialize(ba, null, EventName);
    }
  
    @Hide
    public void _initialize(final BA ba, Object activityClass, String EventName) {
        this.eventName = EventName.toLowerCase(BA.cul);
        this.ba = ba;
        this.setObject(new StickerView(ba.context));
        this.getObject().setOnStickerDeleteListener(new OnStickerDeleteListener(){

            @Override
            public void onDelete() {
                // TODO Auto-generated method stub
              
            }
          
        });
        this.getObject().setOnStickerDeleteListener(new OnStickerDeleteListener(){

            @Override
            public void onDelete() {
                // TODO Auto-generated method stub
                 if (ba.subExists(eventName + "_ondelete")) {
                  BA.Log("lib:Raising.. "+eventName + "_ondelete()");                              
                  //app.raiseEvent(app.context, eventName+"_pagerendered", i, pageCount, filename+"-" + i + ".png");
                  ba.raiseEventFromDifferentThread(this, null, 0, eventName + "_ondelete", true, new Object[] {});
              }else {
                  BA.Log("lib: NOTFOUND '"+eventName + "_ondelete");
              }
              
            }
          
        });
      
     }

before
B4X:
Initialize(BA ba
after
B4X:
Initialize(final BA ba
 
Top