time-duration-picker
time-duration-picker copied to clipboard
Bug for RTL languages
Library version: 1.1.3
Called is:
mValueDialog = new TimeDurationPickerDialog(context, new TimeDurationPickerDialog.OnDurationSetListener() { ... }, iValue * 1000, TimeDurationPicker.HH_MM_SS); mValueDialog.show();
Locale is system locale.
Fixed myself. Fix si in this file
Fixed it in my our code by subclassing TimeDurationPickerDialogFragment
, and overriding the onStart method as follows:
@Override
public void onStart() {
super.onStart();
if (getResources().getConfiguration().getLayoutDirection() == View.LAYOUT_DIRECTION_RTL) {
Dialog dialog = getDialog();
int clearId = R.id.clear;
int backspaceId = R.id.backspace;
View clearButton = dialog.findViewById(clearId);
View backspaceButton = dialog.findViewById(backspaceId);
backspaceButton.setScaleX(-1); // flip image horizontally
RelativeLayout.LayoutParams clearParams = (RelativeLayout.LayoutParams) clearButton.getLayoutParams();
clearParams.removeRule(RelativeLayout.ALIGN_PARENT_RIGHT);
clearParams.addRule(RelativeLayout.ALIGN_PARENT_END);
RelativeLayout.LayoutParams backspaceParams = (RelativeLayout.LayoutParams) backspaceButton.getLayoutParams();
backspaceParams.removeRule(RelativeLayout.LEFT_OF);
backspaceParams.addRule(RelativeLayout.START_OF, clearId);
}
}