• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

phonegap/phonegap-mobile-accessibility: PhoneGap plugin to expose mobile accessi ...

原作者: [db:作者] 来自: 网络 收藏 邀请

开源软件名称(OpenSource Name):

phonegap/phonegap-mobile-accessibility

开源软件地址(OpenSource Url):

https://github.com/phonegap/phonegap-mobile-accessibility

开源编程语言(OpenSource Language):

JavaScript 38.1%

开源软件介绍(OpenSource Introduction):

phonegap-plugin-mobile-accessibility

==========================================

This plugin exposes information on the status of various accessibility features of mobile operating systems, including, for example, whether a screen reader is running, invert colors is enabled, and the preferred scaling for text. It also allows an application to send a string to be spoken by the screen reader, or a command to stop the screen reader from speaking.


Installation

$ cordova plugin add https://github.com/phonegap/phonegap-mobile-accessibility.git

Supported Platforms

  • Amazon Fire OS
  • Android
  • iOS

MobileAccessibility

The MobileAccessibility object, exposed by window.MobileAccessibility, provides methods for determining the status of accessibility features active on the user's device, methods changing the text zoom of the Cordova web view and for using the user's preferred text zoom as set in the operating system settings, and methods for sending a string to be spoken by the screen reader or to stop the screen reader from speaking.


Methods

  • MobileAccessibility.isScreenReaderRunning
  • MobileAccessibility.isVoiceOverRunning
  • MobileAccessibility.isTalkBackRunning
  • MobileAccessibility.isChromeVoxActive
  • MobileAccessibility.isClosedCaptioningEnabled
  • MobileAccessibility.isGuidedAccessEnabled
  • MobileAccessibility.isInvertColorsEnabled
  • MobileAccessibility.isMonoAudioEnabled
  • MobileAccessibility.isReduceMotionEnabled
  • MobileAccessibility.isTouchExplorationEnabled
  • MobileAccessibility.getTextZoom
  • MobileAccessibility.setTextZoom
  • MobileAccessibility.updateTextZoom
  • MobileAccessibility.usePreferredTextZoom
  • MobileAccessibility.postNotification
  • MobileAccessibility.speak
  • MobileAccessibility.stop

MobileAccessibility.isScreenReaderRunning(callback)

Makes an asynchronous call to native MobileAccessibility to determine if a screen reader is running.

Parameters
  • callback (Function) A callback method to receive the boolean result asynchronously from the native MobileAccessibility plugin.
Usage
    function isScreenReaderRunningCallback(boolean) {
        if (boolean) {
            console.log("Screen reader: ON");
            // Do something to improve the behavior of the application while a screen reader is active.
        } else {
            console.log("Screen reader: OFF");
        }
    }

    MobileAccessibility.isScreenReaderRunning(isScreenReaderRunningCallback);
Supported Platforms
  • Amazon Fire OS
  • Android
  • iOS

MobileAccessibility.isVoiceOverRunning(callback)

An iOS-specific proxy for the MobileAccessibility.isScreenReaderRunning method. This method will return false on Android and Amazon Fire OS.

Parameters
  • callback (Function) A callback method to receive the boolean result asynchronously from the native MobileAccessibility plugin.
Usage
    function isVoiceOverRunningCallback(boolean) {
        if (boolean) {
            console.log("Screen reader: ON");
            // Do something to improve the behavior of the application while a screen reader is active.
        } else {
            console.log("Screen reader: OFF");
        }
    }

    MobileAccessibility.isVoiceOverRunning(isVoiceOverRunningCallback);
Supported Platforms
  • iOS

MobileAccessibility.isTalkBackRunning(callback)

An Android/Amazon Fire OS-specific proxy for the MobileAccessibility.isScreenReaderRunning method. This method will return false on iOS.

Parameters
  • callback (Function) A callback method to receive the boolean result asynchronously from the native MobileAccessibility plugin.
Usage
    function isTalkBackRunningCallback(boolean) {
        if (boolean) {
            console.log("Screen reader: ON");
            // Do something to improve the behavior of the application while a screen reader is active.
        } else {
            console.log("Screen reader: OFF");
        }
    }

    MobileAccessibility.isTalkBackRunning(isTalkBackRunningCallback);
Supported Platforms
  • Amazon Fire OS
  • Android

MobileAccessibility.isChromeVoxActive()

On Android, this method returns true if ChromeVox is active and properly initialized with access to the text to speech API in the WebView. If TalkBack is running but ChromeVox is not active, this method is useful to alert the user of a potential problem.

Returns
  • boolean (Boolean) Returns true if ChromeVox is active and properly initialized with access to the text to speech API in the WebView.
Usage
    MobileAccessibility.isTalkBackRunning(
        function (bool) {
            console.log('Talkback status: ' + bool);
            if (bool) {
                /* Use setTimeout to account for latency in initialization of ChromeVox */
                setTimeout(function() {
                    if (MobileAccessibility.isChromeVoxActive()) {
                        console.log('ChromeVox is active.');
                    } else {
                        console.log('ChromeVox is not active.');

                        /* Notify the user of a potential problem */
                        MobileAccessibility.speak('The ChromeVox screen reader has failed to initialize. You may wish to close and restart this app.');
                    }
                }, 5000);
            }
        });
