Giter Site home page Giter Site logo

viezel / nappdrawer Goto Github PK

View Code? Open in Web Editor NEW
248.0 248.0 128.0 20.96 MB

A side drawer navigation container view controller for Appcelerator Titanium.

License: MIT License

JavaScript 4.39% Python 2.03% Java 27.57% Objective-C 65.68% Ruby 0.33%

nappdrawer's People

Contributors

adamkearsley avatar anthonynjuguna avatar bitfabrikken avatar daffodilistic avatar danghy avatar dbankier avatar dylan-oxide avatar fahad86 avatar fokkezb avatar geraudbourdin avatar hansemannn avatar igx89 avatar iotashan avatar janisr avatar kbshl avatar ktorz avatar mpociot avatar omorandi avatar pablog178 avatar sgtcoolguy avatar stephenfeather avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

nappdrawer's Issues

iOS NappDrawer in Tab Window

Stuck on adding a napp drawer to the first window of a tabgroup tab. Unable to set title and leftNavButton - settings got just ignored. Any ideas? What's the best way adding NappDrawer to a tabgroup window?

function DatagridWindow(title) {
...
var button = Ti.UI.createButton({
title:'Test'
});

var self = Ti.UI.createWindow({
    backgroundColor:'#efeff4',
    title:'Groups', leftNavButton:button

});

var mainWindow = NappDrawerModule.createDrawer({
centerWindow:self,
leftWindow:subMenuWin,
centerhiddenInteractivity:'TouchDisabled',
closeDrawerGestureMode: NappDrawerModule.CLOSE_MODE_ALL,
openDrawerGestureMode: NappDrawerModule.OPEN_MODE_ALL,
leftDrawerWidth: 240,
orientationModes: [Ti.UI.PORTRAIT, Ti.UI.UPSIDE_PORTRAIT],
animationMode:NappDrawerModule.ANIMATION_NONE,
shouldStretchDrawer:false ,
showShadow:false

});

return mainWindow;
...
}

[iOS] Still crashing when swapping a view in Alloy

I know this has been reported and some workaround suggested, but this never worked for me.

Nothing special about my scenario:

var tabs = Alloy.createController('tabBar').getView(),
    leftWin = Alloy.createController('left').getView(),
    collectionsWin =  Alloy.createController('collections').getView();

var drawer = NappDrawerModule.createDrawer({
    centerWindow: tabs, // this never changes
    leftWindow: leftWin, // this is the one I want to swap out
    closeDrawerGestureMode: NappDrawerModule.CLOSE_MODE_NONE,
    openDrawerGestureMode: NappDrawerModule.OPEN_MODE_NONE,
    showShadow: false,
    leftDrawerWidth: 130,
    animationVelocity: 400
});

And an event for switching left view:

Alloy.Globals.toggleMenu = function() {
    drawer.setLeftWindow(collectionsWin);
    drawer.toggleLeftWindow();
}

This method works fine unless I'm reassigning the window with setLeftWindow . At this point it'll crash or nothing happens..

My left view is NavigationWindow . I also tried with simple Window == same result.

@viezel could take a look at this when you have some spare time?

Really appreciate your help!

onCreateOptionsMenu - Solved!

I need to create a menu button (3 dots) on the ActionBar, but is not working.
Do you have any suggestion? :-)

drawer.activity.onCreateOptionsMenu = function(e){
var menu = e.menu;
//Something nice
};

[ANDROID] [Alloy] Can't load Alloy views on Android.

To start, I believe this stems from issue #2 - but that thread is getting long and this is explicitly about Android. I've solved #2 in my app and posted my solution on #20.

I'm on the latest Ti / Alloy / Android builds.

On Android, the module doesn't seem to be able to load in Alloy views, below is how I'm calling the drawer with its options, the iOS implementation works brilliantly:

if(Titanium.Platform.name == 'android'){

    var NappDrawerModule = require('dk.napp.drawer');

    drawer = NappDrawerModule.createDrawer({
            fullscreen:false, 
            leftWindow: Alloy.createController("leftDrawer").getView(),
            centerWindow: Alloy.createController("centerView").getView(),
            fading: 0.2, // 0-1
            parallaxAmount: 0.2, //0-1
            shadowWidth:"40dp", 
            leftDrawerWidth: 240,
            animationMode: NappDrawerModule.ANIMATION_PARALLAX_FACTOR_7,
            closeDrawerGestureMode: NappDrawerModule.MODE_MARGIN,
            openDrawerGestureMode: NappDrawerModule.MODE_ALL
    });
    drawer.open();

};

I'm only using Views in my leftDrawer.xml and centerView.xml files, like so:

