Android Question "Like" Whatsapp Keyboard

jotaele

Member
Licensed User
Longtime User
This is a PREVIEW ALFA version of a Whatsapp "Like" keyboard.

Screenshots:

Screenshot 1

Screenshot 2

Requiere this libraries:

-msEmoji (by DonManfred): https://www.b4x.com/android/forum/threads/msemoji-v1-0-0.53787/#content
-FontAwesome (by NJDude): https://www.b4x.com/android/forum/threads/fontawesome.53990/
-IME (by Erel): https://www.b4x.com/android/forum/t...-keyboard-with-the-ime-library.14832/#content

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
-Reflection

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

B4X:
Sub PrecargaScrollView (ScrollViewTmp As ScrollView, Lista As List)

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

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

   ScrollViewTmp.Initialize(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.Initialize("EmojiTextView1")
       EmojiTextView1.Text = Lista.Get(i) & " "

       BotonTransparente.Initialize("BotonTransparente")
       BotonTransparente.Color = Colors.Transparent

       BotonTransparente.Tag = Lista.Get(i)
       ScrollViewTmp.Color = Colors.White
       ScrollViewTmp.Panel.AddView(BotonTransparente, 45dip*(y-1) + 5dip, 40dip * (x-1) + 5dip, 40dip, 40dip)
       ScrollViewTmp.Panel.AddView(EmojiTextView1, 45dip*(y-1) + 5dip, 40dip * (x-1) + 5dip, 40dip, 40dip)
      
       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 + 1
      
     Next

   Next

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

End Sub


Thanks
 

jotaele

Member
Licensed User
Longtime User
What is the size of the list and how long does it take to load them?
What device are you testing on?

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.
 
Upvote 0

DonManfred

Expert
Licensed User
Longtime User
Whatsapp does load the icons in a recycle-grid-view. It does not load 900 images
 
Upvote 0

jotaele

Member
Licensed User
Longtime 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.

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

jotaele

Member
Licensed User
Longtime User
Whatsapp does load the icons in a recycle-grid-view. It does not load 900 images

Interesting.

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

MSDynamicGridView : https://www.b4x.com/android/forum/threads/msdynamicgridview-library.49331/#content

XmlLayoutBuilder: https://www.b4x.com/android/forum/threads/xmllayoutbuilder-load-xml-layouts.33762/


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:
Upvote 0
Top