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:android.support.v7.app.MediaRouteControllerDialog.java
public MediaRouteControllerDialog(Context context, int theme) { super(MediaRouterThemeHelper.createThemedContext(context, theme), theme); mContext = getContext();//from w ww . j av a 2 s . co m mControllerCallback = new MediaControllerCallback(); mRouter = MediaRouter.getInstance(mContext); mCallback = new MediaRouterCallback(); mRoute = mRouter.getSelectedRoute(); setMediaSession(mRouter.getMediaSessionToken()); mVolumeGroupListPaddingTop = mContext.getResources() .getDimensionPixelSize(R.dimen.mr_controller_volume_group_list_padding_top); mAccessibilityManager = (AccessibilityManager) mContext.getSystemService(Context.ACCESSIBILITY_SERVICE); if (android.os.Build.VERSION.SDK_INT >= 21) { mLinearOutSlowInInterpolator = AnimationUtils.loadInterpolator(context, R.interpolator.mr_linear_out_slow_in); mFastOutSlowInInterpolator = AnimationUtils.loadInterpolator(context, R.interpolator.mr_fast_out_slow_in); } mAccelerateDecelerateInterpolator = new AccelerateDecelerateInterpolator(); }
From source file:androidx.mediarouter.app.MediaRouteControllerDialog.java
public MediaRouteControllerDialog(Context context, int theme) { super(context = MediaRouterThemeHelper.createThemedDialogContext(context, theme, true), MediaRouterThemeHelper.createThemedDialogStyle(context)); mContext = getContext();//from www. j av a 2 s.co m mControllerCallback = new MediaControllerCallback(); mRouter = MediaRouter.getInstance(mContext); mCallback = new MediaRouterCallback(); mRoute = mRouter.getSelectedRoute(); setMediaSession(mRouter.getMediaSessionToken()); mVolumeGroupListPaddingTop = mContext.getResources() .getDimensionPixelSize(R.dimen.mr_controller_volume_group_list_padding_top); mAccessibilityManager = (AccessibilityManager) mContext.getSystemService(Context.ACCESSIBILITY_SERVICE); if (android.os.Build.VERSION.SDK_INT >= 21) { mLinearOutSlowInInterpolator = AnimationUtils.loadInterpolator(context, R.interpolator.mr_linear_out_slow_in); mFastOutSlowInInterpolator = AnimationUtils.loadInterpolator(context, R.interpolator.mr_fast_out_slow_in); } mAccelerateDecelerateInterpolator = new AccelerateDecelerateInterpolator(); }
From source file:com.box.myview.MyTopSnackBar.TSnackbar.java
private TSnackbar(ViewGroup parent, @OverSnackAppearDirection int appearDirection) { this.appearDirection = appearDirection; mParent = parent;/* www .j av a2s . co m*/ mContext = parent.getContext(); LayoutInflater inflater = LayoutInflater.from(mContext); if (appearDirection == APPEAR_FROM_BOTTOM_TO_TOP) { mView = (SnackbarLayout) inflater.inflate(R.layout.view_bsnackbar_layout, mParent, false); } else { mView = (SnackbarLayout) inflater.inflate(R.layout.view_tsnackbar_layout, mParent, false); } mAccessibilityManager = (AccessibilityManager) mContext.getSystemService(Context.ACCESSIBILITY_SERVICE); if (appearDirection == APPEAR_FROM_TOP_TO_DOWN) { setMinHeight(0, 0); } }
From source file:com.odo.kcl.mobileminer.activities.MainActivity.java
private boolean isAccessibilityEnabled() { // http://stackoverflow.com/questions/5081145/android-how-do-you-check-if-a-particular-accessibilityservice-is-enabled if (Build.VERSION.SDK_INT >= 17) { AccessibilityManager am = (AccessibilityManager) this.getSystemService(Context.ACCESSIBILITY_SERVICE); List<AccessibilityServiceInfo> runningServices = am .getEnabledAccessibilityServiceList(AccessibilityEvent.TYPES_ALL_MASK); for (AccessibilityServiceInfo service : runningServices) { if ("com.odo.kcl.mobileminer/.NotificationService".equals(service.getId())) return true; }/*from www. j av a 2 s . c om*/ } return false; }
From source file:com.stasbar.knowyourself.timer.CountingTimerView.java
public CountingTimerView(Context context, AttributeSet attrs) { super(context, attrs); mAccessibilityManager = (AccessibilityManager) context.getSystemService(Context.ACCESSIBILITY_SERVICE); Resources r = context.getResources(); mDefaultColor = mWhiteColor = ContextCompat.getColor(context, R.color.colorPrimary); mPressedColor = mAccentColor = ContextCompat.getColor(context, R.color.colorPrimary); mBigFontSize = r.getDimension(R.dimen.big_font_size); mSmallFontSize = r.getDimension(R.dimen.small_font_size); mPaintBigThin.setAntiAlias(true);/*from w w w. j a v a 2 s .c om*/ mPaintBigThin.setStyle(Paint.Style.STROKE); mPaintBigThin.setTextAlign(Paint.Align.CENTER); mPaintBigThin.setTypeface(Typeface.create("sans-serif-thin", Typeface.NORMAL)); mPaintMed.setAntiAlias(true); mPaintMed.setStyle(Paint.Style.STROKE); mPaintMed.setTextAlign(Paint.Align.CENTER); mPaintMed.setTypeface(Typeface.create("sans-serif-light", Typeface.NORMAL)); resetTextSize(); setTextColor(mDefaultColor); // allDigits will contain ten digits: "0123456789" in the default locale final String allDigits = String.format(Locale.getDefault(), "%010d", 123456789); mBigSeconds = new UnsignedTime(mPaintBigThin, 0.f, allDigits); mBigHours = new SignedTime(mBigSeconds, HOURS_MINUTES_SPACING); mBigMinutes = new SignedTime(mBigSeconds, HOURS_MINUTES_SPACING); mMedHundredths = new Hundredths(mPaintMed, HUNDREDTHS_SPACING, allDigits); mRadiusOffset = Utils.calculateRadiusOffset(r); }
From source file:android.support.design.widget.BaseTransientBottomBar.java
/** * Constructor for the transient bottom bar. * * @param parent The parent for this transient bottom bar. * @param content The content view for this transient bottom bar. * @param contentViewCallback The content view callback for this transient bottom bar. *//*from w w w . j av a2s. co m*/ protected BaseTransientBottomBar(@NonNull ViewGroup parent, @NonNull View content, @NonNull ContentViewCallback contentViewCallback) { if (parent == null) { throw new IllegalArgumentException("Transient bottom bar must have non-null parent"); } if (content == null) { throw new IllegalArgumentException("Transient bottom bar must have non-null content"); } if (contentViewCallback == null) { throw new IllegalArgumentException("Transient bottom bar must have non-null callback"); } mTargetParent = parent; mContentViewCallback = contentViewCallback; mContext = parent.getContext(); ThemeUtils.checkAppCompatTheme(mContext); LayoutInflater inflater = LayoutInflater.from(mContext); // Note that for backwards compatibility reasons we inflate a layout that is defined // in the extending Snackbar class. This is to prevent breakage of apps that have custom // coordinator layout behaviors that depend on that layout. mView = (SnackbarBaseLayout) inflater.inflate(R.layout.design_layout_snackbar, mTargetParent, false); mView.addView(content); ViewCompat.setAccessibilityLiveRegion(mView, ViewCompat.ACCESSIBILITY_LIVE_REGION_POLITE); ViewCompat.setImportantForAccessibility(mView, ViewCompat.IMPORTANT_FOR_ACCESSIBILITY_YES); // Make sure that we fit system windows and have a listener to apply any insets ViewCompat.setFitsSystemWindows(mView, true); ViewCompat.setOnApplyWindowInsetsListener(mView, new android.support.v4.view.OnApplyWindowInsetsListener() { @Override public WindowInsetsCompat onApplyWindowInsets(View v, WindowInsetsCompat insets) { // Copy over the bottom inset as padding so that we're displayed // above the navigation bar v.setPadding(v.getPaddingLeft(), v.getPaddingTop(), v.getPaddingRight(), insets.getSystemWindowInsetBottom()); return insets; } }); mAccessibilityManager = (AccessibilityManager) mContext.getSystemService(Context.ACCESSIBILITY_SERVICE); }
From source file:com.rexmtorres.android.patternlock.PatternLockView.java
@SuppressWarnings("deprecation") public PatternLockView(Context context, AttributeSet attrs) { super(context, attrs); mContext = getContext();//from www . j av a 2 s. c o m TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.PatternLockView, R.attr.patternLockViewStyle, 0); final String aspect = a.getString(R.styleable.PatternLockView_aspect); if ("square".equals(aspect)) { mAspect = ASPECT_SQUARE; } 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); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) { 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); } else { Resources resources = context.getResources(); mRegularColor = resources.getColor(R.color.lock_pattern_view_regular_color); mErrorColor = resources.getColor(R.color.lock_pattern_view_error_color); mSuccessColor = resources.getColor(R.color.lock_pattern_view_success_color); } mRegularColor = a.getColor(R.styleable.PatternLockView_regularColor, mRegularColor); mErrorColor = a.getColor(R.styleable.PatternLockView_errorColor, mErrorColor); mSuccessColor = a.getColor(R.styleable.PatternLockView_successColor, mSuccessColor); int pathColor = a.getColor(R.styleable.PatternLockView_pathColor, mRegularColor); // [START rexmtorres 20160401] If set, replaces the pattern dots with the specified bitmap. Drawable oDotDrawable = a.getDrawable(R.styleable.PatternLockView_dotBitmap); if (oDotDrawable != null) { if (oDotDrawable instanceof BitmapDrawable) { m_oDotBitmap = ((BitmapDrawable) oDotDrawable).getBitmap(); m_oBigDotBitmap = Bitmap.createScaledBitmap(m_oDotBitmap, (int) (m_oDotBitmap.getWidth() * 1.25), (int) (m_oDotBitmap.getHeight() * 1.25), false); } } // [END rexmtorres 20160401] a.recycle(); mPathPaint.setColor(pathColor); mPathPaint.setStyle(Paint.Style.STROKE); mPathPaint.setStrokeJoin(Paint.Join.ROUND); mPathPaint.setStrokeCap(Paint.Cap.ROUND); mPathWidth = getResources().getDimensionPixelSize(R.dimen.lock_pattern_dot_line_width); mPathPaint.setStrokeWidth(mPathWidth); mDotSize = getResources().getDimensionPixelSize(R.dimen.lock_pattern_dot_size); mDotSizeActivated = getResources().getDimensionPixelSize(R.dimen.lock_pattern_dot_size_activated); mPaint.setAntiAlias(true); mPaint.setDither(true); mCellStates = new CellState[3][3]; for (int i = 0; i < 3; i++) { for (int j = 0; j < 3; j++) { mCellStates[i][j] = new CellState(); mCellStates[i][j].radius = mDotSize / 2; mCellStates[i][j].row = i; mCellStates[i][j].col = j; mCellStates[i][j].bitmapDot = m_oDotBitmap; } } mFastOutSlowInInterpolator = new FastOutSlowInInterpolator(); mLinearOutSlowInInterpolator = new LinearOutSlowInInterpolator(); mExploreByTouchHelper = new PatternExploreByTouchHelper(this); ViewCompat.setAccessibilityDelegate(this, mExploreByTouchHelper); mAccessibilityManager = (AccessibilityManager) mContext.getSystemService(Context.ACCESSIBILITY_SERVICE); mAudioManager = (AudioManager) mContext.getSystemService(Context.AUDIO_SERVICE); }
From source file:finalproject.ece558.edu.pdx.ece.brailleblackjack.PlayBlackJackGameFragment.java
/** * Check accessibility and set flags. Set-up The Android TextToSpeech Engine. Also Set-up * the Google MessageApi Client.//from w w w. j a v a2 s.c om * * Android Developers Website was used to aid in creating the MessageApi Client. For more info * go there * Source: http://developer.android.com/training/wearables/data-layer/events.html * @param savedInstanceState * * A Tutorial from tutorialspoint.com was used to aid with Android TextToSpeech * Source: http://www.tutorialspoint.com/android/android_text_to_speech.htm */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); context = this.getActivity(); /* Check if Accessibility is on to Speak upon certain events */ am = (AccessibilityManager) context.getSystemService(Context.ACCESSIBILITY_SERVICE); isAccessibilityEnabled = am.isEnabled(); isExploreByTouchEnabled = am.isTouchExplorationEnabled(); /* Set-up the TTS Api */ textToSpeech = new TextToSpeech(context, new TextToSpeech.OnInitListener() { @Override public void onInit(int status) { if (status == TextToSpeech.SUCCESS) { int result = textToSpeech.setLanguage(Locale.US); if (result == TextToSpeech.LANG_MISSING_DATA || result == TextToSpeech.LANG_NOT_SUPPORTED) { Log.e("error", "Language chosen is not supported"); } else { if (isAccessibilityEnabled) { if (!first_draw_spoken) { String speak = "You drew " + player_left_card.getCardDescription() + " and " + player_right_card.getCardDescription() + "\n Dealer drew " + dealer_right_card.getCardDescription(); convertTextToSpeech(speak); first_draw_spoken = true; } } } } else { Log.e("error", "Initialization Failed!"); } } }); Log.d(TAG, "Attempting to connect to Google Api Client"); mGoogleApiClient = new GoogleApiClient.Builder(context).addApi(Wearable.API).addConnectionCallbacks(this) .addOnConnectionFailedListener(this).build(); Log.d(TAG, "Connected to Google Api Client"); // Initialize state flags button_hit_state = true; button_stand_state = true; button_hint_state = true; button_start_over_state = true; first_draw_spoken = false; }
From source file:com.mark.quick.ui.view.snackbar.BaseTransientBottomBar.java
/** * Constructor for the transient bottom bar. * * @param parent The parent for this transient bottom bar. * @param content The content view for this transient bottom bar. * @param contentViewCallback The content view callback for this transient bottom bar. */// w w w .j a v a 2s. c o m protected BaseTransientBottomBar(@NonNull ViewGroup parent, @NonNull View content, @NonNull ContentViewCallback contentViewCallback) { if (parent == null) { throw new IllegalArgumentException("Transient bottom bar must have non-null parent"); } if (content == null) { throw new IllegalArgumentException("Transient bottom bar must have non-null content"); } if (contentViewCallback == null) { throw new IllegalArgumentException("Transient bottom bar must have non-null callback"); } mTargetParent = parent; mContentViewCallback = contentViewCallback; mContext = parent.getContext(); ThemeUtils.checkAppCompatTheme(mContext); LayoutInflater inflater = LayoutInflater.from(mContext); // Note that for backwards compatibility reasons we inflate a layout that is defined // in the extending Snackbar class. This is to prevent breakage of apps that have custom // coordinator layout behaviors that depend on that layout. mView = (SnackbarBaseLayout) inflater.inflate(R.layout.mark_design_layout_snackbar, mTargetParent, false); mView.addView(content); ViewCompat.setAccessibilityLiveRegion(mView, ViewCompat.ACCESSIBILITY_LIVE_REGION_POLITE); ViewCompat.setImportantForAccessibility(mView, ViewCompat.IMPORTANT_FOR_ACCESSIBILITY_YES); // Make sure that we fit system windows and have a listener to apply any insets ViewCompat.setFitsSystemWindows(mView, true); ViewCompat.setOnApplyWindowInsetsListener(mView, new android.support.v4.view.OnApplyWindowInsetsListener() { @Override public WindowInsetsCompat onApplyWindowInsets(View v, WindowInsetsCompat insets) { // Copy over the bottom inset as padding so that we're displayed // above the navigation bar v.setPadding(v.getPaddingLeft(), v.getPaddingTop(), v.getPaddingRight(), insets.getSystemWindowInsetBottom()); return insets; } }); mAccessibilityManager = (AccessibilityManager) mContext.getSystemService(Context.ACCESSIBILITY_SERVICE); }
From source file:com.commonsware.cwac.crossport.design.widget.BaseTransientBottomBar.java
/** * Constructor for the transient bottom bar. * * @param parent The parent for this transient bottom bar. * @param content The content view for this transient bottom bar. * @param contentViewCallback The content view callback for this transient bottom bar. *//* ww w . j a va 2s .c o m*/ protected BaseTransientBottomBar(@NonNull ViewGroup parent, @NonNull View content, @NonNull ContentViewCallback contentViewCallback) { if (parent == null) { throw new IllegalArgumentException("Transient bottom bar must have non-null parent"); } if (content == null) { throw new IllegalArgumentException("Transient bottom bar must have non-null content"); } if (contentViewCallback == null) { throw new IllegalArgumentException("Transient bottom bar must have non-null callback"); } mTargetParent = parent; mContentViewCallback = contentViewCallback; mContext = parent.getContext(); // ThemeUtils.checkAppCompatTheme(mContext); LayoutInflater inflater = LayoutInflater.from(mContext); // Note that for backwards compatibility reasons we inflate a layout that is defined // in the extending Snackbar class. This is to prevent breakage of apps that have custom // coordinator layout behaviors that depend on that layout. mView = (SnackbarBaseLayout) inflater.inflate(R.layout.design_layout_snackbar, mTargetParent, false); mView.addView(content); ViewCompat.setAccessibilityLiveRegion(mView, ViewCompat.ACCESSIBILITY_LIVE_REGION_POLITE); ViewCompat.setImportantForAccessibility(mView, ViewCompat.IMPORTANT_FOR_ACCESSIBILITY_YES); // Make sure that we fit system windows and have a listener to apply any insets ViewCompat.setFitsSystemWindows(mView, true); ViewCompat.setOnApplyWindowInsetsListener(mView, new android.support.v4.view.OnApplyWindowInsetsListener() { @Override public WindowInsetsCompat onApplyWindowInsets(View v, WindowInsetsCompat insets) { // Copy over the bottom inset as padding so that we're displayed // above the navigation bar v.setPadding(v.getPaddingLeft(), v.getPaddingTop(), v.getPaddingRight(), insets.getSystemWindowInsetBottom()); return insets; } }); mAccessibilityManager = (AccessibilityManager) mContext.getSystemService(Context.ACCESSIBILITY_SERVICE); }