<Alloy>
    <View class="container" id="contID">
        <TableView id="tableID"></TableView>    
    </View>
</Alloy>

The error I get from ADB is as follows, the app just crashes on load, as soon as I try to load an Alloy view:

[WARN][dalvikvm(  719)] threadid=1: thread exiting with uncaught exception (group=0x40a71930)
[ERROR][TiApplication(  719)] (main) [3894,5135] Sending event: exception on thread: main msg:java.lang.RuntimeException: Unable to start activity ComponentInfo{com.atypical.enfold/org.appcelerator.titanium.TiActivity}: java.lang.NumberFormatException: Unable to convert null; Titanium 3.1.3,2013/09/18 12:01,222f4d1
[ERROR][TiApplication(  719)] java.lang.RuntimeException: Unable to start activity ComponentInfo{com.atypical.enfold/org.appcelerator.titanium.TiActivity}: java.lang.NumberFormatException: Unable to convert null
[ERROR][TiApplication(  719)]   at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2180)
[ERROR][TiApplication(  719)]   at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2230)
[ERROR][TiApplication(  719)]   at android.app.ActivityThread.access$600(ActivityThread.java:141)
[ERROR][TiApplication(  719)]   at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1234)
[ERROR][TiApplication(  719)]   at android.os.Handler.dispatchMessage(Handler.java:99)
[ERROR][TiApplication(  719)]   at android.os.Looper.loop(Looper.java:137)
[ERROR][TiApplication(  719)]   at android.app.ActivityThread.main(ActivityThread.java:5041)
[ERROR][TiApplication(  719)]   at java.lang.reflect.Method.invokeNative(Native Method)
[ERROR][TiApplication(  719)]   at java.lang.reflect.Method.invoke(Method.java:511)
[ERROR][TiApplication(  719)]   at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793)
[ERROR][TiApplication(  719)]   at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560)
[ERROR][TiApplication(  719)]   at dalvik.system.NativeStart.main(Native Method)
[ERROR][TiApplication(  719)] Caused by: java.lang.NumberFormatException: Unable to convert null
[ERROR][TiApplication(  719)]   at org.appcelerator.titanium.util.TiConvert.toInt(TiConvert.java:407)
[ERROR][TiApplication(  719)]   at dk.napp.drawer.Drawer.processProperties(Drawer.java:344)
[ERROR][TiApplication(  719)]   at org.appcelerator.kroll.KrollProxy.setModelListener(KrollProxy.java:1162)
[ERROR][TiApplication(  719)]   at dk.napp.drawer.DrawerProxy.windowCreated(DrawerProxy.java:145)
[ERROR][TiApplication(  719)]   at org.appcelerator.titanium.TiActivityWindows.windowCreated(TiActivityWindows.java:32)
[ERROR][TiApplication(  719)]   at org.appcelerator.titanium.TiBaseActivity.windowCreated(TiBaseActivity.java:437)
[ERROR][TiApplication(  719)]   at org.appcelerator.titanium.TiBaseActivity.onCreate(TiBaseActivity.java:512)
[ERROR][TiApplication(  719)]   at org.appcelerator.titanium.TiActivity.onCreate(TiActivity.java:18)
[ERROR][TiApplication(  719)]   at android.app.Activity.performCreate(Activity.java:5104)
[ERROR][TiApplication(  719)]   at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1080)
[ERROR][TiApplication(  719)]   at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2144)
[ERROR][TiApplication(  719)]   ... 11 more
[ERROR][AndroidRuntime(  719)] FATAL EXCEPTION: main
[ERROR][AndroidRuntime(  719)] java.lang.RuntimeException: Unable to start activity ComponentInfo{com.atypical.enfold/org.appcelerator.titanium.TiActivity}: java.lang.NumberFormatException: Unable to convert null
[ERROR][AndroidRuntime(  719)]  at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2180)
[ERROR][AndroidRuntime(  719)]  at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2230)
[ERROR][AndroidRuntime(  719)]  at android.app.ActivityThread.access$600(ActivityThread.java:141)
[ERROR][AndroidRuntime(  719)]  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1234)
[ERROR][AndroidRuntime(  719)]  at android.os.Handler.dispatchMessage(Handler.java:99)
[ERROR][AndroidRuntime(  719)]  at android.os.Looper.loop(Looper.java:137)
[ERROR][AndroidRuntime(  719)]  at android.app.ActivityThread.main(ActivityThread.java:5041)
[ERROR][AndroidRuntime(  719)]  at java.lang.reflect.Method.invokeNative(Native Method)
[ERROR][AndroidRuntime(  719)]  at java.lang.reflect.Method.invoke(Method.java:511)
[ERROR][AndroidRuntime(  719)]  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793)
[ERROR][AndroidRuntime(  719)]  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560)
[ERROR][AndroidRuntime(  719)]  at dalvik.system.NativeStart.main(Native Method)
[ERROR][AndroidRuntime(  719)] Caused by: java.lang.NumberFormatException: Unable to convert null
[ERROR][AndroidRuntime(  719)]  at org.appcelerator.titanium.util.TiConvert.toInt(TiConvert.java:407)
[ERROR][AndroidRuntime(  719)]  at dk.napp.drawer.Drawer.processProperties(Drawer.java:344)
[ERROR][AndroidRuntime(  719)]  at org.appcelerator.kroll.KrollProxy.setModelListener(KrollProxy.java:1162)
[ERROR][AndroidRuntime(  719)]  at dk.napp.drawer.DrawerProxy.windowCreated(DrawerProxy.java:145)
[ERROR][AndroidRuntime(  719)]  at org.appcelerator.titanium.TiActivityWindows.windowCreated(TiActivityWindows.java:32)
[ERROR][AndroidRuntime(  719)]  at org.appcelerator.titanium.TiBaseActivity.windowCreated(TiBaseActivity.java:437)
[ERROR][AndroidRuntime(  719)]  at org.appcelerator.titanium.TiBaseActivity.onCreate(TiBaseActivity.java:512)
[ERROR][AndroidRuntime(  719)]  at org.appcelerator.titanium.TiActivity.onCreate(TiActivity.java:18)
[ERROR][AndroidRuntime(  719)]  at android.app.Activity.performCreate(Activity.java:5104)
[ERROR][AndroidRuntime(  719)]  at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1080)
[ERROR][AndroidRuntime(  719)]  at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2144)
[ERROR][AndroidRuntime(  719)]  ... 11 more

