Hmm Spotlight

Peter Simpson

Expert
Licensed User
Longtime User
What I great idea, now.
Previously I thought yeah right, what for, blah blah blah?

But as of late I've been thinking what a great idea, I like it, I like it a lot as long as it's implemented correctly with useful options
 
Last edited:

ilan

Expert
Licensed User
Longtime User
video has been updated

very simple to call the menu

B4X:
Sub Globals
    Dim splight As SpotLight
    Dim icon As Bitmap
End Sub

Sub Activity_Create(FirstTime As Boolean)
    Activity.LoadLayout("1")
    icon.Initialize(File.DirAssets,"images.png")
 
    splight.Initialize(Me,"splight",12%y,Activity)
    splight.additem("I am item 1",Colors.Black,18,icon)
    splight.additem("and i am item 2",Colors.Black,18,icon)
    splight.additem("i have no icon",Colors.Black,18,Null)
End Sub

Sub splight_Clicked(index As Int)
    Log("selected item: " & index)
End Sub

i will need to make some improvements and upload this lib soon
 
Last edited:

Beja

Expert
Licensed User
Longtime User
Hi Ilan, thanks for this.. it's really cool.
How do you call a specific item (index in traditional menu) full example will help
 

ilan

Expert
Licensed User
Longtime User
Hi Ilan, thanks for this.. it's really cool.
How do you call a specific item (index in traditional menu) full example will help

when you click on an item you receive its index and then you can update that item like this:

B4X:
Sub splight_Clicked(index As Int)
    Log("selected itemindex: " & index)
   
    If index = 1 Then
        Dim p As Panel = splight.itemsList.Get(index)
        Dim lbl As Label = p.GetView(0) 'get the label in item 1
        Dim img As ImageView = p.GetView(1) 'get the image view that holds the icon (only if you added an icon!!!)
        lbl.Text = "New Item Text"
        img.Bitmap = splight.updatebmp(LoadBitmap(File.DirAssets,"plusbtn2.png"))   
    End If
End Sub

BEFORE: AFTER:



Note that you dont need to use a round bitmap, the library will round your bitmap automatically.
 

Beja

Expert
Licensed User
Longtime User
Gosh! how come I didn't see the index param before.. very strange.

Thanks Ilan.
 

ilan

Expert
Licensed User
Longtime User
Last edited:

Cableguy

Expert
Licensed User
Longtime User
B4A only? It would be cool to have it B4X!
 

Cableguy

Expert
Licensed User
Longtime User
Yes, but from your answer I guess it's a native control
 

ilan

Expert
Licensed User
Longtime User

sorry but i dont understand if you mean the popupmenu or the android 7 feature.
the popupmenu will be available also for b4i
the android 7 feature i guess its already available, i have no android 7 phone but it seems like google copied the iphone 3d touch menu
 

Cableguy

Expert
Licensed User
Longtime User
Now you got me lost... I thought the lib showcased only one feature... The pop-up menu... What's this android 7 feature you speak about?
(BTW, can you make the pop-up b4j compatible?)
 

ilan

Expert
Licensed User
Longtime User
(BTW, can you make the pop-up b4j compatible?)

should not be a problem. will look at it.

the android 7.1 feature is something like IOS 3d Touch menu where you press a hard click on the icons on your homescreen and you get a menu with some options.
google now has implemented that feature on android 7.1 and because i liked the popup menu i made this lib that allows you to use it inside your app (or on floating windows on your home screen)

the feature is explained here: http://www.androidpolice.com/2016/1...uts-are-supported-in-the-google-now-launcher/
 

Cableguy

Expert
Licensed User
Longtime User
Thanks for the explanation, very clear
 

Paulo Rosa

Member
Licensed User

Hi, just to say that Nova Launcher implements Android 7.1 app shorcuts on any phone with Android 5.1+: https://www.androidcentral.com/app-shortcuts-nova-launcher-little-taste-nougat. My phone has Android 7.0 and Nova Launcher, and app shorcuts feature is very nice.
 

Paulo Rosa

Member
Licensed User
I am a bit confused here. Does this library implements only the so called app shortcuts Android 7.1+ feature? I mean, is it also possible to use this library for implementing a popup menu on a widget's image?

Regards,
 
Cookies are required to use this site. You must accept them to continue using the site. Learn more…