am 7e8afaf9: am e25a0992: Merge "Accessibility improvements for design lib" into mnc-ub-dev

* commit '7e8afaf9471d2ae988ae82b0d4093a4f82abf4ea':
  Accessibility improvements for design lib

GitOrigin-RevId=347536e8c751179028aa926e48e3e55d038fd37d

PiperOrigin-RevId: 140550280
This commit is contained in:
Chris Banes 2016-11-30 01:33:59 +00:00 committed by Travis Collins
parent b5ab60dc9a
commit 7262492bcc
2 changed files with 13 additions and 5 deletions

View File

@ -509,7 +509,8 @@ public final class Snackbar {
private void animateViewIn() {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH) {
ViewCompat.setTranslationY(mView, mView.getHeight());
ViewCompat.animate(mView).translationY(0f)
ViewCompat.animate(mView)
.translationY(0f)
.setInterpolator(FAST_OUT_SLOW_IN_INTERPOLATOR)
.setDuration(ANIMATION_DURATION)
.setListener(new ViewPropertyAnimatorListenerAdapter() {
@ -528,7 +529,8 @@ public final class Snackbar {
}
}).start();
} else {
Animation anim = AnimationUtils.loadAnimation(mView.getContext(), R.anim.design_snackbar_in);
Animation anim = AnimationUtils.loadAnimation(mView.getContext(),
R.anim.design_snackbar_in);
anim.setInterpolator(FAST_OUT_SLOW_IN_INTERPOLATOR);
anim.setDuration(ANIMATION_DURATION);
anim.setAnimationListener(new Animation.AnimationListener() {
@ -552,7 +554,8 @@ public final class Snackbar {
private void animateViewOut(final int event) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH) {
ViewCompat.animate(mView).translationY(mView.getHeight())
ViewCompat.animate(mView)
.translationY(mView.getHeight())
.setInterpolator(FAST_OUT_SLOW_IN_INTERPOLATOR)
.setDuration(ANIMATION_DURATION)
.setListener(new ViewPropertyAnimatorListenerAdapter() {
@ -670,6 +673,9 @@ public final class Snackbar {
// in the layout since older versions of the Android do not inflate includes with
// the correct Context.
LayoutInflater.from(context).inflate(R.layout.design_layout_snackbar_include, this);
ViewCompat.setAccessibilityLiveRegion(this,
ViewCompat.ACCESSIBILITY_LIVE_REGION_POLITE);
}
@Override

View File

@ -362,6 +362,8 @@ public class TextInputLayout extends LinearLayout {
mErrorView = new TextView(getContext());
mErrorView.setTextAppearance(getContext(), mErrorTextAppearance);
mErrorView.setVisibility(INVISIBLE);
ViewCompat.setAccessibilityLiveRegion(mErrorView,
ViewCompat.ACCESSIBILITY_LIVE_REGION_POLITE);
LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(
0, LinearLayout.LayoutParams.WRAP_CONTENT);
params.weight = 1.f;
@ -447,8 +449,6 @@ public class TextInputLayout extends LinearLayout {
updateEditTextBackground();
}
}
sendAccessibilityEvent(AccessibilityEvent.TYPE_WINDOW_CONTENT_CHANGED);
}
/**
@ -467,6 +467,8 @@ public class TextInputLayout extends LinearLayout {
LinearLayout.LayoutParams.WRAP_CONTENT);
params.gravity = (params.gravity & Gravity.VERTICAL_GRAVITY_MASK) |
GravityCompat.END;
ViewCompat.setAccessibilityLiveRegion(mCounterView,
ViewCompat.ACCESSIBILITY_LIVE_REGION_POLITE);
addIndicator(mCounterView, -1, params);
if (mEditText == null) {
updateCounter(0);