Supported Platforms
  • Amazon Fire OS
  • Android

MobileAccessibility.isBoldTextEnabled(callback)

Makes an asynchronous call to native MobileAccessibility to determine if Bold Text is enabled.

Parameters
  • callback (Function) A callback method to receive the boolean result asynchronously from the native MobileAccessibility plugin.
Usage
    function isBoldTextEnabledCallback(boolean) {
        if (boolean) {
            console.log("Bold Text: ON");
            // Do something to improve the behavior of the application while Bold Text is enabled.
        } else {
            console.log("Bold Text: OFF");
        }
    }

    MobileAccessibility.isBoldTextEnabled(isBoldTextEnabledCallback);
Supported Platforms
  • iOS

MobileAccessibility.isClosedCaptioningEnabled(callback)

Makes an asynchronous call to native MobileAccessibility to determine if system-level closed captioning is enabled on the device.

Parameters
  • callback (Function) A callback method to receive the boolean result asynchronously from the native MobileAccessibility plugin.
Usage
    function isClosedCaptioningEnabledCallback(boolean) {
        if (boolean) {
            console.log("Closed Captioning: ON");
            // Do something to improve the behavior of the application while closed captioning is enabled.
        } else {
            console.log("Closed Captioning: OFF");
        }
    }

    MobileAccessibility.isClosedCaptioningEnabled(isClosedCaptioningEnabledCallback);
Supported Platforms
  • Amazon Fire OS
  • Android
  • iOS

MobileAccessibility.isDarkerSystemColorsEnabled(callback)

Makes an asynchronous call to native MobileAccessibility to determine if Darker System Colors is enabled.

Parameters
  • callback (Function) A callback method to receive the boolean result asynchronously from the native MobileAccessibility plugin.
Usage
    function isDarkerSystemColorsEnabledCallback(boolean) {
        if (boolean) {
            console.log("Darker System Colors: ON");
            // Do something to improve the behavior of the application while Darker System Colors is enabled.
        } else {
            console.log("Darker System Colors: OFF");
        }
    }

    MobileAccessibility.isDarkerSystemColorsEnabled(isDarkerSystemColorsEnabledCallback);
Supported Platforms
  • iOS

MobileAccessibility.isGrayscaleEnabled(callback)

Makes an asynchronous call to native MobileAccessibility to determine if Grayscale is enabled.

Parameters
  • callback (Function) A callback method to receive the boolean result asynchronously from the native MobileAccessibility plugin.
Usage
    function isGrayscaleEnabledCallback(boolean) {
        if (boolean) {
            console.log("Grayscale: ON");
            // Do something to improve the behavior of the application while Grayscale is enabled.
        } else {
            console.log("Grayscale: OFF");
        }
    }

    MobileAccessibility.isGrayscaleEnabled(isGrayscaleEnabledCallback);
Supported Platforms
  • iOS

MobileAccessibility.isGuidedAccessEnabled(callback)

Makes an asynchronous call to native MobileAccessibility to determine if Guided Access is enabled.

Parameters
  • callback (Function) A callback method to receive the boolean result asynchronously from the native MobileAccessibility plugin.
Usage
    function isGuidedAccessEnabledCallback(boolean) {
        if (boolean) {
            console.log("Guided Access: ON");
            // Do something to improve the behavior of the application while Guided Access is enabled.
        } else {
            console.log("Guided Access: OFF");
        }
    }

    MobileAccessibility.isGuidedAccessEnabledEnabled(isGuidedAccessEnabledCallback);
Supported Platforms
  • iOS

MobileAccessibility.isInvertColorsEnabled(callback)

Makes an asynchronous call to native MobileAccessibility to determine if the display colors have been inverted.

Parameters
  • callback (Function) A callback method to receive the boolean result asynchronously from the native MobileAccessibility plugin.
Usage
    function isInvertColorsEnabledCallback(boolean) {
        if (boolean) {
            console.log("Invert Colors: ON");
            // Do something to improve the behavior of the application while Invert Colors is enabled.
        } else {
            console.log("Invert Colors: OFF");
        }
    }

    MobileAccessibility.isInvertColorsEnabled(isInvertColorsEnabledCallback);
Supported Platforms
  • iOS

MobileAccessibility.isMonoAudioEnabled(callback)

Makes an asynchronous call to native MobileAccessibility to determine if mono audio is enabled.

Parameters
  • callback (Function) A callback method to receive the boolean result asynchronously from the native MobileAccessibility plugin.
Usage
    function isMonoAudioEnabledCallback(boolean) {
        if (boolean) {
            console.log("Mono Audio: ON");
            // Do something to improve the behavior of the application while Mono Audio is enabled.
        } else {
            console.log("Mono Audio: OFF");
        }
    }

    MobileAccessibility.isMonoAudioEnabled(isMonoAudioEnabledCallback);
Supported Platforms
  • iOS

MobileAccessibility.isReduceMotionEnabled(callback)

Makes an asynchronous call to native MobileAccessibility to determine if reduce motion is enabled.

Parameters
  • callback (Function) A callback method to receive the boolean result asynchronously from the native MobileAccessibility plugin.
Usage

鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap