Android Question "Like" Whatsapp Keyboard

Discussion in 'Android Questions' started by jotaele, Jun 17, 2015.

  1. jotaele

    jotaele Member Licensed User

    This is a PREVIEW ALFA version of a Whatsapp "Like" keyboard.


    Screenshot 1

    Screenshot 2

    Requiere this libraries:

    -msEmoji (by DonManfred):
    -FontAwesome (by NJDude):
    -IME (by Erel):

    You can DONATE them if you find this usefull.

    The question is that the load of the grid of icons is very slow, and I tried:

    -Reduce the size of the picteres
    -Use an ImageView instead EmojiViewText

    But its slow load. If anyone can contribute to speed the load, it might be a good keyboard.

    SOURCE CODE - Click Here (> 4Mb)

    And this is the part that load the images in a ScrollView

    Sub PrecargaScrollView (ScrollViewTmp As ScrollView, Lista As List)

    Dim now As Long
       now = 
    Log("TIEMPO INICIO 1: " & DateTime.Time(now))

    Dim NumeroIconosFila As Int
       NumeroIconosFila = (
    100%x) / 45dip
    Dim NumeroFilas As Int
       NumeroFilas = (Lista.Size / NumeroIconosFila)

    40dip * NumeroFilas)

    Dim i As Int = 0
    For x = 1 To NumeroFilas '+1 Falta retocar para que la última fila, si tiene 3 iconos p.ej., funcions.
    For y = 1 To NumeroIconosFila

           EmojiTextView1.Text = Lista.Get(i) & 
    " "

           BotonTransparente.Color = 

           BotonTransparente.Tag = Lista.Get(i)
           ScrollViewTmp.Color = 
    45dip*(y-1) + 5dip40dip * (x-1) + 5dip40dip40dip)
    45dip*(y-1) + 5dip40dip * (x-1) + 5dip40dip40dip)
           EmojiTextView1.Height = 
    40dip : EmojiTextView1.Width = 40dip
           BotonTransparente.Width = 
    40dip : BotonTransparente.Height = 40dip

    '       Imagen.Initialize("Imagen")
    '       Dim Cad As String = Lista.Get(i)
    '       ScrollViewTmp.Color = Colors.White
    '       Imagen.Bitmap = CreateScaledBitmap(LoadBitmap(File.DirAssets, "imagenes/" & Cad.SubString2(1, Cad.Length -1) & ".png"), 35, 35, True)
    '       ScrollViewTmp.Panel.AddView(Imagen, 45dip*(y-1) + 5dip, 40dip * (x-1) + 5dip, 40dip, 40dip)
    '       Imagen.Tag = Lista.Get(i)
           i = i + 


       now = 
    Log("TIEMPO FINAL 1: " & DateTime.Time(now))

    End Sub

    KZero, MarcoRome and DonManfred like this.
  2. thedesolatesoul

    thedesolatesoul Expert Licensed User

    What is the size of the list and how long does it take to load them?
    What device are you testing on?
  3. jotaele

    jotaele Member Licensed User

    I attached the source code in the post.

    The list is about 900 elements ( 5 lists of 200 elements, aprox)

    The total size of the images to load is about 4 Mb

    I am testing in a Galaxy S5 Mini. Its a good device. ;)

    The load time in this device is about 4 seconds. I know that are a lot of images, but when you open whatsapp, the load time is instantaneous.
  4. thedesolatesoul

    thedesolatesoul Expert Licensed User

    Your source is in a language unfortunately I cannot follow with both comments and variable names not meaning anything to me.
    I think you are loading too many images, 900 elements wont show at the same time. But again it should not be that slow.
    lemonisdead likes this.
  5. Peter Simpson

    Peter Simpson Expert Licensed User

    Hello @jotaele, on my N5 it takes about 1.7 seconds to load. You could always try the threading library.
    lemonisdead likes this.
  6. DonManfred

    DonManfred Expert Licensed User

    Whatsapp does load the icons in a recycle-grid-view. It does not load 900 images
    KZero and LucaMs like this.
  7. jotaele

    jotaele Member Licensed User

    TDS, I has only one comment in all the code and it's a bug. All is B4A. ;)
  8. jotaele

    jotaele Member Licensed User

    I think that this is not the way. Threading must process all the images and I think that no accelerate the execution.
  9. jotaele

    jotaele Member Licensed User


    I will use this TDS library of this thread with and XmlLayoutBuilder for not repeat the resources.

    MSDynamicGridView :


    Is the correct way?

    I am autoresponding.

    Yes, is the correct way. The keyboard loads very fast if I put the images in the MSDynamicGridView

    Thanks to @thedesolatesoul
    Last edited: Jun 20, 2015
  10. Prosg

    Prosg Active Member Licensed User

    i want to test but

    unknow member