Java Code Examples for android.view.accessibility.AccessibilityManager#getInstance()

The following examples show how to use android.view.accessibility.AccessibilityManager#getInstance() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: MediaController.java    From android_9.0.0_r45 with Apache License 2.0 5 votes vote down vote up
public MediaController(Context context, AttributeSet attrs) {
    super(context, attrs);
    mRoot = this;
    mContext = context;
    mUseFastForward = true;
    mFromXml = true;
    mAccessibilityManager = AccessibilityManager.getInstance(context);
}
 
Example 2
Source File: MediaController.java    From android_9.0.0_r45 with Apache License 2.0 5 votes vote down vote up
public MediaController(Context context, boolean useFastForward) {
    super(context);
    mContext = context;
    mUseFastForward = useFastForward;
    initFloatingWindowLayout();
    initFloatingWindow();
    mAccessibilityManager = AccessibilityManager.getInstance(context);
}
 
Example 3
Source File: Toast.java    From android_9.0.0_r45 with Apache License 2.0 5 votes vote down vote up
private void trySendAccessibilityEvent() {
    AccessibilityManager accessibilityManager =
            AccessibilityManager.getInstance(mView.getContext());
    if (!accessibilityManager.isEnabled()) {
        return;
    }
    // treat toasts as notifications since they are used to
    // announce a transient piece of information to the user
    AccessibilityEvent event = AccessibilityEvent.obtain(
            AccessibilityEvent.TYPE_NOTIFICATION_STATE_CHANGED);
    event.setClassName(getClass().getName());
    event.setPackageName(mView.getContext().getPackageName());
    mView.dispatchPopulateAccessibilityEvent(event);
    accessibilityManager.sendAccessibilityEvent(event);
}
 
Example 4
Source File: JsWindow.java    From JsDroidCmd with Mozilla Public License 2.0 5 votes vote down vote up
private void trySendAccessibilityEvent() {
	AccessibilityManager accessibilityManager = AccessibilityManager
			.getInstance(mView.getContext());
	if (!accessibilityManager.isEnabled()) {
		return;
	}
	// treat toasts as notifications since they are used to
	// announce a transient piece of information to the user
	AccessibilityEvent event = AccessibilityEvent
			.obtain(AccessibilityEvent.TYPE_NOTIFICATION_STATE_CHANGED);
	event.setClassName(getClass().getName());
	event.setPackageName(mView.getContext().getPackageName());
	mView.dispatchPopulateAccessibilityEvent(event);
	accessibilityManager.sendAccessibilityEvent(event);
}
 
Example 5
Source File: ContextImpl.java    From AndroidComponentPlugin with Apache License 2.0 4 votes vote down vote up
public Object getService(ContextImpl ctx) {
    return AccessibilityManager.getInstance(ctx);
}
 
Example 6
Source File: ContextImpl.java    From AndroidComponentPlugin with Apache License 2.0 4 votes vote down vote up
public Object getService(ContextImpl ctx) {
    return AccessibilityManager.getInstance(ctx);
}
 
Example 7
Source File: ContextImpl.java    From AndroidComponentPlugin with Apache License 2.0 4 votes vote down vote up
public Object getService(ContextImpl ctx) {
    return AccessibilityManager.getInstance(ctx);
}
 
Example 8
Source File: ContextImpl.java    From AndroidComponentPlugin with Apache License 2.0 4 votes vote down vote up
public Object getService(ContextImpl ctx) {
    return AccessibilityManager.getInstance(ctx);
}
 
Example 9
Source File: ContextImpl.java    From AndroidComponentPlugin with Apache License 2.0 4 votes vote down vote up
public Object getService(ContextImpl ctx) {
    return AccessibilityManager.getInstance(ctx);
}
 
Example 10
Source File: ContextImpl.java    From AndroidComponentPlugin with Apache License 2.0 4 votes vote down vote up
public Object getService(ContextImpl ctx) {
    return AccessibilityManager.getInstance(ctx);
}
 
Example 11
Source File: ContextImpl.java    From AndroidComponentPlugin with Apache License 2.0 4 votes vote down vote up
public Object getService(ContextImpl ctx) {
    return AccessibilityManager.getInstance(ctx);
}
 
Example 12
Source File: AutofillManager.java    From android_9.0.0_r45 with Apache License 2.0 4 votes vote down vote up
CompatibilityBridge() {
    final AccessibilityManager am = AccessibilityManager.getInstance(mContext);
    am.setAccessibilityPolicy(this);
}
 
