Fix floating action button position in landscape.
Floating action button should always be fixed to the right
side of the screen in landscape orientation.
Bug: 15386162
Change-Id: Ic14fa184ffdf4ad7b817930217ea3d3fca901949
diff --git a/src/com/android/dialer/DialtactsActivity.java b/src/com/android/dialer/DialtactsActivity.java
index 53e438d..db9bb2a 100644
--- a/src/com/android/dialer/DialtactsActivity.java
+++ b/src/com/android/dialer/DialtactsActivity.java
@@ -1128,7 +1128,7 @@
// Only scroll the button when the first tab is selected. The button should scroll from
// the middle to right position only on the transition from the first tab to the second
// tab.
- if (position == ListsFragment.TAB_INDEX_SPEED_DIAL) {
+ if (position == ListsFragment.TAB_INDEX_SPEED_DIAL && !mIsLandscape) {
mFloatingActionButtonController.onPageScrolled(positionOffset);
}
}
@@ -1187,9 +1187,13 @@
align = mIsLandscape ? FloatingActionButtonController.ALIGN_QUARTER_RIGHT
: FloatingActionButtonController.ALIGN_MIDDLE;
} else {
- align = mCurrentTabPosition == ListsFragment.TAB_INDEX_SPEED_DIAL
- ? FloatingActionButtonController.ALIGN_MIDDLE
- : FloatingActionButtonController.ALIGN_RIGHT;
+ if (!mIsLandscape) {
+ align = mCurrentTabPosition == ListsFragment.TAB_INDEX_SPEED_DIAL
+ ? FloatingActionButtonController.ALIGN_MIDDLE
+ : FloatingActionButtonController.ALIGN_RIGHT;
+ } else {
+ align = FloatingActionButtonController.ALIGN_RIGHT;
+ }
}
mFloatingActionButtonController.align(align,
0 /* offsetX */,