AHQuickAction library - Nice looking popup menus

Paulsche

Well-Known Member
Licensed User
Longtime User
This can only be done by changing the xml files.

Das kannst Du nur in den xml Files ändern.

Gesendet von meinem LG-P500 mit Tapatalk 2

ok, danke, in welcher Datei und wie muss der Code aussehen ?
 

Paulsche

Well-Known Member
Licensed User
Longtime User
ok, danke, in welcher Datei und wie muss der Code aussehen ?

Ok, hab herausgefunden, dass die Hintergrundgrafik in der Datei "ahqa_action_item_btn.xml" angegeben ist. Wenn ich die PNG-Datei "ahqa_action_item_selected.9.png" die für die selektierung (gelbverlauf) ist,
kopiere und umbenenne, diese als Hintergrundgrafik angebe, funktioniert das auch.
Nur wenn ich die Datei bearbeite um die Farbe zu ändern, kommt die Fehlermeldung beim kompilieren. Irgendwas läuft beim speichern der Datei falsch, aber was ?

* Problem ist, ich hatte die Helligkeit der ganzen grafik geändert, der Alphakanal muss aber auf Schwarz bleiben,
habe nun nur einen markierten Bereich geändert, kein Fehler mehr.

Anbei das Ergebnis wie das Popupmenü jetzt aussieht.
 

Attachments

  • png.png
    png.png
    33.9 KB · Views: 331
  • popup.png
    popup.png
    55.8 KB · Views: 384
Last edited:

EenOog

New Member
Licensed User
Longtime User
Great work

thanx dude awsome work really digging this site and this tool best software i ever bought.:sign0098:
 

BarrySumpter

Active Member
Licensed User
Longtime User
Combined ActionBar with QuickAction Menus

Combined ActionBar with QuickAction Menus.


----
Note to self:
7 attmepts to combine and clean. grrr
Out of b4a completely
unzip ActionBar example
unzip QuickAction Menu example
Copy QuickActoin Menu res folder contents
to ActionBar res folder

set ActionBar res folder
and all contents including subfolder
to read only

Open ActinBar.b4a
Tools Clean Project
Compile and test run before modifying any code.
 

Attachments

  • ActionBarWithQuickActions2.zip
    95.7 KB · Views: 334
Last edited:

BarrySumpter

Active Member
Licensed User
Longtime User
Looks perfect for me.

You should use this:

B4X:
Sub AB_ItemClicked(ItemID As Int)
    Menu.show(AB.GetActionView(ItemID))
End Sub
AB is the AHActionBar
Menu is the AHQuickAction3D

Already posted.
Thanks Corwin42

Although the balloon pointer position shows up in a different position in landscape than portriat.

B4X:
Sub AB_ItemClicked(ItemID As Int)
    'If the refresh action is pressed, show the progress indicator a few seconds.
    Select ItemID
        Case ID_ACTION_REFRESH
            ab.ProgressBarVisible = True
            ab.SetActionVisibility(ID_ACTION_REFRESH, False)
            Timer1.Enabled = True
        Case ID_ACTION_HOME
            Msgbox("Home action pressed", "Item clicked")
        Case ID_ACTION_SHARE
            Msgbox("Share some content ...", "Item clicked")
        Case ID_ACTION_STAR
            Msgbox("Star action pressed", "Item clicked")
        Case ID_ACTION_OVERFLOW
    
            
            'Msgbox("Open a Menu here (Perhaps with AHQuickAction popups)", "Item clicked")
    
    'ac2.show(btnFake)
    ac2.show(ab.GetActionView(ItemID))
    
    
    
    End Select
End Sub
 
Last edited:

William Hunter

Active Member
Licensed User
Longtime User
AHQuickAction3D - IndexOutOfBoundsException

I am getting an Index out of bounds error in using a menu created with AHQuickAction3D. I can see no reason for the error as my code is configured the same as in the example. If I move the code from Sub CreateMenu into Activity_Create it makes no difference as I get the same error message. I have set out the error message and my code (reduced for brevity) below. The error occurs on line: ac1.addActionItem(ai).

I have seen a post where another member is having the same problem, and attributes the problem to having the initialize portion within the loop. I don’t understand why this would be a no-no in my project, but not problematic in the example. The one thing I have noticed, is that that this error seems to have no discernable negative effect on the performance of a finished project.

B4X:
java.lang.IndexOutOfBoundsException: index=5 count=0
   at android.view.ViewGroup.addInArray(ViewGroup.java:2044)
   at android.view.ViewGroup.addViewInner(ViewGroup.java:1988)
   at android.view.ViewGroup.addView(ViewGroup.java:1865)
   at android.view.ViewGroup.addView(ViewGroup.java:1822)
   at de.amberhome.quickaction.QuickAction3D.addActionItem(QuickAction3D.java:218)
   at mail.purge.main._vvvvvvvvvvvv4(main.java:852)
   at mail.purge.main._activity_create(main.java:341)
   at java.lang.reflect.Method.invokeNative(Native Method)
   at java.lang.reflect.Method.invoke(Method.java:521)
   at anywheresoftware.b4a.BA.raiseEvent2(BA.java:170)
   at mail.purge.main.afterFirstLayout(main.java:84)
   at mail.purge.main.access$100(main.java:16)
   at mail.purge.main$WaitForLayout.run(main.java:72)
   at android.os.Handler.handleCallback(Handler.java:587)
   at android.os.Handler.dispatchMessage(Handler.java:92)
   at android.os.Looper.loop(Looper.java:123)
   at android.app.ActivityThread.main(ActivityThread.java:4627)
   at java.lang.reflect.Method.invokeNative(Native Method)
   at java.lang.reflect.Method.invoke(Method.java:521)
   at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
   at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
   at dalvik.system.NativeStart.main(Native Method)
