Hi all!
I'm figured out in a strange error. I have 4 bitmap drawable, 2 couples of 2 image (with different colors).
When i try to change the color at Runtime (switching between 2 images) i don't see nothing... this is the code, maybe anyone can help me.. thanks!
This is the log. True and false are notif.enabled field, the drawables are the 2 images.. i saw that these change, but i don't see nothing..
I'm figured out in a strange error. I have 4 bitmap drawable, 2 couples of 2 image (with different colors).
When i try to change the color at Runtime (switching between 2 images) i don't see nothing... this is the code, maybe anyone can help me.. thanks!
B4X:
Sub InitializeImage
Dim xml As XmlLayoutBuilder
Dim p As JavaObject
p.InitializeStatic("android.graphics.PorterDuff.Mode")
Dim bddowne As BitmapDrawable = xml.GetDrawable("wifidown")
Dim bddownd As BitmapDrawable = xml.GetDrawable("wifidown")
Dim bdupe As BitmapDrawable = xml.GetDrawable("wifiup")
Dim bdupd As BitmapDrawable = xml.GetDrawable("wifiup")
Dim jo As JavaObject = bddowne : jo.RunMethod("setColorFilter",Array(Utils.Azzurro,p.GetField("SRC_IN")))
Dim jo As JavaObject = bddownd : jo.RunMethod("setColorFilter",Array(Utils.greydisabled,p.GetField("SRC_IN")))
Dim jo As JavaObject = bdupe : jo.RunMethod("setColorFilter",Array(Utils.Azzurro,p.GetField("SRC_IN")))
Dim jo As JavaObject = bdupd : jo.RunMethod("setColorFilter",Array(Utils.greydisabled,p.GetField("SRC_IN")))
Dim mdown As Map = CreateMap(True:bddowne,False:bddownd)
Dim mup As Map = CreateMap(True:bdupe,False:bdupd)
mapBdWifi = CreateMap("utils5":mdown,"utils6":mup)
End sub
Sub click(....)
'Some stuff..
'Notif is a class. Every time i call this sub, i change notif.enabled..
If mapBdWifi.IsInitialized = False Then InitializeImage("wifi")
cs.Color(Utils.IIF(notif.enabled,Utils.Black,Utils.GreyDisabled)).Append(" • ").Color(Utils.Azzurro).Pop.Pop
cs.Append(notif.custom.Get("time"))
cs.Color(Utils.IIF(notif.enabled,Utils.Black,Utils.GreyDisabled)).Append(" • ").Color(Utils.Azzurro).Pop.Pop
cs.Append(Utils.GetWifiRete(notif.idrete).name)
Dim m As Map = mapBdWifi.Get(Utils.loc.GetLocalizeKey(notif.custom.Get("event")))
img.Background = m.Get(notif.enabled)
Log(img.Background)
Log(notif.enabled)
End sub
This is the log. True and false are notif.enabled field, the drawables are the 2 images.. i saw that these change, but i don't see nothing..
B4X:
android.graphics.drawable.BitmapDrawable@c727695
false
*** Service (sendnotification) Create ***
** Service (sendnotification) Start **
android.graphics.drawable.BitmapDrawable@54ccc54
true
** Service (sendnotification) Start **
android.graphics.drawable.BitmapDrawable@c727695
false
** Service (sendnotification) Start **
android.graphics.drawable.BitmapDrawable@54ccc54
true
** Service (sendnotification) Start **
android.graphics.drawable.BitmapDrawable@c727695
false
** Service (sendnotification) Start **
android.graphics.drawable.BitmapDrawable@54ccc54
true
** Service (sendnotification) Start **