Package net.rim.device.api.amms.control.camera

Examples of net.rim.device.api.amms.control.camera.FeatureControl


     * Builds the menu items for the various scene modes supported on the device
     */
    private void buildSceneModeMenuItems() {

        // Feature Control allows for accessing the various scene modes
        final FeatureControl featureControl =
                (FeatureControl) _player
                        .getControl("net.rim.device.api.amms.control.camera.FeatureControl");

        if (featureControl != null) {
            // Use a Vector to store each of the scene mode (sub)menu items
            final Vector sceneModeMenuItems = new Vector();

            // Check for auto scene mode support
            if (featureControl
                    .isSceneModeSupported(FeatureControl.SCENE_MODE_AUTO)) {
                final MenuItem enableSceneModeAuto =
                        new MenuItem(new StringProvider(
                                "Enable Scene Mode: AUTO"), Integer.MAX_VALUE,
                                0);
                enableSceneModeAuto.setCommand(new Command(
                        new CommandHandler() {
                            /**
                             * @see CommandHandler#execute(ReadOnlyCommandMetadata,
                             *      Object)
                             */
                            public void execute(
                                    final ReadOnlyCommandMetadata metadata,
                                    final Object context) {
                                featureControl
                                        .setSceneMode(FeatureControl.SCENE_MODE_AUTO);
                            };
                        }));

                sceneModeMenuItems.addElement(enableSceneModeAuto);
            }

            // Check for beach scene mode support
            if (featureControl
                    .isSceneModeSupported(FeatureControl.SCENE_MODE_BEACH)) {
                final MenuItem enableSceneModeBeach =
                        new MenuItem(new StringProvider(
                                "Enable Scene Mode: BEACH"), Integer.MAX_VALUE,
                                0);
                enableSceneModeBeach.setCommand(new Command(
                        new CommandHandler() {
                            /**
                             * @see CommandHandler#execute(ReadOnlyCommandMetadata,
                             *      Object)
                             */
                            public void execute(
                                    final ReadOnlyCommandMetadata metadata,
                                    final Object context) {
                                featureControl
                                        .setSceneMode(FeatureControl.SCENE_MODE_BEACH);
                            };
                        }));

                sceneModeMenuItems.addElement(enableSceneModeBeach);
            }

            // Check for face detection scene mode support
            if (featureControl
                    .isSceneModeSupported(FeatureControl.SCENE_MODE_FACEDETECTION)) {
                final MenuItem enableSceneModeFaceDetection =
                        new MenuItem(new StringProvider(
                                "Enable Scene Mode: FACE DETECTION"),
                                Integer.MAX_VALUE, 0);
                enableSceneModeFaceDetection.setCommand(new Command(
                        new CommandHandler() {
                            /**
                             * @see CommandHandler#execute(ReadOnlyCommandMetadata,
                             *      Object)
                             */
                            public void execute(
                                    final ReadOnlyCommandMetadata metadata,
                                    final Object context) {
                                featureControl
                                        .setSceneMode(FeatureControl.SCENE_MODE_FACEDETECTION);
                            };
                        }));

                sceneModeMenuItems.addElement(enableSceneModeFaceDetection);
            }

            // Check for landscape scene mode support
            if (featureControl
                    .isSceneModeSupported(FeatureControl.SCENE_MODE_LANDSCAPE)) {
                final MenuItem enableSceneModeLandscape =
                        new MenuItem(new StringProvider(
                                "Enable Scene Mode: LANDSCAPE"),
                                Integer.MAX_VALUE, 0);
                enableSceneModeLandscape.setCommand(new Command(
                        new CommandHandler() {
                            /**
                             * @see CommandHandler#execute(ReadOnlyCommandMetadata,
                             *      Object)
                             */
                            public void execute(
                                    final ReadOnlyCommandMetadata metadata,
                                    final Object context) {
                                featureControl
                                        .setSceneMode(FeatureControl.SCENE_MODE_LANDSCAPE);
                            };
                        }));

                sceneModeMenuItems.addElement(enableSceneModeLandscape);
            }

            // Check for macro scene mode support
            if (featureControl
                    .isSceneModeSupported(FeatureControl.SCENE_MODE_MACRO)) {
                final MenuItem enableSceneModeMacro =
                        new MenuItem(new StringProvider(
                                "Enable Scene Mode: MACRO"), Integer.MAX_VALUE,
                                0);
                enableSceneModeMacro.setCommand(new Command(
                        new CommandHandler() {
                            /**
                             * @see CommandHandler#execute(ReadOnlyCommandMetadata,
                             *      Object)
                             */
                            public void execute(
                                    final ReadOnlyCommandMetadata metadata,
                                    final Object context) {
                                featureControl
                                        .setSceneMode(FeatureControl.SCENE_MODE_MACRO);
                            };
                        }));

                sceneModeMenuItems.addElement(enableSceneModeMacro);
            }

            // Check for night scene mode support
            if (featureControl
                    .isSceneModeSupported(FeatureControl.SCENE_MODE_NIGHT)) {
                final MenuItem enableSceneModeNight =
                        new MenuItem(new StringProvider(
                                "Enable Scene Mode: NIGHT"), Integer.MAX_VALUE,
                                0);
                enableSceneModeNight.setCommand(new Command(
                        new CommandHandler() {
                            /**
                             * @see CommandHandler#execute(ReadOnlyCommandMetadata,
                             *      Object)
                             */
                            public void execute(
                                    final ReadOnlyCommandMetadata metadata,
                                    final Object context) {
                                featureControl
                                        .setSceneMode(FeatureControl.SCENE_MODE_NIGHT);
                            };
                        }));

                sceneModeMenuItems.addElement(enableSceneModeNight);
            }

            // Check for party scene mode support
            if (featureControl
                    .isSceneModeSupported(FeatureControl.SCENE_MODE_PARTY)) {
                final MenuItem enableSceneModeParty =
                        new MenuItem(new StringProvider(
                                "Enable Scene Mode: PARTY"), Integer.MAX_VALUE,
                                0);
                enableSceneModeParty.setCommand(new Command(
                        new CommandHandler() {
                            /**
                             * @see CommandHandler#execute(ReadOnlyCommandMetadata,
                             *      Object)
                             */
                            public void execute(
                                    final ReadOnlyCommandMetadata metadata,
                                    final Object context) {
                                featureControl
                                        .setSceneMode(FeatureControl.SCENE_MODE_PARTY);
                            };
                        }));

                sceneModeMenuItems.addElement(enableSceneModeParty);
            }

            // Check for portrait scene mode support
            if (featureControl
                    .isSceneModeSupported(FeatureControl.SCENE_MODE_PORTRAIT)) {
                final MenuItem enableSceneModePortrait =
                        new MenuItem(new StringProvider(
                                "Enable Scene Mode: PORTRAIT"),
                                Integer.MAX_VALUE, 0);
                enableSceneModePortrait.setCommand(new Command(
                        new CommandHandler() {
                            /**
                             * @see CommandHandler#execute(ReadOnlyCommandMetadata,
                             *      Object)
                             */
                            public void execute(
                                    final ReadOnlyCommandMetadata metadata,
                                    final Object context) {
                                featureControl
                                        .setSceneMode(FeatureControl.SCENE_MODE_PORTRAIT);
                            };
                        }));

                sceneModeMenuItems.addElement(enableSceneModePortrait);
            }

            // Check for snow scene mode support
            if (featureControl
                    .isSceneModeSupported(FeatureControl.SCENE_MODE_SNOW)) {
                final MenuItem enableSceneModeSnow =
                        new MenuItem(new StringProvider(
                                "Enable Scene Mode: SNOW"), Integer.MAX_VALUE,
                                0);
                enableSceneModeSnow.setCommand(new Command(
                        new CommandHandler() {
                            /**
                             * @see CommandHandler#execute(ReadOnlyCommandMetadata,
                             *      Object)
                             */
                            public void execute(
                                    final ReadOnlyCommandMetadata metadata,
                                    final Object context) {
                                featureControl
                                        .setSceneMode(FeatureControl.SCENE_MODE_SNOW);
                            };
                        }));

                sceneModeMenuItems.addElement(enableSceneModeSnow);
            }

            // Check for sport scene mode support
            if (featureControl
                    .isSceneModeSupported(FeatureControl.SCENE_MODE_SPORT)) {
                final MenuItem enableSceneModeSport =
                        new MenuItem(new StringProvider(
                                "Enable Scene Mode: SPORT"), Integer.MAX_VALUE,
                                0);
                enableSceneModeSport.setCommand(new Command(
                        new CommandHandler() {
                            /**
                             * @see CommandHandler#execute(ReadOnlyCommandMetadata,
                             *      Object)
                             */
                            public void execute(
                                    final ReadOnlyCommandMetadata metadata,
                                    final Object context) {
                                featureControl
                                        .setSceneMode(FeatureControl.SCENE_MODE_SPORT);
                            };
                        }));

                sceneModeMenuItems.addElement(enableSceneModeSport);
            }

            // Check for text scene mode support
            if (featureControl
                    .isSceneModeSupported(FeatureControl.SCENE_MODE_TEXT)) {
                final MenuItem enableSceneModeText =
                        new MenuItem(new StringProvider(
                                "Enable Scene Mode: TEXT"), Integer.MAX_VALUE,
                                0);
                enableSceneModeText.setCommand(new Command(
                        new CommandHandler() {
                            /**
                             * @see CommandHandler#execute(ReadOnlyCommandMetadata,
                             *      Object)
                             */
                            public void execute(
                                    final ReadOnlyCommandMetadata metadata,
                                    final Object context) {
                                featureControl
                                        .setSceneMode(FeatureControl.SCENE_MODE_TEXT);
                            };
                        }));

                sceneModeMenuItems.addElement(enableSceneModeText);
View Full Code Here

TOP

Related Classes of net.rim.device.api.amms.control.camera.FeatureControl

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.