Example #1
0
 private void displayDescription(View view, String desc) {
   hideDescriptionToast();
   mCurrentToast = Toast.makeText(mContext.getApplicationContext(), desc, Toast.LENGTH_LONG);
   mCurrentToast.show();
   if (Build.VERSION.SDK_INT >= 16) {
     view.announceForAccessibility(desc);
   }
 }
 private void selectTile(View v) {
   if (mSelectedTile != null) {
     mSelectedTile.setSelected(false);
     mSelectedTile = null;
   }
   mSelectedTile = v;
   v.setSelected(true);
   mSelectedIndex = mWallpapersView.indexOfChild(v);
   // TODO: Remove this once the accessibility framework and
   // services have better support for selection state.
   v.announceForAccessibility(getString(R.string.announce_selection, v.getContentDescription()));
 }
 /**
  * Try to speak the specified text, for accessibility. Only available on JB or later.
  *
  * @param text Text to announce.
  */
 @SuppressLint("NewApi")
 public static void tryAccessibilityAnnounce(View view, CharSequence text) {
   if (isJellybeanOrLater() && view != null && text != null) {
     view.announceForAccessibility(text);
   }
 }