1
0
mirror of https://github.com/KokaKiwi/BarInsta synced 2024-11-22 22:57:29 +00:00

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

View File

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