Example usage for android.view.accessibility AccessibilityManager isEnabled

List of usage examples for android.view.accessibility AccessibilityManager isEnabled

Introduction

In this page you can find the example usage for android.view.accessibility AccessibilityManager isEnabled.

Prototype

public boolean isEnabled() 

Source Link

Document

Returns if the accessibility in the system is enabled.

Usage

From source file:com.android.contacts.activities.ContactDetailActivity.java

/**
 * Setup the activity title and subtitle with contact name and company.
 *///from  w  w w.  j  a  va 2  s .  com
private void setupTitle() {
    CharSequence displayName = ContactDetailDisplayUtils.getDisplayName(this, mContactData);
    String company = ContactDetailDisplayUtils.getCompany(this, mContactData);

    ActionBar actionBar = getActionBar();
    actionBar.setTitle(displayName);
    actionBar.setSubtitle(company);

    final StringBuilder talkback = new StringBuilder();
    if (!TextUtils.isEmpty(displayName)) {
        talkback.append(displayName);
    }
    if (!TextUtils.isEmpty(company)) {
        if (talkback.length() != 0) {
            talkback.append(", ");
        }
        talkback.append(company);
    }

    if (talkback.length() != 0) {
        AccessibilityManager accessibilityManager = (AccessibilityManager) this
                .getSystemService(Context.ACCESSIBILITY_SERVICE);
        if (accessibilityManager.isEnabled()) {
            View decorView = getWindow().getDecorView();
            decorView.setContentDescription(talkback);
            decorView.sendAccessibilityEvent(AccessibilityEvent.TYPE_WINDOW_STATE_CHANGED);
        }
    }
}

From source file:com.renard.ocr.BaseDocumentActivitiy.java

protected void loadBitmapFromContentUri(final Uri cameraPicUri, ImageSource source) {
    mImageSource = source;/*  ww  w . j av  a2 s . c o  m*/
    if (mBitmapLoadTask != null) {
        mBitmapLoadTask.cancel(true);
    }
    AccessibilityManager am = (AccessibilityManager) getSystemService(ACCESSIBILITY_SERVICE);
    boolean isAccessibilityEnabled = am.isEnabled();
    boolean isExploreByTouchEnabled = AccessibilityManagerCompat.isTouchExplorationEnabled(am);
    final boolean skipCrop = isExploreByTouchEnabled && isAccessibilityEnabled;

    registerImageLoaderReceiver();
    mBitmapLoadTask = new ImageLoadAsyncTask(this, skipCrop, rotateXDegrees, cameraPicUri).execute();

}

From source file:com.example.linhdq.test.documents.creation.NewDocumentActivity.java

protected void loadBitmapFromContentUri(final Uri cameraPicUri, ImageSource source) {
    mImageSource = source;/*from   w w w .j  a  va 2s.c  o m*/
    if (mBitmapLoadTask != null) {
        mBitmapLoadTask.cancel(true);
    }
    AccessibilityManager am = (AccessibilityManager) getSystemService(ACCESSIBILITY_SERVICE);
    boolean isAccessibilityEnabled = am.isEnabled();
    boolean isExploreByTouchEnabled = AccessibilityManagerCompat.isTouchExplorationEnabled(am);
    final boolean skipCrop = isExploreByTouchEnabled && isAccessibilityEnabled;

    registerImageLoaderReceiver();
    mBitmapLoadTask = new ImageLoadAsyncTask(this, skipCrop, cameraPicUri).execute();

}

From source file:org.mozilla.gecko.GeckoAppShell.java

public static boolean getAccessibilityEnabled() {
    AccessibilityManager accessibilityManager = (AccessibilityManager) GeckoApp.mAppContext
            .getSystemService(Context.ACCESSIBILITY_SERVICE);
    return accessibilityManager.isEnabled();
}

From source file:com.renard.ocr.documents.creation.NewDocumentActivity.java

protected void loadBitmapFromContentUri(final Uri cameraPicUri, ImageSource source) {
    if (TextFairyApplication.isRelease()) {
        Crashlytics.log("Loading " + cameraPicUri.toString() + " from " + source.name());
    }//from  www  .ja v  a 2s.  c  o m
    mImageSource = source;
    if (mBitmapLoadTask != null) {
        mBitmapLoadTask.cancel(true);
    }
    AccessibilityManager am = (AccessibilityManager) getSystemService(ACCESSIBILITY_SERVICE);
    boolean isAccessibilityEnabled = am.isEnabled();
    boolean isExploreByTouchEnabled = AccessibilityManagerCompat.isTouchExplorationEnabled(am);
    final boolean skipCrop = isExploreByTouchEnabled && isAccessibilityEnabled;

    registerImageLoaderReceiver();
    mBitmapLoadTask = new ImageLoadAsyncTask(this, skipCrop, cameraPicUri).execute();

}

