Sub Activity_Create(FirstTime As Boolean)
If FirstTime Then
hc.Initialize("hc")
End If
Activity.LoadLayout("foro")
server.Initialize(0, "")
IME.Initialize("IME")
IME.AddHeightChangedEvent
IME_HeightChanged(100%y, 0) 'manually call this method to set the layout of EditText1 and btnHideKeyboard
Dim pantalla As Float ' dependiendo del tamaño de pantalla cargo el tamaño de letra
pantalla = GetDeviceLayoutValues.ApproximateScreenSize
If pantalla <= 4 Then Tam_letra = 1
If pantalla > 4 And pantalla < 4.5 Then Tam_letra = 2
If pantalla >= 4.5 Then Tam_letra = 3
cargar_list
End Sub
Sub IME_HeightChanged(NewHeight As Int, OldHeight As Int) ' cuando el teclado se muestra entra a este evento
PnlHideKeyboard.Top = NewHeight - PnlHideKeyboard.Height 'PnlHideKeyboard es el panel donde esta la caja de texto y botón enviar conversación
ScrollView2.Height = PnlHideKeyboard.Top - ScrollView2.Top
End Sub
Sub hc_ResponseSuccess (Response As HttpResponse, tarea As Int)
Dim res As String
res = Response.GetString("UTF8")
Log("Resp: " & res)
Dim parser As JSONParser
parser.Initialize(res)
Dim l As List
l.Initialize
l = parser.NextArray
Select tarea
Case 1
If l.Size = 0 Then
Log("no se encuentran datos!")
ToastMessageShow("No hay temas en discucion en el momento",False)
p1.Visible = False
btnnuevof.Visible = True
Pvista.Visible = True
'pnuevotema.Visible = False
'Presp.Visible = False
TopBocadillo = 0
ProgressDialogHide
Else
For i = 0 To l.Size - 1
Dim m As Map
m = l.Get(i)
'TRAIGO EL FORO CONSULTADO
id= m.Get("id")
cod= m.Get("cod")
asunto= m.Get("asunto")
usuario= m.Get("usuario")
descripcion= m.Get("descripcion")
fecha= m.Get("fecha")
v(id,0) = cod
v(id,1) = usuario
v(id,2) = descripcion
v(id,3) = fecha
v(id,4) = asunto
Dim total, total1 As String
Dim Txt_Bocadillo, Txt_titulo, txt_fecha As Label ' lo de bocadillo es por el globo de los tebeos cuando alguien habla :D
Txt_Bocadillo.Initialize("lblmensaje")
Txt_titulo.Initialize("")
txt_fecha.Initialize("")
'Txt_Bocadillo.TextSize = 12 ' el valor que quieras
Txt_Bocadillo.TextColor = Colors.Black
Txt_Bocadillo.Color = Colors.White
Txt_Bocadillo.Gravity = Bit.Or(Gravity.LEFT,Gravity.TOP)
Txt_Bocadillo.Typeface = Typeface.DEFAULT
Txt_titulo.TextColor = Colors.DarkGray
Txt_titulo.Color = Colors.White
Txt_titulo.Gravity = Bit.Or(Gravity.CENTER_VERTICAL,Gravity.BOTTOM)
Txt_titulo.Typeface = Typeface.DEFAULT
txt_fecha.TextColor = Colors.DarkGray
txt_fecha.Color = Colors.White
txt_fecha.Gravity = Bit.Or(Gravity.TOP,Gravity.RIGHT)
txt_fecha.Typeface = Typeface.DEFAULT
txt_fecha.TextSize = 12
Txt_titulo.TextSize = 12
total1 = usuario
total = asunto & CRLF
txt_fecha.Text = fecha
Txt_titulo.Text = total1
Txt_Bocadillo.Text = total
Txt_Bocadillo.Tag = id
Select Tam_letra
Case 1
Txt_Bocadillo.TextSize = 10
'PANTALLAS TAMAÑO MEDIANO MAYOR 4.0 dip
ScrollView1.Panel.AddView(Txt_titulo,1,TopBocadillo,100%x,10)
ScrollView1.Panel.AddView(txt_fecha,200,TopBocadillo,70%x,50)
TopBocadillo = TopBocadillo + 50
ScrollView1.Panel.AddView(Txt_Bocadillo,1,TopBocadillo,100%x,10)
Dim ht,ht1 As Float
Dim StrUtil As StringUtils
ht = StrUtil.MeasureMultilineTextHeight(Txt_Bocadillo,total)
ht1 = StrUtil.MeasureMultilineTextHeight(Txt_titulo,total1)
Txt_Bocadillo.Height = ht + 5dip '
Txt_titulo.Height = ht1
TopBocadillo = TopBocadillo + ht + 6dip
ScrollView1.Panel.Height = TopBocadillo
Case 2
Txt_Bocadillo.TextSize = 13
'PANTALLAS TAMAÑO MEDIANO MAYOR 4.0 dip
ScrollView1.Panel.AddView(Txt_titulo,1,TopBocadillo,100%x,10)
ScrollView1.Panel.AddView(txt_fecha,200,TopBocadillo,70%x,50)
TopBocadillo = TopBocadillo + 50
ScrollView1.Panel.AddView(Txt_Bocadillo,1,TopBocadillo,100%x,10)
Dim ht,ht1 As Float
Dim StrUtil As StringUtils
ht = StrUtil.MeasureMultilineTextHeight(Txt_Bocadillo,total)
ht1 = StrUtil.MeasureMultilineTextHeight(Txt_titulo,total1)
Txt_Bocadillo.Height = ht + 5dip
Txt_titulo.Height = ht1
TopBocadillo = TopBocadillo + ht + 6dip
ScrollView1.Panel.Height = TopBocadillo
Case 3
Txt_Bocadillo.TextSize = 16
'ingreso el scrollview 16 dip
ScrollView1.Panel.AddView(Txt_titulo,1,TopBocadillo,100%x,10)
ScrollView1.Panel.AddView(txt_fecha,200,TopBocadillo,70%x,50)
TopBocadillo = TopBocadillo + 30
ScrollView1.Panel.AddView(Txt_Bocadillo,1,TopBocadillo,100%x,10)
Dim ht,ht1 As Float
Dim StrUtil As StringUtils
ht = StrUtil.MeasureMultilineTextHeight(Txt_Bocadillo,total)
ht1 = StrUtil.MeasureMultilineTextHeight(Txt_titulo,total1)
Txt_Bocadillo.Height = ht + 5dip
Txt_titulo.Height = ht1
TopBocadillo = TopBocadillo + ht + 6dip
ScrollView1.Panel.Height = TopBocadillo
End Select
Next
ProgressDialogHide
End If
End Select
Response.Release
End Sub
End Sub