List of usage examples for android.view.accessibility AccessibilityManager isEnabled
public boolean isEnabled()
From source file:com.android.leanlauncher.Workspace.java
protected void onResume() { AccessibilityManager am = (AccessibilityManager) getContext() .getSystemService(Context.ACCESSIBILITY_SERVICE); sAccessibilityEnabled = am.isEnabled(); }
From source file:com.aware.Aware_Preferences.java
/** * Check if the accessibility service for AWARE Aware is active * @return boolean isActive/* w w w . j av a2s. co m*/ */ private boolean isAccessibilityServiceActive() { AccessibilityManager accessibilityManager = (AccessibilityManager) getSystemService(ACCESSIBILITY_SERVICE); if (accessibilityManager.isEnabled()) { List<ServiceInfo> accessibilityServices = accessibilityManager.getAccessibilityServiceList(); for (ServiceInfo s : accessibilityServices) { if (s.name.equalsIgnoreCase("com.aware.Applications") || s.name.equalsIgnoreCase("com.aware.ApplicationsJB")) { return true; } } } return false; }
From source file:cc.flydev.launcher.Page.java
private void sendScrollAccessibilityEvent() { AccessibilityManager am = (AccessibilityManager) getContext() .getSystemService(Context.ACCESSIBILITY_SERVICE); if (am.isEnabled()) { AccessibilityEvent ev = AccessibilityEvent.obtain(AccessibilityEvent.TYPE_VIEW_SCROLLED); ev.setItemCount(getChildCount()); ev.setFromIndex(mCurrentPage);/*from w w w .j a v a2 s.c o m*/ final int action; if (getNextPage() >= mCurrentPage) { action = AccessibilityNodeInfo.ACTION_SCROLL_FORWARD; } else { action = AccessibilityNodeInfo.ACTION_SCROLL_BACKWARD; } ev.setAction(action); sendAccessibilityEventUnchecked(ev); } }
From source file:cc.flydev.launcher.Page.java
protected boolean computeScrollHelper() { if (mScroller.computeScrollOffset()) { // Don't bother scrolling if the page does not need to be moved if (getScrollX() != mScroller.getCurrX() || getScrollY() != mScroller.getCurrY() || mOverScrollX != mScroller.getCurrX()) { float scaleX = mFreeScroll ? getScaleX() : 1f; int scrollX = (int) (mScroller.getCurrX() * (1 / scaleX)); scrollTo(scrollX, mScroller.getCurrY()); }/* w w w. j a v a 2s .c o m*/ invalidate(); return true; } else if (mNextPage != INVALID_PAGE) { sendScrollAccessibilityEvent(); mCurrentPage = Math.max(0, Math.min(mNextPage, getPageCount() - 1)); mNextPage = INVALID_PAGE; notifyPageSwitchListener(); // Load the associated pages if necessary if (mDeferLoadAssociatedPagesUntilScrollCompletes) { loadAssociatedPages(mCurrentPage); mDeferLoadAssociatedPagesUntilScrollCompletes = false; } // We don't want to trigger a page end moving unless the page has settled // and the user has stopped scrolling if (mTouchState == TOUCH_STATE_REST) { pageEndMoving(); } onPostReorderingAnimationCompleted(); AccessibilityManager am = (AccessibilityManager) getContext() .getSystemService(Context.ACCESSIBILITY_SERVICE); if (am.isEnabled()) { // Notify the user when the page changes announceForAccessibility(getCurrentPageDescription()); } return true; } return false; }
From source file:com.aliyun.homeshell.Folder.java
public 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);// w w w . ja va2 s .c om accessibilityManager.sendAccessibilityEvent(event); } }
From source file:com.n2hsu.launcher.Page.java
protected boolean computeScrollHelper() { if (mScroller.computeScrollOffset()) { // Don't bother scrolling if the page does not need to be moved if (getScrollX() != mScroller.getCurrX() || getScrollY() != mScroller.getCurrY() || mOverScrollX != mScroller.getCurrX()) { float scaleX = mFreeScroll ? getScaleX() : 1f; int scrollX = (int) (mScroller.getCurrX() * (1 / scaleX)); scrollTo(scrollX, mScroller.getCurrY()); }/*from www.j ava 2 s . c o m*/ invalidate(); return true; } else if (mNextPage != INVALID_PAGE) { sendScrollAccessibilityEvent(); mCurrentPage = Math.max(0, Math.min(mNextPage, getPageCount() - 1)); mNextPage = INVALID_PAGE; notifyPageSwitchListener(); // Load the associated pages if necessary if (mDeferLoadAssociatedPagesUntilScrollCompletes) { loadAssociatedPages(mCurrentPage); mDeferLoadAssociatedPagesUntilScrollCompletes = false; } // We don't want to trigger a page end moving unless the page has // settled // and the user has stopped scrolling if (mTouchState == TOUCH_STATE_REST) { pageEndMoving(); } onPostReorderingAnimationCompleted(); AccessibilityManager am = (AccessibilityManager) getContext() .getSystemService(Context.ACCESSIBILITY_SERVICE); if (am.isEnabled()) { // Notify the user when the page changes announceForAccessibility(getCurrentPageDescription()); } return true; } return false; }
From source file:de.vanita5.twittnuker.util.Utils.java
public static void announceForAccessibilityCompat(final Context context, final View view, final CharSequence text, final Class<?> cls) { final AccessibilityManager accessibilityManager = (AccessibilityManager) context .getSystemService(Context.ACCESSIBILITY_SERVICE); if (!accessibilityManager.isEnabled()) return;//from ww w. ja v a 2 s.c o m // Prior to SDK 16, announcements could only be made through FOCUSED // events. Jelly Bean (SDK 16) added support for speaking text verbatim // using the ANNOUNCEMENT event type. final int eventType; if (Build.VERSION.SDK_INT < Build.VERSION_CODES.JELLY_BEAN) { eventType = AccessibilityEvent.TYPE_VIEW_FOCUSED; } else { eventType = AccessibilityEventCompat.TYPE_ANNOUNCEMENT; } // Construct an accessibility event with the minimum recommended // attributes. An event without a class name or package may be dropped. final AccessibilityEvent event = AccessibilityEvent.obtain(eventType); event.getText().add(text); event.setClassName(cls.getName()); event.setPackageName(context.getPackageName()); event.setSource(view); // Sends the event directly through the accessibility manager. If your // application only targets SDK 14+, you should just call // getParent().requestSendAccessibilityEvent(this, event); accessibilityManager.sendAccessibilityEvent(event); }
From source file:com.wb.launcher3.Page.java
protected boolean computeScrollHelper() { if (mScroller.computeScrollOffset()) { // Don't bother scrolling if the page does not need to be moved if (getScrollX() != mScroller.getCurrX() || getScrollY() != mScroller.getCurrY() || mOverScrollX != mScroller.getCurrX()) { float scaleX = mFreeScroll ? getScaleX() : 1f; int scrollX = (int) (mScroller.getCurrX() * (1 / scaleX)); scrollTo(scrollX, mScroller.getCurrY()); }/*from ww w. j a v a 2 s . c o m*/ invalidate(); return true; } else if (mNextPage != INVALID_PAGE) { sendScrollAccessibilityEvent(); mCurrentPage = Math.max(0, Math.min(mNextPage, getPageCount() - 1)); mNextPage = INVALID_PAGE; //*/Added by tyd Greg 2014-03-20,for transition effect if (TydtechConfig.CYCLE_ROLL_PAGES_ENABLED && m_isCycleSnaped) { updateCurrentPageScroll(); m_isScrollWallpaper = false; m_isCycleSnaped = false; } //*/ notifyPageSwitchListener(); // Load the associated pages if necessary if (mDeferLoadAssociatedPagesUntilScrollCompletes) { loadAssociatedPages(mCurrentPage); mDeferLoadAssociatedPagesUntilScrollCompletes = false; } // We don't want to trigger a page end moving unless the page has settled // and the user has stopped scrolling if (mTouchState == TOUCH_STATE_REST) { pageEndMoving(); } onPostReorderingAnimationCompleted(); AccessibilityManager am = (AccessibilityManager) getContext() .getSystemService(Context.ACCESSIBILITY_SERVICE); if (am.isEnabled()) { // Notify the user when the page changes announceForAccessibility(getCurrentPageDescription()); } return true; } return false; }
From source file:cc.flydev.launcher.Workspace.java
protected void onResume() { if (getPageIndicator() != null) { // In case accessibility state has changed, we need to perform this on every // attach to window OnClickListener listener = getPageIndicatorClickListener(); if (listener != null) { getPageIndicator().setOnClickListener(listener); }//from w w w . j a v a 2 s . c o m } AccessibilityManager am = (AccessibilityManager) getContext() .getSystemService(Context.ACCESSIBILITY_SERVICE); sAccessibilityEnabled = am.isEnabled(); }
From source file:com.example.launcher3.Workspace.java
protected void onResume() { if (getPageIndicator() != null) { // In case accessibility state has changed, we need to perform this // on every // attach to window OnClickListener listener = getPageIndicatorClickListener(); if (listener != null) { getPageIndicator().setOnClickListener(listener); }/*from www . j a va 2s.c o m*/ } AccessibilityManager am = (AccessibilityManager) getContext() .getSystemService(Context.ACCESSIBILITY_SERVICE); sAccessibilityEnabled = am.isEnabled(); }