Use ViewCompat.getLayoutDirection in Toolbar.
Otherwise it crashes using v17+ getLayoutDirection from View.
Bug: 28282893
Change-Id: I4eef42828c4ebb2d4c832bf4df9aa3e4dbf6912e
diff --git a/v7/appcompat/src/android/support/v7/widget/Toolbar.java b/v7/appcompat/src/android/support/v7/widget/Toolbar.java
index f765f27..f0adadc 100644
--- a/v7/appcompat/src/android/support/v7/widget/Toolbar.java
+++ b/v7/appcompat/src/android/support/v7/widget/Toolbar.java
@@ -1327,7 +1327,7 @@
* @see #getContentInsetEndWithActions()
*/
public int getCurrentContentInsetLeft() {
- return getLayoutDirection() == LAYOUT_DIRECTION_RTL
+ return ViewCompat.getLayoutDirection(this) == ViewCompat.LAYOUT_DIRECTION_RTL
? getCurrentContentInsetEnd()
: getCurrentContentInsetStart();
}
@@ -1342,7 +1342,7 @@
* @see #getContentInsetEndWithActions()
*/
public int getCurrentContentInsetRight() {
- return getLayoutDirection() == LAYOUT_DIRECTION_RTL
+ return ViewCompat.getLayoutDirection(this) == ViewCompat.LAYOUT_DIRECTION_RTL
? getCurrentContentInsetStart()
: getCurrentContentInsetEnd();
}