BJTAWJ / webclient-mobile-for-ca-plex

Automatically exported from code.google.com/p/webclient-mobile-for-ca-plex
0 stars 0 forks source link

Back button reverse transition effect #14

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
Not a defect - but and enhancement.

From a user interaction perspective the back button should transition the 
screens in the reverse direction to all other buttons.

Also I wanted to be able to change the animation for transitions.

I have achieved this by making the following changes:

1. WebPushbutton.ctrl handler changes:

        /(!If:/(!Event:phys=Pressed))
            /(!If:/(!Param:ui)=back)
            window.backButtonPressed = true;
            /(!If)
            /(!If:/(!Param:animType)=)
            /(!Else)
            window.panelAnimType = "/(!Param:animType)",
            /(!If)
            /(!If:/(!Param:animDuration)=)
            /(!Else)
            window.panelAnimDuration = /(!Param:animDuration),
            /(!If)
            panel.submit(wcli.util.evt("Pressed", "/(!NameID)"));
        /(!If)

2. util.js changes:

                        controller.on('cardswitch', function() {
                            panel.destroy();
                            window.panel = newPanel;
                        }, { single: true });

                        // 20 Jun 2011 HawkBridge - Add support for WebBackbutton template
                        var animType = 'slide';
                        if (window.panelAnimType) {
                            animType = window.panelAnimType;
                        };
                        // 20 Jul 2011 issue with durations being defined!
                        var animDuration = 250;
                        if (window.panelAnimDuration) {
                            animDuration = window.panelAnimDuration;
                        };
                        if (window.backButtonPressed == true) {
                            controller.setActiveItem(newPanel, {type: animType, direction: 'right', duration: animDuration});
                        } else {
                            controller.setActiveItem(newPanel, {type: animType, direction: 'left', duration: animDuration});
                        }
                        window.backButtonPressed = false;
                        window.panelAnimType = null;
                        window.panelAnimDuration = null;
                        // controller.setActiveItem(newPanel, 'slide');
                        // end HawkBridge mod

                        eval(result.postInit).call(window);

3. For the Plex button control name we can now use the following parameters:

- "ui=back" to reverse the slide direction
- "animType" to specify the animation type
- "animDuration" to specify the duration of the animation

Original issue reported on code.google.com by darryl.m...@radmt.com on 31 Jul 2011 at 9:38