java.lang.IndexOutOfBoundsException: index=5 count=0
B4X:
Sub Globals
   'These global variables will be redeclared each time the activity is created.
   'These variables can only be accessed from this module.
   Dim ac1 As AHQuickAction3D
End Sub

Sub Activity_Create(FirstTime As Boolean)
   CreateMenu ' code minimized for brevity
End Sub

Sub CreateMenu
   ac1.Initialize("AC", ac1.HORIZONTAL)
   For i = 1 To 3
      Dim ai As AHActionItem
      Dim bd As BitmapDrawable
      Dim Filename, Text As String
      Select i
         Case 1         
            Filename = "menu_ok.png"
            Text = "Credits"
         Case 2
            Filename = "menu_info.png"
            Text = "About"
         Case 3
            Filename = "menu_settings.png"
            Text = "Settings"
      End Select
      'Initialize a bitmap drawable and the action item
      bd.Initialize(LoadBitmap(File.DirAssets, Filename))
      ai.Initialize(i, Text, bd)
      ai.Selected = True
      'Add the item to Quickaction popup
      ac1.addActionItem(ai) ' NOTE - error occurs on this line
   Next
End Sub

Could someone with more knowledge help me to resolve this issue? These are great looking menus and I would like to continue to use them. :sign0163:

Best regards

This edit added for further information.

I have switched to AHQuickAction (no 3D) in my project and this Index out of bounds error no longer appears. CharlesIPTI has also noted this condition in another post.

Perhaps the author would revisit this library, with a view to checking into this further. I really like the look of the 3D menus, and hope to be able to use them in the future. I wish I could work at this level, so I could create menus like this.
 
Last edited:

aaronk

Well-Known Member
Licensed User
Longtime User
Hello,

I have got it to load the popop menu when you select a item in the ListView but the popup displays at the bottom of the ListView.

Is there a way to display the popup menu at the location the item was selected rather than displaying it at the bottom?

For Example:
I have 20 items in my event list, and if I select item 5 the popup menu will display at the bottom and is no where near item 5.
I like it to display near the item I tap on.

Can this be done?
 
Last edited:

corwin42

Expert
Licensed User
Longtime User
I have got it to load the popop menu when you select a item in the ListView but the popup displays at the bottom of the ListView.

Is there a way to display the popup menu at the location the item was selected rather than displaying it at the bottom?

For a listview currently not. The problem is that you need the view that represents the list item. Unfortunately Erel refused to add it to the ListItem_Click event so there is no simple way to position the QuickAction.

Erel posted a workaround for this somewhere catching the touch event, adding a dummy view and then display the Quickaction with this dummy view. Unfortunately this does not work anymore on Android 4.0+.

I took a look into the internal structure of the standard ListView and I think it should be possible to get the View with Reflection. Haven't tried it yet. I guess Erel would have to solution for it in minutes. :D

Another solution for your problem will be to use Erels CustomListview Class.
 

corwin42

Expert
Licensed User
Longtime User
Maybe my ListViewWithEvents library may help. With it, you can get the first and last visible item. With an easy computation, you can locate the position of the clicked item.

Yes, I think this would be possible. The easiest way for it still would be to add a parameter to the events with the view in it. The ListView click Event has this normally in Java, it is just not used for the RaiseEvent.
 

moster67

Expert
Licensed User
Longtime User
Unless I don't understand the problem properly, I believe Erel already posted the solution using the Reflection-library. Look here:

http://www.b4x.com/forum/additional-libraries-classes-official-updates/14563-ahquickaction-library-nice-looking-popup-menus-2.html#post83441

I am using it and it works nicely also on my Samsung S3 with ICS.

I took a look into the internal structure of the standard ListView and I think it should be possible to get the View with Reflection. Haven't tried it yet. I guess Erel would have to solution for it in minutes. :D
 

Informatix

Expert
Licensed User
Longtime User
Unless I don't understand the problem properly, I believe Erel already posted the solution using the Reflection-library. Look here:

http://www.b4x.com/forum/additional-libraries-classes-official-updates/14563-ahquickaction-library-nice-looking-popup-menus-2.html#post83441

I am using it and it works nicely also on my Samsung S3 with ICS.

The same thing with the library ListViewWithScrollEvents:
B4X:
Sub LVSE_ItemClick (Position As Int, Value As Object)
   ac1.Show(GetViewAtPos(Sender, Position))
End Sub

Sub GetViewAtPos(LV As ListViewWithScrollEvents, Position As Int) As View
    Dim r As Reflector
    Dim v As View
    r.Target = LV
    v = r.RunMethod2("getChildAt", Position - LVSE1.FirstVisibleItem, "java.lang.int")
    Return v
End Sub
 
Top