From source file:org.mozilla.gecko.GeckoAppShell.java

public static void emitGeckoAccessibilityEvent(int eventType, String role, String text, String description,
        boolean enabled, boolean checked, boolean password) {
    AccessibilityManager accessibilityManager = (AccessibilityManager) GeckoApp.mAppContext
            .getSystemService(Context.ACCESSIBILITY_SERVICE);

    if (!accessibilityManager.isEnabled())
        return;//ww w.j  a  v a 2 s  . c  om

    LayerController layerController = GeckoApp.mAppContext.getLayerController();
    LayerView layerView = layerController.getView();

    AccessibilityEvent event = AccessibilityEvent.obtain(eventType);
    event.setClassName(layerView.getClass().getName() + "$" + role);
    event.setPackageName(GeckoApp.mAppContext.getPackageName());
    event.setEnabled(enabled);
    event.setChecked(checked);
    event.setPassword(password);
    event.setContentDescription(description);
    event.getText().add(text);

    accessibilityManager.sendAccessibilityEvent(event);
}

From source file:android.support.wear.widget.drawer.WearableDrawerLayout.java

public WearableDrawerLayout(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) {
    super(context, attrs, defStyleAttr, defStyleRes);

    mFlingWatcher = new FlingWatcherFactory(this);
    mTopDrawerDraggerCallback = new TopDrawerDraggerCallback();
    mTopDrawerDragger = ViewDragHelper.create(this, 1f /* sensitivity */, mTopDrawerDraggerCallback);
    mTopDrawerDragger.setEdgeTrackingEnabled(ViewDragHelper.EDGE_TOP);

    mBottomDrawerDraggerCallback = new BottomDrawerDraggerCallback();
    mBottomDrawerDragger = ViewDragHelper.create(this, 1f /* sensitivity */, mBottomDrawerDraggerCallback);
    mBottomDrawerDragger.setEdgeTrackingEnabled(ViewDragHelper.EDGE_BOTTOM);

    WindowManager windowManager = (WindowManager) context.getSystemService(Context.WINDOW_SERVICE);
    DisplayMetrics metrics = new DisplayMetrics();
    windowManager.getDefaultDisplay().getMetrics(metrics);
    mNestedScrollSlopPx = Math.round(metrics.density * NESTED_SCROLL_SLOP_DP);

    AccessibilityManager accessibilityManager = (AccessibilityManager) context
            .getSystemService(Context.ACCESSIBILITY_SERVICE);
    mIsAccessibilityEnabled = accessibilityManager.isEnabled();
}

From source file:cc.flydev.launcher.Folder.java

private void sendCustomAccessibilityEvent(int type, String text) {
    AccessibilityManager accessibilityManager = (AccessibilityManager) getContext()
            .getSystemService(Context.ACCESSIBILITY_SERVICE);
    if (accessibilityManager.isEnabled()) {
        AccessibilityEvent event = AccessibilityEvent.obtain(type);
        onInitializeAccessibilityEvent(event);
        event.getText().add(text);//from   ww  w  . ja v a2  s  . c om
        accessibilityManager.sendAccessibilityEvent(event);
    }
}

From source file:com.android.launcher3.Utilities.java

public static void sendCustomAccessibilityEvent(View target, int type, String text) {
    AccessibilityManager accessibilityManager = (AccessibilityManager) target.getContext()
            .getSystemService(Context.ACCESSIBILITY_SERVICE);
    if (accessibilityManager.isEnabled()) {
        AccessibilityEvent event = AccessibilityEvent.obtain(type);
        target.onInitializeAccessibilityEvent(event);
        event.getText().add(text);/* www.  j av a2  s.c o  m*/
        accessibilityManager.sendAccessibilityEvent(event);
    }
}

From source file:com.llf.android.launcher3.Folder.java

private void sendCustomAccessibilityEvent(int type, String text) {
    AccessibilityManager accessibilityManager = (AccessibilityManager) getContext()
            .getSystemService(Context.ACCESSIBILITY_SERVICE);
    if (accessibilityManager.isEnabled()) {
        AccessibilityEvent event = AccessibilityEvent.obtain(type);
        // XXX onInitializeAccessibilityEvent(event);
        event.getText().add(text);//from w  ww.jav a2 s.  c o m
        accessibilityManager.sendAccessibilityEvent(event);
    }
}