AHQuickAction library - Nice looking popup menus

corwin42

Expert
Licensed User
Longtime User
Updated first post with version 1.01 of this library. Sorry it took so long to update this.

This version includes a fix from barx for the AHQuickaction not sizing and positioning correct on high resolution devices. I still think there are some problems with this but it is much better now.

There was a problem with positioning and sizing of the AHQuickAction3D too that is now fixed.

Added the ICS style popup menu from thedesolatesoul to this library. Thank you very much for this.

Also fixed the animations of the popups. Seems that no one noticed that the entry/exit animations did not work.
 

thedesolatesoul

Expert
Licensed User
Longtime User
Added the ICS style popup menu from thedesolatesoul to this library. Thank you very much for this.
Thanks for adding this. I think there is room for improvement. Maybe we should pick up the resources directly from the android resources rather than bundling it in the res files.

Also fixed the animations of the popups. Seems that no one noticed that the entry/exit animations did not work.
I never noticed, because I think I fixed it for the ICS Popup.
 

Informatix

Expert
Licensed User
Longtime User
Thanks for this new version.

I noticed a little graphical glitch: when you click on a button like Info or Delete in the QAB, it becomes transparent and you can see the list behind. That lasts the time the QAB vanishes, so it's very short, but you can see it.
 

corwin42

Expert
Licensed User
Longtime User
I noticed a little graphical glitch: when you click on a button like Info or Delete in the QAB, it becomes transparent and you can see the list behind. That lasts the time the QAB vanishes, so it's very short, but you can see it.

As I remember this effect was in the original library, too. Though I cannot reproduce it on my Galaxy Nexus with Android 4.1.2 anymore. Maybe this is gone with hardware acceleration or the GN is too fast to show this effect?
This happens only when you press the entry very short so that the pressed state is not completely rendered and the window gets closed. If you press the entry longer you won't see this effect.
 

Informatix

Expert
Licensed User
Longtime User
This happens only when you press the entry very short so that the pressed state is not completely rendered and the window gets closed. If you press the entry longer you won't see this effect.

On my current device, that happens every time, no matter of the quickness of the action, and the pressed state is rendered properly at least for the first stage (the colored background). I cannot say whether it returns correctly to the normal state because it is too fast. I have not this problem with QAB3D.
 

airblaster

Active Member
Licensed User
Longtime User
This is a great library, but there is something I don't understand:
How do you get the ID of the Item that launched the QuickActionPopup?
 

airblaster

Active Member
Licensed User
Longtime User
Figured it out myself...
Saving the item index to a global variable in the click event does the trick
 

PhillipMorris

Member
Licensed User
Longtime User
Hello,

I get an error when I am pressing
men.Show(sender)
in order to show an AHPopupMenu

The message says :
An error has occurred in sub:
main_mnuSettings1_Click (java line:574)
java.lang.ClassCastException:
java.lang.String cannot be cast to Android.view.View

EDIT
I read the thread from the beginning...
Tried to re-paste /res folder and apply read-only.
Tried Tools - Clean Project more than 20 times.
Sub Globals
Dim men As AHPopupMenu
End Sub

Sub Activity_Create(FirstTime As Boolean)
men.Initialize("AC")
For i = 1 To 3
Dim ai As AHActionItem
Dim bd As BitmapDrawable
Dim Filename, Text As String

Select i
Case 1
Filename = "Menu_Search.png"
Text = "MenuItem1"
Case 2
Filename = "Menu_Info.png"
Text = "MenuItem2"
Case 3
Filename = "Menu_Web.png"
Text = "MenuItem3"
End Select

'Initialize a bitmap drawable and the action item
bd.Initialize(LoadBitmap(File.DirAssets, Filename))
ai.Initialize(i, Text, bd)
ai.Selected = True
men.AddActionItem(ai)
Next
End Sub

Sub mnuSettings_Click
men.Show(Sender)
End Sub

What am I doing wrong ?
Thanks.
 
Last edited:

corwin42

Expert
Licensed User
Longtime User
The popup window used by this library always needs an anchor view where the popup will be displayed. You can create an invisible dummy view (label, panel), add it to the activity and use this as the anchor for the popup. Or you can use any other view you already have on your activity.
 

PhillipMorris

Member
Licensed User
Longtime User
Hello Corwin, thanks for your reply.
As far as I can understand as a newbie (I am coming from the .NET world)
if I use
B4X:
Activity.AddMenuItem3("Settings","mnuSettings",LoadBitmap(File.DirRootExternal,"Settings.png"),True)
the anchor created is a text object but I need to pass a view object.

Using this
B4X:
Sub mnuSettings_Click
   men.Show(Sender)
End Sub
will do nothing and create an error.

Can you please guide me on how to create an anchor using a label ?
Thanks.
 

PhillipMorris

Member
Licensed User
Longtime User
The popup window used by this library always needs an anchor view where the popup will be displayed. You can create an invisible dummy view (label, panel), add it to the activity and use this as the anchor for the popup. Or you can use any other view you already have on your activity.

Can you please show me an example.
I didn't manage to do it...
 

corwin42

Expert
Licensed User
Longtime User
Updated first post with Version 1.02 of the library. This should fix a bug in positioning the AHQuickAction popup.

@PhillipMorris:
Something like this (untested)

B4X:
Sub mnuSettings_Click
   Dim dummy As Panel
   dummy.Initialize("")
   Activity.AddView(dummy, 0, 100%x, 100%x, 1)
    men.Show(dummy)
   dummy.RemoveView
End Sub
 

Malky

Active Member
Licensed User
Longtime User
This is brilliant and solves a major problem for me tastefully.

However, is it possible to change the text values in real time? In the example the texts for the menu items are hard coded "Next" etc. I need to populate a the texts depending on the selected language.

Also, the user can change the language at any time, so I would need to be able to either destroy the original texts and try to recreate them, or overwrite them in the chosen language. Is this possible?

Thanks,

Malky
 

Malky

Active Member
Licensed User
Longtime User
OK, think I found the solution on page 3. Re-dim the option in the subroutine I created.

Malky
 

Scantech

Well-Known Member
Licensed User
Longtime User
Bug with inputlist?

The app crashed on me every time I use inputlist on top of the AHQuickAction. Show the QuickAction, I used Vertical type and then use one of those item to open a inputlist, then rotate your device and you will notice it will crash.
 

Scantech

Well-Known Member
Licensed User
Longtime User
Here is a test file.

Click the button and then click one of the item in the Vertical Bar, then rotate the device.
 

Attachments

  • Testing.zip
    63.2 KB · Views: 312
Top