#Region Project Attributes
#ApplicationLabel: AppCompat Basics
#VersionCode: 2
#VersionName: 3.20
'SupportedOrientations possible values: unspecified, landscape or portrait.
#SupportedOrientations: unspecified
#CanInstallToExternalStorage: False
#End Region
'#Extends: android.support.v7.app.AppCompatActivity
#Region Activity Attributes
#FullScreen: False
#IncludeTitle: True
#End Region
Sub Process_Globals
'These global variables will be declared once when the application starts.
'These variables can be accessed from all modules.
End Sub
Sub Globals
'These global variables will be redeclared each time the activity is created.
'These variables can only be accessed from this module.
Private ScrollView1 As ScrollView
Private ACSwitch1 As ACSwitch
Private ACActionMenu1 As ACActionMenu
Private ACSubmenu1 As ACSubMenu
Private ACButton3 As ACButton
Private Panel6 As Panel
Private ACSpinner1 As ACSpinner
Private ACSpinner2 As ACSpinner
Private sv As ACSearchView
Private si As ACMenuItem
End Sub
'Inline Java code to initialize the Menu
#If Java
public boolean _onCreateOptionsMenu(android.view.Menu menu) {
if (processBA.subExists("activity_createmenu")) {
processBA.raiseEvent2(null, true, "activity_createmenu", false, new de.amberhome.objects.appcompat.ACMenuWrapper(menu));
return true;
}
else
return false;
}
#End If
Sub Activity_Create(FirstTime As Boolean)
'Do not forget to load the layout file created with the visual designer. For example:
Activity.LoadLayout("layout1")
ScrollView1.Panel.LoadLayout("lay_scrollview")
ScrollView1.Panel.Height = Panel6.Top + Panel6.Height + 8dip
ACSpinner1.AddAll(Array As String ("Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday"))
ACSpinner2.AddAll(Array As String ("January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"))
'Ad some Action Menu items
ACActionMenu1.Menu.Add(1, 1, "Menu1", Null)
ACSubmenu1 = ACActionMenu1.Menu.AddSubMenu(1, 2, 2, "Submenu")
ACSubmenu1.Add(101, 1, "Submenu Item 1", Null)
ACSubmenu1.Add(102, 2, "Submenu Item 2", Null)
ACActionMenu1.Menu.Add(3, 3, "MenuItem 2", Null)
End Sub
Sub Activity_Resume
End Sub
Sub Activity_Pause (UserClosed As Boolean)
End Sub
'This is the Sub called by the inline Java code to initialize the Menu
Sub Activity_CreateMenu(Menu As ACMenu)
sv.Initialize2("Search", sv.THEME_DARK)
sv.IconifiedByDefault = True
'Clear the menu
Menu.Clear
'Add a menu item and assign the SearchView to it
si = Menu.Add2(1, 1, "Search", Null)
si.SearchView = sv
End Sub
'If the user submits a search then this event sub is called
Sub Search_QuerySubmitted (Query As String)
sv.Iconfied = True
si.ItemCollapsed = True
Log("Search for '" & Query & "'")
End Sub
Sub Search_Closed
Log("SearchView closed")
End Sub
Sub Search_QueryChanged (Query As String)
Log("Query changed: " & Query)
End Sub
Sub ACButton1_Click
Log("Button1 Click event fired")
End Sub
Sub ACCheckBox1_CheckedChange(Checked As Boolean)
Log("Checkbox changed")
End Sub
Sub ACActionMenu1_MenuItemClick (Item As ACMenuItem)
Log("Menu Item Clicked: " & Item.Id & " - " & Item.Title)
End Sub
Sub SeekBar1_ValueChanged (Value As Int, UserChanged As Boolean)
Log("Seekbar Value: " & Value)
End Sub
Sub ACButton3_Click
'Open a Popup Menu
Dim Pop As ACPopupMenu
Pop.Initialize("Popup", ACButton3)
Pop.AddMenuItem(1, "Menu1", Null)
Pop.AddMenuItem(2, "Menu2", Null)
Pop.Show
End Sub
Sub Popup_ItemClicked (Item As ACMenuItem)
Log("Popupmenu Item clicked: " & Item.Id & " - " & Item.Title)
End Sub
Sub ACSpinner1_ItemClick (Position As Int, Value As Object)
Log("Spinner Item selected: " & Position & " - " & Value)
End Sub