Am I just being daft or missing something vital? I've poured over the Android example with no luck and would really appreciate any guidance as I know Obj-C much better then Java.

Thanks for the badass module @viezel !

Cheers,
//MD

Unable to compile with Ti SDK 3.2.0

When building with an app the latest 3.2.0 Titanium SDK compiler fails:

[TRACE] :  Undefined symbols for architecture i386:
[TRACE] :    "_OBJC_CLASS_$_CustomMMDrawerController", referenced from:
[TRACE] :        objc-class-ref in libdk.napp.drawer.a(DkNappDrawerDrawer.o)
[TRACE] :  ld: symbol(s) not found for architecture i386
[TRACE] :  clang: error: linker command failed with exit code 1 (use -v to see invocation)
[ERROR] :  ** BUILD FAILED **

Prior 3.2.0 NappDrawer worked just fine.

[iOS7] Crashes when using Alloy and setLeftWindow

Hi there,

First - the module is a gem, thank you.

The issue I'm running into is using the module in iOS7 and with Alloy.

This code works brilliantly in iOS6, but not in 7:

drawer.setLeftWindow(Alloy.createController("leftDrawer").getView());

Basically, I start the whole thing in my alloy.js and set default views. After a user logs in via the app, I need to rewrite the left drawer to show a nav. Works perfectly in iOS6, but in iOS7 the simulator just fails when I get to the point of setting the left drawer.

The console tells me almost nothing and in Xcode, all it points to is the setLeftWindow method.

Any ideas? What info can I provide to help?

Thank you!
//MD

Hide and show centerWindow?

I have a search bar in my left window, where I want to hide the centerWindow on focus.
That worked so far. But when onBlur the search bar or clicking the cancel button, I can not set the width of the centerWindow. It appears black.

Any suggestions?

Tableview in center window gets stuck

Sometimes (rarely, 1 in 100 app launches) while scrolling a tableview, placed in the center window, horizontally with a slight vertical direction the opening of de nav drawer is triggered and the tableview gets stuck. From that point forward the tableview cannot be scrolled at all.

I was wondering if somebody else is also experiencing this issue. It might not have to do something with the nappdrawer at all but if anybody is experiencing it aswell I think this is an issue.

This only happens on iOS.

[Question] Android + deeper App Navigation

Hey,

I'm building a crossplatform application using this module - great work (as always :) ) so far. ๐Ÿ‘

I am now facing the following problem:
Since the android version uses views instead of Windows, i can't add a tabgroup to the center"window".

So the holy question is, what you think is the best way to create a deeper app structure? (Deep = meaning something like the navigationWindow on ios, for example a list, navigating to a detail page and so on ...)

Any ideas/hints? Can't imagine all guys using this are just bulding app where the centerWindow is only one screen without any deeper logic :)

