当前位置: 首页>>代码示例>>Java>>正文


Java AccessibilityManager.isEnabled方法代码示例

本文整理汇总了Java中android.view.accessibility.AccessibilityManager.isEnabled方法的典型用法代码示例。如果您正苦于以下问题:Java AccessibilityManager.isEnabled方法的具体用法?Java AccessibilityManager.isEnabled怎么用?Java AccessibilityManager.isEnabled使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在android.view.accessibility.AccessibilityManager的用法示例。


在下文中一共展示了AccessibilityManager.isEnabled方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: sendScrollAccessibilityEvent

import android.view.accessibility.AccessibilityManager; //导入方法依赖的package包/类
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);
        }
    }
}
 
开发者ID:enricocid,项目名称:LaunchEnr,代码行数:18,代码来源:PagedView.java

示例2: createHotseatAlphaAnimator

import android.view.accessibility.AccessibilityManager; //导入方法依赖的package包/类
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;
    }
}
 
开发者ID:enricocid,项目名称:LaunchEnr,代码行数:26,代码来源:Workspace.java

示例3: isAccessibilityEnabled

import android.view.accessibility.AccessibilityManager; //导入方法依赖的package包/类
/**
 * 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();
}
 
开发者ID:rkshuai,项目名称:chromium-for-android-56-debug-video,代码行数:12,代码来源:AccessibilityUtil.java

示例4: computeScrollHelper

import android.view.accessibility.AccessibilityManager; //导入方法依赖的package包/类
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;
}
 
开发者ID:TeamBrainStorm,项目名称:SimpleUILauncher,代码行数:38,代码来源:PagedView.java

示例5: run

import android.view.accessibility.AccessibilityManager; //导入方法依赖的package包/类
@Override
public void run() {
    AccessibilityManager am = (AccessibilityManager)
            getContext().getSystemService(Context.ACCESSIBILITY_SERVICE);
    boolean accessibilityEnabled = am.isEnabled();
    AlphaUpdateListener.updateVisibility(DropTargetBar.this, accessibilityEnabled);
}
 
开发者ID:enricocid,项目名称:LaunchEnr,代码行数:8,代码来源:DropTargetBar.java

示例6: sendCustomAccessibilityEvent

import android.view.accessibility.AccessibilityManager; //导入方法依赖的package包/类
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);
    }
}
 
开发者ID:TeamBrainStorm,项目名称:SimpleUILauncher,代码行数:11,代码来源:Utilities.java

示例7: getAnimationToState

import android.view.accessibility.AccessibilityManager; //导入方法依赖的package包/类
public AnimatorSet getAnimationToState(Workspace.State fromState, Workspace.State toState,
        boolean animated, HashMap<View, Integer> 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;
}
 
开发者ID:TeamBrainStorm,项目名称:SimpleUILauncher,代码行数:13,代码来源:WorkspaceStateTransitionAnimation.java

示例8: sendAccessibilityEventForVirtualButton

import android.view.accessibility.AccessibilityManager; //导入方法依赖的package包/类
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);
    }
}
 
开发者ID:h6ah4i,项目名称:android-numberpickercompat,代码行数:16,代码来源:AccessibilityNodeProviderImpl.java

示例9: checkAndStartService

import android.view.accessibility.AccessibilityManager; //导入方法依赖的package包/类
private void checkAndStartService() {
    accessibilityManager = (AccessibilityManager) getSystemService(ACCESSIBILITY_SERVICE);
    accessibilityManager.addAccessibilityStateChangeListener(new AccessibilityManager.AccessibilityStateChangeListener() {
        @Override
        public void onAccessibilityStateChanged(boolean b) {
            Log.d(TAG,"onAccessibilityStateChanged b = "+b);
            if(b){
                goWecaht();
            }else{
                openService();
            }
        }
    });

    name = sendName.getText().toString();
    content = sendContent.getText().toString();

    if(TextUtils.isEmpty(name)){
        Toast.makeText(this,"联系人不能为空",Toast.LENGTH_SHORT).show();
        return;
    }
    if(TextUtils.isEmpty(content)) {
        Toast.makeText(this,"内容不能为空",Toast.LENGTH_SHORT).show();
        return;
    }
    SharedPreferencesUtils.init(this, Contant.CONTACT).putString("friend",name);
    SharedPreferencesUtils.init(this, Contant.CONTACT).putString("content",content);

    if(!accessibilityManager.isEnabled()){
        openService();
    }else{
        goWecaht();
    }
}
 
开发者ID:xmlxin,项目名称:ReplyMessage,代码行数:35,代码来源:SendMsgWx.java

示例10: checkAndStartService

import android.view.accessibility.AccessibilityManager; //导入方法依赖的package包/类
private void checkAndStartService() {
    accessibilityManager = (AccessibilityManager) getSystemService(ACCESSIBILITY_SERVICE);
    accessibilityManager.addAccessibilityStateChangeListener(new AccessibilityManager.AccessibilityStateChangeListener() {
        @Override
        public void onAccessibilityStateChanged(boolean b) {
            Log.d(TAG,"onAccessibilityStateChanged b = "+b);
            if(b){
                goWecaht();
            }else{
                openService();
            }
        }
    });

    name = sendName.getText().toString();
    content = sendContent.getText().toString();

    if(TextUtils.isEmpty(name)){
        Toast.makeText(this,"联系人不能为空",Toast.LENGTH_SHORT).show();
        return;
    }
    if(TextUtils.isEmpty(content)) {
        Toast.makeText(this,"内容不能为空",Toast.LENGTH_SHORT).show();
        return;
    }

    if(!accessibilityManager.isEnabled()){
        openService();
    }else{
        goWecaht();
    }
}
 
开发者ID:xmlxin,项目名称:ReplyMessage,代码行数:33,代码来源:SendMsgqq.java

示例11: doInBackground

import android.view.accessibility.AccessibilityManager; //导入方法依赖的package包/类
@Override
protected Boolean doInBackground(Void... params) {
	/*
	 * Presumably if the accessibility manager is not enabled, we don't
	 * need to send accessibility events.
	 */
	final AccessibilityManager accessibility = (AccessibilityManager) context
			.getSystemService(Context.ACCESSIBILITY_SERVICE);
	if (!accessibility.isEnabled()) {
		return Boolean.FALSE;
	}

	/*
	 * Restrict the set of intents to only accessibility services that
	 * have the category FEEDBACK_SPOKEN (aka, screen readers).
	 */
	final Intent screenReaderIntent = new Intent(SCREENREADER_INTENT_ACTION);
	screenReaderIntent.addCategory(SCREENREADER_INTENT_CATEGORY);

	final ContentResolver cr = context.getContentResolver();

	final List<ResolveInfo> screenReaders = context.getPackageManager().queryIntentServices(
			screenReaderIntent, 0);

	boolean foundScreenReader = false;

	for (ResolveInfo screenReader : screenReaders) {
		/*
		 * All screen readers are expected to implement a content
		 * provider that responds to:
		 * content://<nameofpackage>.providers.StatusProvider
		 */
		final Cursor cursor = cr.query(
				Uri.parse("content://" + screenReader.serviceInfo.packageName
						+ ".providers.StatusProvider"), null, null, null, null);
		if (cursor != null) {
			try {
				if (!cursor.moveToFirst()) {
					continue;
				}

				/*
				 * These content providers use a special cursor that only has
				 * one element, an integer that is 1 if the screen reader is
				 * running.
				 */
				final int status = cursor.getInt(0);

				if (status == 1) {
					foundScreenReader = true;
					break;
				}
			} finally {
				cursor.close();
			}
		}
	}

	if (foundScreenReader) {
		mControlCodes = Pattern.compile(CONTROL_CODE_PATTERN);
	}

	return foundScreenReader;
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:65,代码来源:TerminalView.java