Example 13
Source File: KeyboardView.java    From android_9.0.0_r45 with Apache License 2.0 4 votes vote down vote up
public KeyboardView(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) {
    super(context, attrs, defStyleAttr, defStyleRes);

    TypedArray a = context.obtainStyledAttributes(
            attrs, android.R.styleable.KeyboardView, defStyleAttr, defStyleRes);

    LayoutInflater inflate =
            (LayoutInflater) context
                    .getSystemService(Context.LAYOUT_INFLATER_SERVICE);

    int previewLayout = 0;
    int keyTextSize = 0;

    int n = a.getIndexCount();

    for (int i = 0; i < n; i++) {
        int attr = a.getIndex(i);

        switch (attr) {
        case com.android.internal.R.styleable.KeyboardView_keyBackground:
            mKeyBackground = a.getDrawable(attr);
            break;
        case com.android.internal.R.styleable.KeyboardView_verticalCorrection:
            mVerticalCorrection = a.getDimensionPixelOffset(attr, 0);
            break;
        case com.android.internal.R.styleable.KeyboardView_keyPreviewLayout:
            previewLayout = a.getResourceId(attr, 0);
            break;
        case com.android.internal.R.styleable.KeyboardView_keyPreviewOffset:
            mPreviewOffset = a.getDimensionPixelOffset(attr, 0);
            break;
        case com.android.internal.R.styleable.KeyboardView_keyPreviewHeight:
            mPreviewHeight = a.getDimensionPixelSize(attr, 80);
            break;
        case com.android.internal.R.styleable.KeyboardView_keyTextSize:
            mKeyTextSize = a.getDimensionPixelSize(attr, 18);
            break;
        case com.android.internal.R.styleable.KeyboardView_keyTextColor:
            mKeyTextColor = a.getColor(attr, 0xFF000000);
            break;
        case com.android.internal.R.styleable.KeyboardView_labelTextSize:
            mLabelTextSize = a.getDimensionPixelSize(attr, 14);
            break;
        case com.android.internal.R.styleable.KeyboardView_popupLayout:
            mPopupLayout = a.getResourceId(attr, 0);
            break;
        case com.android.internal.R.styleable.KeyboardView_shadowColor:
            mShadowColor = a.getColor(attr, 0);
            break;
        case com.android.internal.R.styleable.KeyboardView_shadowRadius:
            mShadowRadius = a.getFloat(attr, 0f);
            break;
        }
    }

    a = mContext.obtainStyledAttributes(
            com.android.internal.R.styleable.Theme);
    mBackgroundDimAmount = a.getFloat(android.R.styleable.Theme_backgroundDimAmount, 0.5f);

    mPreviewPopup = new PopupWindow(context);
    if (previewLayout != 0) {
        mPreviewText = (TextView) inflate.inflate(previewLayout, null);
        mPreviewTextSizeLarge = (int) mPreviewText.getTextSize();
        mPreviewPopup.setContentView(mPreviewText);
        mPreviewPopup.setBackgroundDrawable(null);
    } else {
        mShowPreview = false;
    }

    mPreviewPopup.setTouchable(false);

    mPopupKeyboard = new PopupWindow(context);
    mPopupKeyboard.setBackgroundDrawable(null);
    //mPopupKeyboard.setClippingEnabled(false);

    mPopupParent = this;
    //mPredicting = true;

    mPaint = new Paint();
    mPaint.setAntiAlias(true);
    mPaint.setTextSize(keyTextSize);
    mPaint.setTextAlign(Align.CENTER);
    mPaint.setAlpha(255);

    mPadding = new Rect(0, 0, 0, 0);
    mMiniKeyboardCache = new HashMap<Key,View>();
    mKeyBackground.getPadding(mPadding);

    mSwipeThreshold = (int) (500 * getResources().getDisplayMetrics().density);
    mDisambiguateSwipe = getResources().getBoolean(
            com.android.internal.R.bool.config_swipeDisambiguation);

    mAccessibilityManager = AccessibilityManager.getInstance(context);
    mAudioManager = (AudioManager) context.getSystemService(Context.AUDIO_SERVICE);

    resetMultiTap();
}
 
Example 14
Source File: SystemServiceRegistry.java    From android_9.0.0_r45 with Apache License 2.0 4 votes vote down vote up
@Override
public AccessibilityManager createService(ContextImpl ctx) {
    return AccessibilityManager.getInstance(ctx);
}