Example usage for android.support.v4.view ViewCompat setAccessibilityDelegate

List of usage examples for android.support.v4.view ViewCompat setAccessibilityDelegate

Introduction

In this page you can find the example usage for android.support.v4.view ViewCompat setAccessibilityDelegate.

Prototype

public static void setAccessibilityDelegate(View v, AccessibilityDelegateCompat delegate) 

Source Link

Document

Sets a delegate for implementing accessibility support via compositon as opposed to inheritance.

Usage

From source file:com.example.zhaozhu.practisecustomview.customviewgroup.HSlidingPaneLayout2.java

public HSlidingPaneLayout2(final Context context, final AttributeSet attrs, final int defStyle) {
    super(context, attrs, defStyle);

    final float density = context.getResources().getDisplayMetrics().density;
    //TODO -32?0//ww  w  .  java  2 s  . com
    //this.mOverhangSize = -32;
    this.mOverhangSize = 0;

    this.setWillNotDraw(false);

    ViewCompat.setAccessibilityDelegate(this, new AccessibilityDelegate());
    ViewCompat.setImportantForAccessibility(this, ViewCompat.IMPORTANT_FOR_ACCESSIBILITY_YES);

    this.mDragHelper = ViewDragHelper.create(this, 0.5f, new DragHelperCallback());
    this.mDragHelper.setEdgeTrackingEnabled(ViewDragHelper.EDGE_LEFT);
    this.mDragHelper.setMinVelocity(HSlidingPaneLayout2.MIN_FLING_VELOCITY * density);
}

From source file:com.cooper.redditvideo.CustomSlidingPaneLayout.java

public CustomSlidingPaneLayout(Context context, AttributeSet attrs, int defStyle) {
    super(context, attrs, defStyle);

    final float density = context.getResources().getDisplayMetrics().density;
    mOverhangSize = (int) (DEFAULT_OVERHANG_SIZE * density + 0.5f);

    final ViewConfiguration viewConfig = ViewConfiguration.get(context);

    setWillNotDraw(false);//  w  w w  .j ava  2s  .c om

    ViewCompat.setAccessibilityDelegate(this, new AccessibilityDelegate());
    ViewCompat.setImportantForAccessibility(this, ViewCompat.IMPORTANT_FOR_ACCESSIBILITY_YES);

    mDragHelper = ViewDragHelper.create(this, 0.5f, new DragHelperCallback());
    mDragHelper.setEdgeTrackingEnabled(ViewDragHelper.EDGE_LEFT);
    mDragHelper.setMinVelocity(MIN_FLING_VELOCITY * density);
}

From source file:wb.android.ui.UpNavigationSlidingPaneLayout.java

public UpNavigationSlidingPaneLayout(Context context, AttributeSet attrs, int defStyle) {
    super(context, attrs, defStyle);

    final float density = context.getResources().getDisplayMetrics().density;
    mOverhangSize = (int) (DEFAULT_OVERHANG_SIZE * density + 0.5f);

    //final ViewConfiguration viewConfig = ViewConfiguration.get(context);

    setWillNotDraw(false);/*from w w w  . ja v  a 2 s .  co m*/

    ViewCompat.setAccessibilityDelegate(this, new AccessibilityDelegate());
    ViewCompat.setImportantForAccessibility(this, ViewCompat.IMPORTANT_FOR_ACCESSIBILITY_YES);

    mDragHelper = ViewDragHelper.create(this, 0.5f, new DragHelperCallback());
    mDragHelper.setEdgeTrackingEnabled(ViewDragHelper.EDGE_LEFT);
    mDragHelper.setMinVelocity(MIN_FLING_VELOCITY * density);
}

