Comments (22)
yes, it extends the default Ti.UI.Window so you could specify fullscreen:false, like so:
var drawer = NappDrawerModule.createDrawer({
fullscreen:false, // HERE :)
leftWindow: leftMenuView,
centerWindow: centerView,
rightWindow: rightMenuView
});
from nappdrawer.
I did of course test that. I figured that you had extended the TiWindow proxy.
_navDrawerWindow = _navDrawerModule.createDrawer({
fullscreen: false,
navBarHidden: false,
leftWindow: leftNavDrawer,
centerWindow: centerView,
rightWindow: rightNavDrawer,
});
_navDrawerWindow.addEventListener('open', onNavDrawerWinOpen);
_navDrawerWindow.open();
function onNavDrawerWinOpen(evt) {
this.removeEventListener('open', onNavDrawerWinOpen);
Ti.API.info('Activity:');
Ti.API.info(this.activity);
if(this.activity) {
var actionBar = this.activity.actionBar;
if (actionBar) {
actionBar.title = 'Stream';
actionBar.onHomeIconItemSelected = function() {
this.toggleLeftWindow();
};
}
}
}
Does not give me an activity
To be precise:
Activity:
undefined
Am I missing something?
from nappdrawer.
hmm.. i see. Good question how to solve that. Cause the activity property should be part of the window. I do not alter it, just extend it.
from nappdrawer.
Isee that the Proxy extends the TiUIWindowProxy, but Drawer extends TiUIView. Is that correct? Shouldn't that be TiUiWindow as well?
from nappdrawer.
Did you manage to find a solution to this?
from nappdrawer.
nope, i did not. Cause I cannot just extend TiUIWindowProxy.. Titanium's window architecture is kinda tricky.
from nappdrawer.
Is there not even any work-around to permit the use of the action bar on android?
from nappdrawer.
The inability to use an ActionBar unfortunately makes this module a no-go for me -- pretty much every Android app with a slider menu I've seen make use of the action bar for making the slider menu discoverable, among other things. Any progress on figuring this issue out yet, viezel? A solution would be much appreciated!
from nappdrawer.
@IGx89 Yeah - I share your opinion. If anyone have the time to implement it, ill gladly tell want needs to be done. Im under quite the workload atm, so I do not have time in the near future.
Give a shout out if you are interested, then ill explain it here.
from nappdrawer.
Shout!
Although my experience with Android native modules is limited
from nappdrawer.
@timanrebel learn something new ;) Its actually not that hard. I find java quite easy to learn.
from nappdrawer.
shout as in - please explain what needs to be done?
from nappdrawer.
How to get Android ActionBar working (or at least - what I believe is the correct path to choose)
First of all. NappDrawer for Android is based on this library: https://github.com/jfeinstein10/SlidingMenu
How it works
So the library uses Fragments http://developer.android.com/guide/components/fragments.html as UI but my module does not. it uses TiUIView. Fragments are possible to use in 2.3.3 if the android support library v4 is included into the project.
I believe that to get this to work with the ActionBar, we need to use fragments. As I understand the library, we need to extend the SlidingFragmentActivity
https://github.com/jfeinstein10/SlidingMenu/blob/master/library/src/com/jeremyfeinstein/slidingmenu/lib/app/SlidingFragmentActivity.java#L138 to get the ActionBar support. something like this:
final ActionBar actionBar = getSupportActionBar();
actionBar.setDisplayHomeAsUpEnabled(true);
setSlidingActionBarEnabled(false); // enable ActionBar in SlidingMenu lib
Download the example app
If you download the app: http://bit.ly/TWejze and take it for a spin, you will find different examples. Look at "Sliding Title Bar" - the correspondent code is here: https://github.com/jfeinstein10/SlidingMenu/blob/master/example/src/com/jeremyfeinstein/slidingmenu/example/SlidingTitleBar.java#L24
Inspiration
Appcelerator already uses fragments for the ActionBar to work within Ti SDK. have a look here: https://github.com/appcelerator/titanium_mobile/blob/master/android/modules/ui/src/java/ti/modules/titanium/ui/widget/tabgroup/TiUIActionBarTab.java#L26
The alternative Path
SlidingMenu library is optimised to use the ActionBarSherlock library. Which is a lib for getting ActionBar like behaviour on android 2.x. There are many tutorials on the net how to get that working. But start here: https://github.com/jfeinstein10/SlidingMenu#setup-with-actionbarsherlock
Hopes that makes it easier to start implementing it. Be sure when you are done.. hundreds of tidevs will love you :)
from nappdrawer.
Thanks for all that information! I like a good challenge, so I just may take a stab at it this weekend...
from nappdrawer.
sounds awesome. let me know if you have any additional question.
from nappdrawer.
In response to @timanrebel's example, if you call the getter and setter methods on the drawer instead of trying to access the activity directly you seem to get access to the action bar
_navDrawerWindow.addEventListener('open', onNavDrawerWinOpen)
function onNavDrawerWinOpen(evt) {
this.removeEventListener('open', onNavDrawerWinOpen);
Ti.API.info('Activity:');
Ti.API.info(this.getActivity()); // Use the get activity method
if(this.getActivity()) {
// Also use the get method for the action bar
var actionBar = this.getActivity().getActionBar();
if (actionBar) {
// Now we can do stuff to the actionbar
actionBar.setTitle('Stream');
// You have to save a reference to the drawer when setting the callback, using 'this'
// will reference the activity, not the drawer
var myDrawer = this;
actionBar.setOnHomeIconItemSelected(function() {
myDrawer.toggleLeftWindow();
});
}
}
}
from nappdrawer.
I was wondering that. I've had success doing that exact same thing with TabGroup's, and looking through the code yesterday I couldn't find many/any differences between the TabGroup classes and NappDrawer's ones -- they both extend TiUIView. The only difference I saw was the method of access that you pointed out: timanrebel's code used properties and my working TabGroup code called the methods directly. If that's the only thing we need to do, that's awesome!
from nappdrawer.
Confirmed working! @timanrebel, can you confirm too? If so, this issue might be closeable :). Only thing I'd suggest is maybe the example be updated to demo accessing the action bar like this, since this is probably going to continually come up as a question if not.
from nappdrawer.
@IGx89 can you send me a copy of your testing code. Ill like to add this into the demo example app, so people know how it works.
from nappdrawer.
I used pretty much exactly what ashokfernandez had in his comment above. If you want more of a patch to the existing demo app that incorporates that functionality, I can do that too though.
from nappdrawer.
that would be great
from nappdrawer.
Pull request submitted: #47
from nappdrawer.
Related Issues (20)
- Setting the title and nav buttons on the status bar (iOS)
- (Android) NappDrawer not showing when resuming to app via intent HOT 1
- App crashes when setRightWindow only HOT 5
- Not working with SDK 6.3.0 HOT 5
- How to reopen drawer which is closed by drawer.close()
- Latest Titanium SDK not support HOT 6
- iOS — Open Drawer Animation Bug (v2.0.0) 🐛 HOT 6
- App crashes after setting centerWindow multiple times (iOS) HOT 18
- Child windows orientations HOT 8
- Build errors when trying to compile with 7.0.2.GA HOT 1
- RefreshControl in listview is lost after switching between winodws.
- iOS - setLeftWindow(false) throws error using Titanium 7.1.0 GA HOT 1
- [Android] Drop-down list not shown in Webview HOT 2
- 8.0.1.GA Support HOT 5
- [Android] addWindowToStack error using v2.0.2 in TiSDK 8 HOT 2
- iOS module is not working with latest SDK 8.2.0.GA. HOT 1
- iOS module not working on iOS 13 VoiceOver
- 2.1.1 version of navdrawer cause app crashing HOT 1
- drawer.setAnimationMode not working on sdk 10 HOT 1
- Crash on iOS 12.5.4 and Ti SDK 10.0.0.GA HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from nappdrawer.