Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(561)

Unified Diff: ui/android/java/src/org/chromium/ui/widget/ButtonCompat.java

Issue 1390883007: ButtonCompat: handle missing StateListAnimator gracefully. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/android/java/src/org/chromium/ui/widget/ButtonCompat.java
diff --git a/ui/android/java/src/org/chromium/ui/widget/ButtonCompat.java b/ui/android/java/src/org/chromium/ui/widget/ButtonCompat.java
index df5b52d1f3f83b58554035c391e4253c01bb8afa..27ed3e34a192eab006a87447c8b1c844b3bbbb30 100644
--- a/ui/android/java/src/org/chromium/ui/widget/ButtonCompat.java
+++ b/ui/android/java/src/org/chromium/ui/widget/ButtonCompat.java
@@ -81,9 +81,15 @@ public class ButtonCompat extends Button {
TypedArray a = getContext().obtainStyledAttributes(null,
new int[]{android.R.attr.stateListAnimator}, 0,
android.R.style.Widget_Material_Button);
- setStateListAnimator(AnimatorInflater.loadStateListAnimator(getContext(),
- a.getResourceId(0, 0)));
+ int stateListAnimatorId = a.getResourceId(0, 0);
a.recycle();
+ // stateListAnimatorId could be 0 on custom or future builds of Android, or when using a
+ // framework like Xposed. Handle these cases gracefully by simply not using a
+ // StateListAnimator.
+ if (stateListAnimatorId != 0) {
+ setStateListAnimator(AnimatorInflater.loadStateListAnimator(getContext(),
+ stateListAnimatorId));
+ }
}
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698