Merge "Remove unnecessary right padding from time picker"
This commit is contained in:
@@ -454,6 +454,7 @@ class TimePickerClockDelegate extends TimePicker.AbstractTimePickerDelegate {
|
||||
(RelativeLayout.LayoutParams) mAmPmLayout.getLayoutParams();
|
||||
if (params.getRule(RelativeLayout.RIGHT_OF) != 0
|
||||
|| params.getRule(RelativeLayout.LEFT_OF) != 0) {
|
||||
final int margin = (int) (mContext.getResources().getDisplayMetrics().density * 8);
|
||||
// Horizontal mode, with AM/PM appearing to left/right of hours and minutes.
|
||||
final boolean isAmPmAtLeft;
|
||||
if (TextUtils.getLayoutDirectionFromLocale(mLocale) == View.LAYOUT_DIRECTION_LTR) {
|
||||
@@ -461,10 +462,6 @@ class TimePickerClockDelegate extends TimePicker.AbstractTimePickerDelegate {
|
||||
} else {
|
||||
isAmPmAtLeft = !isAmPmAtStart;
|
||||
}
|
||||
if (mIsAmPmAtLeft == isAmPmAtLeft) {
|
||||
// AM/PM is already at the correct location. No change needed.
|
||||
return;
|
||||
}
|
||||
|
||||
if (isAmPmAtLeft) {
|
||||
params.removeRule(RelativeLayout.RIGHT_OF);
|
||||
@@ -473,6 +470,14 @@ class TimePickerClockDelegate extends TimePicker.AbstractTimePickerDelegate {
|
||||
params.removeRule(RelativeLayout.LEFT_OF);
|
||||
params.addRule(RelativeLayout.RIGHT_OF, mMinuteView.getId());
|
||||
}
|
||||
|
||||
if (isAmPmAtStart) {
|
||||
params.setMarginStart(0);
|
||||
params.setMarginEnd(margin);
|
||||
} else {
|
||||
params.setMarginStart(margin);
|
||||
params.setMarginEnd(0);
|
||||
}
|
||||
mIsAmPmAtLeft = isAmPmAtLeft;
|
||||
} else if (params.getRule(RelativeLayout.BELOW) != 0
|
||||
|| params.getRule(RelativeLayout.ABOVE) != 0) {
|
||||
|
||||
Reference in New Issue
Block a user