示例12: isAccessibilityEnabled

import android.view.accessibility.AccessibilityManager; //导入方法依赖的package包/类
private boolean isAccessibilityEnabled() {
    AccessibilityManager am = (AccessibilityManager) getContext().getSystemService(Context.ACCESSIBILITY_SERVICE);
    return am.isEnabled();
}
 
开发者ID:Justson,项目名称:AgentWeb,代码行数:5,代码来源:AgentWebView.java

示例13: dispatchHoverEvent

import android.view.accessibility.AccessibilityManager; //导入方法依赖的package包/类
@Override
protected boolean dispatchHoverEvent(MotionEvent event) {
    AccessibilityManager accessibilityManager =
            (AccessibilityManager) getContext().getSystemService(Context.ACCESSIBILITY_SERVICE);

    if (accessibilityManager.isEnabled()) {
        final int eventY = (int) event.getY();
        final int hoveredVirtualViewId;
        if (eventY < mTopSelectionDividerTop) {
            hoveredVirtualViewId = AccessibilityNodeProviderImpl.VIRTUAL_VIEW_ID_DECREMENT;
        } else if (eventY > mBottomSelectionDividerBottom) {
            hoveredVirtualViewId = AccessibilityNodeProviderImpl.VIRTUAL_VIEW_ID_INCREMENT;
        } else {
            hoveredVirtualViewId = AccessibilityNodeProviderImpl.VIRTUAL_VIEW_ID_INPUT;
        }
        final int action = event.getActionMasked();
        AccessibilityNodeProviderImpl provider = (AccessibilityNodeProviderImpl) getAccessibilityNodeProviderCompat();
        switch (action) {
            case MotionEvent.ACTION_HOVER_ENTER: {
                provider.sendAccessibilityEventForVirtualView(hoveredVirtualViewId,
                        AccessibilityEvent.TYPE_VIEW_HOVER_ENTER);
                mLastHoveredChildVirtualViewId = hoveredVirtualViewId;
                provider.performAction(hoveredVirtualViewId,
                        AccessibilityNodeInfo.ACTION_ACCESSIBILITY_FOCUS, null);
            }
            break;
            case MotionEvent.ACTION_HOVER_MOVE: {
                if (mLastHoveredChildVirtualViewId != hoveredVirtualViewId
                        && mLastHoveredChildVirtualViewId != View.NO_ID) {
                    provider.sendAccessibilityEventForVirtualView(
                            mLastHoveredChildVirtualViewId,
                            AccessibilityEvent.TYPE_VIEW_HOVER_EXIT);
                    provider.sendAccessibilityEventForVirtualView(hoveredVirtualViewId,
                            AccessibilityEvent.TYPE_VIEW_HOVER_ENTER);
                    mLastHoveredChildVirtualViewId = hoveredVirtualViewId;
                    provider.performAction(hoveredVirtualViewId,
                            AccessibilityNodeInfo.ACTION_ACCESSIBILITY_FOCUS, null);
                }
            }
            break;
            case MotionEvent.ACTION_HOVER_EXIT: {
                provider.sendAccessibilityEventForVirtualView(hoveredVirtualViewId,
                        AccessibilityEvent.TYPE_VIEW_HOVER_EXIT);
                mLastHoveredChildVirtualViewId = View.NO_ID;
            }
            break;
        }
    }
    return false;
}
 
开发者ID:h6ah4i,项目名称:android-numberpickercompat,代码行数:51,代码来源:NumberPicker.java


注:本文中的android.view.accessibility.AccessibilityManager.isEnabled方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。