Giter Site home page Giter Site logo

Comments (22)

viezel avatar viezel commented on June 16, 2024

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.

timanrebel avatar timanrebel commented on June 16, 2024

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.

viezel avatar viezel commented on June 16, 2024

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.

timanrebel avatar timanrebel commented on June 16, 2024

Isee that the Proxy extends the TiUIWindowProxy, but Drawer extends TiUIView. Is that correct? Shouldn't that be TiUiWindow as well?

from nappdrawer.

MatteoRosina avatar MatteoRosina commented on June 16, 2024

Did you manage to find a solution to this?

from nappdrawer.

viezel avatar viezel commented on June 16, 2024

nope, i did not. Cause I cannot just extend TiUIWindowProxy.. Titanium's window architecture is kinda tricky.

from nappdrawer.

MatteoRosina avatar MatteoRosina commented on June 16, 2024

Is there not even any work-around to permit the use of the action bar on android?

from nappdrawer.

IGx89 avatar IGx89 commented on June 16, 2024

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.

viezel avatar viezel commented on June 16, 2024

@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.

timanrebel avatar timanrebel commented on June 16, 2024

Shout!

Although my experience with Android native modules is limited

from nappdrawer.

viezel avatar viezel commented on June 16, 2024

@timanrebel learn something new ;) Its actually not that hard. I find java quite easy to learn.

from nappdrawer.

viezel avatar viezel commented on June 16, 2024

shout as in - please explain what needs to be done?

from nappdrawer.

viezel avatar viezel commented on June 16, 2024

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.

IGx89 avatar IGx89 commented on June 16, 2024

Thanks for all that information! I like a good challenge, so I just may take a stab at it this weekend...

from nappdrawer.

viezel avatar viezel commented on June 16, 2024

sounds awesome. let me know if you have any additional question.

from nappdrawer.

ashokfernandez avatar ashokfernandez commented on June 16, 2024

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.

IGx89 avatar IGx89 commented on June 16, 2024

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.

IGx89 avatar IGx89 commented on June 16, 2024

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.

viezel avatar viezel commented on June 16, 2024

@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.

IGx89 avatar IGx89 commented on June 16, 2024

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.

viezel avatar viezel commented on June 16, 2024

that would be great

from nappdrawer.

IGx89 avatar IGx89 commented on June 16, 2024

Pull request submitted: #47

from nappdrawer.

Related Issues (20)

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.