AHQuickAction library - Nice looking popup menus

corwin42

Expert
Licensed User
Longtime User
This library is deprecated. If you develop for Android 3.0 and above (API11) you should use PopupMenu object of the StdActionBarHelper library .
Development has stopped on this library.


This library provides three objects for some nice looking popup menus.

The AHQuickAction object is a popup window with horizontally aligned items. You can see this popup window in many apps like Tapatalk or Folder Organizer.

The AHQuickAction3D object is a popup that can be used horizontally and vertically. You can find a similar popup in many Google apps like 3D-Gallery and Text&Tables.

The AHPopupMenu is an ICS style menu.

This library is somewhat different to other libraries because it makes use of standard Android resource files. Resource files cannot be published inside a .jar file and so you have to copy them to your Basic4Android project directory.

Copy the whole "res" directory structure to the "Objects" directory of your B4A project and VERY IMPORTANT: make alle the files you have copied READ ONLY! Otherwise B4A will delete them when compiling. After you make any change to the Objecs/res directory use "Clean project" menu item in B4A to force the compiler to recreate the R.java file.

If you forget to make the resource files read only then you will most likely get a ResourceNotFound exception when you try to use the popup objects.

The objects are ported from open source projects and you can find them here:
NewQuickAction
NewQuickAction3D

Installation instructions:
- Copy the .xml and .jar files to your custom libraries folder
- Copy the res directory to your projects "Objects" folder
- Make all files copied to the Objects/res folder read only

Version history:
V1.00:
- initial version

V1.01:
- Fixed positioning/sizing problem with AHQuickAction3D
- Improved positioning/sizing with AHQuickAction (many thanks to barx)
- Added ICS Style Menu (many thanks to thedesolatesoul)
- Added ItemCount property to get number of items

V1.02:
- Fixed positioning of QuickAction popup (sometimes didn't show above anchor)

Have fun with it
 

Attachments

  • AHQuickAction1_01.zip
    74 KB · Views: 1,829
  • AHQuickActionExample1_01.zip
    68.8 KB · Views: 2,102
  • Screenshot_2012-10-25-12-54-50.jpg
    Screenshot_2012-10-25-12-54-50.jpg
    53.6 KB · Views: 3,581
  • Screenshot_2012-10-25-12-54-58.jpg
    Screenshot_2012-10-25-12-54-58.jpg
    57.6 KB · Views: 3,349
  • Screenshot_2012-10-25-12-55-03.jpg
    Screenshot_2012-10-25-12-55-03.jpg
    56.7 KB · Views: 3,066
  • AHQuickAction1_02.zip
    74.5 KB · Views: 2,187
Last edited:

moster67

Expert
Licensed User
Longtime User
Thank you Markus!

With your latest libraries you are continuously spoiling the B4A-community with really nice and important features.

I can't test in this moment but will surely do so later.
 

corwin42

Expert
Licensed User
Longtime User
I just have updated the .jar of the library in the first post because I forgot to remove some debug info. If you have downloaded the library, please download again. Otherwise no changes so I leave the version the same.
 

susu

Well-Known Member
Licensed User
Longtime User
Very nice ActionBar view! Thank you for your sharing :D
 

bluedude

Well-Known Member
Licensed User
Longtime User
Great!

Awesome, just what we needed. And now the action bar :) BTW, should be possible to use an action bar at top or bottom (see Android gMail).
 

Inman

Well-Known Member
Licensed User
Longtime User
Great work. Your libraries definitely enhance the stock Android UI.
 
D

Deleted member 103

Guest
Hallo corwin42,

erstmal vielen Dank für diese Library.

Bei der "AHQuickAction3D", in der Vertikale ausrichtung, finde ich den Abstand von Element zu Element einfach zu klein, gibt es da eine möglichkeit diese Abstand zu vergrössern?


first thank you for this library.

In the "AHQuickAction3D" by the vertical Alignment, I find the distance from element to element just too small, is there a possibility to enlarge this distance?


Ciao,
Filippo
 

corwin42

Expert
Licensed User
Longtime User
In the "AHQuickAction3D" by the vertical Alignment, I find the distance from element to element just too small, is there a possibility to enlarge this distance?

Yes, this is possible. Since all the layouts are defined in XML files you can make changes to them.

I currently don't have access to the sources but have a look in Objects/res/layout. There should be a file called something like "ahqa_item_vertical.xml". That is the layout for the vertically aligned items. I think you can add some top and buttom padding to the layout to make the items larger.

Be aware that you make the file read only again after you edit it.
 

hbruno

Member
Licensed User
Longtime User
ListView ?

Hi Markus,

First, this a very nice object. :sign0098:

In a program, i've attached a QuickAction with a ListView like this :
B4X:
Sub ListView1_ItemLongClick (Position As Int, Value As Object)
    QuickAction.show(ListView1)
End Sub
The QuickAction always show at the same place, whatever the selected item.
Is it possible to point the selected item ?

Thank's
 

corwin42

Expert
Licensed User
Longtime User
The QuickAction always show at the same place, whatever the selected item.
Is it possible to point the selected item ?

Unfortunately not.

It would be very easy if the ItemLongClick event would provide the view that causes the event but unfortunately it does not. Perhaps we can ask Erel to add this as a parameter to the ItemClick and ItemLongClick events. Should be a 5 minutes change for Erel.

I will add a request for this.
 

latcc

Banned
Very nice work!!

Presumably this new style MENU system is called from an on-screen button. Does anyone know how this button appears in apps, or do we just make this button look as we feel fit?
 

fpdianzen

Member
Licensed User
Longtime User
i can't make this work on my existing project, when i copy the res files into my object files, it gives an error that i need to somewhat declare the resources. how can i do that? :sign0104:
 

corwin42

Expert
Licensed User
Longtime User
The QuickAction always show at the same place, whatever the selected item.
Is it possible to point the selected item ?

Erel had a nice workaround for this. It's not perfect but works in most cases
 

Attachments

  • AHQuickActionListViewExample.zip
    61.7 KB · Views: 699

Erel

B4X founder
Staff member
Licensed User
Longtime User
A better solution using Reflection library:
B4X:
Sub ListView1_ItemClick (Position As Int, Value As Object)
   ac1.Show(GetViewAtPos(Sender, Position))
End Sub

Sub GetViewAtPos(LV As ListView, Position As Int) As View
   Dim r As Reflector
   Dim v As View
   r.Target = LV
   Dim first As Int
   first = r.RunMethod("getFirstVisiblePosition")
   v = r.RunMethod2("getChildAt", Position - first, "java.lang.int")
   Return v
End Sub
 
Top