本文整理汇总了Java中android.view.accessibility.AccessibilityManager类的典型用法代码示例。如果您正苦于以下问题:Java AccessibilityManager类的具体用法?Java AccessibilityManager怎么用?Java AccessibilityManager使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
AccessibilityManager类属于android.view.accessibility包,在下文中一共展示了AccessibilityManager类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: IsAccessibilityServiceEnabled
import android.view.accessibility.AccessibilityManager; //导入依赖的package包/类
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;
}
示例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;
}
}
示例3: onHoverEvent
import android.view.accessibility.AccessibilityManager; //导入依赖的package包/类
@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;
}
示例4: 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);
}
}
}
示例5: AdapterView
import android.view.accessibility.AccessibilityManager; //导入依赖的package包/类
@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");
}
}
示例6: onFinishInflate
import android.view.accessibility.AccessibilityManager; //导入依赖的package包/类
@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);
}
}
示例7: aktivitetOnCreate
import android.view.accessibility.AccessibilityManager; //导入依赖的package包/类
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");
}
示例8: onHoverEvent
import android.view.accessibility.AccessibilityManager; //导入依赖的package包/类
@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);
}
示例9: onCreate
import android.view.accessibility.AccessibilityManager; //导入依赖的package包/类
@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();
}
示例10: isTouchExplorationEnabled
import android.view.accessibility.AccessibilityManager; //导入依赖的package包/类
public static boolean isTouchExplorationEnabled(AccessibilityManager accessibilityManager) {
if (Build.VERSION.SDK_INT >= 14) {
return accessibilityManager.isTouchExplorationEnabled();
} else {
return false;
}
}
示例11: onDestroy
import android.view.accessibility.AccessibilityManager; //导入依赖的package包/类
@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();
}
}
示例12: getAnimationToState
import android.view.accessibility.AccessibilityManager; //导入依赖的package包/类
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;
}
示例13: setup
import android.view.accessibility.AccessibilityManager; //导入依赖的package包/类
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);
}
示例14: createFor
import android.view.accessibility.AccessibilityManager; //导入依赖的package包/类
public static DragViewStateAnnouncer createFor(View v) {
if (((AccessibilityManager) v.getContext().getSystemService(Context.ACCESSIBILITY_SERVICE))
.isEnabled()) {
return new DragViewStateAnnouncer(v);
} else {
return null;
}
}
示例15: 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);
}