Example usage for android.view.accessibility AccessibilityEvent setClassName

List of usage examples for android.view.accessibility AccessibilityEvent setClassName

Introduction

In this page you can find the example usage for android.view.accessibility AccessibilityEvent setClassName.

Prototype

public void setClassName(CharSequence className) 

Source Link

Document

Sets the class name of the source.

Usage

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;/* w w w. ja  v  a  2s .c  o m*/

    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:com.albedinsky.android.support.ui.widget.ViewPagerWidget.java

/**
 *//*from   ww  w .  j ava2 s .c  o m*/
@Override
public void onInitializeAccessibilityEvent(@NonNull AccessibilityEvent event) {
    super.onInitializeAccessibilityEvent(event);
    event.setClassName(ViewPagerWidget.class.getName());
}

From source file:com.albedinsky.android.ui.widget.ViewPagerWidget.java

/**
 *//* ww w. ja  va  2 s.  c  o m*/
@Override
@TargetApi(Build.VERSION_CODES.ICE_CREAM_SANDWICH)
public void onInitializeAccessibilityEvent(@NonNull AccessibilityEvent event) {
    super.onInitializeAccessibilityEvent(event);
    event.setClassName(ViewPagerWidget.class.getName());
}

From source file:lewa.support.v7.widget.SwitchCompat.java

@TargetApi(Build.VERSION_CODES.ICE_CREAM_SANDWICH)
@Override/*from  w  w  w . j a v  a  2s .c  om*/
public void onInitializeAccessibilityEvent(AccessibilityEvent event) {
    super.onInitializeAccessibilityEvent(event);
    event.setClassName(SwitchCompat.class.getName());
}

From source file:com.android.yijiang.kzx.widget.betterpickers.TouchExplorationHelper.java

private AccessibilityEvent getEventForItem(T item, int eventType) {
    final AccessibilityEvent event = AccessibilityEvent.obtain(eventType);
    final AccessibilityRecordCompat record = new AccessibilityRecordCompat(event);
    final int virtualDescendantId = getIdForItem(item);

    // Ensure the client has good defaults.
    event.setEnabled(true);/*  w w w. jav  a2s.  c om*/

    // Allow the client to populate the event.
    populateEventForItem(item, event);

    if (event.getText().isEmpty() && TextUtils.isEmpty(event.getContentDescription())) {
        throw new RuntimeException("You must add text or a content description in populateEventForItem()");
    }

    // Don't allow the client to override these properties.
    event.setClassName(item.getClass().getName());
    event.setPackageName(mParentView.getContext().getPackageName());
    record.setSource(mParentView, virtualDescendantId);

    return event;
}

From source file:com.deange.datetimepicker.TouchExplorationHelper.java

private AccessibilityEvent getEventForItem(T item, int eventType) {
    final AccessibilityEvent event = AccessibilityEvent.obtain(eventType);
    final AccessibilityRecordCompat record = new AccessibilityRecordCompat(event);
    final int virtualDescendantId = getIdForItem(item);

    // Ensure the client has good defaults.
    event.setEnabled(true);//from   w w w. ja v a2 s.com

    // Allow the client to populate the event.
    populateEventForItem(item, event);

    if (event.getText().isEmpty() && TextUtils.isEmpty(event.getContentDescription())) {
        throw new RuntimeException("You must add text or a content description in populateEventForItem()");
    }

    // Don't allow the client to override these properties.
    event.setClassName(item.getClass().getName());
    event.setPackageName(mParentView.getContext().getPackageName());
    record.setSource(mParentView, virtualDescendantId);

    return event;
}

From source file:com.grottworkshop.gwsmaterialcalendarview.MaterialCalendarView.java

@Override
public void onInitializeAccessibilityEvent(@NonNull AccessibilityEvent event) {
    super.onInitializeAccessibilityEvent(event);
    event.setClassName(MaterialCalendarView.class.getName());
}

From source file:android.support.v7.widget.SwitchCompat.java

@TargetApi(Build.VERSION_CODES.ICE_CREAM_SANDWICH)
@Override/*w w  w .  j  av  a 2  s  .  c  o m*/
public void onInitializeAccessibilityEvent(AccessibilityEvent event) {
    super.onInitializeAccessibilityEvent(event);
    event.setClassName(ACCESSIBILITY_EVENT_CLASS_NAME);
}

From source file:io.doist.datetimepicker.time.TimePickerClockDelegate.java

@Override
public void onInitializeAccessibilityEvent(AccessibilityEvent event) {
    event.setClassName(TimePicker.class.getName());
}

From source file:com.mixiaoxiao.support.widget.SmoothSwitch.java

@TargetApi(Build.VERSION_CODES.ICE_CREAM_SANDWICH)
@Override//from www  .j  a va  2  s .c o m
public void onInitializeAccessibilityEvent(AccessibilityEvent event) {
    super.onInitializeAccessibilityEvent(event);
    event.setClassName(SmoothSwitch.class.getName());
}