Android Question concatenate an English string with Arabic string

M.LAZ

Active Member
Licensed User
Longtime User
Hi ,,
i have an issue with cs builder with listview
firstly i adjusted the listview for rtl and works fine
then i added cs builder for listview labels with material icons font

i want to appear the icon first then the arabic font

my code is

B4X:
Sub Process_Globals
    'These global variables will be declared once when the application starts.
    'These variables can be accessed from all modules.
    Dim myFont As Typeface
    myFont = Typeface.LoadFromAssets("DroidKufi-Regular.ttf")
  
End Sub

Sub Globals
    'These global variables will be redeclared each time the activity is created.
    'These variables can only be accessed from this module.

    Private ListView1 As ListView
  
End Sub

Sub Activity_Create(FirstTime As Boolean)
    'Do not forget to load the layout file created with the visual designer. For example:
    Activity.LoadLayout("Layout1")



    Dim homeStr,searchStr,favStr,adminStr,contactStr,signoutStr,notifStr As String
  
    homeStr= "الرئيسية" ' Chr(0x200F)  & "الرئيسية"  & Chr(0x200E)
    searchStr="بحث"
    favStr="المفضلة"
    notifStr="إشعارات"
    adminStr="الإدارة"
    contactStr="تواصل معنا"
    signoutStr="تسجيل خروج"


    ListView1.SingleLineLayout.Label.Gravity = Gravity.Right  'Right '  'CENTER
    ListView1.SingleLineLayout.Label.Left =-10dip' 0dip
    Dim Label1 As Label
    Label1 = ListView1.SingleLineLayout.Label
    Label1.TextSize = 14
    Label1.TextColor = Colors.White
  
    Dim cs As CSBuilder
    cs.Initialize

    ListView1.AddSingleLine2(cs.Alignment("ALIGN_NORMAL").Initialize.Typeface(Typeface.MATERIALICONS).VerticalAlign(10dip).RelativeSize(1.5).Color(Colors.LightGray).Size(25).Append(Chr(0xE88A)).Popall.Append(TAB).PopAll.Typeface(myFont).Size(11).VerticalAlign(5dip).RelativeSize(1.5).Bold.Append(homeStr ).Popall,1)
    ListView1.AddSingleLine2(cs.Alignment("ALIGN_NORMAL").Initialize.Typeface(Typeface.MATERIALICONS).VerticalAlign(10dip).RelativeSize(1.5).Color(Colors.LightGray).Size(25).Append(Chr(0xE8B6)).Popall.Append(TAB).PopAll.Typeface(myFont).Size(11).VerticalAlign(5dip).RelativeSize(1.5).Bold.Append(searchStr ).Popall,1)
    ListView1.AddSingleLine2(cs.Alignment("ALIGN_NORMAL").Initialize.Typeface(Typeface.MATERIALICONS).VerticalAlign(10dip).RelativeSize(1.5).Color(Colors.LightGray).Size(25).Append(Chr(0xE87D)).Popall.Append(TAB).PopAll.Typeface(myFont).Size(11).VerticalAlign(5dip).RelativeSize(1.5).Bold.Append(favStr ).Popall,1)
    ListView1.AddSingleLine2(cs.Alignment("ALIGN_NORMAL").Initialize.Typeface(Typeface.MATERIALICONS).VerticalAlign(10dip).RelativeSize(1.5).Color(Colors.LightGray).Size(25).Append(Chr(0xE0CF)).Popall.Append(TAB).PopAll.Typeface(myFont).Size(11).VerticalAlign(5dip).RelativeSize(1.5).Bold.Append(contactStr ).Popall,1)
    ListView1.AddSingleLine2(cs.Alignment("ALIGN_NORMAL").Initialize.Typeface(Typeface.MATERIALICONS).VerticalAlign(10dip).RelativeSize(1.5).Color(Colors.LightGray).Size(25).Append(Chr(0xE8AC)).Popall.Append(TAB).PopAll.Typeface(myFont).Size(11).VerticalAlign(5dip).RelativeSize(1.5).Bold.Append(signoutStr ).Popall,1)
    ListView1.AddSingleLine2(cs.Alignment("ALIGN_NORMAL").Initialize.Typeface(Typeface.MATERIALICONS).VerticalAlign(10dip).RelativeSize(1.5).Color(Colors.LightGray).Size(25).Append(Chr(0xE7F7)).Popall.Append(TAB).PopAll.Typeface(myFont).Size(11).VerticalAlign(5dip).RelativeSize(1.5).Bold.Append(notifStr ).Popall,1)
  
End Sub

Sub Activity_Resume

End Sub

Sub Activity_Pause (UserClosed As Boolean)

End Sub


Sub ListView1_ItemClick (Position As Int, Value As Object)
  
End Sub

Sub ListView1_ItemLongClick (Position As Int, Value As Object)
  
End Sub

i read some topics about LRM and RLM to concatenate strings without disorder strings ..
and use

B4X:
Chr(0x200F)
before arabic strings and
B4X:
Chr(0x200E)
before english letters..
how to solve this issue ?
 

Attachments

  • Screenshot_2017-12-19-13-54-59.png
    Screenshot_2017-12-19-13-54-59.png
    136.6 KB · Views: 361
  • ListView RTL with Label+MaterialIcons.zip
    49.2 KB · Views: 335

M.LAZ

Active Member
Licensed User
Longtime User
it's very nice now.. thank you so much ,, but there is no any animation when press the panel .. it's will be best if there is an animation when press listview item like the standard listview...
 

Attachments

  • Screenshot_2017-12-19-21-08-01.png
    Screenshot_2017-12-19-21-08-01.png
    68.1 KB · Views: 311
Upvote 0
Top