From source file:com.android.nobug.view.pattern.PatternView.java

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

    TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.PatternView, defStyleAttr, 0);

    mRowCount = a.getInteger(R.styleable.PatternView_rowCount, PATTERN_SIZE_DEFAULT);
    mColumnCount = a.getInteger(R.styleable.PatternView_columnCount, PATTERN_SIZE_DEFAULT);

    final String aspect = a.getString(R.styleable.PatternView_aspect);

    if ("square".equals(aspect)) {
        mAspect = ASPECT_SQUARE;/* w w w .j a v  a2s .c om*/
    } else if ("lock_width".equals(aspect)) {
        mAspect = ASPECT_LOCK_WIDTH;
    } else if ("lock_height".equals(aspect)) {
        mAspect = ASPECT_LOCK_HEIGHT;
    } else {
        mAspect = ASPECT_SQUARE;
    }

    setClickable(true);

    mPathPaint.setAntiAlias(true);
    mPathPaint.setDither(true);

    mRegularColor = a.getColor(R.styleable.PatternView_regularColor, mRegularColor);
    mErrorColor = a.getColor(R.styleable.PatternView_errorColor, mErrorColor);
    mSuccessColor = a.getColor(R.styleable.PatternView_successColor, mSuccessColor);

    a.recycle();

    mPathPaint.setStyle(Paint.Style.STROKE);
    mPathPaint.setStrokeJoin(Paint.Join.ROUND);
    mPathPaint.setStrokeCap(Paint.Cap.ROUND);

    mPathWidth = getResources().getDimensionPixelSize(R.dimen.pl_pattern_dot_line_width);
    mPathPaint.setStrokeWidth(mPathWidth);

    mDotSize = getResources().getDimensionPixelSize(R.dimen.pl_pattern_dot_size);
    mDotSizeActivated = getResources().getDimensionPixelSize(R.dimen.pl_pattern_dot_size_activated);

    mPaint.setAntiAlias(true);
    mPaint.setDither(true);

    updatePatternSize();

    mFastOutSlowInInterpolator = new FastOutSlowInInterpolator();
    mLinearOutSlowInInterpolator = new LinearOutSlowInInterpolator();
    mExploreByTouchHelper = new PatternExploreByTouchHelper(this);
    ViewCompat.setAccessibilityDelegate(this, mExploreByTouchHelper);
    mAccessibilityManager = (AccessibilityManager) getContext().getSystemService(Context.ACCESSIBILITY_SERVICE);
    mAudioManager = (AudioManager) getContext().getSystemService(Context.AUDIO_SERVICE);
}

From source file:com.yunmall.ymsdk.widget.YmSlidingPaneLayout.java

public YmSlidingPaneLayout(Context context, AttributeSet attrs, int defStyle) {
    super(context, attrs, defStyle);

    final float density = context.getResources().getDisplayMetrics().density;
    mOverhangSize = (int) (DEFAULT_OVERHANG_SIZE * density + 0.5f);

    final ViewConfiguration viewConfig = ViewConfiguration.get(context);

    setWillNotDraw(false);//from   w  w  w  . ja  v  a 2s.  c  o  m

    ViewCompat.setAccessibilityDelegate(this, new AccessibilityDelegate());
    ViewCompat.setImportantForAccessibility(this, ViewCompat.IMPORTANT_FOR_ACCESSIBILITY_YES);

    mDragHelper = ViewDragHelper.create(this, 0.5f, new DragHelperCallback());
    mDragHelper.setEdgeTrackingEnabled(ViewDragHelper.EDGE_LEFT);
    mDragHelper.setMinVelocity(MIN_FLING_VELOCITY * density);

    setShadowResource(R.drawable.ymsdk_shadow_left);

    /** ?20dip??? */
    setEdgeWidth(100);
}

From source file:com.common.view.slidingfinish.CustomSlidingPaneLayout.java

public CustomSlidingPaneLayout(Context context, AttributeSet attrs, int defStyle) {
    super(context, attrs, defStyle);

    final float density = context.getResources().getDisplayMetrics().density;
    mOverhangSize = (int) (DEFAULT_OVERHANG_SIZE * density + 0.5f);

    final ViewConfiguration viewConfig = ViewConfiguration.get(context);

    setWillNotDraw(false);//from  ww w. ja  va 2  s  .  com

    ViewCompat.setAccessibilityDelegate(this, new AccessibilityDelegate());
    ViewCompat.setImportantForAccessibility(this, ViewCompat.IMPORTANT_FOR_ACCESSIBILITY_YES);

    mDragHelper = ViewDragHelper.create(this, 0.5f, new DragHelperCallback());
    mDragHelper.setMinVelocity(MIN_FLING_VELOCITY * density);
}

From source file:com.youle.gamebox.ui.view.SlidingPaneLayout.java

public SlidingPaneLayout(Context context, AttributeSet attrs, int defStyle) {
    super(context, attrs, defStyle);

    final float density = context.getResources().getDisplayMetrics().density;
    mOverhangSize = (int) (DEFAULT_OVERHANG_SIZE * density + 0.5f);

    // /*from ww  w .j a  v  a  2s . c  o m*/
    //        final ViewConfiguration viewConfig = ViewConfiguration.get(context);

    setWillNotDraw(false);

    ViewCompat.setAccessibilityDelegate(this, new AccessibilityDelegate());
    ViewCompat.setImportantForAccessibility(this, ViewCompat.IMPORTANT_FOR_ACCESSIBILITY_YES);

    mDragHelper = ViewDragHelper.create(this, 0.5f, new DragHelperCallback());
    mDragHelper.setEdgeTrackingEnabled(ViewDragHelper.EDGE_LEFT);
    mDragHelper.setMinVelocity(MIN_FLING_VELOCITY * density);
}

From source file:sg.rghis.android.views.widgets.RGSlidingPaneLayout.java

