Switch isSwapTime conditional

This doesn't change behavior, but makes the variable `isSwapTime` match
the value of the checkbox state (`cbSwapTimeDate.isChecked()`). Now,
both of them will be either `true` or `false` together, instead of
having opposite values.
This commit is contained in:
Anderson Mesquita 2020-09-18 10:55:47 -04:00
parent 10f2e51a2e
commit 29840f66c7
1 changed files with 5 additions and 4 deletions

View File

@ -86,11 +86,12 @@ public final class TimeSettingsDialog extends DialogFragment implements AdapterV
final String timeStr = String.valueOf(timeSettingsBinding.spTimeFormat.getSelectedItem());
final String dateStr = String.valueOf(timeSettingsBinding.spDateFormat.getSelectedItem());
final boolean isSwapTime = !timeSettingsBinding.cbSwapTimeDate.isChecked();
final boolean isSwapTime = timeSettingsBinding.cbSwapTimeDate.isChecked();
final boolean isBlankSeparator = timeSettingsBinding.spSeparator.getSelectedItemPosition() <= 0;
selectedFormat = (isSwapTime ? timeStr : dateStr)
+ (TextUtils.isEmpty(sepStr) || timeSettingsBinding.spSeparator.getSelectedItemPosition() == 0 ? " " : " '" + sepStr + "' ")
+ (isSwapTime ? dateStr : timeStr);
selectedFormat = (isSwapTime ? dateStr : timeStr)
+ (isBlankSeparator ? " " : " '" + sepStr + "' ")
+ (isSwapTime ? timeStr : dateStr);
timeSettingsBinding.btnConfirm.setEnabled(true);
currentFormat = new SimpleDateFormat(selectedFormat, LocaleUtils.getCurrentLocale());