1
0
mirror of https://github.com/KokaKiwi/BarInsta synced 2024-12-23 05:16:58 +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 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());