"""
Copyright (c) 2017, CodeLV.
Distributed under the terms of the MIT License.
The full license is in the file LICENSE, distributed with this software.
Created on July 7, 2017
@author: jrm
"""
from atom.api import Atom, Typed, set_default
from enamlnative.widgets.action_menu_view import ProxyActionMenuView
from .android_linear_layout import AndroidLinearLayout, LinearLayout
from .bridge import JavaBridgeObject, JavaMethod, JavaCallback
onMenuItemClick = JavaCallback('android.view.MenuItem', returns='boolean')
super(Atom, self).__init__()
__nativeclass__ = set_default('android.view.MenuItem')
[docs]class AndroidActionMenuView(AndroidLinearLayout, ProxyActionMenuView):
""" An Android implementation of an Enaml ProxyActionMenuView.
"""
#: A reference to the widget created by the proxy.
widget = Typed(ActionMenuView)
# -------------------------------------------------------------------------
# Initialization API
# -------------------------------------------------------------------------
self.widget = ActionMenuView(self.get_context())
w.onMenuItemClick.connect(self.on_menu_item_click)
[docs] def on_menu(self, menu):
""" """
Menu(__id__=menu)
# -------------------------------------------------------------------------
# OnMenuItemClickListener API
# -------------------------------------------------------------------------
[docs] def on_menu_item_click(self, item):
return False
# -------------------------------------------------------------------------
# ProxyActionMenuView API
# -------------------------------------------------------------------------
[docs] def set_opened(self, opened):
if opened:
self.widget.showOverflowMenu()
else:
self.widget.hideOverflowMenu()