Merge "Gets the contextual drawable correctly when rotating device"

This commit is contained in:
TreeHugger Robot
2018-09-26 23:58:09 +00:00
committed by Android (Google) Code Review

View File

@@ -67,9 +67,15 @@ public class ContextualButton extends ButtonDispatcher {
}
protected KeyButtonDrawable getNewDrawable() {
return KeyButtonDrawable.create(getContext(), mIconResId, false /* shadow */);
return KeyButtonDrawable.create(getContext().getApplicationContext(), mIconResId,
false /* shadow */);
}
/**
* This context is from the view that could be stale after rotation or config change. To get
* correct resources use getApplicationContext() as well.
* @return current view context
*/
protected Context getContext() {
return getCurrentView().getContext();
}