Example usage for android.view.accessibility AccessibilityManager isTouchExplorationEnabled

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

Introduction

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

Prototype

public boolean isTouchExplorationEnabled() 

Source Link

Document

Returns if the touch exploration in the system is enabled.

Usage

From source file:com.hippo.widget.lockpattern.LockPatternView.java

@Override
public boolean onHoverEvent(@NonNull MotionEvent event) {
    AccessibilityManager accessibilityManager = (AccessibilityManager) getContext()
            .getSystemService(Context.ACCESSIBILITY_SERVICE);
    if (accessibilityManager.isTouchExplorationEnabled()) {
        final int action = event.getAction();
        switch (action) {
        case MotionEvent.ACTION_HOVER_ENTER:
            event.setAction(MotionEvent.ACTION_DOWN);
            break;
        case MotionEvent.ACTION_HOVER_MOVE:
            event.setAction(MotionEvent.ACTION_MOVE);
            break;
        case MotionEvent.ACTION_HOVER_EXIT:
            event.setAction(MotionEvent.ACTION_UP);
            break;
        }//from  w w  w  .  j  a va  2  s  . co m
        onTouchEvent(event);
        event.setAction(action);
    }
    return super.onHoverEvent(event);
}

From source file:org.onebusaway.android.ui.HomeActivity.java

@Override
public void onStart() {
    super.onStart();
    // Make sure GoogleApiClient is connected, if available
    if (mGoogleApiClient != null && !mGoogleApiClient.isConnected()) {
        mGoogleApiClient.connect();/*from www .j a  va 2 s .  c  o m*/
    }
    ObaAnalytics.reportActivityStart(this);
    if (Build.VERSION.SDK_INT >= 14) {
        AccessibilityManager am = (AccessibilityManager) getSystemService(ACCESSIBILITY_SERVICE);
        Boolean isTalkBackEnabled = am.isTouchExplorationEnabled();
        if (isTalkBackEnabled) {
            ObaAnalytics.reportEventWithCategory(ObaAnalytics.ObaEventCategory.ACCESSIBILITY.toString(),
                    getString(R.string.analytics_action_touch_exploration),
                    getString(R.string.analytics_label_talkback) + getClass().getSimpleName()
                            + " using TalkBack");
        }
    }
}

From source file:com.android.incallui.widget.multiwaveview.GlowPadView.java

@Override
public boolean onHoverEvent(MotionEvent event) {
    final AccessibilityManager accessibilityManager = (AccessibilityManager) getContext()
            .getSystemService(Context.ACCESSIBILITY_SERVICE);
    if (accessibilityManager.isTouchExplorationEnabled()) {
        final int action = event.getAction();
        switch (action) {
        case MotionEvent.ACTION_HOVER_ENTER:
            event.setAction(MotionEvent.ACTION_DOWN);
            break;
        case MotionEvent.ACTION_HOVER_MOVE:
            event.setAction(MotionEvent.ACTION_MOVE);
            break;
        case MotionEvent.ACTION_HOVER_EXIT:
            event.setAction(MotionEvent.ACTION_UP);
            break;
        }//from   www  . j  av a2s. c  om
        onTouchEvent(event);
        event.setAction(action);
    }
    super.onHoverEvent(event);
    return true;
}

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

@Override
protected OnClickListener getPageIndicatorClickListener() {
    AccessibilityManager am = (AccessibilityManager) getContext()
            .getSystemService(Context.ACCESSIBILITY_SERVICE);
    if (!am.isTouchExplorationEnabled()) {
        return null;
    }//from   ww  w.  j av  a2s .  c o m
    OnClickListener listener = new OnClickListener() {
        @Override
        public void onClick(View arg0) {
            enterOverviewMode();
        }
    };
    return listener;
}

From source file:com.klinker.android.launcher.launcher3.Workspace.java

@Override
protected OnClickListener getPageIndicatorClickListener() {
    AccessibilityManager am = (AccessibilityManager) getContext()
            .getSystemService(Context.ACCESSIBILITY_SERVICE);
    if (!am.isTouchExplorationEnabled()) {
        return null;
    }/* w w  w .  ja v  a2  s .  c  om*/
    OnClickListener listener = new OnClickListener() {
        @Override
        public void onClick(View arg0) {
            mLauncher.showOverviewMode(true);
        }
    };
    return listener;
}

From source file:com.android.soma.Launcher.java

private boolean isClingsEnabled() {
    if (DISABLE_CLINGS) {
        return false;
    }//from w  ww .  java2 s  .  c o m

    // For now, limit only to phones
    LauncherAppState app = LauncherAppState.getInstance();
    DeviceProfile grid = app.getDynamicGrid().getDeviceProfile();
    if (grid.isTablet()) {
        return false;
    }

    // disable clings when running in a test harness
    if (ActivityManager.isRunningInTestHarness())
        return false;

    // Disable clings for accessibility when explore by touch is enabled
    final AccessibilityManager a11yManager = (AccessibilityManager) getSystemService(ACCESSIBILITY_SERVICE);
    if (a11yManager.isTouchExplorationEnabled()) {
        return false;
    }

    // Restricted secondary users (child mode) will potentially have very few apps
    // seeded when they start up for the first time. Clings won't work well with that
    //        boolean supportsLimitedUsers =
    //                android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.JELLY_BEAN_MR2;
    //        Account[] accounts = AccountManager.get(this).getAccounts();
    //        if (supportsLimitedUsers && accounts.length == 0) {
    //            UserManager um = (UserManager) getSystemService(Context.USER_SERVICE);
    //            Bundle restrictions = um.getUserRestrictions();
    //            if (restrictions.getBoolean(UserManager.DISALLOW_MODIFY_ACCOUNTS, false)) {
    //               return false;
    //            }
    //        }
    return true;
}

From source file:com.lb.launcher.Workspace.java

@Override
protected OnClickListener getPageIndicatorClickListener() {
    AccessibilityManager am = (AccessibilityManager) getContext()
            .getSystemService(Context.ACCESSIBILITY_SERVICE);
    if (!am.isTouchExplorationEnabled()) {
        return null;
    }/*from   w w w . j a  v  a 2 s . com*/
    OnClickListener listener = new OnClickListener() {
        @Override
        public void onClick(View arg0) {
            Log.v(getClass().toString() + ":anon:onClick:", arg0.toString()); // added by H.Yasui 2016/11/

            enterOverviewMode();
        }
    };
    return listener;
}

From source file:myblog.richard.vewe.launcher3.Workspace.java

@Override
protected OnClickListener getPageIndicatorClickListener() {
    AccessibilityManager am = (AccessibilityManager) getContext()
            .getSystemService(Context.ACCESSIBILITY_SERVICE);
    if (!am.isTouchExplorationEnabled()) {
        return null;
    }//from www .j av  a2 s.c  o  m
    OnClickListener listener = new OnClickListener() {
        @Override
        public void onClick(View arg0) {
            enterOverviewMode();
            mLauncher.onEnterOverviewMode();
        }
    };
    return listener;
}