public RGSlidingPaneLayout(Context context, AttributeSet attrs, int defStyle) {
    super(context, attrs, defStyle);

    final float density = context.getResources().getDisplayMetrics().density;
    mOverhangSize = (int) (DEFAULT_OVERHANG_SIZE * density + 0.5f);

    final ViewConfiguration viewConfig = ViewConfiguration.get(context);

    setWillNotDraw(false);/*from  ww w  .j  a  va  2s.com*/

    ViewCompat.setAccessibilityDelegate(this, new AccessibilityDelegate());
    ViewCompat.setImportantForAccessibility(this, ViewCompat.IMPORTANT_FOR_ACCESSIBILITY_YES);

    mDragHelper = ViewDragHelper.create(this, 0.5f, new DragHelperCallback());
    mDragHelper.setMinVelocity(MIN_FLING_VELOCITY * density);
}

From source file:me.zhanghai.android.patternlock.PatternView.java

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

    TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.PatternView, defStyleAttr, 0);

    mRowCount = a.getInteger(R.styleable.PatternView_pl_rowCount, PATTERN_SIZE_DEFAULT);
    mColumnCount = a.getInteger(R.styleable.PatternView_pl_columnCount, PATTERN_SIZE_DEFAULT);

    final String aspect = a.getString(R.styleable.PatternView_pl_aspect);

    if ("square".equals(aspect)) {
        mAspect = ASPECT_SQUARE;//www. j  a v  a2s . c  o m
    } else if ("lock_width".equals(aspect)) {
        mAspect = ASPECT_LOCK_WIDTH;
    } else if ("lock_height".equals(aspect)) {
        mAspect = ASPECT_LOCK_HEIGHT;
    } else {
        mAspect = ASPECT_SQUARE;
    }

    setClickable(true);

    mPathPaint.setAntiAlias(true);
    mPathPaint.setDither(true);

    // Removed since every developer should set their own patternViewStyle.
    //mRegularColor = context.getColor(R.color.lock_pattern_view_regular_color);
    //mErrorColor = context.getColor(R.color.lock_pattern_view_error_color);
    //mSuccessColor = context.getColor(R.color.lock_pattern_view_success_color);
    mRegularColor = a.getColor(R.styleable.PatternView_pl_regularColor, mRegularColor);
    mErrorColor = a.getColor(R.styleable.PatternView_pl_errorColor, mErrorColor);
    mSuccessColor = a.getColor(R.styleable.PatternView_pl_successColor, mSuccessColor);

    a.recycle();

    mPathPaint.setStyle(Paint.Style.STROKE);
    mPathPaint.setStrokeJoin(Paint.Join.ROUND);
    mPathPaint.setStrokeCap(Paint.Cap.ROUND);

    mPathWidth = getResources().getDimensionPixelSize(R.dimen.pl_pattern_dot_line_width);
    mPathPaint.setStrokeWidth(mPathWidth);

    mDotSize = getResources().getDimensionPixelSize(R.dimen.pl_pattern_dot_size);
    mDotSizeActivated = getResources().getDimensionPixelSize(R.dimen.pl_pattern_dot_size_activated);

    mPaint.setAntiAlias(true);
    mPaint.setDither(true);

    updatePatternSize();

    mFastOutSlowInInterpolator = new FastOutSlowInInterpolator();
    mLinearOutSlowInInterpolator = new LinearOutSlowInInterpolator();
    mExploreByTouchHelper = new PatternExploreByTouchHelper(this);
    ViewCompat.setAccessibilityDelegate(this, mExploreByTouchHelper);
    mAccessibilityManager = (AccessibilityManager) getContext().getSystemService(Context.ACCESSIBILITY_SERVICE);
    mAudioManager = (AudioManager) getContext().getSystemService(Context.AUDIO_SERVICE);
}

From source file:cn.zmdx.kaka.locker.widget.SlidingPaneLayout.java

public SlidingPaneLayout(Context context, AttributeSet attrs, int defStyle) {
    super(context, attrs, defStyle);

    final float density = context.getResources().getDisplayMetrics().density;
    mOverhangSize = (int) (DEFAULT_OVERHANG_SIZE * density + 0.5f);

    final ViewConfiguration viewConfig = ViewConfiguration.get(context);

    setWillNotDraw(false);//from  w  w w.j a va 2  s  .c om

    ViewCompat.setAccessibilityDelegate(this, new AccessibilityDelegate());
    ViewCompat.setImportantForAccessibility(this, ViewCompat.IMPORTANT_FOR_ACCESSIBILITY_YES);

    mDragHelper = ViewDragHelper.create(this, 0.5f, new DragHelperCallback());
    mDragHelper.setMinVelocity(MIN_FLING_VELOCITY * density);
}