diff options
| author | Alan Viverette <alanv@google.com> | 2015-04-22 13:43:31 -0700 |
|---|---|---|
| committer | Alan Viverette <alanv@google.com> | 2015-04-22 13:43:31 -0700 |
| commit | ddf655c49f4173aa55c9ba1a2622cf75cf5bc2f2 (patch) | |
| tree | 77b25d08489acc03d26cfa0abb073dce4123c25e /core/java/android/widget/DayPickerView.java | |
| parent | b5665c99105170998f0069b2a53d50587074f437 (diff) | |
Implement RTL support in framework ViewPager, DatePicker
Lays out ViewPager in the opposite direction when in RTL mode, e.g.
the first item's starting edge is laid out at the largest possible
scrolling distance. This preserves both the meaning of positive
scrollX values and the meaning of positive adapter positions.
Also removes clickable attribute from DayPickerView since it has a
virtual view hierarchy.
Bug: 19408740
Bug: 20134073
Change-Id: Ib6f945335bd88da59c8c593c7c270e290e15d0a5
Diffstat (limited to 'core/java/android/widget/DayPickerView.java')
| -rw-r--r-- | core/java/android/widget/DayPickerView.java | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/core/java/android/widget/DayPickerView.java b/core/java/android/widget/DayPickerView.java index c6b4d7e3aaf3..113e597bedfd 100644 --- a/core/java/android/widget/DayPickerView.java +++ b/core/java/android/widget/DayPickerView.java @@ -196,9 +196,23 @@ class DayPickerView extends ViewGroup { } @Override + public void onRtlPropertiesChanged(@ResolvedLayoutDir int layoutDirection) { + super.onRtlPropertiesChanged(layoutDirection); + + requestLayout(); + } + + @Override protected void onLayout(boolean changed, int left, int top, int right, int bottom) { - final ImageButton leftButton = mPrevButton; - final ImageButton rightButton = mNextButton; + final ImageButton leftButton; + final ImageButton rightButton; + if (isLayoutRtl()) { + leftButton = mNextButton; + rightButton = mPrevButton; + } else { + leftButton = mPrevButton; + rightButton = mNextButton; + } final int width = right - left; final int height = bottom - top; |
