Java 类android.view.accessibility.AccessibilityManager 实例源码
项目:LucaHome-AndroidApplication
文件:AndroidSystemController.java
public boolean IsAccessibilityServiceEnabled(@NonNull String serviceId) {
Logger.getInstance().Debug(TAG, String.format(Locale.getDefault(), "IsAccessibilityServiceEnabled for serviceId %s", serviceId));
AccessibilityManager accessibilityManager = (AccessibilityManager) _context.getSystemService(Context.ACCESSIBILITY_SERVICE);
if (accessibilityManager == null) {
Logger.getInstance().Error(TAG, "accessibilityManager is null!");
return false;
}
List<AccessibilityServiceInfo> runningServices = accessibilityManager.getEnabledAccessibilityServiceList(AccessibilityEvent.TYPES_ALL_MASK);
for (AccessibilityServiceInfo service : runningServices) {
Logger.getInstance().Debug(TAG, String.format(Locale.getDefault(), "Found active service %s", service.getId()));
if (serviceId.equals(service.getId())) {
return true;
}
}
return false;
}
项目:LaunchEnr
文件:Workspace.java
public ValueAnimator createHotseatAlphaAnimator(float finalValue) {
if (Float.compare(finalValue, mHotseatAlpha[HOTSEAT_STATE_ALPHA_INDEX]) == 0) {
// Return a dummy animator to avoid null checks.
return ValueAnimator.ofFloat(0, 0);
} else {
ValueAnimator animator = ValueAnimator
.ofFloat(mHotseatAlpha[HOTSEAT_STATE_ALPHA_INDEX], finalValue);
animator.addUpdateListener(new AnimatorUpdateListener() {
@Override
public void onAnimationUpdate(ValueAnimator valueAnimator) {
float value = (Float) valueAnimator.getAnimatedValue();
setHotseatAlphaAtIndex(value, HOTSEAT_STATE_ALPHA_INDEX);
}
});
AccessibilityManager am = (AccessibilityManager)
mLauncher.getSystemService(Context.ACCESSIBILITY_SERVICE);
final boolean accessibilityEnabled = am.isEnabled();
animator.addUpdateListener(
new AlphaUpdateListener(mLauncher.getHotseat(), accessibilityEnabled));
animator.addUpdateListener(
new AlphaUpdateListener(mPageIndicator, accessibilityEnabled));
return animator;
}
}
项目:CSipSimple
文件:GlowPadView.java
@Override
public boolean onHoverEvent(MotionEvent event) {
if (((AccessibilityManager) getContext().getSystemService(Context.ACCESSIBILITY_SERVICE)).isTouchExplorationEnabled()) {
final int action = event.getAction();
switch (action) {
case MotionEvent.ACTION_HOVER_ENTER:
event.setAction(MotionEvent.ACTION_DOWN);
break;
case MotionEvent.ACTION_HOVER_MOVE:
event.setAction(MotionEvent.ACTION_MOVE);
break;
case MotionEvent.ACTION_HOVER_EXIT:
event.setAction(MotionEvent.ACTION_UP);
break;
}
onTouchEvent(event);
event.setAction(action);
}
super.onHoverEvent(event);
return true;
}
项目:SimpleUILauncher
文件:PagedView.java
private void sendScrollAccessibilityEvent() {
AccessibilityManager am =
(AccessibilityManager) getContext().getSystemService(Context.ACCESSIBILITY_SERVICE);
if (am.isEnabled()) {
if (mCurrentPage != getNextPage()) {
AccessibilityEvent ev =
AccessibilityEvent.obtain(AccessibilityEvent.TYPE_VIEW_SCROLLED);
ev.setScrollable(true);
ev.setScrollX(getScrollX());
ev.setScrollY(getScrollY());
ev.setMaxScrollX(mMaxScrollX);
ev.setMaxScrollY(0);
sendAccessibilityEventUnchecked(ev);
}
}
}
项目:letv
文件:AdapterView.java
@TargetApi(16)
public AdapterView(Context context, AttributeSet attrs, int defStyle) {
super(context, attrs, defStyle);
this.mFirstPosition = 0;
this.mSyncColId = Long.MIN_VALUE;
this.mNeedSync = false;
this.mInLayout = false;
this.mNextSelectedPosition = -1;
this.mNextSelectedColId = Long.MIN_VALUE;
this.mSelectedPosition = -1;
this.mSelectedColId = Long.MIN_VALUE;
this.mOldSelectedPosition = -1;
this.mOldSelectedColId = Long.MIN_VALUE;
this.mBlockLayoutRequests = false;
if (VERSION.SDK_INT >= 16 && getImportantForAccessibility() == 0) {
setImportantForAccessibility(1);
}
if (!isInEditMode()) {
this.mAccessibilityManager = (AccessibilityManager) getContext().getSystemService("accessibility");
}
}
项目:android-dialer
文件:DialpadView.java
@Override
protected void onFinishInflate() {
setupKeypad();
mDigits = (EditText) findViewById(R.id.digits);
mDelete = (ImageButton) findViewById(R.id.deleteButton);
mOverflowMenuButton = findViewById(R.id.dialpad_overflow);
mRateContainer = (ViewGroup) findViewById(R.id.rate_container);
mIldCountry = (TextView) mRateContainer.findViewById(R.id.ild_country);
mIldRate = (TextView) mRateContainer.findViewById(R.id.ild_rate);
AccessibilityManager accessibilityManager =
(AccessibilityManager) getContext().getSystemService(Context.ACCESSIBILITY_SERVICE);
if (accessibilityManager.isEnabled()) {
// The text view must be selected to send accessibility events.
mDigits.setSelected(true);
}
}
项目:EsperantoRadio
文件:App.java
public void aktivitetOnCreate(Basisaktivitet ctx) {
ctx.getResources().updateConfiguration(App.sprogKonfig, null);
// Forgrundsinitialisering der skal ske før app'en bliver synlig første gang
// - muligvis aldrig hvis app'en kun betjenes via levende ikon, eller kun er aktiv i baggrunden
if (App.color!=null) return; // initialisering allerede sket
App.color = new DRFarver();
accessibilityManager = (AccessibilityManager) ctx.getSystemService(Context.ACCESSIBILITY_SERVICE); // tager tid i test
skrift_gibson = Typeface.DEFAULT;
skrift_gibson_fed = Typeface.DEFAULT_BOLD;
skrift_georgia = Typeface.SERIF;
skrift_gibson_fed_span = new EgenTypefaceSpan("Gibson fed", App.skrift_gibson_fed);
AppOpdatering.APK_URL = res.getString(R.string.AppOpdatering_APK_URL);
if (!EMULATOR) AppOpdatering.tjekForNyAPK(ctx);
Log.d("onCreate tog " + (System.currentTimeMillis() - TIDSSTEMPEL_VED_OPSTART) + " ms");
}
项目:SimpleUILauncher
文件:Workspace.java
public ValueAnimator createHotseatAlphaAnimator(float finalValue) {
if (Float.compare(finalValue, mHotseatAlpha[HOTSEAT_STATE_ALPHA_INDEX]) == 0) {
// Return a dummy animator to avoid null checks.
return ValueAnimator.ofFloat(0, 0);
} else {
ValueAnimator animator = ValueAnimator
.ofFloat(mHotseatAlpha[HOTSEAT_STATE_ALPHA_INDEX], finalValue);
animator.addUpdateListener(new AnimatorUpdateListener() {
@Override
public void onAnimationUpdate(ValueAnimator valueAnimator) {
float value = (Float) valueAnimator.getAnimatedValue();
setHotseatAlphaAtIndex(value, HOTSEAT_STATE_ALPHA_INDEX);
}
});
AccessibilityManager am = (AccessibilityManager)
mLauncher.getSystemService(Context.ACCESSIBILITY_SERVICE);
final boolean accessibilityEnabled = am.isEnabled();
animator.addUpdateListener(
new AlphaUpdateListener(mLauncher.getHotseat(), accessibilityEnabled));
animator.addUpdateListener(
new AlphaUpdateListener(mPageIndicator, accessibilityEnabled));
return animator;
}
}
项目:FlickLauncher
文件:PagedView.java
private void sendScrollAccessibilityEvent() {
AccessibilityManager am =
(AccessibilityManager) getContext().getSystemService(Context.ACCESSIBILITY_SERVICE);
if (am.isEnabled()) {
if (mCurrentPage != getNextPage()) {
AccessibilityEvent ev =
AccessibilityEvent.obtain(AccessibilityEvent.TYPE_VIEW_SCROLLED);
ev.setScrollable(true);
ev.setScrollX(getScrollX());
ev.setScrollY(getScrollY());
ev.setMaxScrollX(mMaxScrollX);
ev.setMaxScrollY(0);
sendAccessibilityEventUnchecked(ev);
}
}
}
项目:CustomAndroidOneSheeld
文件:LockPatternViewEx.java
@Override
public boolean onHoverEvent(MotionEvent event) {
if (Build.VERSION.SDK_INT >= 11) {
if (((AccessibilityManager) getContext().getSystemService(
Context.ACCESSIBILITY_SERVICE)).isTouchExplorationEnabled()) {
final int action = event.getAction();
switch (action) {
case MotionEvent.ACTION_HOVER_ENTER:
event.setAction(MotionEvent.ACTION_DOWN);
break;
case MotionEvent.ACTION_HOVER_MOVE:
event.setAction(MotionEvent.ACTION_MOVE);
break;
case MotionEvent.ACTION_HOVER_EXIT:
event.setAction(MotionEvent.ACTION_UP);
break;
}
onTouchEvent(event);
event.setAction(action);
}
}
return super.onHoverEvent(event);
}
项目:WeChatLuckyMoney
文件:MainActivity.java
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
//CrashReport.initCrashReport(getApplicationContext(), "900019352", false);
Bugly.init(getApplicationContext(), "900019352", false);
setContentView(R.layout.activity_main);
pluginStatusText = (TextView) findViewById(R.id.layout_control_accessibility_text);
pluginStatusIcon = (ImageView) findViewById(R.id.layout_control_accessibility_icon);
handleMaterialStatusBar();
explicitlyLoadPreferences();
//监听AccessibilityService 变化
accessibilityManager = (AccessibilityManager) getSystemService(Context.ACCESSIBILITY_SERVICE);
accessibilityManager.addAccessibilityStateChangeListener(this);
updateServiceStatus();
}
项目:GitHub
文件:Utils.java
public static boolean isTouchExplorationEnabled(AccessibilityManager accessibilityManager) {
if (Build.VERSION.SDK_INT >= 14) {
return accessibilityManager.isTouchExplorationEnabled();
} else {
return false;
}
}
项目:LaunchEnr
文件:Launcher.java
@Override
public void onDestroy() {
super.onDestroy();
mWorkspace.removeCallbacks(mBuildLayersRunnable);
mWorkspace.removeFolderListeners();
// Stop callbacks from LauncherModel
// It's possible to receive onDestroy after a new Launcher activity has
// been created. In this case, don't interfere with the new Launcher.
if (mModel.isCurrentCallbacks(this)) {
mModel.stopLoader();
LauncherAppState.getInstance(this).setLauncher(null);
}
if (mRotationPrefChangeHandler != null) {
mSharedPrefs.unregisterOnSharedPreferenceChangeListener(mRotationPrefChangeHandler);
}
try {
mAppWidgetHost.stopListening();
} catch (NullPointerException ex) {
ex.printStackTrace();
}
mAppWidgetHost = null;
TextKeyListener.getInstance().release();
((AccessibilityManager) getSystemService(ACCESSIBILITY_SERVICE))
.removeAccessibilityStateChangeListener(this);
LauncherAnimUtils.onDestroyActivity();
if (mLauncherCallbacks != null) {
mLauncherCallbacks.onDestroy();
}
}
项目:LaunchEnr
文件:WorkspaceStateTransitionAnimation.java
public AnimatorSet getAnimationToState(Workspace.State fromState, Workspace.State toState,
boolean animated, AnimationLayerSet layerViews) {
AccessibilityManager am = (AccessibilityManager)
mLauncher.getSystemService(Context.ACCESSIBILITY_SERVICE);
final boolean accessibilityEnabled = am.isEnabled();
TransitionStates states = new TransitionStates(fromState, toState);
int workspaceDuration = getAnimationDuration(states);
animateWorkspace(states, animated, workspaceDuration, layerViews,
accessibilityEnabled);
animateBackgroundGradient(states, animated, BACKGROUND_FADE_OUT_DURATION);
return mStateAnimator;
}
项目:LaunchEnr
文件:DragLayer.java
public void setup(Launcher launcher, DragController dragController,
AllAppsTransitionController allAppsTransitionController) {
mLauncher = launcher;
mDragController = dragController;
mAllAppsController = allAppsTransitionController;
boolean isAccessibilityEnabled = ((AccessibilityManager) mLauncher.getSystemService(
Context.ACCESSIBILITY_SERVICE)).isEnabled();
onAccessibilityStateChanged(isAccessibilityEnabled);
}
项目:LaunchEnr
文件:DragViewStateAnnouncer.java
public static DragViewStateAnnouncer createFor(View v) {
if (((AccessibilityManager) v.getContext().getSystemService(Context.ACCESSIBILITY_SERVICE))
.isEnabled()) {
return new DragViewStateAnnouncer(v);
} else {
return null;
}
}
项目:LaunchEnr
文件:DropTargetBar.java
@Override
public void run() {
AccessibilityManager am = (AccessibilityManager)
getContext().getSystemService(Context.ACCESSIBILITY_SERVICE);
boolean accessibilityEnabled = am.isEnabled();
AlphaUpdateListener.updateVisibility(DropTargetBar.this, accessibilityEnabled);
}
项目:RNLearn_Project1
文件:AccessibilityInfoModule.java
public AccessibilityInfoModule(ReactApplicationContext context) {
super(context);
mAccessibilityManager = (AccessibilityManager) getReactApplicationContext()
.getSystemService(Context.ACCESSIBILITY_SERVICE);
mEnabled = mAccessibilityManager.isTouchExplorationEnabled();
if (Build.VERSION.SDK_INT >= 19) {
mTouchExplorationStateChangeListener = new ReactTouchExplorationStateChangeListener();
}
}
项目:LaunchEnr
文件:PagedView.java
protected boolean computeScrollHelper(boolean shouldInvalidate) {
if (mScroller.computeScrollOffset()) {
// Don't bother scrolling if the page does not need to be moved
if (getUnboundedScrollX() != mScroller.getCurrX()
|| getScrollY() != mScroller.getCurrY()) {
float scaleX = mFreeScroll ? getScaleX() : 1f;
int scrollX = (int) (mScroller.getCurrX() * (1 / scaleX));
scrollTo(scrollX, mScroller.getCurrY());
}
if (shouldInvalidate) {
invalidate();
}
return true;
} else if (mNextPage != INVALID_PAGE && shouldInvalidate) {
sendScrollAccessibilityEvent();
mCurrentPage = validateNewPage(mNextPage);
mNextPage = INVALID_PAGE;
notifyPageSwitchListener();
// 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) {
pageEndTransition();
}
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;
}
项目:SimpleUILauncher
文件:PagedView.java
protected boolean computeScrollHelper(boolean shouldInvalidate) {
if (mScroller.computeScrollOffset()) {
// Don't bother scrolling if the page does not need to be moved
if (getScrollX() != mScroller.getCurrX()
|| getScrollY() != mScroller.getCurrY()) {
float scaleX = mFreeScroll ? getScaleX() : 1f;
int scrollX = (int) (mScroller.getCurrX() * (1 / scaleX));
scrollTo(scrollX, mScroller.getCurrY());
}
if (shouldInvalidate) {
invalidate();
}
return true;
} else if (mNextPage != INVALID_PAGE && shouldInvalidate) {
sendScrollAccessibilityEvent();
mCurrentPage = validateNewPage(mNextPage);
mNextPage = INVALID_PAGE;
notifyPageSwitchListener();
// 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;
}
项目:SimpleUILauncher
文件:MultiStateAlphaController.java
public MultiStateAlphaController(View view, int stateCount) {
mTargetView = view;
mAlphas = new float[stateCount];
Arrays.fill(mAlphas, 1);
mAm = (AccessibilityManager) view.getContext().getSystemService(Context.ACCESSIBILITY_SERVICE);
}
项目:airgram
文件:RecyclerView.java
public RecyclerView(Context context, @Nullable AttributeSet attrs, int defStyle) {
super(context, attrs, defStyle);
setScrollContainer(true);
setFocusableInTouchMode(true);
final int version = Build.VERSION.SDK_INT;
mPostUpdatesOnAnimation = version >= 16;
final ViewConfiguration vc = ViewConfiguration.get(context);
mTouchSlop = vc.getScaledTouchSlop();
mMinFlingVelocity = vc.getScaledMinimumFlingVelocity();
mMaxFlingVelocity = vc.getScaledMaximumFlingVelocity();
setWillNotDraw(ViewCompat.getOverScrollMode(this) == ViewCompat.OVER_SCROLL_NEVER);
mItemAnimator.setListener(mItemAnimatorListener);
initAdapterManager();
initChildrenHelper();
// If not explicitly specified this view is important for accessibility.
if (ViewCompat.getImportantForAccessibility(this)
== ViewCompat.IMPORTANT_FOR_ACCESSIBILITY_AUTO) {
ViewCompat.setImportantForAccessibility(this,
ViewCompat.IMPORTANT_FOR_ACCESSIBILITY_YES);
}
mAccessibilityManager = (AccessibilityManager) getContext()
.getSystemService(Context.ACCESSIBILITY_SERVICE);
setAccessibilityDelegateCompat(new RecyclerViewAccessibilityDelegate(this));
// Create the layoutManager if specified.
// Re-set whether nested scrolling is enabled so that it is set on all API levels
setNestedScrollingEnabled(true);
}
项目:SimpleUILauncher
文件:DragViewStateAnnouncer.java
public static DragViewStateAnnouncer createFor(View v) {
if (((AccessibilityManager) v.getContext().getSystemService(Context.ACCESSIBILITY_SERVICE))
.isEnabled()) {
return new DragViewStateAnnouncer(v);
} else {
return null;
}
}
项目:AgentWeb
文件:AgentWebView.java
private void setAccessibilityEnabled(boolean enabled) {
AccessibilityManager am = (AccessibilityManager) getContext().getSystemService(Context.ACCESSIBILITY_SERVICE);
try {
Method setAccessibilityState = am.getClass().getDeclaredMethod("setAccessibilityState", boolean.class);
setAccessibilityState.setAccessible(true);
setAccessibilityState.invoke(am, enabled);
setAccessibilityState.setAccessible(false);
} catch (Throwable e) {
if (LogUtils.isDebug()) {
LogUtils.e(TAG, "setAccessibilityEnabled", e);
}
}
}
项目:FlickLauncher
文件:PagedView.java
protected boolean computeScrollHelper(boolean shouldInvalidate) {
if (mScroller.computeScrollOffset()) {
// Don't bother scrolling if the page does not need to be moved
if (getScrollX() != mScroller.getCurrX()
|| getScrollY() != mScroller.getCurrY()) {
float scaleX = mFreeScroll ? getScaleX() : 1f;
int scrollX = (int) (mScroller.getCurrX() * (1 / scaleX));
scrollTo(scrollX, mScroller.getCurrY());
}
if (shouldInvalidate) {
invalidate();
}
return true;
} else if (mNextPage != INVALID_PAGE && shouldInvalidate) {
sendScrollAccessibilityEvent();
mCurrentPage = validateNewPage(mNextPage);
mNextPage = INVALID_PAGE;
notifyPageSwitchListener();
// 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;
}
项目:pc-android-controller-android
文件:AccessUtil.java
public boolean isGroupReplyServiceEnabled(Context context) {
AccessibilityManager accessibilityManager = (AccessibilityManager) context.getSystemService(Context.ACCESSIBILITY_SERVICE);
List<AccessibilityServiceInfo> accessibilityServices =
accessibilityManager.getEnabledAccessibilityServiceList(AccessibilityServiceInfo.FEEDBACK_GENERIC);
for (AccessibilityServiceInfo info : accessibilityServices) {
// if (info.getId().equals(getPackageName() + "/.WeChatGroupSendService")) {
if (info.getId().equals(context.getPackageName() + "/.access.WeChatAccessService")) {
return true;
}
}
return false;
}
项目:SimpleUILauncher
文件:DropTargetBar.java
@Override
public void run() {
AccessibilityManager am = (AccessibilityManager)
getContext().getSystemService(Context.ACCESSIBILITY_SERVICE);
boolean accessibilityEnabled = am.isEnabled();
AlphaUpdateListener.updateVisibility(DropTargetBar.this, accessibilityEnabled);
}
项目:Hotspot-master-devp
文件:NumberPicker.java
private void sendAccessibilityEventForVirtualButton(int virtualViewId, int eventType,
String text) {
if (((AccessibilityManager) getContext().getSystemService(Context.ACCESSIBILITY_SERVICE)).isEnabled()) {
AccessibilityEvent event = AccessibilityEvent.obtain(eventType);
event.setClassName(Button.class.getName());
event.setPackageName(getContext().getPackageName());
event.getText().add(text);
event.setEnabled(NumberPicker.this.isEnabled());
event.setSource(NumberPicker.this, virtualViewId);
requestSendAccessibilityEvent(NumberPicker.this, event);
}
}
项目:mvo
文件:Utils.java
public static boolean checkAccessibilityPermission(Context context) {
AccessibilityManager accessibilityManager = (AccessibilityManager)context.getSystemService(Context.ACCESSIBILITY_SERVICE);
List<AccessibilityServiceInfo> list = accessibilityManager.getEnabledAccessibilityServiceList(AccessibilityServiceInfo.FEEDBACK_GENERIC);
for (AccessibilityServiceInfo info : list) {
if (info.getResolveInfo().serviceInfo.packageName.equals(context.getPackageName())) {
return true;
}
}
return false;
}
项目:android-numberpickercompat
文件:AccessibilityNodeProviderImpl.java
private void sendAccessibilityEventForVirtualText(int eventType) {
AccessibilityManager accessibilityManager = (AccessibilityManager) getContext().getSystemService(Context.ACCESSIBILITY_SERVICE);
if (accessibilityManager.isEnabled()) {
AccessibilityEvent event = AccessibilityEvent.obtain(eventType);
AccessibilityRecordCompat record = AccessibilityEventCompat.asRecord(event);
ViewCompat.onInitializeAccessibilityEvent(getInputText(), event);
ViewCompat.onPopulateAccessibilityEvent(getInputText(), event);
record.setSource(mNumberPicker, VIRTUAL_VIEW_ID_INPUT);
ViewParentCompat.requestSendAccessibilityEvent(mNumberPicker, mNumberPicker, event);
}
}
项目:android-numberpickercompat
文件:AccessibilityNodeProviderImpl.java
private void sendAccessibilityEventForVirtualButton(int virtualViewId, int eventType,
String text) {
AccessibilityManager accessibilityManager = (AccessibilityManager) getContext().getSystemService(Context.ACCESSIBILITY_SERVICE);
if (accessibilityManager.isEnabled()) {
AccessibilityEvent event = AccessibilityEvent.obtain(eventType);
AccessibilityRecordCompat record = AccessibilityEventCompat.asRecord(event);
event.setPackageName(getContext().getPackageName());
record.setClassName(Button.class.getName());
record.getText().add(text);
record.setEnabled(isEnabled());
record.setSource(mNumberPicker, virtualViewId);
ViewParentCompat.requestSendAccessibilityEvent(mNumberPicker, mNumberPicker, event);
}
}
项目:chromium-for-android-56-debug-video
文件:AccessibilityUtil.java
/**
* Checks to see that this device has accessibility and touch exploration enabled.
* @param context A {@link Context} instance.
* @return Whether or not accessibility and touch exploration are enabled.
*/
@CalledByNative
public static boolean isAccessibilityEnabled(Context context) {
AccessibilityManager manager = (AccessibilityManager)
context.getSystemService(Context.ACCESSIBILITY_SERVICE);
return manager != null && manager.isEnabled() && manager.isTouchExplorationEnabled();
}
项目:chromium-for-android-56-debug-video
文件:AccessibilityUtil.java
/**
* Checks to see if an old version of TalkBack is running that Chrome doesn't support,
* and if so, shows an alert dialog prompting the user to update the app.
* @param context A {@link Context} instance.
* @return True if the dialog was shown.
*/
public static boolean showWarningIfOldTalkbackRunning(Context context) {
AccessibilityManager manager = (AccessibilityManager)
context.getSystemService(Context.ACCESSIBILITY_SERVICE);
if (manager == null) return false;
boolean isTalkbackRunning = false;
try {
List<AccessibilityServiceInfo> services =
manager.getEnabledAccessibilityServiceList(
AccessibilityServiceInfo.FEEDBACK_SPOKEN);
for (AccessibilityServiceInfo service : services) {
if (service.getId().contains(TALKBACK_PACKAGE_NAME)) isTalkbackRunning = true;
}
} catch (NullPointerException e) {
// getEnabledAccessibilityServiceList() can throw an NPE due to a bad
// AccessibilityService.
}
if (!isTalkbackRunning) return false;
if (PackageUtils.getPackageVersion(context, TALKBACK_PACKAGE_NAME) < MIN_TALKBACK_VERSION
&& !sOldTalkBackVersionAlertShown) {
showOldTalkbackVersionAlertOnce(context);
return true;
}
return false;
}
项目:FlickLauncher
文件:Utilities.java
public static void sendCustomAccessibilityEvent(View target, int type, String text) {
AccessibilityManager accessibilityManager = (AccessibilityManager)
target.getContext().getSystemService(Context.ACCESSIBILITY_SERVICE);
if (accessibilityManager.isEnabled()) {
AccessibilityEvent event = AccessibilityEvent.obtain(type);
target.onInitializeAccessibilityEvent(event);
event.getText().add(text);
accessibilityManager.sendAccessibilityEvent(event);
}
}
项目:boohee_v5.6
文件:ExploreByTouchHelper.java
public ExploreByTouchHelper(View forView) {
if (forView == null) {
throw new IllegalArgumentException("View may not be null");
}
this.mView = forView;
this.mManager = (AccessibilityManager) forView.getContext().getSystemService("accessibility");
}
项目:letv
文件:ExploreByTouchHelper.java
public ExploreByTouchHelper(View forView) {
if (forView == null) {
throw new IllegalArgumentException("View may not be null");
}
this.mView = forView;
this.mManager = (AccessibilityManager) forView.getContext().getSystemService("accessibility");
}
项目:exciting-app
文件:AdapterView.java
@TargetApi(16)
public AdapterView( Context context, AttributeSet attrs, int defStyle ) {
super( context, attrs, defStyle );
if( android.os.Build.VERSION.SDK_INT >= 16 ) {
// If not explicitly specified this view is important for accessibility.
if ( getImportantForAccessibility() == IMPORTANT_FOR_ACCESSIBILITY_AUTO ) {
setImportantForAccessibility( IMPORTANT_FOR_ACCESSIBILITY_YES );
}
}
if( ! isInEditMode() ) {
mAccessibilityManager = (AccessibilityManager) getContext().getSystemService( Context.ACCESSIBILITY_SERVICE );
}
}
项目:FlickLauncher
文件:DropTargetBar.java
@Override
public void run() {
AccessibilityManager am = (AccessibilityManager)
getContext().getSystemService(Context.ACCESSIBILITY_SERVICE);
boolean accessibilityEnabled = am.isEnabled();
AlphaUpdateListener.updateVisibility(DropTargetBar.this, accessibilityEnabled);
}
项目:LimitedDatePicker
文件:NumberPicker.java
private void sendAccessibilityEventForVirtualText(int eventType) {
if (((AccessibilityManager) getContext().getSystemService(Context.ACCESSIBILITY_SERVICE)).isEnabled()) {
AccessibilityEvent event = AccessibilityEvent.obtain(eventType);
mInputText.onInitializeAccessibilityEvent(event);
mInputText.onPopulateAccessibilityEvent(event);
event.setSource(NumberPicker.this, VIRTUAL_VIEW_ID_INPUT);
requestSendAccessibilityEvent(NumberPicker.this, event);
}
}
项目:LimitedDatePicker
文件:NumberPicker.java
private void sendAccessibilityEventForVirtualButton(int virtualViewId, int eventType,
String text) {
if (((AccessibilityManager) getContext().getSystemService(Context.ACCESSIBILITY_SERVICE)).isEnabled()) {
AccessibilityEvent event = AccessibilityEvent.obtain(eventType);
event.setClassName(Button.class.getName());
event.setPackageName(getContext().getPackageName());
event.getText().add(text);
event.setEnabled(NumberPicker.this.isEnabled());
event.setSource(NumberPicker.this, virtualViewId);
requestSendAccessibilityEvent(NumberPicker.this, event);
}
}