B4A Library msStickerView V1.0.0

Discussion in 'Additional libraries, classes and official updates' started by DonManfred, May 17, 2015.

  1. DonManfred

    DonManfred Expert Licensed User

    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
     

    Attached Files:

    Last edited: May 17, 2015
  2. little3399

    little3399 Active Member Licensed User

    Great !
     
  3. BarryW

    BarryW Active Member Licensed User

    OnDelete Event is not working...
     
  4. tuhatinhvn

    tuhatinhvn Active Member Licensed User

    Can you make it can use with two finger to rotate, zoom in , zoom out??
    Hope from you, thank you
     
  5. susu

    susu Well-Known Member Licensed User

    @DonManfred How to add another images? I tried to Dim new StickerView2 and add Image2 into it but I can't control StickerView1.
     
  6. susu

    susu Well-Known Member Licensed User

  7. DonManfred

    DonManfred Expert Licensed User

    The java source is in post #1
    Feel free to add and recompile
     
    Johan Schoeman likes this.
  8. susu

    susu Well-Known Member Licensed User

    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.
     
  9. DonManfred

    DonManfred Expert Licensed User

    will check this...
     
    susu likes this.
  10. DonManfred

    DonManfred Expert Licensed User

    Replace the following in the wrapper

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

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

    Code:
    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, 
    null0, eventName + "_ondelete"true, new Object[] {});
                  }else {
                      BA.Log("lib: NOTFOUND '"+eventName + "_ondelete");
                  }
                   
                }
               
            });
     
    Peter Simpson and susu like this.
  11. susu

    susu Well-Known Member Licensed User

    Thank you @DonManfred but I can not compile library. The error below

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

    DonManfred Expert Licensed User

    Code:
    /*
         * 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
    Code:
    Initialize(BA ba
    after
    Code:
    Initialize(final BA ba
     
    susu likes this.
Loading...
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice