B4A Library ScratchView V1.5

Discussion in 'Additional libraries, classes and official updates' started by DonManfred, May 14, 2016.

Similar threads

B4A Library IPCamView
B4A Library ChatMessageView
B4A Library PanoramaImageView
B4A Library SnakeView
B4A Library msEmoji V1.0.0
  1. DonManfred

    DonManfred Expert Licensed User

    This is a wrap for this github project.

    V1.5 needs B4A 6+ as the resources are now inside an aar.

    ScratchView
    Author:
    DonManfred (wrapper)
    Version: 1.5
    • ScratchImageView
      Events:
      • PercentRevealed (percent As Double)
      • onRevealed ( As )
      • onScratching (Scratched As Boolean)
      Fields:
      • ba As BA
      Methods:
      • 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)
      • clear
        clears the scratch area to reveal the hidden image.
      • isRevealed As Boolean
      • setEraserMode
      Properties:
      • Background As Drawable
      • Color As Int
      • Enabled As Boolean
      • ErasePaint As Paint [read only]
      • Height As Int
      • ImageBounds() As Int [read only]
      • ImageDrawable As Drawable [write only]
      • ImageResource As String [write only]
      • Left As Int
      • Parent As Object [read only]
      • StrokeWidth As Int [write only]
        Set the strokes width based on the parameter multiplier.
      • Tag As Object
      • Top As Int
      • Visible As Boolean
      • Width As Int
    • ScratchTextView
      Events:
      • PercentRevealed (percent As Double)
      • onRevealed ( As )
      • onScratching (Scratched As Boolean)
      Fields:
      • ba As BA
      Methods:
      • 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)
      • isRevealed As Boolean
      • reveal
        Reveals the hidden text by erasing the scratch area.
      Properties:
      • Background As Drawable
      • Color As Int
      • Enabled As Boolean
      • Height As Int
      • Left As Int
      • Parent As Object [read only]
      • StrokeWidth As Int [write only]
        Set the strokes width based on the parameter multiplier.
      • Tag As Object
      • Text As String
      • TextColor As Int [write only]
      • TextColor2 As ColorStateList
      • TextSize As Float
      • Top As Int
      • Visible As Boolean
      • Width As Int

    scratch_image_view_demo.gif scratch_text_view_demo.gif
     

    Attached Files:

    Last edited: Jun 26, 2016
  2. susu

    susu Well-Known Member Licensed User

    :) VERY NICE!!! THANK YOU!!! :)
     
  3. DonManfred

    DonManfred Expert Licensed User

    :D

    This wrap has more functionality as the wrapped lib was. The Original does only have a event when you reveal the hole object.... I thought it would be nice to have an additional event when you do your first scratch on one of the scratchitems.... The onScratching event was born :)
    My example shows this
     
    Kwame Twum and alimanam3386 like this.
  4. udg

    udg Expert Licensed User

    Very very nice, Manfred.
    Scratching effect was applied to one of my first apps..eventually it could be re-tooled with your lib!
     
    DonManfred likes this.
  5. MarcoRome

    MarcoRome Expert Licensed User

    Great work Don ( as usual ;) ) +40
    Look this 2 little demo:
    In this first movie as i "touch" but i dont see Text in ( 0$, 1$ or 5$ ) o_O


    if i write ScratchTextView1.Text i dont see this in code but i see in Design.
    P.S. You forget in your demo donmanfred.png
     
  6. DonManfred

    DonManfred Expert Licensed User

    i need to investigate... as for now i dont know why it does not show...
    i´ll update the sample soon
     
    Johan Schoeman and MarcoRome like this.
  7. DonManfred

    DonManfred Expert Licensed User

    See updated lib in Post #1. V1.0.1
    You need to set the CUSTOM VIEW properties....
    Text
    TextColor
    TextSize


    Included in new example too
     
    MarcoRome and Johan Schoeman like this.
  8. LucaMs

    LucaMs Expert Licensed User

    I should "test" it (to know the differences); anyway, I did something like this... probably 2 years ago and... not for me :p

    It was a "Gratta e Vinci" (Scratch and win)
    [​IMG]

    This is just to say: "Unfortunately at the time there was not this library" ;)
     
  9. DonManfred

    DonManfred Expert Licensed User

    Now it is. Time to make a nice Example app out of the lib.
     
    LucaMs likes this.
  10. MarcoRome

    MarcoRome Expert Licensed User

    Now all work. Thank you Great Don and nice day :)
     
    DonManfred and Johan Schoeman like this.
  11. MarcoRome

    MarcoRome Expert Licensed User

    Hi Don what change in Rel. 1.2 ?
     
  12. DonManfred

    DonManfred Expert Licensed User

  13. MarcoRome

    MarcoRome Expert Licensed User

    DonManfred likes this.
  14. DonManfred

    DonManfred Expert Licensed User

    i think you meant to say "Sorry Manfred i have missed this"
    But i think i understand what you wanted to say.

    PS: I missed your answer too :D
     
  15. DonManfred

    DonManfred Expert Licensed User

    I missed this feature and told about in b4achatroom...

    - I got a suggestion from @NJDude for a library which does have such a feature.
    - I tried to make a wrap for it till i saw it does not work. But i copied the code from it which does the calculation and i extended this lib with the code from the other lib. It works!

    V1.2 was born :D
     
    MarcoRome and lemonisdead like this.
  16. MarcoRome

    MarcoRome Expert Licensed User

    Great Don ;)
     
  17. Keith Flanagan

    Keith Flanagan New Member Licensed User

    Hi,

    I get the following error when using the example ScratchViewEx with ScratchViewV1.5 Library, i have copied the jar,xml and aar into my additional libraries folder.

    When compiling i get the following error:

    B4A version: 6.31
    Parsing code. (0.00s)
    Compiling code. (0.03s)
    Compiling layouts code. (0.00s)
    Organizing libraries. (0.00s)
    Generating R file. (0.04s)
    Compiling debugger engine code. (0.58s)
    Compiling generated Java code. Error
    Cannot find: C:\Program Files (x86)\Anywhere Software\Basic4android\libraries\android-support-v4.jar
     
  18. DonManfred

    DonManfred Expert Licensed User

    Add this line to your main activity

    Code:
    #AdditionalJar: com.android.support:support-v4
    Make sure to have the two maven repositories installed correctly and up-to-date
     
  19. DaniDPX

    DaniDPX Member Licensed User

    @DonManfred Am aware that this thread is old but am kindly wanted to ask that PercentRevealed fixed on v1.5? It is not working for me here..

    Regards;
     
  20. DonManfred

    DonManfred Expert Licensed User

    i cant answer this. I lost all my sources last year with a HDD Crash.
     
    DaniDPX and MarcoRome like 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