Best,
Nico

(My current idea is to mimic the android default animation style for opening windows, storing the hirachy in an array and than handle that... but it don't feels very "smooth" - ?! )

add event listener

Could You add eventlistener for closeLeftWindow and closeRightWindow?

My case:
I have a searchbar in the left window. onFocus the softkeyboard launches. now the user can close the left window and the keyboard stays visible, because the search input was not blurred.

Solution:
After getting response from event closeLeftWindow, I can blur the search input and the keyboard disappear.

or do you have any other idea for that?

ios simulator bildschirmfoto 14 11 2013 11 34 35

[iOS] Replacing centerView causes flicker

I use the leftView as a menu and when the user clicks any of the tableRows the centerView is replaced with a new navController on iOS 7.

The problem is that when the switch happens there's a brief moment of there not being a view there, and therefor it doesn't have any background, so it just shows through like this:

401146501256

This causes an undesired flickery effect. I've tried setting backgroundColor white on both the navController and it's window and Ti.UI.backgroundColor = 'white';, with no luck.

setCenterWindow() on Android

Hello,

I need to say that this is one of most useful module for Appcelerator. Thank you for your time.

My question is, other than views created with createView, what other views does the setCenterWindow() accept? I want to pass a listView but my app crashes.

Performance hit with showShadow:false (iOS)

Anyone else experience this? My app is fluid iOS (around 60+fps) with shadows, but without, it becomes choppy - around 30 fps.
This can be duplicated by setting showShadow: false in the example app bundled with the module.

Fix statusBarStyle being reset to black after modal window has closed

Nice to have #13 fixed, but when you open a modal window and then close it, the statusBarStyle again is black. This means I still need to use the hack:

    // open drawer
    $.drawer.open();

    // WORKAROUND https://github.com/viezel/NappDrawer/issues/13
    if (OS_IOS) {
        Ti.UI.createWindow({
            backgroundColor: 'transparent',
            zIndex: 1000,
            touchEnabled: false
        }).open();
    }

Would be nice to have this fixed in a good way. What are you doing in creating the windows for nappdrawer that https://github.com/appcelerator/titanium_mobile/blob/master/iphone/Classes/TiWindowProxy.m doesn't?

shadowWidth value on Android ignored

shadowWidth doesn't respond to any value, it's always showing the same width. Also, setting to "0dp" doesn't hide it.

Only when you remove shadowWidth as parameter it is disabled.

Building with Titanium SDK 3.2.1.v20140114125643

createDrawer parameters not working

I am opening the drawer with the following parameters:

var drawer = NappDrawerModule.createDrawer({
    leftWindow              : Alloy.createController('navwin').getView(),
    centerWindow            : Alloy.createController('centerwin').getView(),
    closeDrawerGestureMode  : NappDrawerModule.CLOSE_MODE_ALL,
    openDrawerGestureMode   : NappDrawerModule.OPEN_MODE_ALL,
    leftDrawerWidth         : 230,
    orientationModes        : [Ti.UI.PORTRAIT, Ti.UI.UPSIDE_PORTRAIT],
    showShadow              : true,
    animationMode           : NappDrawerModule.ANIMATION_SLIDE,
    shouldStretchDrawer     : false
});
drawer.open();

This works fine, except that the bottom two parameters aren't visible in the UI. The animationMode is NONE, and the drawer still is stretched when the left window is opened.

I can get the intended behaviour by calling:

drawer.setAnimationMode(NappDrawerModule.ANIMATION_PARALLAX_FACTOR_5);
drawer.setShouldStretchDrawer(false);

directly after drawer.open(). Then the correct behaviour is seen. Setting these properties between .createDrawer() and .open() also doesn't work. It seems that these parameters are not used (or overrulled) somewhere.

Is anyone else experiencing this behaviour? I would be nice if those properties can be set during creation of the drawer, instead of after opening the drawer.

Build failure

I'm trying to build the module (2f64bb7) against the latest Ti SDK 3.1.3.v20130910153050, but I'm getting a build failure.

/Users/sindresorhus/Downloads/NappDrawer-master/ios/Classes/DkNappDrawerDrawer.m:30:70: error: cannot find protocol declaration for 'TiUIViewController'
    return [[[TiViewController alloc] initWithViewProxy:(TiViewProxy<TiUIViewController>*)proxy] autorelease];
                                                                     ^
1 error generated.

** BUILD FAILED **


The following build commands failed:
    CompileC build/NappDrawer.build/Release-iphoneos/NappDrawer.build/Objects-normal/armv7/DkNappDrawerDrawer.o Classes/DkNappDrawerDrawer.m normal armv7 objective-c com.apple.compilers.llvm.clang.1_0.compiler
(1 failure)
xcodebuild failed

method to close the drawer

There's no method to close the drawer. This happened to me when I used the drawer in a window different than the main one. When I try to call

drawer.close();

the app crashes.

iOS 7

Not able to close the NappDrawer window?

Is it possible to close the main window of the NappDrawer (on iOS)?

If after calling drawer.open(); I later call drawer.close(); I get:

[ERROR] [iphone, 7.0.4, 192.168.0.100] TypeError: 'undefined' is not a function (evaluating 'drawer.close()')

Of course the window is the root window of the app, but I work through TiShadow and need to be able to clean up like this:

    if (Ti.Shadow) {
        Ti.App.addEventListener('tishadow:refresh', function() {
            drawer.close();
        });
    }

[iOS 7] Fullscreen and statusBarStyle light

Hi,
I noticed that I can not change the color of statusBar, and I can not even hide statusBar using the fullscreen property.
Do you think there is a way to solve the problem?

Thank you very much, and congratulations for this great module!

// app.js
var leftWindow = Ti.UI.createWindow({
    fullscreen : true,
    backgroundColor : "red",
    statusBarStyle : Titanium.UI.iPhone.StatusBar.LIGHT_CONTENT
});
var centerWindow = Ti.UI.createWindow({
    fullscreen : true,
    backgroundColor : "blue",
    statusBarStyle : Titanium.UI.iPhone.StatusBar.LIGHT_CONTENT
});
var NappDrawerModule = require('dk.napp.drawer');
var drawerView = NappDrawerModule.createDrawer({
    fullscreen: true, 
    leftWindow: leftWindow,
    centerWindow: centerWindow,
    leftDrawerWidth: "270dp",
    closeDrawerGestureMode: NappDrawerModule.CLOSE_MODE_ALL,
    openDrawerGestureMode: NappDrawerModule.OPEN_MODE_ALL,
    statusBarStyle : Titanium.UI.iPhone.StatusBar.LIGHT_CONTENT,
});
drawerView.open();
<!--> tiapp.xml: <-->
<ios>
    <plist>
        <dict>
            <key>UIStatusBarStyle</key>
            <string>UIStatusBarStyleLightContent</string>
        </dict>
    </plist>
</ios>

[Enhancement] Control Left/Right window bounce animation

Hi @viezel,

Would be awesome if we had some control over the animation level the bounce has for the side drawers.

Would be nice to have maybe a few presets, where it peaks open and then just remains open by 25dp for a few seconds then closes, etc.

Gonna poke around in the module and see if I can tweak it, guidance on where to start?

//MD

Replace CenterWin with created Window using NappDrawer Titanium Android

Hi everyone, I am developing an Android app that uses NappDrawer.

I saw a documentation on iOS like this to change the ceterWindow with a window:

var mainWindow = NappDrawerModule.createDrawer({
centerWindow: navController,
leftWindow: winLeft,
rightWindow: winRight,
closeDrawerGestureMode: NappDrawerModule.CLOSE_MODE_ALL,
openDrawerGestureMode: NappDrawerModule.OPEN_MODE_ALL,
leftDrawerWidth: 180,
rightDrawerWidth: 220
});

var newWin = Ti.UI.createWindow({
backgroundColor: "#FF0000"
};
mainWindow.setCenterWindow(newWin);

Now, how can I make it in NappDrawer implemented like the code above on Android?
Thanks!

[ERROR][NappDrawer( 1058)] (main) [1813,1813] ti.modules.titanium.ui.ViewProxy@b2e097b8

When i run the sample https://github.com/viezel/NappDrawer/blob/master/android/example/app.js in the emulator or mobile device with titanium SDK 3.1.3GA
I get the following error into Titanium studio console.

[INFO][Choreographer( 1058)] Skipped 84 frames! The application may be doing too much work on its main thread.
[INFO][TiAPI ( 1058)] windowDidClose
[ERROR]NappDrawer( 1058) [1813,1813] ti.modules.titanium.ui.ViewProxy@b2e097b8

iOS: problem using setLeftWindow after open()

I've been using version 1.1.1 (after migrating from your Slidemenu) I discovered I needed to close/open the mainwin:

mainwin = NappDrawerModule.createDrawer({ 
    centerWindow : apptabgroup,
    leftWindow : mainmenu.win,
    leftLedge : 100
});

....
//  inside an eventhandler:
mainwin.close();
mainwin.setLeftWindow(itemmenu);
mainwin.open();

To make it work. This causes a black flicker.
After upgrading to 1.1.4. this fix doesn't work anymore, the main win disappears, leaving a black screen.

Am I making a mistake with setLeftWindow?

App crashes when creating a view outside scope

Hi,

The app crashes when ever I create a view outside the event listener or a function: For example

This code is fine:

function setPresentationView() {
Ti.API.info('Show Presentation Module');
var centerWindow = Ti.UI.createView();
drawer.setCenterWindow(centerWindow);
drawer.toggleLeftWindow(); //animate back to center
}

When I create centerWindow outside
This code crashes:

var centerWindow = Ti.UI.createView();
function setPresentationView() {
Ti.API.info('Show Presentation Module');
drawer.setCenterWindow(centerWindow);
drawer.toggleLeftWindow(); //animate back to center
}

Here is the output:

[INFO][DEBUG ( 31)] *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
[INFO][DEBUG ( 31)] Build fingerprint: 'generic/google_sdk/generic:2.3.4/GINGERBREAD/123630:eng/test-keys'
[INFO][DEBUG ( 31)] pid: 1967, tid: 1981 >>> org.xyz.android <<<
[INFO][DEBUG ( 31)] signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 00000014
[INFO][DEBUG ( 31)] r0 00000000 r1 80c95138 r2 00000082 r3 00000000
[INFO][DEBUG ( 31)] r4 00000000 r5 45a5d8f4 r6 001f85f8 r7 45a5d7b7
[INFO][DEBUG ( 31)] r8 00002a18 r9 80505e31 10 3a108091 fp 3a1ffb1d
[INFO][DEBUG ( 31)] ip 80d620dc sp 45a5d758 lr 8087cf15 pc 8087719c cpsr 60000030
[INFO][DEBUG ( 31)] #00 pc 0007719c /data/data/org.xyz.android/lib/libkroll-v8.so
[INFO][DEBUG ( 31)] #1 pc 0007cf10 /data/data/org.xyz.android/lib/libkroll-v8.so
[INFO][DEBUG ( 31)] #2 pc 00005ee0 /data/data/org.xyz.android/lib/libdk.napp.drawer.so
[INFO][DEBUG ( 31)] #3 pc 0016b3a0 /data/data/org.xyz.android/lib/libkroll-v8.so
[INFO][DEBUG ( 31)]
[INFO][DEBUG ( 31)] code around pc:
[INFO][DEBUG ( 31)] 8087717c 1c2060e5 ffc8f7ff 46c0bd70 ffffff9b
[INFO][DEBUG ( 31)] 8087718c 4b19b570 447b1c04 781b681b d1162b00
[INFO][DEBUG ( 31)] 8087719c 2b007d03 6900d00d f836f005 d01a1e05
[INFO][DEBUG ( 31)] 808771ac 23004a12 68607523 1c21447a e8e0f0cc
[INFO][DEBUG ( 31)] 808771bc 6900e003 f814f005 1c281c05 f7ffbd70
[INFO][DEBUG ( 31)]
[INFO][DEBUG ( 31)] code around lr:
[INFO][DEBUG ( 31)] 8087cef4 f0d19002 2800e92e 4b4cdd17 781a58e3
[INFO][DEBUG ( 31)] 8087cf04 40532301 9802703b fa62f7ff f93cf7fa
[INFO][DEBUG ( 31)] 8087cf14 e7ae1c05 703b2301 f0c91c28 1c01ee6e
[INFO][DEBUG ( 31)] 8087cf24 f7ff1c30 1c05fa95 9802e7a3 ed4cf0ce
[INFO][DEBUG ( 31)] 8087cf34 f0dd9004 2301eb50 703b9003 1c304b3c
[INFO][DEBUG ( 31)]
[INFO][DEBUG ( 31)] stack:
[INFO][DEBUG ( 31)] 45a5d718 00000025
[INFO][DEBUG ( 31)] 45a5d71c 00000017
[INFO][DEBUG ( 31)] 45a5d720 434175c4 /dev/ashmem/dalvik-LinearAlloc (deleted)
[INFO][DEBUG ( 31)] 45a5d724 00000001
[INFO][DEBUG ( 31)] 45a5d728 80507ef8 /data/data/org.xyz.android/lib/libdk.napp.drawer.so
[INFO][DEBUG ( 31)] 45a5d72c 5bcecb2a
[INFO][DEBUG ( 31)] 45a5d730 405eade0 /dev/ashmem/dalvik-heap (deleted)
[INFO][DEBUG ( 31)] 45a5d734 8004cd09 /system/lib/libdvm.so
[INFO][DEBUG ( 31)] 45a5d738 405eade0 /dev/ashmem/dalvik-heap (deleted)
[INFO][DEBUG ( 31)] 45a5d73c 8050812d /data/data/org.xyz.android/lib/libdk.napp.drawer.so
[INFO][DEBUG ( 31)] 45a5d740 80507ee4 /data/data/org.xyz.android/lib/libdk.napp.drawer.so
[INFO][DEBUG ( 31)] 45a5d744 8006b84d /system/lib/libdvm.so
[INFO][DEBUG ( 31)] 45a5d748 434175c4 /dev/ashmem/dalvik-LinearAlloc (deleted)
[INFO][DEBUG ( 31)] 45a5d74c 405eade0 /dev/ashmem/dalvik-heap (deleted)
[INFO][DEBUG ( 31)] 45a5d750 df002777
[INFO][DEBUG ( 31)] 45a5d754 e3a070ad
[INFO][DEBUG ( 31)] #00 45a5d758 80d61ff0 /data/data/org.xyz.android/lib/libkroll-v8.so
[INFO][DEBUG ( 31)] 45a5d75c 45a5d8f4
[INFO][DEBUG ( 31)] 45a5d760 001f85f8 [heap]
[INFO][DEBUG ( 31)] 45a5d764 8087cf15 /data/data/org.xyz.android/lib/libkroll-v8.so
[INFO][DEBUG ( 31)] #1 45a5d768 ffffffff
[INFO][DEBUG ( 31)] 45a5d76c 8004cd09 /system/lib/libdvm.so
[INFO][DEBUG ( 31)] 45a5d770 45a5d8f4
[INFO][DEBUG ( 31)] 45a5d774 405eade0 /dev/ashmem/dalvik-heap (deleted)
[INFO][DEBUG ( 31)] 45a5d778 8050812d /data/data/org.xyz.android/lib/libdk.napp.drawer.so
[INFO][DEBUG ( 31)] 45a5d77c 8003af67 /system/lib/libdvm.so
[INFO][DEBUG ( 31)] 45a5d780 4620c641
[INFO][DEBUG ( 31)] 45a5d784 00000001
[INFO][DEBUG ( 31)] 45a5d788 4620c644
[INFO][DEBUG ( 31)] 45a5d78c 00002a18
[INFO][DEBUG ( 31)] 45a5d790 80505e31 /data/data/org.xyz.android/lib/libdk.napp.drawer.so
[INFO][DEBUG ( 31)] 45a5d794 3a108091
[INFO][DEBUG ( 31)] 45a5d798 3a1ffb1d
[INFO][DEBUG ( 31)] 45a5d79c 00252970 [heap]
[INFO][DEBUG ( 31)] 45a5d7a0 45a5d894
[INFO][DEBUG ( 31)] 45a5d7a4 001f85f8 [heap]
[INFO][DEBUG ( 31)] 45a5d7a8 afd4d5c8
[INFO][DEBUG ( 31)] 45a5d7ac 80505ee3 /data/data/org.xyz.android/lib/libdk.napp.drawer.so
[INFO][BootReceiver( 62)] Copying /data/tombstones/tombstone_07 to DropBox (SYSTEM_TOMBSTONE)
[INFO][WindowManager( 62)] WIN DEATH: Window{40707cd0 org.xyz.android/org.appcelerator.titanium.TiActivity paused=false}
[INFO][ActivityManager( 62)] Process org.xyz.android (pid 1967) has died.

Crashes if I switch from win to navController in centerView

When I programmatically switch out a navController in centerView with a plain window it crashes on iOS 7 and Ti SDK 3.1.3.v20130910153050.

app.js

'use strict';
var NappDrawer = require('dk.napp.drawer');

Ti.UI.backgroundColor = 'white';

function createLeftWindow() {
    var win = Ti.UI.createWindow();
    var menuListView = Ti.UI.createListView();
    var menuListViewSection = Ti.UI.createListSection();

    menuListViewSection.items = [{
        properties: {
            title: 'win',
            itemId: 'win'
        }
    }, {
        properties: {
            title: 'nav',
            itemId: 'nav'
        }
    }];

    menuListView.addEventListener('itemclick', function (e) {
        mainWin.centerWindow = require(e.itemId)();
    });

    menuListView.sections = [menuListViewSection];
    win.add(menuListView);

    return win;
}

var mainWin = NappDrawer.createDrawer({
    leftWindow: createLeftWindow(),
    centerWindow: require('win')()
});

mainWin.open();
mainWin.toggleLeftWindow();

nav.js

'use strict';
module.exports = function () {
    var win = Ti.UI.createWindow({
        title: 'nav',
        backgroundColor: 'white'
    });

    var navController = Ti.UI.iPhone.createNavigationGroup({
        window: win
    });

    return navController;
};

win.js

'use strict';
module.exports = function () {
    var win = Ti.UI.createWindow({
        title: 'nav',
        backgroundColor: 'white',
    });

    return win;
};

Set right or left window to null

Is it possible to set left or right window to null?

My case:
Opening a drawer with left and center window.
When I open a subwindow, I set the right window to display another menu.
On closing this subwindow, I have to set the right window empty.

New Windows and Memory Management

Hello,

I am wondering what happens to current windows when any of the methods like setCenterWindow, setLeftWindow and setRightWindow is called.

Are they destroyed? Should we call getCenterWindow and call window close?
I am trying to trace what happens but events like "destroy_activity_window" or "close" never occur.

I need to remove an event listener on window close or hide (geolocation).
Thanks

Events only working on android?

Hey,

are the events (like "viewDidClose", ...) just working on android? I am using them and on ios nothing happens.

Suggestions?

Crash when Google Map is added

App always crashes when I added map to the centerView. There was no problem with the map itself since I've tested it without NappDrawer. Anyone had this figured out - or NappDrawer doesn't support map?

Building with Titanium SDK 3.2, on android, with Google Maps v2 (2.1.3 version module)

Thanks in advance for any help.

Accessing Window for Android

When using this module in Android, the module creates a single window and then changes views that are specified in the leftWindow,rightWindow an centreWindow attributes right?

I would like to know if there is a way to access the mainWindow being used to encompass this views.. as i want to remove the titlebar of the window..

Anyone know how?

(referring to the nAppDrawer titlebar)

image

Orientation Modes - prevent Landscape?

Is there a way to prevent the app from going into Titanium.UI.LANDSCAPE_LEFT and Titanium.UI.LANDSCAPE_RIGHT mode? Unfortunately, assigning orientationModes = [Titanium.UI.PORTRAIT, Titanium.UI.UPSIDE_PORTRAIT] to leftWindow, centerWindow, rightWindow does not lead to success.

Holo Theme

Sorry, if this question sounds stupid. But how can I use NappDrawer with Hole Theme?

Of course I have defined this theme correctly in tiapp.xml. Without NappDrawer a slider UI e.g. is shown differently than with this module (nice blue rounded instead of yellow rectangle).

Changing the text color of the top menu

Hello,

I have been messing around but cannot seem to be able to change the top menu color.

I added in the provided example under createCenterNavWindow() the color red but it stays black...

    var win = Ti.UI.createWindow({
            backgroundColor:'#eee',
            translucent:false,
            title:"NappDrawer",

            color: 'red',

            barColor:"#F9A",
            tintColor:"purple",
            leftNavButton: leftBtn,
            rightNavButton: rightBtn
    });

I can see in the screen shot that the text is white...
What am I doing wrong :(

Thanks
Chris

[iOS] Close gesture wish

Could you please provide a CLOSE_MODE_TAP_PANNING_CENTERWINDOW gesture?

That means a tap OR panning on the centerview to close it.

isLeftWindowOpen and isRightWindowOpen not working

It seems that if you check both isLeft and isRight WindowOpen at the same time and the left menu is open both return true.

Just drop this code at the end of the app.js code example. Any ideas why?

setInterval(function(e){
    Ti.API.info("isLeftWindowOpen: " + drawer.isLeftWindowOpen() + " isRightWindowOpen: " + drawer.isRightWindowOpen());    
}, 2000);

-Windows are created during open- exception using a tabgroup as a centerView

Hi,
I'd like to use the drawer in an existing android layout (based on alloy).
It consist of a tabgroup view which I'm trying to wrap with the drawer module
Launching the application I get:

Unable to start activity ComponentInfo{co.test.myapp/org.appcelerator.titanium.TiActivity}: 
java.lang.IllegalStateException: Windows are created during open; Titanium 3.1.3,2013/09/18 12:01,222f4d1

Code is like this

var centerView = Alloy.createController('tabgroup').getView();
var leftView = Ti.UI.createView({
  backgroundColor:'green',
  width: Ti.UI.FILL,
  height: Ti.UI.FILL
});
var d =NappDrawerModule.createDrawer({
  fullscreen:false,
  leftWindow: leftView,
  centerWindow: centerView,
  // other options
});
d.open();

Does this "means" something to you ?
The titanium source is here https://github.com/appcelerator/titanium_mobile/blob/master/android/titanium/src/java/org/appcelerator/titanium/proxy/TiWindowProxy.java#L80
and is in TiWindowProxy, so I suppose it is related to the drawer container.

Thanks!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.