azwan082 / nc_popup_android Goto Github PK
View Code? Open in Web Editor NEWAndroid PopupMenu module for Titanium
License: Apache License 2.0
Android PopupMenu module for Titanium
License: Apache License 2.0
I tried using this module with ListViews but the app crashes when trying to show the menu.
I have an ItemTemplate which looks like this:
<ItemTemplate name="route" >
<View class="cardData" bindId="cardData">
<View class="views" >
<Label class="blackLabel bigLabel" bindId="routeName" />
<ImageView bindId="icon" class="icons" right="8dp" onClick="showMenu" />
</View>
</View>
</ItemTemplate>
And then here's the showMenu function:
function showMenu(e) {
var item = $.section.getItemAt(e.itemIndex);
var popup = require('nc.popup');
var menu = popup.createPopupMenu({
options: ['Item A', 'Item B', 'Item C'],
view: item.icon
});
menu.addEventListener('click', function(e) {
alert('Selected item: '+e.index);
});
menu.addEventListener('dismiss', function() {
alert('popup menu has been dismissed');
});
menu.show();
}
This is the error shown in Appcelerator's console:
[ERROR] : KrollProxy: (main) [1272,5745] Error creating proxy
[ERROR] : KrollProxy: java.lang.IllegalArgumentException: 'view' is required
[ERROR] : KrollProxy: at nc.popup.PopupMenuProxy.handleCreationDict(PopupMenuProxy.java:65)
[ERROR] : KrollProxy: at org.appcelerator.kroll.KrollProxy.handleCreationArgs(KrollProxy.java:196)
[ERROR] : KrollProxy: at org.appcelerator.kroll.KrollProxy.setupProxy(KrollProxy.java:129)
[ERROR] : KrollProxy: at org.appcelerator.kroll.KrollProxy.createProxy(KrollProxy.java:137)
[ERROR] : KrollProxy: at org.appcelerator.kroll.runtime.v8.V8Object.nativeFireEvent(Native Method)
[ERROR] : KrollProxy: at org.appcelerator.kroll.runtime.v8.V8Object.fireEvent(V8Object.java:62)
[ERROR] : KrollProxy: at org.appcelerator.kroll.KrollProxy.doFireEvent(KrollProxy.java:921)
[ERROR] : KrollProxy: at org.appcelerator.kroll.KrollProxy.handleMessage(KrollProxy.java:1144)
[ERROR] : KrollProxy: at org.appcelerator.titanium.proxy.TiViewProxy.handleMessage(TiViewProxy.java:363)
[ERROR] : KrollProxy: at android.os.Handler.dispatchMessage(Handler.java:98)
[ERROR] : KrollProxy: at android.os.Looper.loop(Looper.java:154)
[ERROR] : KrollProxy: at android.app.ActivityThread.main(ActivityThread.java:6119)
[ERROR] : KrollProxy: at java.lang.reflect.Method.invoke(Native Method)
[ERROR] : KrollProxy: at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:886)
[ERROR] : KrollProxy: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:776)
Before we use to add the popup menu on the actionBar like this
But since Ti SDK 7.5+ this is crashing the app.
We found out that when the view is coming from the ActionBar, the activity cannot find the view (MenuItemProxy) by ID.
Does someone know how to fix it?
Thanks!
Great job, nice module! Just what I was currently looking for :)
I was just testing the example code and discovered that the dismiss event is always firing, even when you select an option.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.