B4A Library msEmoji V1.0.0

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

  1. DonManfred

    DonManfred Expert Licensed User

    msEmoji
    Version:
    1
    • EmojiEditText
      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
      • Backgroundcolor As Int [write only]
      • Color As Int [write only]
      • Enabled As Boolean
      • Height As Int
      • Left As Int
      • Tag As Object
      • Text As String
      • Textcolor As Int [write only]
      • Top As Int
      • Visible As Boolean
      • Width As Int
    • EmojiParser
      Methods:
      • GetEmojiDrawable (DrawableName As String) As Drawable
        Get a Drawable from the Application Resources.
        Returns Null if the Drawable is not found.
      • Initialize (EventName As String)
      • ListEmoji As List
      • demojizedText (text As String) As String
        Return the text with emoticons changed to android code
      • emojiText (text As String) As String
        Parse the text and change emoticons characters to chearsheet characters
        param text
        Input text to be parsed
        returns the Text parsed
    • EmojiTextView
      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
      • Color As Int [write only]
      • Enabled As Boolean
      • Height As Int
      • Left As Int
      • Tag As Object
      • Text As String [write only]
      • Top As Int
      • Visible As Boolean
      • Width As Int
    This is a wrapper for this Github project.

    This Library comes basically with three Objects. All three of them are used in the Example.
    EmojiParser, EmojiTextView and EmojiEditText

    For the normal work you dont need the EmojiParser. It is only used in the example to get the list of all available Emojis

    The Mainobjects are the other two. The EmojiTextview and the EmojiEditText
    A Emoji always starts with a [ and ends with a ]. All chars between is the name of the Emoji.

    This library is Donationware. You can download the library, you can test the library. But if you want to USE the library in your App you need to Donate for it.
    Please click here to donate (You can donate any amount you want to donate for the library (or my work) :)
    [​IMG]

    [​IMG][​IMG]

    Due to the size of the needed resources (the example archive is 4mb in size) the Example can be downloaded from my Dropbox.

    You can find a overview of all supported Emojis here.

    Code:
    Activity.LoadLayout("Layout1")
        lv.Clear
      Emoji.Initialize(
    "")
        
    Dim emojilist As List = Emoji.ListEmoji
        
    For i = 0 To emojilist.Size-1
            
    Dim s As String = emojilist.Get(i)
            
    Dim d As BitmapDrawable = Emoji.GetEmojiDrawable(s)
            lv.AddTwoLinesAndBitmap2(s,
    "Type ["&s&"] to get this Image",d.Bitmap,"["&s&"]")
        
    Next
     
        lblEmoji.Text = 
    "[de] [uk] [us] [wine_glass] [p1] [see_no_evil] [yellow_heart]"
        edtEmoji.Backgroundcolor = 
    Colors.White
        edtEmoji.Text = 
    "[de][uk][us] Donate much [dollar] [grin] [heart_eyes]"
        edtEmoji.Textcolor = 
    Colors.Black
     

    Attached Files:

    Last edited: May 15, 2015
    toby, icefairy333, KZero and 11 others like this.
  2. lymey

    lymey Active Member Licensed User

    This is really good!

    However is it possible to add .SelectionStart like the standard EditText?

    At the moment it isnt possible to edit the text/insert an emoji other than at the end.
     
  3. DonManfred

    DonManfred Expert Licensed User

    Sadly: no... I´m just doing a VIEW-WRAPPER... The view does not expose such methods. Due to this there is nothing i could wrap.
    You can touch the edit to set the curso to a specific position and then press BACK or enter an new emoji. I can add an emoji this way manually to the first position (or any other) without problem. But you can not do this programatically.
     
  4. lymey

    lymey Active Member Licensed User

    When I try this (using your sample app), it just adds the emoji to the end of the text rather than at the position the cursor is. When I try inserting text, it inserts the text.

    I'm using a Moto G with KitKat.
     
  5. DonManfred

    DonManfred Expert Licensed User

  6. lymey

    lymey Active Member Licensed User

    Aaah...so you can't insert into text from a list - only by typing [emoji name?
    You can only add an emoji from a list to the 'end' of the text?

    Try this using your example - position the cursor anywhere (but the last position), select a an emoji from your list - the emoji is appended to the text, not inserted in the cursor position.
     
  7. DonManfred

    DonManfred Expert Licensed User

    Now i understand you.
    Look at the itemclick event. I put the clicked item always to the END...
    Code:
    Sub lv_ItemClick (Position As Int, Value As Object)
        edtEmoji.Text = edtEmoji.Text & Value
    End Sub
    you can use

    Code:
    Sub lv_ItemClick (Position As Int, Value As Object)
        edtEmoji.Text = Value & edtEmoji.Text
    End Sub
    to add it to the start
     
  8. DonManfred

    DonManfred Expert Licensed User

    You also can change the string
    Code:
    Log(Emoji.demojizedText(edtEmoji.Text))
    and add an emoji at any place and then put back the new text to the edit
     
  9. lymey

    lymey Active Member Licensed User

    Ok - I will give it a try!
    Thanks for your help.
     
  10. lymey

    lymey Active Member Licensed User

    Can you explain the difference between 'demojizedText' and 'emojiText'? They return the same values:

    Code:
    Log("dmojized: " & Emoji.demojizedText(edtEmoji.Text))
        
    Log("emojitext: " & Emoji.emojiText(edtEmoji.Text))
    I am trying to find a way for a user to position the cursor in the edit box and insert an emoji
     
  11. jotaele

    jotaele Member Licensed User

    Hi

    I tried to port this library but it was imposible for me. I was reading a lot of info in the forum, but my knowlegment is not enought.

    Take a look

    https://github.com/rockerhieu/emojicon

    This library contains a lot of functions that could be interesting like a keyboard like whatsapp.

    Its only a comment. :)
     
  12. DonManfred

    DonManfred Expert Licensed User

    It´s nothing more than a grid showing emojs..

    Take a panel, put a lot of emojlabels with each one emoj on it on this panel and make them clickable...

    Code:
    lblEmoji.Text = "[de]"
     
  13. jotaele

    jotaele Member Licensed User

    Ok. I will try to do an panel and extend your library.

    ----EDITED----

    Sorry, but I'm going to ask for advice on the type of GRID to use. I've seen libraries , classes, etc. , and if you can advise me I'd appreciate it.

    I think that this can be the best option, but I ask for your opinion:

    http://www.b4x.com/android/forum/threads/grid-table-and-listview-library.16381/

    Thanks

    ----END EDITION----

    I undestood you.

    I started to do the virtual grid, only with the coordinates, and with a transparent mask (button with transparent color) for the click event Its working well.

    In a future, I will post the code if anyone wants a keyboard with icons like whatsapp.

    I am resolving the same issue like @lymey with text position. Its very annoying loose the position when an icon is inserted in the emojiedittext.

    I think that is imposible to fix because the emojiedittext has no method to get or set the position.

    Thanks
     
    Last edited: Jun 9, 2015
  14. jotaele

    jotaele Member Licensed User

    Hi @DonManfred:

    I have a question about wrap a library.

    I was reading the github of the wrapped library and the EmojiEditText object extends EditText object.

    I have no idea than inheritance in the wrapped libraries, but the EditText object has methods to obtain the position. I think that the EmojiEditText can inherit them, isn't it?

    Thanks
     
  15. DonManfred

    DonManfred Expert Licensed User

    Probably. But the wrapped library does not inherit them and my java knowlegde is not enough to do this by myself.
     
  16. jotaele

    jotaele Member Licensed User

    Sorry, but I had to ask the question. ;)
     
  17. jotaele

    jotaele Member Licensed User

  18. DonManfred

    DonManfred Expert Licensed User

    sure. No problem
     
  19. jotaele

    jotaele Member Licensed User

    @thedesolatesoul answered the question.

    He saids that you must expose the methods of the TextEdit than are necessary.

    Can you do it or is a lot of work?

    If you can, I will release the "whatsapp keyboard" soon.

    Thanks
     
  20. DonManfred

    DonManfred Expert Licensed User

    See my answers in the thread you created.
     
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