Android Question Differences between Navigation Items in Corwin Material Design Wrapper

CanguroCode

Active Member
Licensed User
Longtime User
I have followed and successfully implemented the following @corwin42 post's:

https://www.b4x.com/android/forum/threads/material-design-1-basics.48077/
https://www.b4x.com/android/forum/threads/material-design-2-using-the-appcompat-library.48424/
https://www.b4x.com/android/forum/threads/material-design-3-using-a-toolbar-as-actionbar.49053/

To add the icon navigation (burger icon) and click action, I use the following code in a Class:

B4X:
Sub Class_Globals
        Private ActionBar As ACToolBarDark
        Private ABHelper As ACActionBar
        Private xml As XmlLayoutBuilder
        Private bd As BitmapDrawable
End Sub

Public Sub Initialize(Activity1 As Activity)
       ActionBar.Initialize("ActionBar")
       ActionBar.SetAsActionBar
       ActionBar.Title="The Title"
       Activity1.AddView(ActionBar, 0, 0, 100%x, 56dip)
       bd = xml.GetDrawable("ic_menu_white_24dp")
       ActionBar.NavigationIconDrawable=bd
       ActionBar.InitMenuListener
End Sub

Private Sub ActionBar_NavigationItemClick
      ToastMessageShow("Click", True)
End Sub
This works well. And I get the following:

2015-05-10_1346.png


Alternatively I can also use the following code and get the same result:

B4X:
Sub Class_Globals
        Private ActionBar As ACToolBarDark
        Private ABHelper As ACActionBar
        Private xml As XmlLayoutBuilder
        Private bd As BitmapDrawable
End Sub

Public Sub Initialize(Activity1 As Activity)
       ActionBar.Initialize("ActionBar")
       ActionBar.SetAsActionBar
       ActionBar.Title="The Title"
       Activity1.AddView(ActionBar, 0, 0, 100%x, 56dip)
       bd = xml.GetDrawable("ic_menu_white_24dp")
       ABHelper.Initialize
       ABHelper.UpIndicatorDrawable=bd
       ABHelper.ShowUpIndicator = True
       ActionBar.InitMenuListener
End Sub

Private Sub ActionBar_NavigationItemClick
      ToastMessageShow("Click", True)
End Sub

What is the difference? between:

B4X:
ActionBar.NavigationIconDrawable=bd

And

B4X:
ABHelper.UpIndicatorDrawable=bd
ABHelper.ShowUpIndicator = True

What is the proper way to use this component?
 
Last edited:

thedesolatesoul

Expert
Licensed User
Longtime User
If I am not wrong, they are both correct.
ACActionBar exposes the current activity's actionbar related properties. Once you set ActionBar.SetAsActionBar, then ACActionBar will point to this actionbar/toolbar. (A toolbar is a toolbar until set as an actionbar, if that makes sense).
 
Upvote 0

CanguroCode

Active Member
Licensed User
Longtime User
If I am not wrong, they are both correct.
ACActionBar exposes the current activity's actionbar related properties. Once you set ActionBar.SetAsActionBar, then ACActionBar will point to this actionbar/toolbar. (A toolbar is a toolbar until set as an actionbar, if that makes sense).
Thanks!, So, both codes are the same element?
 
Upvote 0

phukol

Active Member
Licensed User
Longtime User
Good day im experiencing error unknown type acactionbar. i tried searching everywhere here but i didnt find any jar file for acactionbar. where can i download this file?
 
Upvote 0
Top