ricardoalcocer / actionbarextras Goto Github PK
View Code? Open in Web Editor NEWTitanium Android Native Module that exposes ActionBar features not exposed by the Titanium SDK
License: MIT License
Titanium Android Native Module that exposes ActionBar features not exposed by the Titanium SDK
License: MIT License
If anyone is using this library in production I'd like to add a section in the README with a link to the app in Google Play. @manumaticx, have you any app in the wild?
When I set the title with a missing string from language file like this:
actionbarextras.title = L('my.missing.string');
It causes a nullpointerexception and crashes the app. It should probably don't change the string at all instead.
i was just wandering if it is possible to use actionbarextras to set regular menu items.
I wanted to use FontAwesome to set icon actions by changing the font.
thanks for your incredible work, this module is very usefull :)
It seems like background color is not setting the background of the Split ActionBar that will be available starting in SDK 3.5. Not sure if this can be changed by code. @manumaticx , ideas?
Would be Awesome to have this!
Could something like this be implemented? See 8.4 here:http://www.vogella.com/tutorials/AndroidActionBar/article.html#actionbar_navigation_dropdown
I can give it a try but wanted to know if @manumaticx sees any red flags.
Titanium now supports force overflow but I've noticed that its implementation isn't consistent across all android API levels. It would be nice to get force overflow functionality back into this module.
Is there any way to use actionbarextras with other normal menu items in action bar?
Hey,
with this tool
http://romannurik.github.io/AndroidAssetStudio/icons-nav-drawer-indicator.html#theme=light&color=33b5e5%2C40
it's easy to create colorized icons for the burger-icon. Anyone knows how to apply these icons? Cause there isn't an option directly on the actionbar i think it's about chaning the theme - any experience with that?
best, nico
I would like to be able to reset the title/subtitle and set it to null.
Now when I use abx.setSubtitle(null), nothing happens. I want to be able to 'hide' the subtitle for instance.
As shown in this thread, setting it to null, hides the view:
http://stackoverflow.com/questions/22709160/remove-actionbar-subtitle-reset-actionbar-text
Currently in setSubtitle for example, if the given obj is not an object or a string, it returns and does nothing. Could you add a check for a null value to reset it?
Thanks alot.
What is the android minsdk support for this module? Now that Titanium uses the AppCompat theme, the ActionBar is available even in devices with API <11. But in the device with Android API <11, for example Android API level 10 (Android 2.3.7), I receive an error because the ActionBar is not found.
As described here: http://stackoverflow.com/questions/9731602/animated-icon-for-actionitem
It is currently not possible to attach a view to an actionbar item other than the searchview.
Hi, I just discovered this module and trying to add it to my project. However I got the following error. Even in the example App. Any fix?
[ERROR] : TiExceptionHandler: (main) [0,103866] - Message: Uncaught TypeError: Object #<Actionbarextras> has no method 'setHomeAsUpIcon'
[ERROR] : TiExceptionHandler: (main) [0,103866] - Source: abx.setHomeAsUpIcon("/images/menu.png");
[ERROR] : V8Exception: Exception occurred at app.js:58: Uncaught TypeError: Object #<Actionbarextras> has no method 'setHomeAsUpIcon'
By the way, I would like to use the same module to add a star icon for bookmarking, and hopefully could toggle the star icon color. Is it possible?
Thanks.
When i call module function at a view to make its parent set ,and there is loading window show at start
the module doesn't set the action bar ( it set the loading window even when we disable action bar at loading window of course)
Very randomly I'm getting this error, which causes an application crash
[DEBUG] : �� �ActionbarextrasModule: (KrollRuntimeThread) [4783,4783] called the setextras method
[WARN] : �� � W/System.err: java.lang.NullPointerException: Attempt to invoke virtual method 'android.app.ActionBar android.app.Activity.getActionBar()' on a null object reference
[WARN] : �� � W/System.err: at com.alcoapps.actionbarextras.ActionbarextrasModule.setExtras(ActionbarextrasModule.java:72)
[WARN] : �� � W/System.err: at org.appcelerator.kroll.runtime.v8.V8Object.nativeFireEvent(Native Method)
[WARN] : �� � W/System.err: at org.appcelerator.kroll.runtime.v8.V8Object.fireEvent(V8Object.java:64)
[WARN] : �� � W/System.err: at org.appcelerator.kroll.KrollProxy.doFireEvent(KrollProxy.java:884)
[WARN] : �� � W/System.err: at org.appcelerator.kroll.KrollProxy.handleMessage(KrollProxy.java:1107)
[WARN] : �� � W/System.err: at org.appcelerator.titanium.proxy.TiViewProxy.handleMessage(TiViewProxy.java:338)
[WARN] : �� � W/System.err: at org.appcelerator.titanium.proxy.TiWindowProxy.handleMessage(TiWindowProxy.java:99)
[WARN] : �� � W/System.err: at ti.modules.titanium.ui.TabGroupProxy.handleMessage(TabGroupProxy.java:104)
[WARN] : �� � W/System.err: at android.os.Handler.dispatchMessage(Handler.java:98)
[WARN] : �� � W/System.err: at android.os.Looper.loop(Looper.java:135)
[WARN] : �� � W/System.err: at org.appcelerator.kroll.KrollRuntime$KrollRuntimeThread.run(KrollRuntime.java:112)
[WARN] : �� � TiExceptionHandler: (main) [63,4846] Activity is null or already finishing, skipping dialog.
[ERROR] : �� �V8Exception: Exception occurred at ui/android/ApplicationWindow.js:36: Uncaught Error: Attempt to invoke virtual method 'android.app.ActionBar android.app.Activity.getActionBar()' on a null object reference
[DEBUG] : �� �AndroidRuntime: Shutting down VM
It seems that in some cases the setExtras
method gets called before the Activity is initialized (like when accessing it before the window is open). I'll have a closer look at this and do some tests.
I was wondering why actionbarextras couldn't change the actionbar's background color of my classic project.
Apparently actionbarextras couldn't recognize short color code (3-4 hex digits like "#45" instead of "#004455") while regular Titanium components can.
Hi Manu + Ricardo,
it it possible to preset the list?
Codestrong!
Rainer
[ERROR] : �� �Failed to run dexer:
[ERROR] : �� �
[ERROR] : �� �trouble processing "javax/xml/datatype/DatatypeConstants$Field.class":
[ERROR] : �� �
[ERROR] : �� �Ill-advised or mistaken usage of a core class (java.* or javax.*)
[ERROR] : �� �when not building a core library.
[ERROR] : �� �
[ERROR] : �� �This is often due to inadvertently including a core library file
[ERROR] : �� �in your application's project, when using an IDE (such as
[ERROR] : �� �Eclipse). If you are sure you're not intentionally defining a
[ERROR] : �� �core class, then this is the most likely explanation of what's
[ERROR] : �� �going on.
[ERROR] : �� �
[ERROR] : �� �However, you might actually be trying to define a class in a core
[ERROR] : �� �namespace, the source of which you may have taken, for example,
[ERROR] : �� �from a non-Android virtual machine project. This will most
[ERROR] : �� �assuredly not work. At a minimum, it jeopardizes the
[ERROR] : �� �compatibility of your app with future versions of the platform.
[ERROR] : �� �It is also often of questionable legality.
[ERROR] : �� �
[ERROR] : �� �If you really intend to build a core library -- which is only
[ERROR] : �� �appropriate as part of creating a full virtual machine
[ERROR] : �� �distribution, as opposed to compiling an application -- then use
[ERROR] : �� �the "--core-library" option to suppress this error message.
[ERROR] : �� �
[ERROR] : �� �If you go ahead and use "--core-library" but are in fact
[ERROR] : �� �building an application, then be forewarned that your application
[ERROR] : �� �will still fail to build or run, at some point. Please be
[ERROR] : �� �prepared for angry customers who find, for example, that your
[ERROR] : �� �application ceases to function once they upgrade their operating
[ERROR] : �� �system. You will be to blame for this problem.
[ERROR] : �� �
[ERROR] : �� �If you are legitimately using some code that happens to be in a
[ERROR] : �� �core package, then the easiest safe alternative you have is to
[ERROR] : �� �repackage that code. That is, move the classes in question into
[ERROR] : �� �your own package namespace. This means that they will never be in
[ERROR] : �� �conflict with core system classes. JarJar is a tool that may help
[ERROR] : �� �you in this endeavor. If you find that you cannot do this, then
[ERROR] : �� �that is an indication that the path you are on will ultimately
[ERROR] : �� �lead to pain, suffering, grief, and lamentation.
[ERROR] : �� �
[ERROR] : �� �1 error; aborting
[ERROR] Application Installer abnormal process termination. Process exit value was 1
Found this and thought it would be nice to add to this module:
http://cyrilmottier.com/2013/05/24/pushing-the-actionbar-to-the-next-level/
@manumaticx, do you see any serious technical challenges with this?
Maybe something like in here??
proposal: MIT
:)
It seems that module has some problems on latest Alloy and Ti SDK. According to documentation this should work:
_abx = require('com.alcoapps.actionbarextras');
_abx.setBackgroundColor("#ffffff");
_abx.title = "wewfwefwe";
_abx.hideLogo();
But in console, while window opens i can see those errors:
[WARN] : W/System.err: java.lang.NullPointerException
[WARN] : W/System.err: at com.alcoapps.actionbarextras.ActionbarextrasModule.handleSetBackgroundColor(ActionbarextrasModule.java:261)
[WARN] : W/System.err: at com.alcoapps.actionbarextras.ActionbarextrasModule.handleMessage(ActionbarextrasModule.java:126)
[WARN] : W/System.err: at android.os.Handler.dispatchMessage(Handler.java:102)
[WARN] : W/System.err: at android.os.Looper.loop(Looper.java:136)
[WARN] : W/System.err: at android.app.ActivityThread.main(ActivityThread.java:5196)
[WARN] : W/System.err: at java.lang.reflect.Method.invokeNative(Native Method)
[WARN] : W/System.err: at java.lang.reflect.Method.invoke(Method.java:515)
[WARN] : W/System.err: at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:786)
[WARN] : W/System.err: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:602)
[WARN] : W/System.err: at dalvik.system.NativeStart.main(Native Method)
[WARN] : W/System.err: java.lang.NullPointerException
[WARN] : W/System.err: at com.alcoapps.actionbarextras.ActionbarextrasModule.handleSetTitle(ActionbarextrasModule.java:190)
[WARN] : W/System.err: at com.alcoapps.actionbarextras.ActionbarextrasModule.handleMessage(ActionbarextrasModule.java:118)
[WARN] : W/System.err: at android.os.Handler.dispatchMessage(Handler.java:102)
[WARN] : W/System.err: at android.os.Looper.loop(Looper.java:136)
[WARN] : W/System.err: at android.app.ActivityThread.main(ActivityThread.java:5196)
[WARN] : W/System.err: at java.lang.reflect.Method.invokeNative(Native Method)
[WARN] : W/System.err: at java.lang.reflect.Method.invoke(Method.java:515)
[WARN] : W/System.err: at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:786)
[WARN] : W/System.err: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:602)
[WARN] : W/System.err: at dalvik.system.NativeStart.main(Native Method)
[WARN] : W/System.err: java.lang.NullPointerException
[WARN] : W/System.err: at com.alcoapps.actionbarextras.ActionbarextrasModule.handleHideLogo(ActionbarextrasModule.java:544)
[WARN] : W/System.err: at com.alcoapps.actionbarextras.ActionbarextrasModule.handleMessage(ActionbarextrasModule.java:162)
[WARN] : W/System.err: at android.os.Handler.dispatchMessage(Handler.java:102)
[WARN] : W/System.err: at android.os.Looper.loop(Looper.java:136)
[WARN] : W/System.err: at android.app.ActivityThread.main(ActivityThread.java:5196)
[WARN] : W/System.err: at java.lang.reflect.Method.invokeNative(Native Method)
[WARN] : W/System.err: at java.lang.reflect.Method.invoke(Method.java:515)
[WARN] : W/System.err: at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:786)
[WARN] : W/System.err: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:602)
[WARN] : W/System.err: at dalvik.system.NativeStart.main(Native Method)
Ti SDK 3.5.1
Alloy 1.5.1
Android device 4.4.4, emulator 5.1.0
Hey, this is really a nice module!
I really appreciate accessing the actionbar without having to get the window and then wait for the activity to be ready to finally activity.onCreateOptionsMenu
...
Here is the workaround I use:
$.currentWindow = require('windowController').getCurrentWin();
activity = $.currentWindow.getActivity();
// Window is not ready yet...
if (activity.actionBar and activity.invalidateOptionsMenu) {
return _.delay( function() {
$.currentWindow = require('windowController').getCurrentWin();
activity = $.currentWindow.getActivity();
}, 100 );
What would be even nicer for this module is to be able to get the activity so I could just simplify the previous code to abx.getActivity().onCreateOptionsMenu...
Thanks a bunch
Pierre
Does this need a fix or should I recompile?
Thanks, Tim.
@manumaticx , perhaps for API consistency we should change
abextras.setTitle=({
title : 'This is the title',
font : 'Chunkfive.otf',
color : 'red'
});
abextras.setSubtitle=({
subtitle : 'This is the subtitle',
font : 'Chunkfive.otf',
color : 'blue'
});
so both use a text property like:
abextras.setTitle=({
text : 'This is the title',
font : 'Chunkfive.otf',
color : 'red'
});
abextras.setSubtitle=({
text : 'This is the subtitle',
font : 'Chunkfive.otf',
color : 'blue'
});
setHomeAsUpIndicator method is available starting from API level 18
E/AndroidRuntime( 4484): FATAL EXCEPTION: main
E/AndroidRuntime( 4484): java.lang.NoSuchMethodError: android.app.ActionBar.setHomeAsUpIndicator
E/AndroidRuntime( 4484): at com.alcoapps.actionbarextras.ActionbarextrasModule.handleSetHomeAsUpIcon(ActionbarextrasModule.java:384)
E/AndroidRuntime( 4484): at com.alcoapps.actionbarextras.ActionbarextrasModule.handleMessage(ActionbarextrasModule.java:116)
E/AndroidRuntime( 4484): at android.os.Handler.dispatchMessage(Handler.java:95)
E/AndroidRuntime( 4484): at android.os.Looper.loop(Looper.java:137)
E/AndroidRuntime( 4484): at android.app.ActivityThread.main(ActivityThread.java:4745)
E/AndroidRuntime( 4484): at java.lang.reflect.Method.invokeNative(Native Method)
E/AndroidRuntime( 4484): at java.lang.reflect.Method.invoke(Method.java:511)
E/AndroidRuntime( 4484): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:786)
E/AndroidRuntime( 4484): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
E/AndroidRuntime( 4484): at dalvik.system.NativeStart.main(Native Method)
If you use the https://github.com/FokkeZB/IconFont to build yours js font file and want to use this module:
Follow the steps
At alloy.js
Alloy.Globals.icons = require('font-awesome');
At your *.js
$.tabs.addEventListener('open', function(e) {
if (OS_ANDROID) {
abx.title = 'My App';
abx.titleColor = "white";
var activity = $.tabs.getActivity();
if (activity) {
activity.onCreateOptionsMenu = function(e) {
e.menu.clear();
var createItem = e.menu.add({
itemId: 101, //unique random number
showAsAction: Ti.Android.SHOW_AS_ACTION_ALWAYS,
});
abx.setMenuItemIcon({
menu:e.menu,
menuItem:createItem,
fontFamily:'FontAwesome',
icon:Alloy.Globals.icons.check,
color:'white',
size:30
})
};
activity.invalidateOptionsMenu();
}
}
}
Hi, I'm using NappDrawer in Android to navigate between views and when i change views I also change the actionbar title and it returns to the original font. If I try to use setExtras() method to change the title it will return an error 'Only the original thread that created a view hierarchy can touch its views.'
If I try to setTitleFont() after I call actionBar.setTitle() in Titanium it will not keep the custom font.
I'm guessing a method to change only the current title (keeping the previously selected custom font) would solve this but it's a little out of my skill set.
Nice module btw.
Title and subtitle works, but I can't set the backgroundColor?
[WARN] W/System.err: java.lang.NullPointerException
[WARN] W/System.err: at com.alcoapps.actionbarextras.ActionbarextrasModule.handleSetMenuItemIcon(ActionbarextrasModule.java:527)
[WARN] W/System.err: at com.alcoapps.actionbarextras.ActionbarextrasModule.handleMessage(ActionbarextrasModule.java:158)
[WARN] W/System.err: at android.os.Handler.dispatchMessage(Handler.java:95)
[WARN] W/System.err: at android.os.Looper.loop(Looper.java:137)
[WARN] W/System.err: at android.app.ActivityThread.main(ActivityThread.java:5103)
[WARN] W/System.err: at java.lang.reflect.Method.invokeNative(Native Method)
[WARN] W/System.err: at java.lang.reflect.Method.invoke(Method.java:525)
[WARN] W/System.err: at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:737)
[WARN] W/System.err: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
[WARN] W/System.err: at dalvik.system.NativeStart.main(Native Method)
[WARN] W/System.err: java.lang.NullPointerException
[WARN] W/System.err: at com.alcoapps.actionbarextras.ActionbarextrasModule.handleSetMenuItemIcon(ActionbarextrasModule.java:527)
[WARN] W/System.err: at com.alcoapps.actionbarextras.ActionbarextrasModule.handleMessage(ActionbarextrasModule.java:158)
[WARN] W/System.err: at android.os.Handler.dispatchMessage(Handler.java:95)
[WARN] W/System.err: at android.os.Looper.loop(Looper.java:137)
[WARN] W/System.err: at android.app.ActivityThread.main(ActivityThread.java:5103)
[WARN] W/System.err: at java.lang.reflect.Method.invokeNative(Native Method)
[WARN] W/System.err: at java.lang.reflect.Method.invoke(Method.java:525)
[WARN] W/System.err: at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:737)
[WARN] W/System.err: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
[WARN] W/System.err: at dalvik.system.NativeStart.main(Native Method)
Hello,
I'm using Alloy MVC, and inside of one of my controllers, I'm using the following:
$.win.addEventListener("open", function() {
if (Ti.Platform.osname === "android") {
if (!$.win.activity) {
Ti.API.error("Can't access action bar on a lightweight window.");
} else {
var abx = require('com.alcoapps.actionbarextras');
abx.window = $.win;
actionBar = $.win.activity.actionBar;
if (actionBar) {
abx.setTitle("Example");
abx.setHomeAsUpIcon('/images/icon_menu.png');
}
}
}
});
I do have an image in /PROJECT_NAME/app/assets/images/icon_menu.png, and my controller is located in /PROJECT_NAME/app/controllers/example.js.
Just to note that all the others images for example in Titanium ImageViews load fine, using the same schema.
When starting my application, the title do change to "Example", however the homeAsUpIcon does not change and an error is shown in console:
[ERROR] ActionbarextrasModule: (main) [273,11626] Couldn't resolve appdata-private://PROJECT_NAME/android/images//icon_menu.png
I've already tried to play with slashes and some folder derivations in icon location, but I am not being able to get it work. Is it possible this is a bug in the module?
Thanks
Hey,
not really an "issue" but maybe anyone around knows the solution.
After adding a logo to the actionbar (setLogo) i'm not able to remove this Logo.
My case:
On some screens there is a logo on other screens (same actionbar) there shouldn't.
Any idea? I've tried several things and properties but none of them are solving it.
thanks,
nico
@manumaticx , any experiece with this?
http://stackoverflow.com/questions/12077690/how-to-display-both-normal-and-split-actionbar
I mean the SplitActionBar to display items on the bottom, not necessarily the Custom View bit. Here's a better example: http://android-er.blogspot.com/2012/06/split-action-bar-for-android-4.html
Feature Request:
Is it possible to change the regular up cavat icon to a drawer icon in the actionbar?
if so, could you please expose this?
cheers,
Mads
Would be nice if there's a support to change the font size as well.
I'm wondering if anyone knows how to do it from the theme (AppCompat) ?
abx.setTitle({
text: "Font Object",
font: {
fontSize: 26,
fontFamily: 'roboto'
}
});
This results in this error:
[ERROR] TiExceptionHandler: (main) [436,436] ----- Titanium Javascript Runtime Error -----
[ERROR] TiExceptionHandler: (main) [1,437] - In alloy/controllers/index.js:1,69
[ERROR] TiExceptionHandler: (main) [0,437] - Message: Uncaught Error: java.util.HashMap cannot be cast to java.lang.String
[ERROR] TiExceptionHandler: (main) [0,437] - Source: lobals.fontAgency.globesherpa,font:Alloy.Globals.fontAgencyName}),i.setTitle({
[DEBUG] Dialog: checkMirrorLinkEnabled returns : false
[DEBUG] Dialog: showing allowed
[ERROR] V8Exception: Exception occurred at alloy/controllers/index.js:1: Uncaught Error: java.util.HashMap cannot be cast to java.lang.String
This does work. It just doesn't allow for sizing:
abx.setTitle({
text: "Font Object",
font: 'roboto'
});
Once you have hidden the icon with abx.disableIcon = true;
it is not possible to show it again.
I think we need to set the appicon as the actionBar.icon, but I'm not sure how to read that from tiapp.xml - but I'll have a look soon.
var dropDownSelection;
dropDownSelection = Alloy.Globals.abx.createDropdown({
titles : ["First", "Second", "Third", "Fourth"],
color : "#fff"
});
dropDownSelection.activeItem = 2; // bydefault set Third variable to be selected
Adding a dropdown to a tab group causes the tabs to disappear.
Test case:
var abx = require('com.alcoapps.actionbarextras');
var opts = {dropdown: false};
var win1 = Ti.UI.createWindow();
var win2 = Ti.UI.createWindow();
var tabGroup = Ti.UI.createTabGroup({
tabs: [Ti.UI.createTab({window: win1, title: 'Tab 1'}), Ti.UI.createTab({window: win2, title: 'Tab 2'})]
});
var dropdown
var btn_dropdown = Ti.UI.createButton({ title: 'Dropdown' });
btn_dropdown.addEventListener('click', function(){
opts.dropdown = !opts.dropdown;
if (opts.dropdown){
dropdown = abx.createDropdown({
titles: ["First", "Second", "Third"]
});
dropdown.addEventListener('change', function(e){
Ti.API.info("dropdown changed to: " + e.index);
});
}else{
dropdown.remove();
}
});
win1.add(btn_dropdown);
tabGroup.open();
Note: I also tried creating the dropdown in the tab group's open event listener and in activity.onCreateOptionsMenu with the same result. It occurs on device with Android 4.4.2 and Genymotion emulator running 4.2.2, built with Ti SDK 3.4.0.GA.
Hey,
i am using your module( great work!) together with the Android Drawer ( https://github.com/manumaticx/Ti.DrawerLayout )
Strange:
I am using a special font for the title in the actionbar - working as expected. But after changing the centerView of the Drawer Instance it changed to the default font and i can't change it :/ New Windows are working fine - just the above case doesn't.
Do you have any idea why? (I thought the bar is attached to the current activity so it should be the same after changing just the centerView - or?
best, Nico
Hi!
Is there any reason why this has been removed? from v1.3.0 it is not forcing menu overflow anymore.
// http://stackoverflow.com/questions/9286822/how-to-force-use-of-overflow-menu-on-devices-with-menu-button
try {
ViewConfiguration config = ViewConfiguration.get(app);
java.lang.reflect.Field menuKeyField = ViewConfiguration.class
.getDeclaredField("sHasPermanentMenuKey");
if (menuKeyField != null) {
menuKeyField.setAccessible(true);
menuKeyField.setBoolean(config, false);
}
} catch (Exception ex) {
// Ignore
}
regerds,
janis
When you set the title (or subtitle) like this, it doesn't apply the font, only the title.
abx.setTitle({
text: "Test",
font: "Aller.ttf"
});
Hi,
var searchView = Ti.UI.Android.createSearchView({
hintText : "Suche in Mediathek"
});
searchView.addEventListener('submit', function(_e) {
require('ui/search.window')(.open();
_e.source.blur(); <== I want to close (decollapse?) the searchview
});
АктйонБар.setSearchView({
searchView : searchView,
cancelIcon : "/images/cancel.png",
searchIcon : "/images/search.png"
});
How can I hide the input field in actionbar after submitting?
Is it possible to change this icon?
Also I've tried using another image for the cancel icon but it was stretched and came over the default icon so I could see both. One on top of each other.
I think it's time for a little code refactoring. By now, the module has some features, all handled by dedicated functions, some properties can be set by setExtras. Beyond that there is no API documentation.
Here's some things I would like to change and I'm interested in what you think about it:
setExtras
title
subtitle
backgroundColor
titleFont
subtitleFont
titleColor
subtitleColor
disableIcon
It would also make sense to deprecate title
and subtitle
since these can be set with the Titanium ActionbarProxy. But at a second thought, we got clear about the issue #10 - so if one uses custom fonts for title or subtitle, these values have to be changed with this module unless we find a way to consistently change the font rather than just replacing the title with a modified string. Therefor it might be handy to have functions to set title, font and color at once.
var abx = require('com.alcoapps.actionbarextras');
abx.setTitle({
title: "the Title",
color: "red",
font: "Roboto-Light.otf"
});
// or through properties as mentioned above
abx.title = "the Title";
abx.titleColor = "red";
abx.titleFont = "Roboto-Light.otf";
What do you think about it, @ricardoalcocer ?
Can we do this too?
http://developer.android.com/design/patterns/actionbar.html#contextual
http://developer.android.com/guide/topics/ui/menus.html#context-menu
There's also a Ticket for this (but low priority)
https://jira.appcelerator.org/browse/TIMOB-16369
Would be very nice to have it. Actually I need this right now.
If you pass icon: 0xf002
to setMenuItemIcon( )
you'll get this error:
05-27 11:28:51.261: W/System.err(12623): java.lang.ClassCastException: java.lang.Integer cannot be cast to java.lang.String
05-27 11:28:51.261: W/System.err(12623): at com.alcoapps.actionbarextras.ActionbarextrasModule.handleSetMenuItemIcon(ActionbarextrasModule.java:518)
05-27 11:28:51.261: W/System.err(12623): at com.alcoapps.actionbarextras.ActionbarextrasModule.handleMessage(ActionbarextrasModule.java:158)
05-27 11:28:51.261: W/System.err(12623): at android.os.Handler.dispatchMessage(Handler.java:98)
05-27 11:28:51.261: W/System.err(12623): at android.os.Looper.loop(Looper.java:135)
05-27 11:28:51.261: W/System.err(12623): at android.app.ActivityThread.main(ActivityThread.java:5254)
05-27 11:28:51.261: W/System.err(12623): at java.lang.reflect.Method.invoke(Native Method)
05-27 11:28:51.261: W/System.err(12623): at java.lang.reflect.Method.invoke(Method.java:372)
05-27 11:28:51.262: W/System.err(12623): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:903)
05-27 11:28:51.262: W/System.err(12623): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:698)
05-27 11:28:51.263: W/System.err(12623): java.lang.ClassCastException: java.lang.Integer cannot be cast to java.lang.String
05-27 11:28:51.265: W/System.err(12623): at com.alcoapps.actionbarextras.ActionbarextrasModule.handleSetMenuItemIcon(ActionbarextrasModule.java:518)
05-27 11:28:51.265: W/System.err(12623): at com.alcoapps.actionbarextras.ActionbarextrasModule.handleMessage(ActionbarextrasModule.java:158)
05-27 11:28:51.265: W/System.err(12623): at android.os.Handler.dispatchMessage(Handler.java:98)
05-27 11:28:51.265: W/System.err(12623): at android.os.Looper.loop(Looper.java:135)
05-27 11:28:51.265: W/System.err(12623): at android.app.ActivityThread.main(ActivityThread.java:5254)
05-27 11:28:51.265: W/System.err(12623): at java.lang.reflect.Method.invoke(Native Method)
05-27 11:28:51.265: W/System.err(12623): at java.lang.reflect.Method.invoke(Method.java:372)
05-27 11:28:51.265: W/System.err(12623): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:903)
05-27 11:28:51.265: W/System.err(12623): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:698)
It should actually parse the hex value to a valid unicode char.
It is obvious from the example that fonts are placed in android folder within the resources folder. In case of alloy, putting it under /app/assets/android/fonts as described by Titanium documentation is not working.
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.