List of usage examples for android.content Context ACCESSIBILITY_SERVICE
String ACCESSIBILITY_SERVICE
To view the source code for android.content Context ACCESSIBILITY_SERVICE.
Click Source Link
From source file:com.partynetwork.iparty.app.widget.crouton.Manager.java
/** * Generates and dispatches an SDK-specific spoken announcement. * <p>//from w ww .ja va 2 s .co m * For backwards compatibility, we're constructing an event from scratch * using the appropriate event type. If your application only targets SDK * 16+, you can just call View.announceForAccessibility(CharSequence). * </p> * <p/> * note: AccessibilityManager is only available from API lvl 4. * <p/> * Adapted from https://http://eyes-free.googlecode.com/files/ * accessibility_codelab_demos_v2_src.zip via * https://github.com/coreform/android-formidable-validation * * @param context * Used to get {@link AccessibilityManager} * @param text * The text to announce. */ public static void announceForAccessibilityCompat(Context context, CharSequence text) { if (Build.VERSION.SDK_INT >= 4) { AccessibilityManager accessibilityManager = null; if (null != context) { accessibilityManager = (AccessibilityManager) context .getSystemService(Context.ACCESSIBILITY_SERVICE); } if (null == accessibilityManager || !accessibilityManager.isEnabled()) { return; } // 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 < 16) { 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(Manager.class.getName()); event.setPackageName(context.getPackageName()); // 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.prashant.custom.widget.crouton.Manager.java
/** * Generates and dispatches an SDK-specific spoken announcement. * <p>//from www . jav a 2s . co m * For backwards compatibility, we're constructing an event from scratch * using the appropriate event type. If your application only targets SDK * 16+, you can just call View.announceForAccessibility(CharSequence). * </p> * <p/> * note: AccessibilityManager is only available from API lvl 4. * <p/> * Adapted from https://http://eyes-free.googlecode.com/files/accessibility_codelab_demos_v2_src.zip * via https://github.com/coreform/android-formidable-validation * * @param context * Used to get {@link AccessibilityManager} * @param text * The text to announce. */ public static void announceForAccessibilityCompat(Context context, CharSequence text) { if (Build.VERSION.SDK_INT >= 4) { AccessibilityManager accessibilityManager = (AccessibilityManager) context .getSystemService(Context.ACCESSIBILITY_SERVICE); if (!accessibilityManager.isEnabled()) { return; } final int eventType; eventType = AccessibilityEvent.TYPE_VIEW_FOCUSED; // 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(Manager.class.getName()); event.setPackageName(context.getPackageName()); // 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.elephant.widget.crouton.Manager.java
/** * Generates and dispatches an SDK-specific spoken announcement. * <p>/*from w w w . j ava 2 s . co m*/ * For backwards compatibility, we're constructing an event from scratch * using the appropriate event type. If your application only targets SDK * 16+, you can just call View.announceForAccessibility(CharSequence). * </p> * <p/> * note: AccessibilityManager is only available from API lvl 4. * <p/> * Adapted from https://http://eyes-free.googlecode.com/files/ * accessibility_codelab_demos_v2_src.zip via * https://github.com/coreform/android-formidable-validation * * @param context * Used to get {@link AccessibilityManager} * @param text * The text to announce. */ public static void announceForAccessibilityCompat(Context context, CharSequence text) { if (Build.VERSION.SDK_INT >= 4) { AccessibilityManager accessibilityManager = (AccessibilityManager) context .getSystemService(Context.ACCESSIBILITY_SERVICE); if (!accessibilityManager.isEnabled()) { return; } // 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 < 16) { 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(Manager.class.getName()); event.setPackageName(context.getPackageName()); // 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.arta.lib.widget.crouton.Manager.java
/** * Generates and dispatches an SDK-specific spoken announcement. * <p>//ww w .j a v a2 s .com * For backwards compatibility, we're constructing an event from scratch * using the appropriate event type. If your application only targets SDK * 16+, you can just call View.announceForAccessibility(CharSequence). * </p> * <p/> * note: AccessibilityManager is only available from API lvl 4. * <p/> * Adapted from https://http://eyes-free.googlecode.com/files/accessibility_codelab_demos_v2_src.zip * via https://github.com/coreform/android-formidable-validation * * @param context * Used to get {@link AccessibilityManager} * @param text * The text to announce. */ public static void announceForAccessibilityCompat(Context context, CharSequence text) { if (Build.VERSION.SDK_INT >= 4) { AccessibilityManager accessibilityManager = null; if (null != context) { accessibilityManager = (AccessibilityManager) context .getSystemService(Context.ACCESSIBILITY_SERVICE); } if (null == accessibilityManager || !accessibilityManager.isEnabled()) { return; } // 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 < 16) { 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(Manager.class.getName()); event.setPackageName(context.getPackageName()); // 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.klinker.deskclock.widget.multiwaveview.GlowPadView.java
private void switchToState(int state, float x, float y) { switch (state) { case STATE_IDLE: deactivateTargets();// w w w . ja v a2 s . c om hideGlow(0, 0, 0.0f, null); startBackgroundAnimation(0, 0.0f); mHandleDrawable.setState(TargetDrawable.STATE_INACTIVE); mHandleDrawable.setAlpha(1.0f); break; case STATE_START: startBackgroundAnimation(0, 0.0f); break; case STATE_FIRST_TOUCH: mHandleDrawable.setAlpha(0.0f); deactivateTargets(); showTargets(true); startBackgroundAnimation(INITIAL_SHOW_HANDLE_DURATION, 1.0f); setGrabbedState(OnTriggerListener.CENTER_HANDLE); final AccessibilityManager accessibilityManager = (AccessibilityManager) getContext() .getSystemService(Context.ACCESSIBILITY_SERVICE); if (accessibilityManager.isEnabled()) { announceTargets(); } break; case STATE_TRACKING: mHandleDrawable.setAlpha(0.0f); showGlow(REVEAL_GLOW_DURATION, REVEAL_GLOW_DELAY, 1.0f, null); break; case STATE_SNAP: // TODO: Add transition states (see list_selector_background_transition.xml) mHandleDrawable.setAlpha(0.0f); showGlow(REVEAL_GLOW_DURATION, REVEAL_GLOW_DELAY, 0.0f, null); break; case STATE_FINISH: doFinish(); break; } }
From source file:com.actionbarsherlock.internal.widget.IcsProgressBar.java
/** * @hide// w ww. j a v a2 s .c om */ public IcsProgressBar(Context context, AttributeSet attrs, int defStyle, int styleRes) { super(context, attrs, defStyle); mUiThreadId = Thread.currentThread().getId(); initProgressBar(); TypedArray a = context.obtainStyledAttributes(attrs, /*R.styleable.*/ProgressBar, defStyle, styleRes); mNoInvalidate = true; Drawable drawable = a.getDrawable(/*R.styleable.*/ProgressBar_progressDrawable); if (drawable != null) { drawable = tileify(drawable, false); // Calling this method can set mMaxHeight, make sure the corresponding // XML attribute for mMaxHeight is read after calling this method setProgressDrawable(drawable); } mDuration = a.getInt(/*R.styleable.*/ProgressBar_indeterminateDuration, mDuration); mMinWidth = a.getDimensionPixelSize(/*R.styleable.*/ProgressBar_minWidth, mMinWidth); mMaxWidth = a.getDimensionPixelSize(/*R.styleable.*/ProgressBar_maxWidth, mMaxWidth); mMinHeight = a.getDimensionPixelSize(/*R.styleable.*/ProgressBar_minHeight, mMinHeight); mMaxHeight = a.getDimensionPixelSize(/*R.styleable.*/ProgressBar_maxHeight, mMaxHeight); mBehavior = a.getInt(/*R.styleable.*/ProgressBar_indeterminateBehavior, mBehavior); final int resID = a.getResourceId(/*com.android.internal.R.styleable.*/ProgressBar_interpolator, android.R.anim.linear_interpolator); // default to linear interpolator if (resID > 0) { setInterpolator(context, resID); } setMax(a.getInt(/*R.styleable.*/ProgressBar_max, mMax)); setProgress(a.getInt(/*R.styleable.*/ProgressBar_progress, mProgress)); setSecondaryProgress(a.getInt(/*R.styleable.*/ProgressBar_secondaryProgress, mSecondaryProgress)); drawable = a.getDrawable(/*R.styleable.*/ProgressBar_indeterminateDrawable); if (drawable != null) { drawable = tileifyIndeterminate(drawable); setIndeterminateDrawable(drawable); } mOnlyIndeterminate = a.getBoolean(/*R.styleable.*/ProgressBar_indeterminateOnly, mOnlyIndeterminate); mNoInvalidate = false; setIndeterminate( mOnlyIndeterminate || a.getBoolean(/*R.styleable.*/ProgressBar_indeterminate, mIndeterminate)); mAnimationResolution = a.getInteger(/*R.styleable.*/ProgressBar_animationResolution, ANIMATION_RESOLUTION); a.recycle(); mAccessibilityManager = (AccessibilityManager) context.getSystemService(Context.ACCESSIBILITY_SERVICE); }
From source file:androidx.media.widget.VideoView2.java
public VideoView2(@NonNull Context context, @Nullable AttributeSet attrs, int defStyleAttr, int defStyleRes) { super(context, attrs, defStyleAttr, defStyleRes); mVideoWidth = 0;/* w w w . j a v a 2 s. com*/ mVideoHeight = 0; mSpeed = 1.0f; mFallbackSpeed = mSpeed; mSelectedSubtitleTrackIndex = INVALID_TRACK_INDEX; // TODO: add attributes to get this value. mShowControllerIntervalMs = DEFAULT_SHOW_CONTROLLER_INTERVAL_MS; mAccessibilityManager = (AccessibilityManager) context.getSystemService(Context.ACCESSIBILITY_SERVICE); mAudioManager = (AudioManager) context.getSystemService(Context.AUDIO_SERVICE); mAudioAttributes = new AudioAttributes.Builder().setUsage(AudioAttributes.USAGE_MEDIA) .setContentType(AudioAttributes.CONTENT_TYPE_MOVIE).build(); setFocusable(true); setFocusableInTouchMode(true); requestFocus(); // TODO: try to keep a single child at a time rather than always having both. mTextureView = new VideoTextureView(getContext()); mSurfaceView = new VideoSurfaceView(getContext()); LayoutParams params = new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT); mTextureView.setLayoutParams(params); mSurfaceView.setLayoutParams(params); mTextureView.setSurfaceListener(this); mSurfaceView.setSurfaceListener(this); addView(mTextureView); addView(mSurfaceView); // mSubtitleView = new SubtitleView(getContext()); // mSubtitleView.setLayoutParams(params); // mSubtitleView.setBackgroundColor(0); // addView(mSubtitleView); boolean enableControlView = (attrs == null) || attrs .getAttributeBooleanValue("http://schemas.android.com/apk/res/android", "enableControlView", true); if (enableControlView) { mMediaControlView = new MediaControlView2(getContext()); } mSubtitleEnabled = (attrs == null) || attrs .getAttributeBooleanValue("http://schemas.android.com/apk/res/android", "enableSubtitle", false); // TODO: Choose TextureView when SurfaceView cannot be created. // Choose surface view by default int viewType = (attrs == null) ? VideoView2.VIEW_TYPE_SURFACEVIEW : attrs.getAttributeIntValue("http://schemas.android.com/apk/res/android", "viewType", VideoView2.VIEW_TYPE_SURFACEVIEW); if (viewType == VideoView2.VIEW_TYPE_SURFACEVIEW) { Log.d(TAG, "viewType attribute is surfaceView."); mTextureView.setVisibility(View.GONE); mSurfaceView.setVisibility(View.VISIBLE); mCurrentView = mSurfaceView; } else if (viewType == VideoView2.VIEW_TYPE_TEXTUREVIEW) { Log.d(TAG, "viewType attribute is textureView."); mTextureView.setVisibility(View.VISIBLE); mSurfaceView.setVisibility(View.GONE); mCurrentView = mTextureView; } // TODO (b/77158231) /* MediaRouteSelector.Builder builder = new MediaRouteSelector.Builder(); builder.addControlCategory(MediaControlIntent.CATEGORY_REMOTE_PLAYBACK); builder.addControlCategory(MediaControlIntent.CATEGORY_LIVE_AUDIO); builder.addControlCategory(MediaControlIntent.CATEGORY_LIVE_VIDEO); mRouteSelector = builder.build(); */ }
From source file:com.android.incallui.widget.multiwaveview.GlowPadView.java
private void switchToState(int state, float x, float y) { switch (state) { case STATE_IDLE: deactivateTargets();//from ww w . j a va 2 s .c om hideGlow(0, 0, 0.0f, null); startBackgroundAnimation(0, 0.0f); mHandleDrawable.setState(TargetDrawable.STATE_INACTIVE); mHandleDrawable.setAlpha(1.0f); break; case STATE_START: startBackgroundAnimation(0, 0.0f); break; case STATE_FIRST_TOUCH: mHandleDrawable.setAlpha(0.0f); deactivateTargets(); showTargets(true); startBackgroundAnimation(INITIAL_SHOW_HANDLE_DURATION, 1.0f); setGrabbedState(OnTriggerListener.CENTER_HANDLE); final AccessibilityManager accessibilityManager = (AccessibilityManager) getContext() .getSystemService(Context.ACCESSIBILITY_SERVICE); if (accessibilityManager.isEnabled()) { announceTargets(); } break; case STATE_TRACKING: mHandleDrawable.setAlpha(0.0f); break; case STATE_SNAP: // TODO: Add transition states (see list_selector_background_transition.xml) mHandleDrawable.setAlpha(0.0f); showGlow(REVEAL_GLOW_DURATION, REVEAL_GLOW_DELAY, 0.0f, null); break; case STATE_FINISH: doFinish(); break; } }
From source file:cc.flydev.launcher.Folder.java
private 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);//from w w w . j av a 2 s . com accessibilityManager.sendAccessibilityEvent(event); } }
From source file:com.android.launcher2.PagedView.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()) { scrollTo(mScroller.getCurrX(), mScroller.getCurrY()); }/* www.ja v a2 s. c o m*/ invalidate(); return true; } else if (mNextPage != INVALID_PAGE) { 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(); } // Notify the user when the page changes AccessibilityManager accessibilityManager = (AccessibilityManager) getContext() .getSystemService(Context.ACCESSIBILITY_SERVICE); if (accessibilityManager.isEnabled()) { AccessibilityEvent ev = AccessibilityEvent.obtain(AccessibilityEvent.TYPE_VIEW_SCROLLED); ev.getText().add(getCurrentPageDescription()); sendAccessibilityEventUnchecked(ev); } return true; } return false; }